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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • 5.3.0, 5.0.7
    • 5.0.8, 6.0.0-rc0
    • Write Ops
    • None
    • Fully Compatible
    • ALL
    • v5.0
    • Execution Team 2022-04-18

    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,
      

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: