Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-38392

Remove assertion that we can't shard a non-empty collection associated with tags

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.0.5, 4.1.7
    • Component/s: Sharding
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Backport Requested:
      v4.0
    • Sprint:
      Sharding 2018-12-17
    • Case:

      Description

      When sharding a non-empty collection that is associated with tags, we should create one chunk on the primary shard and let the balancer handle splitting and moving the chunks which is what we do for non-empty collections not associated with tags.

      In order to do this, we should remove this assertion and instead call `InitialSplitPolicy::calculateHashedSplitPointsForEmptyCollection` if `tags.empty`. We should pass `isEmpty` into `shardCollection()`, `InitialSplitPolicy::createFirstChunks`, and `InitialSplitPolicy::generateShardCollectionInitialZonedChunks` so that we can later check whether or not the collection is empty. In `generateShardCollectionInitialZonedChunks`, if `isEmpty` is false, we should just create one chunk by calling `appendChunk(nss, keyPattern.globalMin(), keyPattern.globalMax(), &version, validAfter, allShardIds[0], &chunks)` and not doing any of this.

      To test this, we should enable the balancer in our ShardingTest and then insert into some unsharded collection and create a few zones associated with this collection. We should then call shardCollection and assert that only one chunk exists after. We should then wait some time for the balancer to run and then assert that the chunks were correctly split and moved.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: