Skip to content

Commit

Permalink
strip routing prefix in all cases if configured
Browse files Browse the repository at this point in the history
Summary:
The routing prefix should always be stripped.
We discovered samples where the routing prefix is not stripped; after investigations these are apparently only TKOs with PoolRoute: https://fburl.com/scuba/mcrouter_requests/6tq7mwtp
This is due to inconsistent logging code in the DestinationRoute and this diff fixes it.

Reviewed By: stuclar

Differential Revision: D50704110

fbshipit-source-id: d0e0a22c4537f52048320c40f928957124f4ee05
  • Loading branch information
Lenar Fatikhov authored and facebook-github-bot committed Nov 14, 2023
1 parent dcdb32b commit 223584a
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions mcrouter/routes/DestinationRoute.h
Original file line number Diff line number Diff line change
Expand Up @@ -230,21 +230,29 @@ class DestinationRoute {
if (bucketIdOptional.has_value()) {
bucketId = *bucketIdOptional;
}
std::optional<Request> newReq;
folly::StringPiece strippedRoutingPrefix;
if (!keepRoutingPrefix_ && !req.key_ref()->routingPrefix().empty()) {
newReq.emplace(req);
newReq->key_ref()->stripRoutingPrefix();
strippedRoutingPrefix = req.key_ref()->routingPrefix();
}
const auto& reqToSend = newReq ? *newReq : req;
RpcStatsContext rpcContext;
ctx.onBeforeRequestSent(
poolName_,
*destination_->accessPoint(),
folly::StringPiece(),
req,
strippedRoutingPrefix,
reqToSend,
fiber_local<RouterInfo>::getRequestClass(),
now,
bucketId);
ctx.onReplyReceived(
poolName_,
std::optional<size_t>(indexInPool_),
*destination_->accessPoint(),
folly::StringPiece(),
req,
strippedRoutingPrefix,
reqToSend,
reply,
fiber_local<RouterInfo>::getRequestClass(),
now,
Expand Down

0 comments on commit 223584a

Please sign in to comment.