diff options
author | Randolph Tan <randolph@10gen.com> | 2016-08-05 17:32:55 -0400 |
---|---|---|
committer | Randolph Tan <randolph@10gen.com> | 2016-08-18 16:59:45 -0400 |
commit | 02080063e74e89e532849b51ecc143bfeb07dd5e (patch) | |
tree | c96ae2734af2d6d17e1da0e06a397e18d85dbae7 | |
parent | cb380a1911e5f3ad1b9e8203f866adcf239e8be1 (diff) | |
download | mongo-02080063e74e89e532849b51ecc143bfeb07dd5e.tar.gz |
SERVER-23598 Race in config.version initialization
Avoid the race by reversing the order of the check on config.version and config.shards collection
-rw-r--r-- | src/mongo/s/catalog/legacy/config_upgrade.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/mongo/s/catalog/legacy/config_upgrade.cpp b/src/mongo/s/catalog/legacy/config_upgrade.cpp index e1ff04131bc..d1766ef7cdb 100644 --- a/src/mongo/s/catalog/legacy/config_upgrade.cpp +++ b/src/mongo/s/catalog/legacy/config_upgrade.cpp @@ -205,11 +205,11 @@ Status getConfigVersion(CatalogManager* catalogManager, VersionType* versionInfo ScopedDbConnection conn(grid.shardRegistry()->getConfigServerConnectionString(), 30); - unique_ptr<DBClientCursor> cursor(_safeCursor(conn->query("config.version", BSONObj()))); - bool hasConfigData = conn->count(ShardType::ConfigNS) || conn->count(DatabaseType::ConfigNS) || conn->count(CollectionType::ConfigNS); + unique_ptr<DBClientCursor> cursor(_safeCursor(conn->query("config.version", BSONObj()))); + if (!cursor->more()) { // Version is 1 if we have data, 0 if we're completely empty if (hasConfigData) { |