diff options
Diffstat (limited to 'src/mongo/db/commands')
-rw-r--r-- | src/mongo/db/commands/bulk_write.cpp | 4 | ||||
-rw-r--r-- | src/mongo/db/commands/create_indexes_cmd.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/commands/dbcheck.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/commands/dbcommands_d.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/commands/drop_indexes_cmd.cpp | 8 | ||||
-rw-r--r-- | src/mongo/db/commands/find_and_modify.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/commands/fsync.cpp | 5 | ||||
-rw-r--r-- | src/mongo/db/commands/list_databases_common.h | 2 | ||||
-rw-r--r-- | src/mongo/db/commands/mr_test.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/commands/oplog_note.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/commands/resize_oplog.cpp | 2 |
11 files changed, 18 insertions, 15 deletions
diff --git a/src/mongo/db/commands/bulk_write.cpp b/src/mongo/db/commands/bulk_write.cpp index c45f4b8d68e..c2d989ef9a7 100644 --- a/src/mongo/db/commands/bulk_write.cpp +++ b/src/mongo/db/commands/bulk_write.cpp @@ -631,7 +631,7 @@ bool handleUpdateOp(OperationContext* opCtx, // is executing an update. This is done to ensure that we can always match, // modify, and return the document under concurrency, if a matching document exists. lastOpFixer.startingOp(nsString); - return writeConflictRetry(opCtx, "bulkWriteUpdate", nsString.ns(), [&] { + return writeConflictRetry(opCtx, "bulkWriteUpdate", nsString, [&] { if (MONGO_unlikely(hangBeforeBulkWritePerformsUpdate.shouldFail())) { CurOpFailpointHelpers::waitWhileFailPointEnabled( &hangBeforeBulkWritePerformsUpdate, opCtx, "hangBeforeBulkWritePerformsUpdate"); @@ -769,7 +769,7 @@ bool handleDeleteOp(OperationContext* opCtx, const bool inTransaction = opCtx->inMultiDocumentTransaction(); lastOpFixer.startingOp(nsString); - return writeConflictRetry(opCtx, "bulkWriteDelete", nsString.ns(), [&] { + return writeConflictRetry(opCtx, "bulkWriteDelete", nsString, [&] { boost::optional<BSONObj> docFound; auto nDeleted = write_ops_exec::writeConflictRetryRemove( opCtx, nsString, &deleteRequest, curOp, opDebug, inTransaction, docFound); diff --git a/src/mongo/db/commands/create_indexes_cmd.cpp b/src/mongo/db/commands/create_indexes_cmd.cpp index ce94c92662a..5c055945f8b 100644 --- a/src/mongo/db/commands/create_indexes_cmd.cpp +++ b/src/mongo/db/commands/create_indexes_cmd.cpp @@ -497,7 +497,7 @@ CreateIndexesReply runCreateIndexesWithCoordinator(OperationContext* opCtx, << "Not primary while creating indexes in " << ns.toStringForErrorMsg()); } - bool indexExists = writeConflictRetry(opCtx, "createCollectionWithIndexes", ns.ns(), [&] { + bool indexExists = writeConflictRetry(opCtx, "createCollectionWithIndexes", ns, [&] { AutoGetCollection collection( opCtx, ns, diff --git a/src/mongo/db/commands/dbcheck.cpp b/src/mongo/db/commands/dbcheck.cpp index 3fce4b46a11..62fcf2dd73d 100644 --- a/src/mongo/db/commands/dbcheck.cpp +++ b/src/mongo/db/commands/dbcheck.cpp @@ -71,7 +71,7 @@ repl::OpTime _logOp(OperationContext* opCtx, oplogEntry.setObject(obj); AutoGetOplog oplogWrite(opCtx, OplogAccessMode::kWrite); return writeConflictRetry( - opCtx, "dbCheck oplog entry", NamespaceString::kRsOplogNamespace.ns(), [&] { + opCtx, "dbCheck oplog entry", NamespaceString::kRsOplogNamespace, [&] { auto const clockSource = opCtx->getServiceContext()->getFastClockSource(); oplogEntry.setWallClockTime(clockSource->now()); diff --git a/src/mongo/db/commands/dbcommands_d.cpp b/src/mongo/db/commands/dbcommands_d.cpp index 16f3f9c457d..a77ed7e7260 100644 --- a/src/mongo/db/commands/dbcommands_d.cpp +++ b/src/mongo/db/commands/dbcommands_d.cpp @@ -292,7 +292,7 @@ public: BSONObj query = BSON("files_id" << jsobj["filemd5"] << "n" << GTE << n); BSONObj sort = BSON("files_id" << 1 << "n" << 1); - return writeConflictRetry(opCtx, "filemd5", toStringForLogging(dbName), [&] { + return writeConflictRetry(opCtx, "filemd5", NamespaceString(dbName), [&] { auto findCommand = std::make_unique<FindCommandRequest>(nss); findCommand->setFilter(query.getOwned()); findCommand->setSort(sort.getOwned()); diff --git a/src/mongo/db/commands/drop_indexes_cmd.cpp b/src/mongo/db/commands/drop_indexes_cmd.cpp index 4cdb380c119..57611e1fb33 100644 --- a/src/mongo/db/commands/drop_indexes_cmd.cpp +++ b/src/mongo/db/commands/drop_indexes_cmd.cpp @@ -192,7 +192,7 @@ public: std::vector<BSONObj> all; { std::vector<std::string> indexNames; - writeConflictRetry(opCtx, "listIndexes", toReIndexNss.ns(), [&] { + writeConflictRetry(opCtx, "listIndexes", toReIndexNss, [&] { indexNames.clear(); acquisition.getCollectionPtr()->getAllIndexes(&indexNames); }); @@ -201,7 +201,7 @@ public: for (size_t i = 0; i < indexNames.size(); i++) { const std::string& name = indexNames[i]; - BSONObj spec = writeConflictRetry(opCtx, "getIndexSpec", toReIndexNss.ns(), [&] { + BSONObj spec = writeConflictRetry(opCtx, "getIndexSpec", toReIndexNss, [&] { return acquisition.getCollectionPtr()->getIndexSpec(name); }); @@ -241,7 +241,7 @@ public: indexer->setIndexBuildMethod(IndexBuildMethod::kForeground); StatusWith<std::vector<BSONObj>> swIndexesToRebuild(ErrorCodes::UnknownError, "Uninitialized"); - writeConflictRetry(opCtx, "dropAllIndexes", toReIndexNss.ns(), [&] { + writeConflictRetry(opCtx, "dropAllIndexes", toReIndexNss, [&] { WriteUnitOfWork wunit(opCtx); CollectionWriter collection(opCtx, &acquisition); collection.getWritableCollection(opCtx)->getIndexCatalog()->dropAllIndexes( @@ -274,7 +274,7 @@ public: uassertStatusOK(indexer->checkConstraints(opCtx, acquisition.getCollectionPtr())); - writeConflictRetry(opCtx, "commitReIndex", toReIndexNss.ns(), [&] { + writeConflictRetry(opCtx, "commitReIndex", toReIndexNss, [&] { WriteUnitOfWork wunit(opCtx); CollectionWriter collection(opCtx, &acquisition); uassertStatusOK(indexer->commit(opCtx, diff --git a/src/mongo/db/commands/find_and_modify.cpp b/src/mongo/db/commands/find_and_modify.cpp index 91bd5d63962..9edaaab77bf 100644 --- a/src/mongo/db/commands/find_and_modify.cpp +++ b/src/mongo/db/commands/find_and_modify.cpp @@ -495,7 +495,7 @@ write_ops::FindAndModifyCommandReply CmdFindAndModify::Invocation::typedRun( // Although usually the PlanExecutor handles WCE internally, it will throw WCEs when it // is executing a findAndModify. This is done to ensure that we can always match, // modify, and return the document under concurrency, if a matching document exists. - return writeConflictRetry(opCtx, "findAndModify", nsString.ns(), [&] { + return writeConflictRetry(opCtx, "findAndModify", nsString, [&] { if (req.getRemove().value_or(false)) { DeleteRequest deleteRequest; makeDeleteRequest(opCtx, req, false, &deleteRequest); diff --git a/src/mongo/db/commands/fsync.cpp b/src/mongo/db/commands/fsync.cpp index 581501ea841..6da5e2cf9a0 100644 --- a/src/mongo/db/commands/fsync.cpp +++ b/src/mongo/db/commands/fsync.cpp @@ -28,6 +28,7 @@ */ +#include "mongo/db/namespace_string.h" #include "mongo/platform/basic.h" #include "mongo/db/commands/fsync.h" @@ -388,9 +389,11 @@ void FSyncLockThread::run() { bool successfulFsyncLock = false; auto backupCursorHooks = BackupCursorHooks::get(_serviceContext); try { + // TODO SERVER-65920: Create a NamespaceString for logging with the "global" ns in + // writeConflictRetry. writeConflictRetry(&opCtx, "beginBackup", - "global", + NamespaceString("global"), [&opCtx, backupCursorHooks, &successfulFsyncLock, storageEngine] { if (backupCursorHooks->enabled()) { backupCursorHooks->fsyncLock(&opCtx); diff --git a/src/mongo/db/commands/list_databases_common.h b/src/mongo/db/commands/list_databases_common.h index 26a3ff7ea1d..d2997966d8e 100644 --- a/src/mongo/db/commands/list_databases_common.h +++ b/src/mongo/db/commands/list_databases_common.h @@ -118,7 +118,7 @@ int64_t setReplyItems(OperationContext* opCtx, continue; } - writeConflictRetry(opCtx, "sizeOnDisk", toStringForLogging(dbName), [&] { + writeConflictRetry(opCtx, "sizeOnDisk", NamespaceString(dbName), [&] { size = storageEngine->sizeOnDiskForDb(opCtx, dbName); }); item.setSizeOnDisk(size); diff --git a/src/mongo/db/commands/mr_test.cpp b/src/mongo/db/commands/mr_test.cpp index 5a97f63a3bf..855f2c3bbfb 100644 --- a/src/mongo/db/commands/mr_test.cpp +++ b/src/mongo/db/commands/mr_test.cpp @@ -548,7 +548,7 @@ TEST_F(MapReduceCommandTest, ReplacingExistingOutputCollectionPreservesIndexes) AutoGetCollection coll(_opCtx.get(), outputNss, MODE_X); ASSERT(coll); writeConflictRetry( - _opCtx.get(), "ReplacingExistingOutputCollectionPreservesIndexes", outputNss.ns(), [&] { + _opCtx.get(), "ReplacingExistingOutputCollectionPreservesIndexes", outputNss, [&] { WriteUnitOfWork wuow(_opCtx.get()); ASSERT_OK( coll.getWritableCollection(_opCtx.get()) diff --git a/src/mongo/db/commands/oplog_note.cpp b/src/mongo/db/commands/oplog_note.cpp index 9ed7f7f3060..ccc9588997b 100644 --- a/src/mongo/db/commands/oplog_note.cpp +++ b/src/mongo/db/commands/oplog_note.cpp @@ -77,7 +77,7 @@ Status _performNoopWrite(OperationContext* opCtx, BSONObj msgObj, StringData not return {ErrorCodes::NotWritablePrimary, "Not a primary"}; } - writeConflictRetry(opCtx, note, NamespaceString::kRsOplogNamespace.ns(), [&opCtx, &msgObj] { + writeConflictRetry(opCtx, note, NamespaceString::kRsOplogNamespace, [&opCtx, &msgObj] { WriteUnitOfWork uow(opCtx); opCtx->getClient()->getServiceContext()->getOpObserver()->onOpMessage(opCtx, msgObj); uow.commit(); diff --git a/src/mongo/db/commands/resize_oplog.cpp b/src/mongo/db/commands/resize_oplog.cpp index 0c96a36e5d4..8daebc4ecd6 100644 --- a/src/mongo/db/commands/resize_oplog.cpp +++ b/src/mongo/db/commands/resize_oplog.cpp @@ -89,7 +89,7 @@ public: auto params = ReplSetResizeOplogRequest::parse(IDLParserContext("replSetResizeOplog"), jsobj); - return writeConflictRetry(opCtx, "replSetResizeOplog", coll->ns().ns(), [&] { + return writeConflictRetry(opCtx, "replSetResizeOplog", coll->ns(), [&] { WriteUnitOfWork wunit(opCtx); if (auto sizeMB = params.getSize()) { |