summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/replication_info.cpp
diff options
context:
space:
mode:
authorLucas de Castro Borges <lucas@gnuabordo.com.br>2025-02-11 15:07:35 -0300
committerLucas de Castro Borges <lucas@gnuabordo.com.br>2025-02-11 15:07:35 -0300
commit4cb8841196d0625dfa3825aa326f071cd27c7b8b (patch)
tree1682a647d4463397c119183369ae6f750d5fdcff /src/mongo/db/repl/replication_info.cpp
parentaa03c6362cbaa767638e6eed9b031d86dd2643d1 (diff)
parent8f0827553e09872941945a093b647a4211a9db7f (diff)
Update upstream source from tag 'upstream/6.0.0'master
Update to upstream version '6.0.0' with Debian dir 5604a80ec1c96ca76f25f40d78e6ef855abec322
Diffstat (limited to 'src/mongo/db/repl/replication_info.cpp')
-rw-r--r--src/mongo/db/repl/replication_info.cpp29
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");