summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/metadata_manager.h
diff options
context:
space:
mode:
authorSam Dunietz <sam.dunietz@10gen.com>2016-06-21 11:02:17 -0400
committerSam Dunietz <sam.dunietz@10gen.com>2016-06-21 13:17:58 -0400
commit42d38ba1fc71a2c0f7cbd19d58da120aa22925bb (patch)
treeff7af678d6135ad59d2f2f42566dd94035004ad4 /src/mongo/db/s/metadata_manager.h
parentebda7755ddb1c932bbca56c97c102d1c0f2a4f2d (diff)
downloadmongo-42d38ba1fc71a2c0f7cbd19d58da120aa22925bb.tar.gz
SERVER-24365 Implement the rangesToClean set and maintenance methods
Diffstat (limited to 'src/mongo/db/s/metadata_manager.h')
-rw-r--r--src/mongo/db/s/metadata_manager.h28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/mongo/db/s/metadata_manager.h b/src/mongo/db/s/metadata_manager.h
index d3625840acd..db0b3b1e255 100644
--- a/src/mongo/db/s/metadata_manager.h
+++ b/src/mongo/db/s/metadata_manager.h
@@ -25,6 +25,7 @@
* exception statement from all source files in the program, then also delete
* it in the license file.
*/
+
#pragma once
#include <list>
@@ -32,6 +33,7 @@
#include "mongo/base/disallow_copying.h"
#include "mongo/db/s/collection_metadata.h"
+#include "mongo/s/catalog/type_chunk.h"
namespace mongo {
@@ -58,6 +60,26 @@ public:
*/
void setActiveMetadata(std::unique_ptr<CollectionMetadata> newMetadata);
+ /**
+ * Adds a new range to be cleaned up.
+ * The newly introduced range must not overlap with the existing ranges.
+ */
+ void addRangeToClean(const ChunkRange& range);
+
+ /**
+ * Removes the specified range from the ranges to be cleaned up.
+ */
+ void removeRangeToClean(const ChunkRange& range);
+
+ /**
+ * Gets copy of _rangesToClean map (see below).
+ */
+ std::map<BSONObj, ChunkRange> getCopyOfRanges();
+
+ /*
+ * Appends information on all the chunk ranges in rangesToClean to builder.
+ */
+ void append(BSONObjBuilder* builder);
private:
friend class ScopedCollectionMetadata;
@@ -82,8 +104,12 @@ private:
std::unique_ptr<CollectionMetadataTracker> _activeMetadataTracker;
std::list<std::unique_ptr<CollectionMetadataTracker>> _metadataInUse;
-};
+ // Contains the information of which ranges of sharding keys need to
+ // 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;
+};
class ScopedCollectionMetadata {
MONGO_DISALLOW_COPYING(ScopedCollectionMetadata);