-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: 3.6.10, 4.0.6, 4.1.8
-
Component/s: Sharding
-
Fully Compatible
-
ALL
-
v4.2
-
Sharding 2019-06-17
-
6
Currently it only uasserts on the commandStatus and then tries to refresh its cache to find the new (supposedly durable) entry for the database, which can lead to commands failing with with "Database <> not found":
ConfigsvrCreateDatabase configCreateDatabaseRequest(dbName.toString()); configCreateDatabaseRequest.setDbName(NamespaceString::kAdminDb); auto configShard = Grid::get(opCtx)->shardRegistry()->getConfigShard(); auto createDbStatus = uassertStatusOK(configShard->runCommandWithFixedRetryAttempts( opCtx, ReadPreferenceSetting(ReadPreference::PrimaryOnly), "admin", CommandHelpers::appendMajorityWriteConcern( configCreateDatabaseRequest.toBSON({})), Shard::RetryPolicy::kIdempotent)) .commandStatus; if (createDbStatus.isOK() || createDbStatus == ErrorCodes::NamespaceExists) { dbStatus = Grid::get(opCtx)->catalogCache()->getDatabase(opCtx, dbName); } else { dbStatus = createDbStatus; }