Skip to content

Commit

Permalink
server: fix TestLogGC test
Browse files Browse the repository at this point in the history
This test started failing after #137069 was
merged into mater. That PR introduced a change
that made it so that a lock is acquired when
performing the initial scan for a DELETE,
over all scanned rows. As a result, a race
condition was exposed in TestLogGC (specifically
when the deadlock flag is set) where calling
`gcSystemLog` resulted in a
`TransactionRetryError: retry txn` error.

This race condition is happening because the
test data being written is using timestamps
in the future as opposed to the past. When
attemping to GC the table, its conflict with
normal writes that are happening at the
same time. To fix, the test data is being
written in the past, which avoids these
conflicts.

Fixes: #137490
Release note: None
  • Loading branch information
kyle-a-wong committed Jan 2, 2025
1 parent 33ec904 commit 4e8545e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/server/server_systemlog_gc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func TestLogGC(t *testing.T) {
a.NoError(err)
}
}
maxTS1 := timeutil.Now()
maxTS1 := timeutil.Now().Add(time.Duration(-24*7) * time.Hour)
maxTS2 := maxTS1.Add(time.Second)
maxTS3 := maxTS2.Add(time.Second)
maxTS4 := maxTS3.Add(time.Second)
Expand Down

0 comments on commit 4e8545e

Please sign in to comment.