diff options
author | Arun Banala <arun.banala@mongodb.com> | 2021-10-05 15:36:22 +0100 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-10-07 14:55:52 +0000 |
commit | 05ecb0e73989a09cffdfad127d659920b43d3f90 (patch) | |
tree | bf1e4a6c52552c9b05727fabe98ef55576d02179 | |
parent | e47e21112d9a99e542d2f1fd9ca06e50a3c64059 (diff) | |
download | mongo-05ecb0e73989a09cffdfad127d659920b43d3f90.tar.gz |
SERVER-60464 Enable balancer for sharded time-series collections
-rw-r--r-- | src/mongo/db/s/balancer/balancer_chunk_selection_policy_impl.cpp | 12 | ||||
-rw-r--r-- | src/mongo/db/s/balancer/balancer_chunk_selection_policy_test.cpp | 10 |
2 files changed, 5 insertions, 17 deletions
diff --git a/src/mongo/db/s/balancer/balancer_chunk_selection_policy_impl.cpp b/src/mongo/db/s/balancer/balancer_chunk_selection_policy_impl.cpp index 1c8d241778b..67ce067c200 100644 --- a/src/mongo/db/s/balancer/balancer_chunk_selection_policy_impl.cpp +++ b/src/mongo/db/s/balancer/balancer_chunk_selection_policy_impl.cpp @@ -296,16 +296,6 @@ StatusWith<SplitInfoVector> BalancerChunkSelectionPolicyImpl::selectChunksToSpli for (const auto& coll : collections) { const NamespaceString& nss(coll.getNss()); - if (coll.getTimeseriesFields()) { - LOGV2_DEBUG(5559200, - 1, - "Not splitting collection {namespace}; explicitly disabled.", - "Not splitting explicitly disabled collection", - "namespace"_attr = nss, - "timeseriesFields"_attr = coll.getTimeseriesFields()); - continue; - } - auto candidatesStatus = _getSplitCandidatesForCollection(opCtx, nss, shardStats); if (candidatesStatus == ErrorCodes::NamespaceNotFound) { // Namespace got dropped before we managed to get to it, so just skip it @@ -375,7 +365,7 @@ StatusWith<MigrateInfoVector> BalancerChunkSelectionPolicyImpl::selectChunksToMo for (const auto& coll : collections) { const NamespaceString& nss(coll.getNss()); - if (!coll.getAllowBalance() || !coll.getAllowMigrations() || coll.getTimeseriesFields()) { + if (!coll.getAllowBalance() || !coll.getAllowMigrations()) { LOGV2_DEBUG(21851, 1, "Not balancing collection {namespace}; explicitly disabled.", diff --git a/src/mongo/db/s/balancer/balancer_chunk_selection_policy_test.cpp b/src/mongo/db/s/balancer/balancer_chunk_selection_policy_test.cpp index 1b2e9f33dcc..4e1f232fc51 100644 --- a/src/mongo/db/s/balancer/balancer_chunk_selection_policy_test.cpp +++ b/src/mongo/db/s/balancer/balancer_chunk_selection_policy_test.cpp @@ -231,7 +231,7 @@ TEST_F(BalancerChunkSelectionTest, TagRangeMaxNotAlignedWithChunkMax) { {BSON(kPattern << -15), kKeyPattern.globalMax()}}); } -TEST_F(BalancerChunkSelectionTest, ShardedTimeseriesCollectionsCannotBeAutoSplitted) { +TEST_F(BalancerChunkSelectionTest, ShardedTimeseriesCollectionsCanBeAutoSplitted) { // Set up two shards in the metadata, each one with its own tag ASSERT_OK(catalogClient()->insertConfigDocument(operationContext(), ShardType::ConfigNS, @@ -274,15 +274,14 @@ TEST_F(BalancerChunkSelectionTest, ShardedTimeseriesCollectionsCannotBeAutoSplit auto candidateChunksStatus = _chunkSelectionPolicy.get()->selectChunksToSplit(opCtx.get()); ASSERT_OK(candidateChunksStatus.getStatus()); - // No chunks to split since the coll is a sharded time-series collection - ASSERT_EQUALS(0U, candidateChunksStatus.getValue().size()); + ASSERT_EQUALS(1U, candidateChunksStatus.getValue().size()); }); expectGetStatsCommands(2); future.default_timed_get(); } -TEST_F(BalancerChunkSelectionTest, ShardedTimeseriesCollectionsCannotBeBalanced) { +TEST_F(BalancerChunkSelectionTest, ShardedTimeseriesCollectionsCanBeBalanced) { // Set up two shards in the metadata. ASSERT_OK(catalogClient()->insertConfigDocument( operationContext(), ShardType::ConfigNS, kShard0, kMajorityWriteConcern)); @@ -321,8 +320,7 @@ TEST_F(BalancerChunkSelectionTest, ShardedTimeseriesCollectionsCannotBeBalanced) auto candidateChunksStatus = _chunkSelectionPolicy.get()->selectChunksToMove(opCtx.get()); ASSERT_OK(candidateChunksStatus.getStatus()); - // No chunks to move since the coll is a sharded time-series collection - ASSERT_EQUALS(0, candidateChunksStatus.getValue().size()); + ASSERT_EQUALS(1, candidateChunksStatus.getValue().size()); }); expectGetStatsCommands(2); |