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

Test that secondaries with capped collections upgrading from FCV 4.4 to FCV 5.0 delete all documents over the cap after stepping up

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • 5.0.0-rc0
    • None
    • None
    • None
    • Fully Compatible
    • Execution Team 2021-05-17
    • 70

    Description

      In FCV 4.4, each node is responsible for deleting the excess documents in capped collections. This implies that capped deletes may not be synchronized between nodes at times. When upgraded to FCV 5.0, the primary will generate delete oplog entries for capped collections. However, if the secondary was behind in deleting excess documents while in FCV 4.4, the primary would have no way of knowing and it would delete the first document it sees in its capped collection. This would leave the capped collection in an inconsistent state across the nodes, until the secondary steps up and starts deleting documents it never had a chance to. The capped collection would be consistent across the replica set nodes once every secondary stepped up, for replica sets where this is possible.

       

      Below is an example of this with a capped collection capacity of 4 documents:

      Node 1 Node 2
      Starts with docs 2-5 Starts with docs 1-5
      isPrimary ...
      Insert 6 ...
      Delete 2 ...
      ... Insert 6
      ... Delete 2
      ... Left with 1 + 3-6
      Stepdown ...
      ... New primary
      ... Insert 7
      ... Delete 1 + 3 (had an excess of one document always)
      Insert 7 ...
      Delete 1 (no-op) ...
      Delete 3 ...

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: