diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2015-08-18 11:55:01 -0400 |
---|---|---|
committer | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2015-08-18 13:58:34 -0400 |
commit | beff0ee6a7a044bc44953a5bd383479d749e8471 (patch) | |
tree | 1a4558141f2eafa83df9816b17bbe42044f65a43 /src/mongo/db/s | |
parent | 9d2cd34feffcecc1a6cab6953e5f67d6efcf40ff (diff) | |
download | mongo-beff0ee6a7a044bc44953a5bd383479d749e8471.tar.gz |
SERVER-19855 Remove 'shardName' field from write commands' metadata
It is not necessary, because it already goes over an initialized
connection, which would have performed the shard name validation.
Diffstat (limited to 'src/mongo/db/s')
-rw-r--r-- | src/mongo/db/s/sharding_state.cpp | 8 | ||||
-rw-r--r-- | src/mongo/db/s/sharding_state.h | 18 |
2 files changed, 25 insertions, 1 deletions
diff --git a/src/mongo/db/s/sharding_state.cpp b/src/mongo/db/s/sharding_state.cpp index 8865a839e5c..c4c1ca55a42 100644 --- a/src/mongo/db/s/sharding_state.cpp +++ b/src/mongo/db/s/sharding_state.cpp @@ -385,6 +385,14 @@ void ShardingState::mergeChunks(OperationContext* txn, _collMetadata[ns] = cloned; } +bool ShardingState::inCriticalMigrateSection() { + return _migrationSourceManager.getInCriticalSection(); +} + +bool ShardingState::waitTillNotInCriticalSection(int maxSecondsToWait) { + return _migrationSourceManager.waitTillNotInCriticalSection(maxSecondsToWait); +} + void ShardingState::resetMetadata(const string& ns) { stdx::lock_guard<stdx::mutex> lk(_mutex); diff --git a/src/mongo/db/s/sharding_state.h b/src/mongo/db/s/sharding_state.h index db006b9de1c..0f7168355d8 100644 --- a/src/mongo/db/s/sharding_state.h +++ b/src/mongo/db/s/sharding_state.h @@ -34,6 +34,8 @@ #include "mongo/base/disallow_copying.h" #include "mongo/bson/oid.h" +#include "mongo/db/s/migration_destination_manager.h" +#include "mongo/db/s/migration_source_manager.h" #include "mongo/stdx/memory.h" #include "mongo/stdx/mutex.h" #include "mongo/util/concurrency/ticketholder.h" @@ -75,6 +77,14 @@ public: std::string getConfigServer(OperationContext* txn); std::string getShardName(); + MigrationSourceManager* migrationSourceManager() { + return &_migrationSourceManager; + } + + MigrationDestinationManager* migrationDestinationManager() { + return &_migrationDestManager; + } + // Initialize sharding state and begin authenticating outgoing connections and handling // shard versions. If this is not run before sharded operations occur auth will not work // and versions will not be tracked. @@ -299,7 +309,13 @@ private: bool useRequestedVersion, ChunkVersion* latestShardVersion); - // protects state below + // Manages the state of the migration donor shard + MigrationSourceManager _migrationSourceManager; + + // Manages the state of the migration recipient shard + MigrationDestinationManager _migrationDestManager; + + // Protects state below stdx::mutex _mutex; // Whether ::initialize has been called |