summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/config/initial_split_policy.h
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2019-01-24 18:05:09 -0500
committerKaloian Manassiev <kaloian.manassiev@mongodb.com>2019-01-25 12:36:54 -0500
commitec3a2060a3fbdd8808a39533b25e6b270ea95b28 (patch)
treedbb749eca4ce96e6d19a818fc887287597a31e41 /src/mongo/db/s/config/initial_split_policy.h
parent6e21e6e124e3124ded27dc4f2e23109db627417c (diff)
downloadmongo-ec3a2060a3fbdd8808a39533b25e6b270ea95b28.tar.gz
SERVER-39180 Don't distribute chunks on `shardCollection` if the collection is not empty
Diffstat (limited to 'src/mongo/db/s/config/initial_split_policy.h')
-rw-r--r--src/mongo/db/s/config/initial_split_policy.h24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/mongo/db/s/config/initial_split_policy.h b/src/mongo/db/s/config/initial_split_policy.h
index 67492c24a98..6e43265b3ae 100644
--- a/src/mongo/db/s/config/initial_split_policy.h
+++ b/src/mongo/db/s/config/initial_split_policy.h
@@ -74,9 +74,11 @@ public:
};
/**
- * Produces the initial chunks that need to be written for a collection which is being
- * newly-sharded. The function performs some basic validation of the input parameters, but there
- * is no checking whether the collection contains any data or not.
+ * Produces the initial chunks that need to be written for an *empty* collection which is being
+ * sharded based on a set of 'splitPoints' and 'numContiguousChunksPerShard'.
+ *
+ * NOTE: The function performs some basic validation of the input parameters, but there is no
+ * checking whether the collection contains any data or not.
*
* Chunks are assigned to a shard in a round-robin fashion, numContiguousChunksPerShard (k)
* chunks at a time. For example, the first k chunks are assigned to the first available shard,
@@ -98,9 +100,16 @@ public:
const int numContiguousChunksPerShard = 1);
/**
- * Produces the initial chunks that need to be written for a collection which is being
- * newly-sharded based on the given tags. Chunks that do not correspond to any pre-defined
- * zones are assigned to available shards in a round-robin fashion.
+ * Produces the initial chunks that need to be written for an *empty* collection which is being
+ * sharded based on the given 'tags'.
+ *
+ * NOTE: The function performs some basic validation of the input parameters, but there is no
+ * checking whether the collection contains any data or not.
+ *
+ * The contents of 'tags' will be used to create chunks, which correspond to these zones and
+ * chunks will be assigned to shards from 'tagToShards'. If there are any holes in between the
+ * zones (zones are not contiguous), these holes will be assigned to 'shardIdsForGaps' in
+ * round-robin fashion.
*/
static ShardCollectionConfig generateShardCollectionInitialZonedChunks(
const NamespaceString& nss,
@@ -108,8 +117,7 @@ public:
const Timestamp& validAfter,
const std::vector<TagsType>& tags,
const StringMap<std::vector<ShardId>>& tagToShards,
- const std::vector<ShardId>& allShardIds,
- const bool isEmpty);
+ const std::vector<ShardId>& shardIdsForGaps);
/**
* Creates the first chunks for a newly sharded collection.