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

Add a sizeStorer call to the onRollback handler for dataSize and numRecords changes

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.0.0-rc0, 6.0.6, 6.3.1, 5.0.22, 4.4.26
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • v5.0, v4.4
    • Execution Team 2023-03-06
    • 4

      Finally got to the bottom of this issue. Henrik spotted it.

      There's a call to the sizeStorer to tell it that the collection is dirty and must be flushed. The new code doesn't call the flush in onRollback, resulting in exactly what we're seeing where the numRecords is 1 greater than the actual documents. The old code would run the sizeStorer call in the onRollback handler in a very fragile non-obvious manner, via a recursive call into the _increaseDataSize function with a opCtx==nullptr. Additionally, the old _changeNumRecords() function didn't call into the sizeStorer, so the code was entirely dependent on the order of calling first _changeNumRecords() immediately followed by _increaseDataSize().

            Assignee:
            yujin.kang@mongodb.com Yujin Kang Park
            Reporter:
            dianna.hohensee@mongodb.com Dianna Hohensee (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: