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

Delete non-existing garbage collectable tenant migration data should not cause a ConflictingInProgress error

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 6.1.1, 6.2.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • ALL
    • v6.1, v6.0
    • Server Serverless 2022-10-17, Server Serverless 2022-10-31
    • 6

      In general, a tenant migration statement data will be marked as garbage collectable after donorForgetMigration. Then, it will be automatically deleted by TTLMonitor once expired or it will be deleted by the next tenant migration request on the same tenant.

      But, there is a corner case that TTLMonitor thread and TenantMigrationRecipientService thread may try to delete the same tenant migration data concurrently. For example, 
      Time 1: [TenantMigrationRecipientService thread] check and get the existing mtab of the migration.
      Time 2: [TTLMonitor thread] delete the mtab due to time expired.
      Time 3: [TenantMigrationRecipientService thread] delete the mtab. Today, a ConflictingOperationInProgress error is return.  This is not expected. Here is the Code to be investigated.

      When checking if there is another ongoing we try to delete the existing state document only if it was marked for garbage collection so the new migration can keep on going. However the code logic handles the following situation :

      • If the state document doesn't have the "expireAt" field, we return false since nDeleted will be 0.
      • If the state document is deleted while we try to delete the state document, nDeleted will return 0 as well. This is wrong, if the state document is being deleted at the same time as we try to delete it, we should process with the migration as it is the same behavior as if we deleted it ourselves.

      We do not have a way to differentiate the second case from the first one and therefor we throw "ConflictingOperationInProgress". This ticket is to improve the code to handle that potential race condition.

            Assignee:
            mathis.bessa@mongodb.com Mathis Bessa (Inactive)
            Reporter:
            sophia.tan@mongodb.com Sophia Tan
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: