summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2021-10-27 07:02:11 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-10-27 11:25:38 +0000
commit553f2901fe2ae2cd9ca43ec74e020fa023966555 (patch)
tree7b6ff01e30e2eb3bf1f376e7e604ce6447fbac22 /src/mongo
parentdbc4453af53117b246b65541a84241a1ac044c17 (diff)
downloadmongo-553f2901fe2ae2cd9ca43ec74e020fa023966555.tar.gz
SERVER-60931 oplog application delegates UUID lookup to processCollModCommand()
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/db/repl/oplog.cpp15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/mongo/db/repl/oplog.cpp b/src/mongo/db/repl/oplog.cpp
index a0a0f30b2a4..2198052beeb 100644
--- a/src/mongo/db/repl/oplog.cpp
+++ b/src/mongo/db/repl/oplog.cpp
@@ -918,25 +918,18 @@ const StringMap<ApplyOpMetadata> kOpsMap = {
const auto& cmd = entry.getObject();
auto opMsg = OpMsgRequest::fromDBAndBody(entry.getNss().db(), cmd);
auto collModCmd = CollMod::parse(IDLParserErrorContext("collModOplogEntry"), opMsg);
- const auto nss([&] {
+ const auto nssOrUUID([&collModCmd, &entry, mode]() -> NamespaceStringOrUUID {
// Oplog entries from secondary oplog application will allways have the Uuid set and
// it is only invocations of applyOps directly that may omit it
if (!entry.getUuid()) {
invariant(mode == OplogApplication::Mode::kApplyOpsCmd);
- return extractNs(entry.getNss().db(), cmd);
+ return collModCmd.getNamespace();
}
- const auto& uuid = *entry.getUuid();
- auto catalog = CollectionCatalog::get(opCtx);
- const auto nsByUUID = catalog->lookupNSSByUUID(opCtx, uuid);
- uassert(ErrorCodes::NamespaceNotFound,
- str::stream() << "Failed to apply operation due to missing collection ("
- << uuid << "): " << redact(cmd.toString()),
- nsByUUID);
- return *nsByUUID;
+ return {collModCmd.getDbName().toString(), *entry.getUuid()};
}());
BSONObjBuilder resultWeDontCareAbout;
- return processCollModCommand(opCtx, nss, collModCmd, &resultWeDontCareAbout);
+ return processCollModCommand(opCtx, nssOrUUID, collModCmd, &resultWeDontCareAbout);
},
{ErrorCodes::IndexNotFound, ErrorCodes::NamespaceNotFound}}},
{"dbCheck", {dbCheckOplogCommand, {}}},