diff options
author | Kevin Pulo <kevin.pulo@mongodb.com> | 2019-09-16 22:24:06 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-09-16 22:24:06 +0000 |
commit | fd24abfe23e40b6a57bd82ee7bf54cccfe1d9048 (patch) | |
tree | d1a10123f30384e36012cfbbb1a67b18c4601913 | |
parent | 734306ecd8345b55b2758f9c34055b2e62bff015 (diff) | |
download | mongo-fd24abfe23e40b6a57bd82ee7bf54cccfe1d9048.tar.gz |
SERVER-42155 include relevant optimes in read concern timeout reporting
(cherry picked from commit e086820df23f95fd6f8ce5be6280bd5a791c7ec6)
-rw-r--r-- | src/mongo/db/repl/replication_coordinator_impl.cpp | 24 | ||||
-rw-r--r-- | src/mongo/db/service_entry_point_mongod.cpp | 3 |
2 files changed, 19 insertions, 8 deletions
diff --git a/src/mongo/db/repl/replication_coordinator_impl.cpp b/src/mongo/db/repl/replication_coordinator_impl.cpp index 5792d1377dd..255abc57d1c 100644 --- a/src/mongo/db/repl/replication_coordinator_impl.cpp +++ b/src/mongo/db/repl/replication_coordinator_impl.cpp @@ -1368,7 +1368,12 @@ Status ReplicationCoordinatorImpl::_waitUntilOpTime(OperationContext* opCtx, auto waitStatus = opCtx->waitForConditionOrInterruptNoAssert(_currentCommittedSnapshotCond, lock); if (!waitStatus.isOK()) { - return waitStatus; + return waitStatus.withContext(str::stream() + << "Error waiting for snapshot not less than " + << targetOpTime.toString() + << ", current relevant optime is " + << getCurrentOpTime().toString() + << "."); } LOG(3) << "Got notified of new snapshot: " << _currentCommittedSnapshot->toString(); continue; @@ -1386,17 +1391,22 @@ Status ReplicationCoordinatorImpl::_waitUntilOpTime(OperationContext* opCtx, if (deadline) { auto waitUntilStatus = opCtx->waitForConditionOrInterruptNoAssertUntil(condVar, lock, *deadline); - if (!waitUntilStatus.isOK()) { - waitStatus = waitUntilStatus.getStatus(); - } - // If deadline is set no need to wait until the targetTime time is reached. - return waitStatus; + waitStatus = waitUntilStatus.getStatus(); } else { waitStatus = opCtx->waitForConditionOrInterruptNoAssert(condVar, lock); } if (!waitStatus.isOK()) { - return waitStatus; + return waitStatus.withContext(str::stream() << "Error waiting for optime " + << targetOpTime.toString() + << ", current relevant optime is " + << getCurrentOpTime().toString() + << "."); + } + + // If deadline is set no need to wait until the targetTime time is reached. + if (deadline) { + return Status::OK(); } } diff --git a/src/mongo/db/service_entry_point_mongod.cpp b/src/mongo/db/service_entry_point_mongod.cpp index af783c87514..6c6aa1520c7 100644 --- a/src/mongo/db/service_entry_point_mongod.cpp +++ b/src/mongo/db/service_entry_point_mongod.cpp @@ -449,7 +449,8 @@ bool runCommandImpl(OperationContext* opCtx, serverGlobalParams.clusterRole == ClusterRole::ConfigServer ? 0 : 2; LOG(debugLevel) << "Command on database " << db << " timed out waiting for read concern to be satisfied. Command: " - << redact(command->getRedactedCopyForLogging(request.body)); + << redact(command->getRedactedCopyForLogging(request.body)) + << ". Info: " << redact(rcStatus); } auto result = Command::appendCommandStatus(inPlaceReplyBob, rcStatus); |