diff options
author | Charlie Swanson <cswanson310@gmail.com> | 2015-03-18 13:27:19 -0400 |
---|---|---|
committer | Charlie Swanson <cswanson310@gmail.com> | 2015-03-18 13:27:19 -0400 |
commit | c887c1e141b9d135a29e7f53dbb280a3406a87a2 (patch) | |
tree | 26b02240729e7a32a7821eae120f91de126b0e0f /src | |
parent | 0f6f2e9a199bff05c69ca5aace94a5ac8fe2cff3 (diff) | |
download | mongo-c887c1e141b9d135a29e7f53dbb280a3406a87a2.tar.gz |
Revert "SERVER-17586 Update ShardVersionMap in ChunkManager when shard is deleted during balancing"
This reverts commit 465ca1774ddb7078566cb2edf0408f5881d6aae3.
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/s/chunk_manager.cpp | 26 | ||||
-rw-r--r-- | src/mongo/s/chunk_manager.h | 2 |
2 files changed, 10 insertions, 18 deletions
diff --git a/src/mongo/s/chunk_manager.cpp b/src/mongo/s/chunk_manager.cpp index 9e075c4724e..6e3dfe60309 100644 --- a/src/mongo/s/chunk_manager.cpp +++ b/src/mongo/s/chunk_manager.cpp @@ -158,7 +158,7 @@ namespace { ShardVersionMap shardVersions; Timer t; - bool success = _load(config, chunkMap, shards, &shardVersions, oldManager); + bool success = _load(config, chunkMap, shards, shardVersions, oldManager); if( success ){ { @@ -201,7 +201,7 @@ namespace { bool ChunkManager::_load(const string& config, ChunkMap& chunkMap, set<Shard>& shards, - ShardVersionMap* shardVersions, + ShardVersionMap& shardVersions, const ChunkManager* oldManager) { @@ -215,7 +215,7 @@ namespace { // Get the old max version _version = oldManager->getVersion(); // Load a copy of the old versions - *shardVersions = oldManager->_shardVersions; + shardVersions = oldManager->_shardVersions; // Load a copy of the chunk map, replacing the chunk manager with our own const ChunkMap& oldChunkMap = oldManager->getChunkMap(); @@ -243,7 +243,7 @@ namespace { // Attach a diff tracker for the versioned chunk data CMConfigDiffTracker differ( this ); - differ.attach( _ns, chunkMap, _version, *shardVersions ); + differ.attach( _ns, chunkMap, _version, shardVersions ); // Diff tracker should *always* find at least one chunk if collection exists int diffsApplied = differ.calculateConfigDiff(config); @@ -252,17 +252,9 @@ namespace { LOG(2) << "loaded " << diffsApplied << " chunks into new chunk manager for " << _ns << " with version " << _version; - // Add all existing shards we find to the shards set - for (ShardVersionMap::iterator it = shardVersions->begin(); - it != shardVersions->end(); - ) { - if (Shard::findIfExists(it->first).ok()) { - shards.insert(it->first); - ++it; - } - else { - shardVersions->erase(it++); - } + // Add all the shards we find to the shards set + for( ShardVersionMap::iterator it = shardVersions.begin(); it != shardVersions.end(); it++ ){ + shards.insert( it->first ); } return true; @@ -275,7 +267,7 @@ namespace { // Set all our data to empty chunkMap.clear(); - shardVersions->clear(); + shardVersions.clear(); _version = ChunkVersion( 0, 0, OID() ); return true; @@ -299,7 +291,7 @@ namespace { // Set all our data to empty to be extra safe chunkMap.clear(); - shardVersions->clear(); + shardVersions.clear(); _version = ChunkVersion( 0, 0, OID() ); return allInconsistent; diff --git a/src/mongo/s/chunk_manager.h b/src/mongo/s/chunk_manager.h index 1e57c45d6d5..c15fb7dbaa1 100644 --- a/src/mongo/s/chunk_manager.h +++ b/src/mongo/s/chunk_manager.h @@ -224,7 +224,7 @@ namespace mongo { bool _load(const std::string& config, ChunkMap& chunks, std::set<Shard>& shards, - ShardVersionMap* shardVersions, + ShardVersionMap& shardVersions, const ChunkManager* oldManager); static bool _isValid(const ChunkMap& chunks); |