From cdb29a2cc9acfa2f2ae733a0799aadef814b6c79 Mon Sep 17 00:00:00 2001 From: Nathan VanBenschoten Date: Wed, 17 Jul 2024 12:37:01 -0400 Subject: [PATCH 1/2] kv: deflake TestStoreRangeMergeWithData Fixes #126249. This commit deflakes the test by making sure that the merge transaction does not get aborted after each time we manually advance the clock to trigger a lease acquisition. Release note: None --- pkg/kv/kvserver/client_merge_test.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/kv/kvserver/client_merge_test.go b/pkg/kv/kvserver/client_merge_test.go index 5d93937f19af..d2ac16f99c45 100644 --- a/pkg/kv/kvserver/client_merge_test.go +++ b/pkg/kv/kvserver/client_merge_test.go @@ -264,8 +264,6 @@ func TestStoreRangeMergeWithData(t *testing.T) { defer leaktest.AfterTest(t)() defer log.Scope(t).Close(t) - skip.WithIssue(t, 126249) - for _, retries := range []int64{0, 3} { t.Run(fmt.Sprintf("retries=%d", retries), func(t *testing.T) { mergeWithData(t, retries) @@ -276,6 +274,10 @@ func TestStoreRangeMergeWithData(t *testing.T) { func mergeWithData(t *testing.T, retries int64) { ctx := context.Background() + // Set a long txn liveness threshold so that the merge txn cannot be aborted, + // even when we manually advance the clock to trigger a lease acquisition. + defer txnwait.TestingOverrideTxnLivenessThreshold(time.Hour)() + manualClock := hlc.NewHybridManualClock() var store *kvserver.Store // Maybe inject some retryable errors when the merge transaction commits. From e42017db764d8f67af2f66dfd170e611a8cb9d04 Mon Sep 17 00:00:00 2001 From: Rafi Shamim Date: Wed, 17 Jul 2024 15:05:05 -0400 Subject: [PATCH 2/2] schematelemetry: test that logs are redacted correctly Release note: None --- pkg/sql/catalog/schematelemetry/schema_telemetry_test.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkg/sql/catalog/schematelemetry/schema_telemetry_test.go b/pkg/sql/catalog/schematelemetry/schema_telemetry_test.go index 9510b4f760ab..79dfa3dbd130 100644 --- a/pkg/sql/catalog/schematelemetry/schema_telemetry_test.go +++ b/pkg/sql/catalog/schematelemetry/schema_telemetry_test.go @@ -187,7 +187,14 @@ UPDATE system.namespace SET id = %d WHERE id = %d; // Ensure that a log line is emitted for each invalid object, with a loose // enforcement of the log structure. errorRE := regexp.MustCompile(`found invalid object with ID \d+: .+`) - entries, err := log.FetchEntriesFromFiles(0, math.MaxInt64, 1000, errorRE, log.SelectEditMode(false, false)) + entries, err := log.FetchEntriesFromFiles(0, math.MaxInt64, 1000, errorRE, log.SelectEditMode(false /* redact */, false /* keepRedactable */)) require.NoError(t, err) require.Len(t, entries, 9) + + // Verify that the log entries have redaction markers applied by checking one + // of the specific error messages. + errorRE = regexp.MustCompile(`found invalid object with ID \d+: relation ‹"nojob"›`) + entries, err = log.FetchEntriesFromFiles(0, math.MaxInt64, 1000, errorRE, log.SelectEditMode(false /* redact */, true /* keepRedactable */)) + require.NoError(t, err) + require.Len(t, entries, 1) }