[SERVER-51420] Deletes read the document twice before deleting Created: 07/Oct/20  Updated: 29/Oct/23  Resolved: 06/Nov/20

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 4.9.0

Type: Improvement Priority: Major - P3
Reporter: Louis Williams Assignee: Brian DeLeonardis (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Sprint: Execution Team 2020-11-02, Execution Team 2020-11-16
Participants:

 Description   

When deleting a document, we perform two reads (and thus make two copies) of the document before actually deleting it.

At least one document read is required to generate the keys to delete index entries, but this path could be optimized to only perform one read.

The first read can happen in either the IXSCAN+FETCH or COLLSCAN stages. The document is then passed to the WorkingSet.

The second read happens in Collection::deleteDocument. This second read is not technically required because at the point where we delete the document, we already have a version of the document from the WorkingSet.



 Comments   
Comment by Githook User [ 06/Nov/20 ]

Author:

{'name': 'Brian DeLeonardis', 'email': 'brian.deleonardis@mongodb.com', 'username': 'bdeleonardis1'}

Message: SERVER-51420 Optimize delete to only read document once
Branch: master
https://github.com/mongodb/mongo/commit/cb016ca64de26c7c45854f22e8772937475771e3

Comment by Brian DeLeonardis (Inactive) [ 03/Nov/20 ]

Code review: https://mongodbcr.appspot.com/714480001/

Comment by Louis Williams [ 28/Oct/20 ]

I think the solution should be to create a version of deleteDocument that takes a BSONObj, and have the DeleteStage use it.

Generated at Thu Feb 08 05:25:26 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.