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.
- is related to
-
SERVER-60337 Investigate incorrect fast count in remove_and_bulk_insert.js
- Closed
- related to
-
SERVER-74103 Increase storage log verbosity in oplog_sampling.js
- Closed