summaryrefslogtreecommitdiff
path: root/src/mongo/executor
diff options
context:
space:
mode:
authorMisha Tyulenev <misha@mongodb.com>2020-02-28 14:59:17 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-02-28 22:29:37 +0000
commit90d3ce821b6faa28c68b515bfacb4ce63388759d (patch)
tree046ecee7b8a3078f91d285b214bb1c6339d5804c /src/mongo/executor
parentcfa5c05fa1855fb1a04cb3a6e2eb10a7e82bf726 (diff)
downloadmongo-90d3ce821b6faa28c68b515bfacb4ce63388759d.tar.gz
SERVER-46463 add logging for hedged reads
Diffstat (limited to 'src/mongo/executor')
-rw-r--r--src/mongo/executor/network_interface_tl.cpp15
-rw-r--r--src/mongo/executor/network_interface_tl.h4
2 files changed, 17 insertions, 2 deletions
diff --git a/src/mongo/executor/network_interface_tl.cpp b/src/mongo/executor/network_interface_tl.cpp
index afe86fa7ae7..76ff8e8cc7d 100644
--- a/src/mongo/executor/network_interface_tl.cpp
+++ b/src/mongo/executor/network_interface_tl.cpp
@@ -334,12 +334,14 @@ void NetworkInterfaceTL::RequestState::returnConnection(Status status) noexcept
void NetworkInterfaceTL::CommandStateBase::tryFinish(Status status) noexcept {
invariant(finishLine.isReady());
+ LOGV2_DEBUG(4646302, 2, "Finished request {request_id}", "request_id"_attr = requestOnAny.id);
+
if (timer) {
// The command has resolved one way or another,
timer->cancel(baton);
}
- if (!status.isOK()) {
+ if (!status.isOK()) { // TODO: SERVER-46469: || (requestManager && requestManager->isHedging))
if (requestManager) {
requestManager->cancelRequests();
}
@@ -552,6 +554,11 @@ void NetworkInterfaceTL::RequestManager::cancelRequests() {
for (size_t i = 0; i < requests.size(); i++) {
auto requestState = requests[i].lock();
if (requestState) {
+ LOGV2_DEBUG(4646301,
+ 2,
+ "Cancelling request {request_id} with index {idx}",
+ "request_id"_attr = cmdState.lock()->requestOnAny.id,
+ "idx"_attr = i);
requestState->cancel();
}
}
@@ -594,6 +601,12 @@ void NetworkInterfaceTL::RequestManager::trySend(
}
}
+ LOGV2_DEBUG(4646300,
+ 2,
+ "Sending request {request_id} with index {idx}",
+ "request_id"_attr = cmdState.lock()->requestOnAny.id,
+ "idx"_attr = idx);
+
auto req = getNextRequest();
if (req) {
req->send(std::move(swConn), {cmdStatePtr->requestOnAny, idx});
diff --git a/src/mongo/executor/network_interface_tl.h b/src/mongo/executor/network_interface_tl.h
index fc4d40c194d..9d599452af3 100644
--- a/src/mongo/executor/network_interface_tl.h
+++ b/src/mongo/executor/network_interface_tl.h
@@ -211,7 +211,8 @@ private:
RequestManager(size_t numHedges, std::shared_ptr<CommandStateBase> cmdState_)
: connStatus(cmdState_->requestOnAny.target.size(), ConnStatus::Unset),
requests(numHedges),
- cmdState(cmdState_) {}
+ cmdState(cmdState_),
+ isHedging(numHedges > 1) {}
std::shared_ptr<RequestState> makeRequest(RequestManager* mgr) {
auto req = std::make_shared<RequestState>(mgr, cmdState.lock());
@@ -248,6 +249,7 @@ private:
AtomicWord<size_t> requestCnt{0};
// blocks sending requests
bool isLocked{false};
+ bool isHedging{false};
Mutex mutex = MONGO_MAKE_LATCH("NetworkInterfaceTL::RequestManager::mutex");
};