Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
storage: fix stats inconsistency due to WriteTooOld optimization
This fixes a bug introduced in cockroachdb#22315 with the introduction of a "local retry" to avoid WriteTooOldError inside of 1PC transactions that were not carrying out any reads. Such a transaction can simply be re-evaluated at a higher timestamp, which can allow it to commit. The bug was that when such a re-evaluation was carried out, we were not discarding the MVCCStats accrued from the first attempt. In effect, the request would thus be double-counted in stats, which would set off the consistency checker. The fix is easy: discard the delta before re-evaluating. Fixes cockroachdb#31870. Release note (bug fix): remove a source of (benign) stats inconsistencies (i.e. the stats of a range not accurately reflecting its contents).
- Loading branch information