From 398dfc7d58be0f4a9f1b4c68ef0c962b9c67a897 Mon Sep 17 00:00:00 2001 From: Erik Grinaker Date: Mon, 19 Dec 2022 11:46:05 +0000 Subject: [PATCH] kvnemesis: ignore `SysBytes:10` MVCC stats discrepancy Epic: none Release note: None --- pkg/kv/kvnemesis/env.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/pkg/kv/kvnemesis/env.go b/pkg/kv/kvnemesis/env.go index a0ed54c317bc..9f8e3cff737c 100644 --- a/pkg/kv/kvnemesis/env.go +++ b/pkg/kv/kvnemesis/env.go @@ -14,6 +14,7 @@ import ( "context" gosql "database/sql" "fmt" + "regexp" "time" "github.com/cockroachdb/cockroach-go/v2/crdb" @@ -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.