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

TenantMigrationDonorInstance should distinguish local and remote shutdown/stepdown errors

    • Fully Compatible
    • Sharding 2020-11-16, Sharding 2020-11-30, Sharding 2020-12-14

      Currently, TenantMigrationDonorInstance stops retrying on shutdown/stepdown errors regardless of if the error is local or remote.

      Once there is a way to distinguish local and remote errors, TenantMigrationDonorInstance should be updated to only stop retrying if the error is local.

       

      Edit: We decided not to use the machinery being built for SERVER-50549. Instead, we can use the fact that an Instance has a private _isRunning bool that gets set to true when the instance's run() is called.

      Right now the bool never gets set to false, but we can make PrimaryOnlyService::onStepdown and PrimaryOnlyService::shutdown iterate all instances in that service and set their _isRunning bools to false, similarly to how they iterate their instances and call interrupt on them. (This does mean PrimaryOnlyService::Instance will need a member mutex to protect _isRunning.)

      We can add a protected `const isRunning()` method to PrimaryOnlyService::Instance that returns _isRunning.

      Then, an instance's retry loop can just keep retrying until `status.isOK() || !isRunning()` instead of checking if the status is a NotPrimary or Shutdown error.

            Assignee:
            jason.zhang@mongodb.com Jason Zhang
            Reporter:
            esha.maharishi@mongodb.com Esha Maharishi (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: