diff options
author | Misha Tyulenev <misha@mongodb.com> | 2020-03-05 16:32:01 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-03-05 22:05:40 +0000 |
commit | a924cde8580dd00409a0c8296e81ff73709ad1a2 (patch) | |
tree | 6e9b30f116c54b6d16e6abe5135b70b0634bb31d /src/mongo/executor | |
parent | a4cc0fda2778dcc2c39d1e1d471fcfdd98534b38 (diff) | |
download | mongo-a924cde8580dd00409a0c8296e81ff73709ad1a2.tar.gz |
SERVER-46607 ignore MaxTimeMSExpire error on hedged reads
Diffstat (limited to 'src/mongo/executor')
-rw-r--r-- | src/mongo/executor/network_interface_tl.cpp | 42 |
1 files changed, 31 insertions, 11 deletions
diff --git a/src/mongo/executor/network_interface_tl.cpp b/src/mongo/executor/network_interface_tl.cpp index 2e49b840ccf..6d9acef2aa5 100644 --- a/src/mongo/executor/network_interface_tl.cpp +++ b/src/mongo/executor/network_interface_tl.cpp @@ -712,13 +712,23 @@ void NetworkInterfaceTL::RequestState::resolve(Future<RemoteCommandResponse> fut .onCompletion([ this, anchor = shared_from_this() ](auto swr) noexcept { auto response = uassertStatusOK(swr); auto status = swr.getValue().status; - if (cmdState->finishLine.arriveStrongly()) { - if (hasHedgeOptions && isHedge) { - auto hm = HedgingMetrics::get(cmdState->interface->_svcCtx); - invariant(hm); - hm->incrementNumAdvantageouslyHedgedOperations(); + auto commandStatus = getStatusFromCommandResult(response.data); + // ignore MaxTimeMS expiration errors for hedged reads + if (hasHedgeOptions && isHedge && commandStatus == ErrorCodes::MaxTimeMSExpired) { + LOGV2_DEBUG(4660700, + 2, + "Hedged request {request_id} returned status {status}", + "request_id"_attr = request.get().id, + "status"_attr = commandStatus); + } else { + if (cmdState->finishLine.arriveStrongly()) { + if (hasHedgeOptions && isHedge) { + auto hm = HedgingMetrics::get(cmdState->interface->_svcCtx); + invariant(hm); + hm->incrementNumAdvantageouslyHedgedOperations(); + } + cmdState->fulfillFinalPromise(std::move(response)); } - cmdState->fulfillFinalPromise(std::move(response)); } return status; @@ -733,16 +743,26 @@ void NetworkInterfaceTL::RequestState::resolve(Future<RemoteCommandResponse> fut [ this, anchor = shared_from_this() ](auto swr) noexcept { auto response = uassertStatusOK(swr); auto status = response.status; + auto commandStatus = getStatusFromCommandResult(response.data); ON_BLOCK_EXIT([&] { returnConnection(status); }); if (!cmdState->finishLine.arriveStrongly()) { return; } - if (hasHedgeOptions && isHedge) { - auto hm = HedgingMetrics::get(cmdState->interface->_svcCtx); - invariant(hm); - hm->incrementNumAdvantageouslyHedgedOperations(); + // ignore MaxTimeMS expiration errors for hedged reads + if (hasHedgeOptions && isHedge && commandStatus == ErrorCodes::MaxTimeMSExpired) { + LOGV2_DEBUG(4660701, + 2, + "Hedged request {request_id} returned status {status}", + "request_id"_attr = request.get().id, + "status"_attr = commandStatus); + } else { + if (hasHedgeOptions && isHedge) { + auto hm = HedgingMetrics::get(cmdState->interface->_svcCtx); + invariant(hm); + hm->incrementNumAdvantageouslyHedgedOperations(); + } + cmdState->fulfillFinalPromise(std::move(response)); } - cmdState->fulfillFinalPromise(std::move(response)); }); } } |