Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
storage: correctly update the stats for rolled back deletes
Previously, a delete on a key rolled back by a savepoint did not correctly update the MVCCStats when the intent for that key was resolved. In particular, if the rollback revealed a non-deleted value for the key, the stats considered that key/value non-live and included other inaccuracies. This is an example from the output of kvnemesis, which caught the bug: ``` engine stats: {ContainsEstimates:0 LastUpdateNanos:1698322873881949000 LockAge:0 GCBytesAge:0 LiveBytes:771 LiveCount:13 KeyBytes:1350 KeyCount:34 ValBytes:714 ValCount:53 IntentBytes:8 IntentCount:0 LockBytes:0 LockCount:0 RangeKeyCount:0 RangeKeyBytes:0 RangeValCount:0 RangeValBytes:0 SysBytes:254 SysCount:6 AbortSpanBytes:0} computed stats: {ContainsEstimates:0 LastUpdateNanos:1698322873881949000 LockAge:0 GCBytesAge:0 LiveBytes:161 LiveCount:1 KeyBytes:0 KeyCount:0 ValBytes:8 ValCount:0 IntentBytes:8 IntentCount:0 LockBytes:0 LockCount:0 RangeKeyCount:0 RangeKeyBytes:0 RangeValCount:0 RangeValBytes:0 SysBytes:0 SysCount:0 AbortSpanBytes:0} ``` This patch fixes the logic responsible for computing stats upon intent resolution and adds testing for rolled back deletes. Informs: cockroachdb#97444 Release note (bug fix): Rolled back deletes no longer cause a discrepancy between computed stats and the actual stored values.
- Loading branch information