diff options
author | Alex Li <alex.li@mongodb.com> | 2023-02-06 21:52:33 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2023-02-06 22:29:38 +0000 |
commit | ea3ec1f082a7178fb2ddf0a6d67be2283f488b67 (patch) | |
tree | 73b37f330073b03b83ad7d4714532e9ce1d71058 | |
parent | 1662872fc08f60fbdc1c43597c7b16182e186588 (diff) | |
download | mongo-ea3ec1f082a7178fb2ddf0a6d67be2283f488b67.tar.gz |
SERVER-72670 Change hedgingMetrics.numTotalHedgedOperations increment to reflect definition in documentation
-rw-r--r-- | src/mongo/executor/hedged_async_rpc.h | 7 | ||||
-rw-r--r-- | src/mongo/executor/network_interface_tl.cpp | 12 |
2 files changed, 10 insertions, 9 deletions
diff --git a/src/mongo/executor/hedged_async_rpc.h b/src/mongo/executor/hedged_async_rpc.h index ddc175b5efc..442b889c017 100644 --- a/src/mongo/executor/hedged_async_rpc.h +++ b/src/mongo/executor/hedged_async_rpc.h @@ -170,9 +170,10 @@ SemiFuture<AsyncRPCResponse<typename CommandType::Reply>> sendHedgedCommand( options->baton = baton; requests.push_back( sendCommand(options, opCtx, std::move(t)).thenRunOn(proxyExec)); - if (i > 0) { - hm->incrementNumTotalHedgedOperations(); - } + } + + if (opts.hedgeCount > 0) { + hm->incrementNumTotalHedgedOperations(); } /** diff --git a/src/mongo/executor/network_interface_tl.cpp b/src/mongo/executor/network_interface_tl.cpp index 227c3581580..ecb518b32af 100644 --- a/src/mongo/executor/network_interface_tl.cpp +++ b/src/mongo/executor/network_interface_tl.cpp @@ -687,6 +687,12 @@ Status NetworkInterfaceTL::startCommand(const TaskExecutor::CallbackHandle& cbHa }); } + if (_svcCtx && cmdState->hedgeCount > 1) { + auto hm = HedgingMetrics::get(_svcCtx); + invariant(hm); + hm->incrementNumTotalHedgedOperations(); + } + return Status::OK(); } catch (const DBException& ex) { return ex.toStatus(); @@ -902,12 +908,6 @@ void NetworkInterfaceTL::RequestManager::trySend( logSetMaxTimeMSHedge = true; request->timeout = hedgingMaxTimeMS; } - - if (cmdState->interface->_svcCtx) { - auto hm = HedgingMetrics::get(cmdState->interface->_svcCtx); - invariant(hm); - hm->incrementNumTotalHedgedOperations(); - } } if (request->timeout != RemoteCommandRequest::kNoTimeout && |