summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/database_sharding_state.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/s/database_sharding_state.cpp')
-rw-r--r--src/mongo/db/s/database_sharding_state.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/mongo/db/s/database_sharding_state.cpp b/src/mongo/db/s/database_sharding_state.cpp
index 2f312869758..08b706d7ef3 100644
--- a/src/mongo/db/s/database_sharding_state.cpp
+++ b/src/mongo/db/s/database_sharding_state.cpp
@@ -178,18 +178,19 @@ void DatabaseShardingState::assertMatchingDbVersion(OperationContext* opCtx,
: ShardingMigrationCriticalSection::kRead);
uassert(
StaleDbRoutingVersion(dbName.toString(), receivedVersion, boost::none, critSecSignal),
- str::stream() << "The critical section for the database " << dbName
+ str::stream() << "The critical section for the database "
+ << dbName.toStringForErrorMsg()
<< " is acquired with reason: " << scopedDss->getCriticalSectionReason(),
!critSecSignal);
}
const auto wantedVersion = scopedDss->getDbVersion(opCtx);
uassert(StaleDbRoutingVersion(dbName.toString(), receivedVersion, boost::none),
- str::stream() << "No cached info for the database " << dbName,
+ str::stream() << "No cached info for the database " << dbName.toStringForErrorMsg(),
wantedVersion);
uassert(StaleDbRoutingVersion(dbName.toString(), receivedVersion, *wantedVersion),
- str::stream() << "Version mismatch for the database " << dbName,
+ str::stream() << "Version mismatch for the database " << dbName.toStringForErrorMsg(),
receivedVersion == *wantedVersion);
}
@@ -204,7 +205,8 @@ void DatabaseShardingState::assertIsPrimaryShardForDb(OperationContext* opCtx,
}
uassert(ErrorCodes::IllegalOperation,
- str::stream() << "Received request without the version for the database " << dbName,
+ str::stream() << "Received request without the version for the database "
+ << dbName.toStringForErrorMsg(),
OperationShardingState::get(opCtx).hasDbVersion());
Lock::DBLock dbLock(opCtx, dbName, MODE_IS);
@@ -214,8 +216,9 @@ void DatabaseShardingState::assertIsPrimaryShardForDb(OperationContext* opCtx,
const auto primaryShardId = scopedDss->_dbInfo->getPrimary();
const auto thisShardId = ShardingState::get(opCtx)->shardId();
uassert(ErrorCodes::IllegalOperation,
- str::stream() << "This is not the primary shard for the database " << dbName
- << ". Expected: " << primaryShardId << " Actual: " << thisShardId,
+ str::stream() << "This is not the primary shard for the database "
+ << dbName.toStringForErrorMsg() << ". Expected: " << primaryShardId
+ << " Actual: " << thisShardId,
primaryShardId == thisShardId);
}