[SERVER-26524] check if addShardHandle present in ShardingCatalogManagerImpl::_handleAddShardTaskResponse before continuing Created: 07/Oct/16  Updated: 19/Nov/16  Resolved: 07/Oct/16

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 3.4.0-rc0
Fix Version/s: 3.4.0-rc1

Type: Bug Priority: Major - P3
Reporter: Esha Maharishi (Inactive) Assignee: Esha Maharishi (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Related
is related to SERVER-26526 make TaskExecutor::cancel return whet... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Sharding 2016-10-31
Participants:
Linked BF Score: 0

 Description   

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:

https://github.com/mongodb/mongo/blob/r3.4.0-rc0/src/mongo/s/catalog/sharding_catalog_manager_impl.cpp#L1683-L1693

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:

https://github.com/mongodb/mongo/blob/r3.4.0-rc0/src/mongo/s/catalog/sharding_catalog_manager_impl.cpp#L1771-L1774

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).



 Comments   
Comment by Githook User [ 07/Oct/16 ]

Author:

{u'name': u'Esha Maharishi', u'email': u'esha.maharishi@mongodb.com'}

Message: SERVER-26524 check if addShardHandle present in ShardingCatalogManagerImpl::_handleAddShardTaskResponse before continuing
Branch: master
https://github.com/mongodb/mongo/commit/bb32a18fd09039d246ea8b67073697231ec0e409

Generated at Thu Feb 08 04:12:24 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.