summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/user_writes_recoverable_critical_section_service.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/s/user_writes_recoverable_critical_section_service.cpp')
-rw-r--r--src/mongo/db/s/user_writes_recoverable_critical_section_service.cpp25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/mongo/db/s/user_writes_recoverable_critical_section_service.cpp b/src/mongo/db/s/user_writes_recoverable_critical_section_service.cpp
index e54abafe898..5aec4a6521f 100644
--- a/src/mongo/db/s/user_writes_recoverable_critical_section_service.cpp
+++ b/src/mongo/db/s/user_writes_recoverable_critical_section_service.cpp
@@ -334,12 +334,25 @@ void UserWritesRecoverableCriticalSectionService::releaseRecoverableCriticalSect
// Release the critical section by deleting the critical section document. The OpObserver
// will release the in-memory CS when reacting to the delete event.
- PersistentTaskStore<UserWriteBlockingCriticalSectionDocument> store(
- NamespaceString::kUserWritesCriticalSectionsNamespace);
- store.remove(
- opCtx,
- BSON(UserWriteBlockingCriticalSectionDocument::kNssFieldName << nss.toString()),
- ShardingCatalogClient::kLocalWriteConcern);
+ DBDirectClient dbClient(opCtx);
+ const auto cmdResponse = dbClient.runCommand([&] {
+ write_ops::DeleteCommandRequest deleteOp(
+ NamespaceString::kUserWritesCriticalSectionsNamespace);
+
+ deleteOp.setDeletes({[&] {
+ write_ops::DeleteOpEntry entry;
+ entry.setQ(BSON(UserWriteBlockingCriticalSectionDocument::kNssFieldName
+ << nss.toString()));
+ // At most one doc can possibly match the above query.
+ entry.setMulti(false);
+ return entry;
+ }()});
+
+ return deleteOp.serialize({});
+ }());
+
+ const auto commandReply = cmdResponse->getCommandReply();
+ uassertStatusOK(getStatusFromWriteCommandReply(commandReply));
}
LOGV2_DEBUG(