summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mongo/s/cluster_identity_loader.cpp6
-rw-r--r--src/mongo/s/cluster_identity_loader_test.cpp8
2 files changed, 4 insertions, 10 deletions
diff --git a/src/mongo/s/cluster_identity_loader.cpp b/src/mongo/s/cluster_identity_loader.cpp
index bb54a644f92..b51d0854b90 100644
--- a/src/mongo/s/cluster_identity_loader.cpp
+++ b/src/mongo/s/cluster_identity_loader.cpp
@@ -100,12 +100,6 @@ StatusWith<OID> ClusterIdentityLoader::_fetchClusterIdFromConfig(
OperationContext* opCtx, const repl::ReadConcernLevel& readConcernLevel) {
auto catalogClient = Grid::get(opCtx)->catalogClient();
auto loadResult = catalogClient->getConfigVersion(opCtx, readConcernLevel);
-
- if (loadResult == ErrorCodes::NoMatchingDocument) {
- // if no version document was found on config server return a zero filled ID
- return OID{};
- }
-
if (!loadResult.isOK()) {
return loadResult.getStatus().withContext("Error loading clusterID");
}
diff --git a/src/mongo/s/cluster_identity_loader_test.cpp b/src/mongo/s/cluster_identity_loader_test.cpp
index d9cbae13151..363bb33ceb3 100644
--- a/src/mongo/s/cluster_identity_loader_test.cpp
+++ b/src/mongo/s/cluster_identity_loader_test.cpp
@@ -123,12 +123,12 @@ TEST_F(ClusterIdentityTest, BasicLoadSuccess) {
}
TEST_F(ClusterIdentityTest, NoConfigVersionDocument) {
- // If no version document is found on config server loadClusterId will return a newly generated
- // clusterId
+ // If no version document is found on config server loadClusterId will return an error
auto future = launchAsync([&] {
- ASSERT_OK(
+ ASSERT_EQ(
ClusterIdentityLoader::get(operationContext())
- ->loadClusterId(operationContext(), repl::ReadConcernLevel::kMajorityReadConcern));
+ ->loadClusterId(operationContext(), repl::ReadConcernLevel::kMajorityReadConcern),
+ ErrorCodes::NoMatchingDocument);
});
expectConfigVersionLoad(