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

Resharding Prohibited Commands Does Not Wait For The Recipient To Be Done

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 5.2.0, 5.0.4, 5.1.0-rc0
    • Affects Version/s: None
    • Component/s: Sharding
    • None
    • Fully Compatible
    • ALL
    • v5.1, v5.0
    • Hide
      1. ReshardingRecipientService marks itself as done
      2. Put a sleep on the ReshardingCoordinatorService such that it never tells the participants to refresh
      3. Run the resharding_prohibited_commands.js test
      4. Because it relies on the cache.collections it will continue as if the recipient has finished. But because the CollectionMetadata hasn't refreshed, it will not allow the operation in the second postDecisionPersisted to go through
      Show
      ReshardingRecipientService marks itself as done Put a sleep on the ReshardingCoordinatorService such that it never tells the participants to refresh Run the resharding_prohibited_commands.js test Because it relies on the cache.collections it will continue as if the recipient has finished. But because the CollectionMetadata hasn't refreshed, it will not allow the operation in the second postDecisionPersisted to go through
    • Sharding 2021-10-04, Sharding 2021-10-18
    • 35
    • 1

      Context
      When the ReshardingRecipientService, marks itself as done. It will update it's local in memory representation of the state. But that will not lead to the rest of the recipient's in memory state to know that the recipient is finished. This is because it uses the CollectionMetadata to know the state of the operation.

      The recipient's CollectionMetadata isn't updated until the coordinator sends a commands to the participants of the resharding operation to refresh.

      So any calls to throwIfReshardingInProgress will not necessarily reflect the state of the ReshardingRecipientService but instead reflect the state of the recipient since the last refresh.

      The Problem

      The resharding_prohibited_commands.js relies on updates to the cache.collections collection (which has caused problems in the past, see SERVER-59694), it will allow all of the commands that are prohibited during resharding to be executed before the CollectionMetadata of the recipient has been updated.

      Hence when the colldMod command was executed the throwIfReshardingInProgress function received reshardingFields that have not been updated to reflect the move to done by the ReshardingRecipientService.

      Possible Solution
      The test needs to be updated to not rely on the cache.collections as that doesn't have a strong relation to when the recipient is actually done.

      We should either join the resharding operation and wait until it is done. Or take some other measure to determine whether or not the recipient is fully "done".

            Assignee:
            luis.osta@mongodb.com Luis Osta (Inactive)
            Reporter:
            luis.osta@mongodb.com Luis Osta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: