summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/sharding_state.h
diff options
context:
space:
mode:
authorEsha Maharishi <esha.maharishi@mongodb.com>2016-08-11 20:50:01 -0400
committerEsha Maharishi <esha.maharishi@mongodb.com>2016-08-11 21:07:39 -0400
commitd1223a8ad44d6bc91766f0bd05a08820cdb1fdea (patch)
treecbf51e562e432452193d238abd9f13c84db4ebf4 /src/mongo/db/s/sharding_state.h
parent6c6bf0284642a7fe1138888d6c3044a6f4912468 (diff)
downloadmongo-d1223a8ad44d6bc91766f0bd05a08820cdb1fdea.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.h14
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;