Skip to content

server: fix TestLogGC test#138174

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
kyle-a-wong:fix_testloggc
Jan 2, 2025
Merged

server: fix TestLogGC test#138174
craig[bot] merged 1 commit intocockroachdb:masterfrom
kyle-a-wong:fix_testloggc

Conversation

@kyle-a-wong
Copy link
Copy Markdown
Contributor

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 thetest 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

This test started failing after cockroachdb#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: cockroachdb#137490
Release note: None
@kyle-a-wong kyle-a-wong requested a review from a team as a code owner January 2, 2025 20:16
@kyle-a-wong kyle-a-wong requested review from dhartunian and removed request for a team January 2, 2025 20:16
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

Copy link
Copy Markdown
Collaborator

@michae2 michae2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm: Nice fix!

Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @angles-n-daemons, @dhartunian, @kyle-a-wong, and @xinhaoz)


-- commits line 5 at r1:
typo: "master"

@kyle-a-wong
Copy link
Copy Markdown
Contributor Author

Tftr!

bors r+

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Jan 2, 2025

@craig craig bot merged commit fa660cb into cockroachdb:master Jan 2, 2025
@kyle-a-wong kyle-a-wong deleted the fix_testloggc branch January 6, 2025 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

server: TestLogGC failed

3 participants