diff options
Diffstat (limited to 'src/mongo/db/repl/replication_info.cpp')
| -rw-r--r-- | src/mongo/db/repl/replication_info.cpp | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/src/mongo/db/repl/replication_info.cpp b/src/mongo/db/repl/replication_info.cpp index 39179d71193..2172307d791 100644 --- a/src/mongo/db/repl/replication_info.cpp +++ b/src/mongo/db/repl/replication_info.cpp @@ -248,11 +248,11 @@ public: BSONObjBuilder result; result.append("latestOptime", replCoord->getMyLastAppliedOpTime().getTimestamp()); - auto earliestOplogTimestampFetch = [&]() -> Timestamp { + auto earliestOplogTimestampFetch = [&]() -> StatusWith<Timestamp> { auto oplog = CollectionCatalog::get(opCtx)->lookupCollectionByNamespaceForRead( opCtx, NamespaceString::kRsOplogNamespace); if (!oplog) { - return Timestamp(); + return StatusWith<Timestamp>(ErrorCodes::NamespaceNotFound, "oplog doesn't exist"); } // Try to get the lock. If it's already locked, immediately return null timestamp. @@ -282,13 +282,13 @@ public: return o["ts"].timestamp(); } } - if (!swEarliestOplogTimestamp.isOK()) { - return Timestamp(); - } - return swEarliestOplogTimestamp.getValue(); + + return swEarliestOplogTimestamp; }(); - result.append("earliestOptime", earliestOplogTimestampFetch); + uassert( + 17347, "Problem reading earliest entry from oplog", earliestOplogTimestampFetch.isOK()); + result.append("earliestOptime", earliestOplogTimestampFetch.getValue()); return result.obj(); } @@ -367,14 +367,6 @@ public: sessionTagsToSet |= transport::Session::kKeepOpen; } - // Negotiate compressors before logging metadata so we can include the result in the log - // line. - auto result = replyBuilder->getBodyBuilder(); - if (opCtx->getClient()->session()) { - MessageCompressorManager::forSession(opCtx->getClient()->session()) - .serverNegotiate(cmd.getCompression(), &result); - } - auto client = opCtx->getClient(); if (ClientMetadata::tryFinalize(client)) { audit::logClientMetadata(client); @@ -447,6 +439,8 @@ public: !clientTopologyVersion && !maxAwaitTimeMS); } + auto result = replyBuilder->getBodyBuilder(); + // Try to parse the optional 'helloOk' field. This should be provided on the initial // handshake for an incoming connection if the client supports the hello command. Clients // that specify 'helloOk' do not rely on "not master" error message parsing, which means @@ -506,6 +500,11 @@ public: param->append(opCtx, result, kAutomationServiceDescriptorFieldName); } + if (opCtx->getClient()->session()) { + MessageCompressorManager::forSession(opCtx->getClient()->session()) + .serverNegotiate(cmd.getCompression(), &result); + } + if (opCtx->isExhaust()) { LOGV2_DEBUG(23905, 3, "Using exhaust for isMaster or hello protocol"); |
