Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
127366: kv: deflake TestStoreRangeMergeWithData r=nvanbenschoten a=nvanbenschoten

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

127381: schematelemetry: test that logs are redacted correctly r=rafiss a=rafiss

follow-up from #127195
informs: #126584
Release note: None

Co-authored-by: Nathan VanBenschoten <[email protected]>
Co-authored-by: Rafi Shamim <[email protected]>
  • Loading branch information
3 people committed Jul 17, 2024
3 parents c32c075 + cdb29a2 + e42017d commit 13d71ca
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
6 changes: 4 additions & 2 deletions pkg/kv/kvserver/client_merge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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.
Expand Down
9 changes: 8 additions & 1 deletion pkg/sql/catalog/schematelemetry/schema_telemetry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

0 comments on commit 13d71ca

Please sign in to comment.