0
0
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:
Jordi Serra Torrens 2021-06-29 07:38:58 +00:00 committed by Evergreen Agent
parent 201f3d1d49
commit 4e2b70cd68
2 changed files with 7 additions and 6 deletions

View File

@ -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));

View File

@ -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>&) {