summaryrefslogtreecommitdiff
path: root/src/mongo/db/op_observer_impl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/op_observer_impl.cpp')
-rw-r--r--src/mongo/db/op_observer_impl.cpp24
1 files changed, 8 insertions, 16 deletions
diff --git a/src/mongo/db/op_observer_impl.cpp b/src/mongo/db/op_observer_impl.cpp
index 43341431068..c51f6407677 100644
--- a/src/mongo/db/op_observer_impl.cpp
+++ b/src/mongo/db/op_observer_impl.cpp
@@ -182,19 +182,11 @@ void OpObserverImpl::onUpdate(OperationContext* opCtx, const OplogUpdateEntryArg
updateSessionProgress(opCtx, opTime);
}
-CollectionShardingState::DeleteState OpObserverImpl::aboutToDelete(OperationContext* opCtx,
- const NamespaceString& nss,
- const BSONObj& doc) {
- CollectionShardingState::DeleteState deleteState;
- BSONElement idElement = doc["_id"];
- if (!idElement.eoo()) {
- deleteState.idDoc = idElement.wrap();
- }
-
- auto css = CollectionShardingState::get(opCtx, nss.ns());
- deleteState.isMigrating = css->isDocumentInMigratingChunk(opCtx, doc);
-
- return deleteState;
+auto OpObserverImpl::aboutToDelete(OperationContext* opCtx,
+ NamespaceString const& nss,
+ BSONObj const& doc) -> CollectionShardingState::DeleteState {
+ auto* css = CollectionShardingState::get(opCtx, nss.ns());
+ return CollectionShardingState::DeleteState(opCtx, css, doc);
}
void OpObserverImpl::onDelete(OperationContext* opCtx,
@@ -203,13 +195,13 @@ void OpObserverImpl::onDelete(OperationContext* opCtx,
StmtId stmtId,
CollectionShardingState::DeleteState deleteState,
bool fromMigrate) {
- if (deleteState.idDoc.isEmpty())
+ if (deleteState.documentKey.isEmpty())
return;
auto opTime =
- repl::logOp(opCtx, "d", nss, uuid, deleteState.idDoc, nullptr, fromMigrate, stmtId);
+ repl::logOp(opCtx, "d", nss, uuid, deleteState.documentKey, nullptr, fromMigrate, stmtId);
AuthorizationManager::get(opCtx->getServiceContext())
- ->logOp(opCtx, "d", nss, deleteState.idDoc, nullptr);
+ ->logOp(opCtx, "d", nss, deleteState.documentKey, nullptr);
auto css = CollectionShardingState::get(opCtx, nss.ns());
if (!fromMigrate) {