summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/storage_interface_impl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/repl/storage_interface_impl.cpp')
-rw-r--r--src/mongo/db/repl/storage_interface_impl.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/mongo/db/repl/storage_interface_impl.cpp b/src/mongo/db/repl/storage_interface_impl.cpp
index b11ab834531..3f53b30474f 100644
--- a/src/mongo/db/repl/storage_interface_impl.cpp
+++ b/src/mongo/db/repl/storage_interface_impl.cpp
@@ -561,6 +561,7 @@ Status StorageInterfaceImpl::renameCollection(OperationContext* opCtx,
Status StorageInterfaceImpl::setIndexIsMultikey(OperationContext* opCtx,
const NamespaceString& nss,
+ const UUID& collectionUUID,
const std::string& indexName,
const KeyStringSet& multikeyMetadataKeys,
const MultikeyPaths& paths,
@@ -568,13 +569,19 @@ Status StorageInterfaceImpl::setIndexIsMultikey(OperationContext* opCtx,
if (ts.isNull()) {
return Status(ErrorCodes::InvalidOptions,
str::stream() << "Cannot set index " << indexName << " on " << nss.ns()
- << " as multikey at null timestamp");
+ << " (" << collectionUUID << ") as multikey at null timestamp");
}
return writeConflictRetry(opCtx, "StorageInterfaceImpl::setIndexIsMultikey", nss.ns(), [&] {
- AutoGetCollection autoColl(opCtx, nss, MODE_IX);
+ const NamespaceStringOrUUID nsOrUUID(nss);
+ boost::optional<AutoGetCollection> autoColl;
+ try {
+ autoColl.emplace(opCtx, nsOrUUID, MODE_IX);
+ } catch (ExceptionFor<ErrorCodes::NamespaceNotFound>& ex) {
+ return ex.toStatus();
+ }
auto collectionResult = getCollection(
- autoColl, nss, "The collection must exist before setting an index to multikey.");
+ *autoColl, nsOrUUID, "The collection must exist before setting an index to multikey.");
if (!collectionResult.isOK()) {
return collectionResult.getStatus();
}
@@ -590,8 +597,9 @@ Status StorageInterfaceImpl::setIndexIsMultikey(OperationContext* opCtx,
opCtx, indexName, true /* includeUnfinishedIndexes */);
if (!idx) {
return Status(ErrorCodes::IndexNotFound,
- str::stream() << "Could not find index " << indexName << " in "
- << nss.ns() << " to set to multikey.");
+ str::stream()
+ << "Could not find index " << indexName << " in " << nss.ns() << " ("
+ << collectionUUID << ") to set to multikey.");
}
collection->getIndexCatalog()->setMultikeyPaths(opCtx, idx, multikeyMetadataKeys, paths);
wunit.commit();