Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-65261

Deleting from a capped collection via collection scan reports number of documents deleted incorrectly

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 5.0.8, 6.0.0-rc0
    • Affects Version/s: 5.3.0, 5.0.7
    • Component/s: Write Ops
    • None
    • Fully Compatible
    • ALL
    • v5.0
    • Execution Team 2022-04-18

      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,
      

            Assignee:
            gregory.wlodarek@mongodb.com Gregory Wlodarek
            Reporter:
            max.hirschhorn@mongodb.com Max Hirschhorn
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: