Skip to content

Commit

Permalink
kvnemesis: ignore SysBytes:10 MVCC stats discrepancy
Browse files Browse the repository at this point in the history
Epic: none
Release note: None
  • Loading branch information
erikgrinaker committed Dec 19, 2022
1 parent b6667d9 commit 398dfc7
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 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 @@ -67,6 +68,22 @@ func (e *Env) CheckConsistency(ctx context.Context, span roachpb.Span) []error {
if err := rows.Scan(&rangeID, &key, &status, &detail); err != nil {
return []error{err}
}
// TODO(erikgrinaker): There's a known issue that can result in a 10-byte
// discrepancy in SysBytes. This hasn't been investigated, but it's not
// critical so we ignore it for now. See:
// https://github.com/cockroachdb/cockroach/issues/93896
if status == roachpb.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 roachpb.CheckConsistencyResponse_RANGE_INDETERMINATE.String():
// Can't do anything, so let it slide.
Expand Down

0 comments on commit 398dfc7

Please sign in to comment.