Skip to content

Commit

Permalink
Merge pull request #131518 from cockroachdb/blathers/backport-release…
Browse files Browse the repository at this point in the history
…-24.1-131446

release-24.1: kvnemesis: ignore SysBytes:{,-}10 MVCC stats discrepancy
  • Loading branch information
arulajmani authored Sep 27, 2024
2 parents bf09095 + 53422fa commit 75c89fc
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions pkg/kv/kvnemesis/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"context"
gosql "database/sql"
"fmt"
"regexp"
"time"

"github.com/cockroachdb/cockroach-go/v2/crdb"
Expand Down Expand Up @@ -68,6 +69,23 @@ func (e *Env) CheckConsistency(ctx context.Context, span roachpb.Span) []error {
if err := rows.Scan(&rangeID, &key, &status, &detail); err != nil {
return []error{err}
}
// NB: There's a known issue that can result in a 10-byte discrepancy in
// SysBytes. See:
// https://github.com/cockroachdb/cockroach/issues/93896
//
// This isn't critical, so we ignore such discrepancies.
if status == kvpb.CheckConsistencyResponse_RANGE_CONSISTENT_STATS_INCORRECT.String() {
m := regexp.MustCompile(`.*\ndelta \(stats-computed\): \{(.*)\}`).FindStringSubmatch(detail)
if len(m) > 1 {
delta := m[1]
// Strip out LastUpdateNanos and all zero-valued fields.
delta = regexp.MustCompile(`LastUpdateNanos:\d+`).ReplaceAllString(delta, "")
delta = regexp.MustCompile(`\S+:0\b`).ReplaceAllString(delta, "")
if regexp.MustCompile(`^\s*SysBytes:-?10\s*$`).MatchString(delta) {
continue
}
}
}
switch status {
case kvpb.CheckConsistencyResponse_RANGE_INDETERMINATE.String():
// Can't do anything, so let it slide.
Expand Down

0 comments on commit 75c89fc

Please sign in to comment.