summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/metadata_manager.h
diff options
context:
space:
mode:
authorLeon Zaruvinsky <leon@mongodb.com>2016-06-24 16:41:07 -0400
committerLeon Zaruvinsky <leon@mongodb.com>2016-07-06 13:39:10 -0400
commita05bea91482fa70583680596823a115293d9d9a6 (patch)
tree52e746b7a6a9c76b760d718b9edb40c81e8467f7 /src/mongo/db/s/metadata_manager.h
parent16a914fa106becc7dc347cbfc7d2ffef04f694b4 (diff)
downloadmongo-a05bea91482fa70583680596823a115293d9d9a6.tar.gz
SERVER-24629 Add concurrency protection to MetadataManager
Diffstat (limited to 'src/mongo/db/s/metadata_manager.h')
-rw-r--r--src/mongo/db/s/metadata_manager.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/mongo/db/s/metadata_manager.h b/src/mongo/db/s/metadata_manager.h
index db0b3b1e255..73f91f7e44f 100644
--- a/src/mongo/db/s/metadata_manager.h
+++ b/src/mongo/db/s/metadata_manager.h
@@ -34,6 +34,7 @@
#include "mongo/base/disallow_copying.h"
#include "mongo/db/s/collection_metadata.h"
#include "mongo/s/catalog/type_chunk.h"
+#include "mongo/stdx/memory.h"
namespace mongo {
@@ -44,6 +45,7 @@ class MetadataManager {
public:
MetadataManager();
+ ~MetadataManager();
/**
* An ActiveMetadata must be set before this function can be called.
@@ -99,7 +101,10 @@ private:
* Removes the CollectionMetadata stored in the tracker from the _metadataInUse
* list (if it's there).
*/
- void _removeMetadata(CollectionMetadataTracker* metadataTracker);
+ void _removeMetadata_inlock(CollectionMetadataTracker* metadataTracker);
+
+ void _addRangeToClean_inlock(const ChunkRange& range);
+ void _removeRangeToClean_inlock(const ChunkRange& range);
std::unique_ptr<CollectionMetadataTracker> _activeMetadataTracker;
@@ -109,6 +114,8 @@ private:
// be deleted from the shard. The map is from the minimum value of the
// range to be deleted (e.g. BSON("key" << 0)) to the entire chunk range.
std::map<BSONObj, ChunkRange> _rangesToClean;
+
+ stdx::mutex _managerLock;
};
class ScopedCollectionMetadata {