summaryrefslogtreecommitdiff
path: root/src/mongo/db/catalog/rename_collection.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/catalog/rename_collection.cpp')
-rw-r--r--src/mongo/db/catalog/rename_collection.cpp29
1 files changed, 10 insertions, 19 deletions
diff --git a/src/mongo/db/catalog/rename_collection.cpp b/src/mongo/db/catalog/rename_collection.cpp
index 5b41b3e3539..352f2ca73b8 100644
--- a/src/mongo/db/catalog/rename_collection.cpp
+++ b/src/mongo/db/catalog/rename_collection.cpp
@@ -148,15 +148,8 @@ Status renameTargetCollectionToTmp(OperationContext* opCtx,
if (!tmpNameResult.isOK()) {
return tmpNameResult.getStatus().withContext(
str::stream() << "Cannot generate a temporary collection name for the target "
- << targetNs
- << " ("
- << targetUUID
- << ") so that the source"
- << sourceNs
- << " ("
- << sourceUUID
- << ") could be renamed to "
- << targetNs);
+ << targetNs << " (" << targetUUID << ") so that the source" << sourceNs
+ << " (" << sourceUUID << ") could be renamed to " << targetNs);
}
const auto& tmpName = tmpNameResult.getValue();
const bool stayTemp = true;
@@ -290,9 +283,10 @@ Status renameCollectionWithinDB(OperationContext* opCtx,
boost::optional<Lock::CollectionLock> targetLock;
// To prevent deadlock, always lock system.views collection in the end because concurrent
// view-related operations always lock system.views in the end.
- if (!source.isSystemDotViews() && (target.isSystemDotViews() ||
- ResourceId(RESOURCE_COLLECTION, source.ns()) <
- ResourceId(RESOURCE_COLLECTION, target.ns()))) {
+ if (!source.isSystemDotViews() &&
+ (target.isSystemDotViews() ||
+ ResourceId(RESOURCE_COLLECTION, source.ns()) <
+ ResourceId(RESOURCE_COLLECTION, target.ns()))) {
// To prevent deadlock, always lock source and target in ascending resourceId order.
sourceLock.emplace(opCtx, source, MODE_X);
targetLock.emplace(opCtx, target, MODE_X);
@@ -498,8 +492,7 @@ Status renameBetweenDBs(OperationContext* opCtx,
if (!tmpNameResult.isOK()) {
return tmpNameResult.getStatus().withContext(
str::stream() << "Cannot generate temporary collection name to rename " << source
- << " to "
- << target);
+ << " to " << target);
}
const auto& tmpName = tmpNameResult.getValue();
@@ -586,7 +579,7 @@ Status renameBetweenDBs(OperationContext* opCtx,
tmpColl->uuid(),
indexToCopy,
false // fromMigrate
- );
+ );
auto indexResult =
tmpIndexCatalog->createIndexOnEmptyCollection(opCtx, indexToCopy);
if (!indexResult.isOK()) {
@@ -647,7 +640,7 @@ Status renameBetweenDBs(OperationContext* opCtx,
}
cursor->save();
// When this exits via success or WCE, we need to restore the cursor.
- ON_BLOCK_EXIT([ opCtx, ns = tmpName.ns(), &cursor ]() {
+ ON_BLOCK_EXIT([opCtx, ns = tmpName.ns(), &cursor]() {
writeConflictRetry(
opCtx, "retryRestoreCursor", ns, [&cursor] { cursor->restore(); });
});
@@ -861,9 +854,7 @@ Status renameCollectionForRollback(OperationContext* opCtx,
invariant(source->db() == target.db(),
str::stream() << "renameCollectionForRollback: source and target namespaces must "
"have the same database. source: "
- << *source
- << ". target: "
- << target);
+ << *source << ". target: " << target);
log() << "renameCollectionForRollback: rename " << *source << " (" << uuid << ") to " << target
<< ".";