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

Fastcount gets out of sync when a delete rollbacks and another transaction deletes the same rows

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 5.3.0, 4.4.18, 5.0.14
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • ALL
    • v5.0, v4.4, v4.2
    • Execution Team 2022-02-21
    • 13

      In the WiredTigerRecordStore we keep track of the number of records we hold. When a transaction rollbacks we patch up the metadata so that eventually it stays in sync with the real number of rows, even though it can get out of sync if there's a crash.

      To fix up issues after a crash, we clamp the value to a positive integer however this can cause problems if there are rollbacks:

      • Thread 1 deletes the last row, sets numRecords = 0
      • Thread 1 rollbacks, it rollbacks the WT transaction but hasn't fixed up the metadata yet
      • Thread 2 deletes the last row, numRecords is 0 so it clamps numRecords to 0 and commits.
      • Thread 1 fixes up the metadata by increasing numRecords by the same amount it reduced, numRecords = 1

      We should allow negative values of numRecords so that the metadata patching process works correctly.

            Assignee:
            daniel.gomezferro@mongodb.com Daniel Gomez Ferro
            Reporter:
            daniel.gomezferro@mongodb.com Daniel Gomez Ferro
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: