mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
SERVER-58143 shardsvrDropCollectionParticipant should be killable on stepdown
This commit is contained in:
parent
201f3d1d49
commit
4e2b70cd68
@ -70,19 +70,18 @@ boost::optional<BSONObj> DropCollectionCoordinator::reportForCurrentOp(
|
||||
|
||||
DropReply DropCollectionCoordinator::dropCollectionLocally(OperationContext* opCtx,
|
||||
const NamespaceString& nss) {
|
||||
DropReply result;
|
||||
uassertStatusOK(dropCollection(
|
||||
opCtx, nss, &result, DropCollectionSystemCollectionMode::kDisallowSystemCollectionDrops));
|
||||
|
||||
{
|
||||
// Clear the CollectionShardingRuntime entry
|
||||
UninterruptibleLockGuard noInterrupt(opCtx->lockState());
|
||||
// Clear CollectionShardingRuntime entry
|
||||
Lock::DBLock dbLock(opCtx, nss.db(), MODE_IX);
|
||||
Lock::CollectionLock collLock(opCtx, nss, MODE_IX);
|
||||
auto* csr = CollectionShardingRuntime::get(opCtx, nss);
|
||||
csr->clearFilteringMetadata(opCtx);
|
||||
}
|
||||
|
||||
DropReply result;
|
||||
uassertStatusOK(dropCollection(
|
||||
opCtx, nss, &result, DropCollectionSystemCollectionMode::kDisallowSystemCollectionDrops));
|
||||
|
||||
// Force the refresh of the catalog cache to purge outdated information
|
||||
const auto catalog = Grid::get(opCtx)->catalogCache();
|
||||
uassertStatusOK(catalog->getCollectionRoutingInfoWithRefresh(opCtx, nss));
|
||||
|
@ -73,6 +73,8 @@ public:
|
||||
<< opCtx->getWriteConcern().wMode,
|
||||
opCtx->getWriteConcern().wMode == WriteConcernOptions::kMajority);
|
||||
|
||||
opCtx->setAlwaysInterruptAtStepDownOrUp();
|
||||
|
||||
try {
|
||||
DropCollectionCoordinator::dropCollectionLocally(opCtx, ns());
|
||||
} catch (const ExceptionFor<ErrorCodes::NamespaceNotFound>&) {
|
||||
|
Loading…
Reference in New Issue
Block a user