summaryrefslogtreecommitdiff
path: root/src/mongo/db/index_builds_coordinator_mongod.cpp
diff options
context:
space:
mode:
authorSophia Tan <sophia_tll@hotmail.com>2023-04-18 07:41:17 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-04-18 08:57:59 +0000
commit274cb477d2a1b64ac81b85e9f1b3172387ce0184 (patch)
treee89f778fa52a40413403b6a125b69271cf8469c0 /src/mongo/db/index_builds_coordinator_mongod.cpp
parent8863b04c282557081cf2634bce0e26f4fa5389b2 (diff)
downloadmongo-274cb477d2a1b64ac81b85e9f1b3172387ce0184.tar.gz
SERVER-74486 Always include tenant in collection name attributes in error messages
Diffstat (limited to 'src/mongo/db/index_builds_coordinator_mongod.cpp')
-rw-r--r--src/mongo/db/index_builds_coordinator_mongod.cpp25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/mongo/db/index_builds_coordinator_mongod.cpp b/src/mongo/db/index_builds_coordinator_mongod.cpp
index 77a2bad5375..900d86482b6 100644
--- a/src/mongo/db/index_builds_coordinator_mongod.cpp
+++ b/src/mongo/db/index_builds_coordinator_mongod.cpp
@@ -964,7 +964,7 @@ Status IndexBuildsCoordinatorMongod::setCommitQuorum(OperationContext* opCtx,
return Status(ErrorCodes::IndexNotFound,
str::stream()
<< "Cannot set a new commit quorum on an index build in collection '"
- << nss << "' without providing any indexes.");
+ << nss.toStringForErrorMsg() << "' without providing any indexes.");
}
// Take the MODE_IX lock now, so that when we actually persist the value later, we don't need to
@@ -972,7 +972,8 @@ Status IndexBuildsCoordinatorMongod::setCommitQuorum(OperationContext* opCtx,
AutoGetCollection collection(opCtx, nss, MODE_IX);
if (!collection) {
return Status(ErrorCodes::NamespaceNotFound,
- str::stream() << "Collection '" << nss << "' was not found.");
+ str::stream()
+ << "Collection '" << nss.toStringForErrorMsg() << "' was not found.");
}
UUID collectionUUID = collection->uuid();
@@ -992,13 +993,14 @@ Status IndexBuildsCoordinatorMongod::setCommitQuorum(OperationContext* opCtx,
auto collIndexBuilds = activeIndexBuilds.filterIndexBuilds(pred);
if (collIndexBuilds.empty()) {
return Status(ErrorCodes::IndexNotFound,
- str::stream() << "Cannot find an index build on collection '" << nss
- << "' with the provided index names");
+ str::stream()
+ << "Cannot find an index build on collection '"
+ << nss.toStringForErrorMsg() << "' with the provided index names");
}
invariant(
1U == collIndexBuilds.size(),
str::stream() << "Found multiple index builds with the same index names on collection "
- << nss << " (" << collectionUUID
+ << nss.toStringForErrorMsg() << " (" << collectionUUID
<< "): first index name: " << indexNames.front());
replState = collIndexBuilds.front();
@@ -1018,18 +1020,19 @@ Status IndexBuildsCoordinatorMongod::setCommitQuorum(OperationContext* opCtx,
return Status(ErrorCodes::IndexNotFound,
str::stream()
<< "Index build not yet started for the provided indexes in collection '"
- << nss << "'.");
+ << nss.toStringForErrorMsg() << "'.");
}
auto currentCommitQuorum = invariantStatusOK(swOnDiskCommitQuorum);
if (currentCommitQuorum.numNodes == CommitQuorumOptions::kDisabled ||
newCommitQuorum.numNodes == CommitQuorumOptions::kDisabled) {
return Status(ErrorCodes::BadValue,
- str::stream() << "Commit quorum value can be changed only for index builds "
- << "with commit quorum enabled, nss: '" << nss
- << "' first index name: '" << indexNames.front()
- << "' currentCommitQuorum: " << currentCommitQuorum.toBSON()
- << " providedCommitQuorum: " << newCommitQuorum.toBSON());
+ str::stream()
+ << "Commit quorum value can be changed only for index builds "
+ << "with commit quorum enabled, nss: '" << nss.toStringForErrorMsg()
+ << "' first index name: '" << indexNames.front()
+ << "' currentCommitQuorum: " << currentCommitQuorum.toBSON()
+ << " providedCommitQuorum: " << newCommitQuorum.toBSON());
}
invariant(opCtx->lockState()->isRSTLLocked());