[SERVER-80423] Make the preImage document always available to OplogDeleteEntryArgs Created: 25/Aug/23  Updated: 29/Oct/23  Resolved: 15/Sep/23

Status: Closed
Project: Core Server
Component/s: Write Ops
Affects Version/s: None
Fix Version/s: 7.2.0-rc0

Type: Improvement Priority: Major - P3
Reporter: Max Hirschhorn Assignee: Benety Goh
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-80956 remove OpObserver::aboutToDelete Backlog
related to SERVER-80680 remove no-op MigrationChunkClonerSour... Closed
related to SERVER-81080 rename OplogDeleteEntryArgs::oplogSlo... Closed
is related to SERVER-16049 Replicate capped collection deletes e... Closed
is related to SERVER-68205 Pull capped collection maintenance ou... Closed
is related to SERVER-17148 Remove plans do not need a FETCH stage Backlog
is related to SERVER-60602 Delete code for unreplicated capped d... Closed
is related to SERVER-69237 Make the preImage document always ava... Closed
is related to SERVER-77484 migrate OperationContext decorations ... Closed
Assigned Teams:
Storage Execution NAMER
Backwards Compatibility: Fully Compatible
Sprint: Execution NAMR Team 2023-09-18, Execution NAMR Team 2023-10-02
Participants:

 Description   

collection_internal::deleteDocument() always receives an owned BSONObj when the storage engine supports document-level concurrency. This is because either (a) DeleteStage and BatchedDeleteStage will have called WorkingSetMember::makeObjOwnedIfNeeded() or (b) collection_internal::deleteDocument(const RecordId& loc) will have called CollectionPtr::docFor() which copies the contents out of the storage engine. This means that, since the removal of the MMAPv1 storage engine in MongoDB 4.2, OplogDeleteEntryArgs::deletedDoc can be non-nullptr BSONObj.

Furthermore, OpObserver::aboutToDelete() no longer serves a meaningful purpose because the memory for the copied deletedDoc is guaranteed to outlive the contents of the storage engine. We can therefore simplify the pattern of using decorations to propagate state between OpObserver::aboutToDelete() and OpObserver::onDelete() by instead using local variables within OpObserver::onDelete().



 Comments   
Comment by Githook User [ 15/Sep/23 ]

Author:

{'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}

Message: SERVER-80423 replace pre-image OplogDeleteEntryArgs::deletedDoc field with OpObserver::onDelete() parameter
Branch: master
https://github.com/mongodb/mongo/commit/12803ad6b78ee7e2d8503e848883ac62b746c95a

Comment by Githook User [ 15/Sep/23 ]

Author:

{'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}

Message: SERVER-80423 merge ClusterServerParameterOpObserver::aboutToDelete() into onDelete()
Branch: master
https://github.com/mongodb/mongo/commit/6d643f352e61aa0b5245bd32c49d1c105fa243ad

Comment by Githook User [ 15/Sep/23 ]

Author:

{'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}

Message: SERVER-80423 deleteDocument() always provides pre-image to OpObserver::onDelete()
Branch: master
https://github.com/mongodb/mongo/commit/61eb1e49f4d0726dca06969a7f633e0d6ca0fa61

Comment by Githook User [ 15/Sep/23 ]

Author:

{'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}

Message: SERVER-80423 cappedDeleteUntilBelowConfiguredMaximum() always provides pre-image to OpObserver::onDelete()
Branch: master
https://github.com/mongodb/mongo/commit/87e032e0e3a44389283335f1b327fdbff4816afa

Generated at Thu Feb 08 06:43:30 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.