SERVER-138942Needs Scheduling

Retry counter is reset on every iteration in ShardingCatalogManager::createDatabase()

I found a logical error in {{ShardingCatalogManager::createDatabase()}} in MongoDB 8.0.9: [https://github.com/mongodb/mongo/blob/r8.0.9/src/mongo/db/s/config/sharding_catalog_manager_database_operations.cpp#L207-L242] In this method, the {{retries}} variable is initialized to 10 inside the {{while (true)}} loop: {{while (true) \{ // ... auto retries = 10; try { return _commitCreateDatabase(opCtx, dbName, candidatePrimaryShardId); } catch (const ExceptionFor<

Affected Versions
Versions known to exhibit this issue
8.0.9
Fixed Versions
Versions that include the fix

No fix available yet.

Components
Server components related to this issue

No components specified.

Labels
Tags and classification
StaticCodeAnalsis