Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backupccl: fix flake in TestProtectedTimestampDuringBackup #47582

Merged
merged 3 commits into from
Apr 21, 2020

Conversation

pbardea
Copy link
Contributor

@pbardea pbardea commented Apr 16, 2020

TestProtectedTimestampDuringBackup would sometimes flake as the GC queue
would assign it a low priority that would be below the threshold to turn
shouldQueue to true. However, the priority is non-zero indicating that
the timestamp was indeed not protected. This change aims to remove the
flake by checking for a non-zero priority rather than if shouldQueue is
true.

This PR also makes the same change to the ImportInto variant of the test since
they share the same test structure.

Fixes #47522.

Release note: None

@pbardea pbardea requested a review from ajwerner April 16, 2020 20:58
@cockroach-teamcity
Copy link
Member

This change is Reviewable

// This regex matches when all float priorities other than 0.00000.
matchNonZeroSmall := "0\\.\\d*[1-9]" // matches 0.00123, 0.00001
matchNonZeroLarge := "[1-9]\\d*(\\.\\d+)?" // matches 123.000, 123.2, and 1234
nonZeroProgressRE := regexp.MustCompile(fmt.Sprintf("priority=(%s|%s)", matchNonZeroSmall, matchNonZeroLarge))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wanted to simplify this, but this was the best I could come up with given that Go's regex doesn't support negative lookahead... if any ideas come to mind, I'm open to suggestions. :)

@@ -3669,11 +3676,14 @@ func TestProtectedTimestampsDuringBackup(t *testing.T) {

// Wait for the ranges to learn about the removed record and ensure that we
// can GC from the range soon.
gcRanRE := regexp.MustCompile("(?s)shouldQueue=true.*processing replica.*GC score after GC")
// This regex matches when all float priorities other than 0.00000.
Copy link
Contributor

Choose a reason for hiding this comment

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

how about: [1-9]\d*\.\d+|0\.\d*[1-9]\d*

@blathers-crl
Copy link

blathers-crl bot commented Apr 16, 2020

❌ The GitHub CI (Cockroach) build has failed on 5d90c485.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan.

This commit is purely a change for readability. It releases the
timestamp during the backup job before sending the result over the
channel. I don't expect this to have any functional change, but it
improves readability as returning the result channel is typically the
last important thing we want to do in a job.

Release note: None
@blathers-crl
Copy link

blathers-crl bot commented Apr 16, 2020

❌ The GitHub CI (Cockroach) build has failed on 130e8b11.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan.

TestProtectedTimestampDuringBackup would sometimes flake as the GC queue
would assign it a low priority that would be below the threshold to turn
shouldQueue to true. However, the priority is non-zero indicating that
the timestamp was indeed not protected. This change aims to remove the
flake by checking for a non-zero priority rather than if shouldQueue is
true.

Release note: None
Similar to the previous commit, this commit changes the test to wait for
a non-zero priority for this range in the GC queue. Although we've never
seen this flake in practice, it is potentially susceptible to the same
flake that has been seen in TestProtectedTimestampDuringBackup.

Release note: None
@pbardea
Copy link
Contributor Author

pbardea commented Apr 21, 2020

Updated the regex - RFAL

Copy link
Contributor

@ajwerner ajwerner left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 1 of 1 files at r1, 1 of 1 files at r5, 1 of 1 files at r6.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained

@pbardea
Copy link
Contributor Author

pbardea commented Apr 21, 2020

TFTR!
bors r+

@craig
Copy link
Contributor

craig bot commented Apr 21, 2020

Build failed (retrying...)

@craig
Copy link
Contributor

craig bot commented Apr 21, 2020

Build succeeded

@craig craig bot merged commit 998abbe into cockroachdb:master Apr 21, 2020
@pbardea pbardea deleted the protected-ts-flake branch April 27, 2020 00:50
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.

backupccl: TestProtectedTimestampsDuringBackup is flaky on master
3 participants