[SERVER-65261] Deleting from a capped collection via collection scan reports number of documents deleted incorrectly Created: 05/Apr/22  Updated: 06/Feb/24  Resolved: 07/Apr/22

Status: Closed
Project: Core Server
Component/s: Write Ops
Affects Version/s: 5.3.0, 5.0.7
Fix Version/s: 5.0.8, 6.0.0-rc0

Type: Bug Priority: Major - P3
Reporter: Max Hirschhorn Assignee: Gregory Wlodarek
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Problem/Incident
is caused by SERVER-63201 Relax restriction of deletion ops in ... Closed
Related
related to SERVER-82863 Add support for the new capped collec... In Progress
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v5.0
Sprint: Execution Team 2022-04-18
Participants:

 Description   

User deletes on capped collections became possible in SERVER-63201. However, when the delete on the capped collection is performed via a collection scan, a CappedPositionLost write error is returned back to the client. There are couple issues with this behavior:

  • For limit:1 deletes (aka single-delete) 1 document is actually deleted but n:0 is returned in addition to the CappedPositionLost write error.
  • For limit:0 deletes (aka multi-deletes) no documents are deleted, n:0 is returned in addition to the CappedPositionLost write error. The reporting here is accurate but we should probably make it possible to clear a capped collection.

[js_test:repro_capped_user_delete] 	"n" : 0,
[js_test:repro_capped_user_delete] 	"writeErrors" : [
[js_test:repro_capped_user_delete] 		{
[js_test:repro_capped_user_delete] 			"index" : 0,
[js_test:repro_capped_user_delete] 			"code" : 136,
[js_test:repro_capped_user_delete] 			"errmsg" : "CollectionScan died due to position in capped collection being deleted. Last seen record id: RecordId(1)"
[js_test:repro_capped_user_delete] 		}
[js_test:repro_capped_user_delete] 	],
[js_test:repro_capped_user_delete] 	"ok" : 1,



 Comments   
Comment by Githook User [ 15/Apr/22 ]

Author:

{'name': 'Gregory Wlodarek', 'email': 'gregory.wlodarek@mongodb.com', 'username': 'GWlodarek'}

Message: SERVER-65261 User deletes on capped collections do not return CappedPositionLost
Branch: v5.0
https://github.com/mongodb/mongo/commit/4cbdf0b6db42e8ba867d17b56bd93358c9e6aee6

Comment by Githook User [ 07/Apr/22 ]

Author:

{'name': 'Gregory Wlodarek', 'email': 'gregory.wlodarek@mongodb.com', 'username': 'GWlodarek'}

Message: SERVER-65261 User deletes on capped collections do not return CappedPositionLost
Branch: master
https://github.com/mongodb/mongo/commit/55ded8c1cefa67b3d7c1ceeb1e28a8f0bfa45e25

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