If removeShard() is called for the shardId, the CallbackHandle for the task to upsert the shardIdentity on the new shard is canceled, and the CallbackHandle for that task is untracked:
Since canceling the task can occur after the task has already completed, but before the task's callback has run, it's possible for the task to have been canceled but not receive the CallbackCanceled status, which currently is checked for in the callback:
In this case, we don't return early, and end up trying to untrack the handle again, which hits an invariant (BF-3721).
To fix this, we should also return early if the handle is no longer tracked (signifying the shard has been removed).
- is related to
-
SERVER-26526 make TaskExecutor::cancel return whether the task was successfully canceled
- Closed