diff options
author | Esha Maharishi <esha.maharishi@mongodb.com> | 2016-08-12 10:02:38 -0400 |
---|---|---|
committer | Esha Maharishi <esha.maharishi@mongodb.com> | 2016-08-12 15:24:05 -0400 |
commit | 5b6ca35994ae865db7ea3a036cd53aa43a62d2c5 (patch) | |
tree | 3f7eb3e9cc28e27c09931c5825f9b9dfc73e27d8 /src/mongo/db/s/sharding_state.h | |
parent | 5788d423ae4362200df5887486c8db213d799993 (diff) | |
download | mongo-5b6ca35994ae865db7ea3a036cd53aa43a62d2c5.tar.gz |
SERVER-22663 Make --shardsvr required for a mongod to be used as a shard
Diffstat (limited to 'src/mongo/db/s/sharding_state.h')
-rw-r--r-- | src/mongo/db/s/sharding_state.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mongo/db/s/sharding_state.h b/src/mongo/db/s/sharding_state.h index c959592c866..28eb837c215 100644 --- a/src/mongo/db/s/sharding_state.h +++ b/src/mongo/db/s/sharding_state.h @@ -259,6 +259,16 @@ public: */ Status initializeShardingAwarenessIfNeeded(OperationContext* txn); + /** + * Check if a command is one of the whitelisted commands that can be accepted with shardVersion + * information before this node is sharding aware, because the command initializes sharding + * awareness. + */ + static bool commandInitializesShardingAwareness(const std::string& commandName) { + return _commandsThatInitializeShardingAwareness.find(commandName) != + _commandsThatInitializeShardingAwareness.end(); + } + private: friend class ScopedRegisterMigration; @@ -372,6 +382,10 @@ private: // The id for the cluster this shard belongs to. OID _clusterId; + // A whitelist of sharding commands that are allowed when running with --shardsvr but not yet + // shard aware, because they initialize sharding awareness. + static const std::set<std::string> _commandsThatInitializeShardingAwareness; + // Function for initializing the external sharding state components not owned here. GlobalInitFunc _globalInit; |