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

sql/logictest: add metamorphic param for global MVCC range tombstone #86866

Merged

Conversation

erikgrinaker
Copy link
Contributor

@erikgrinaker erikgrinaker commented Aug 25, 2022

kvserver: add GlobalMVCCRangeTombstone testing knob

This patch adds a set of testing knobs to enable writing an MVCC range
tombstone at the bottom of the keyspace during cluster bootstrapping.
This also subsumes the previous mechanism to trigger this from the
envvar COCKROACH_GLOBAL_MVCC_RANGE_TOMBSTONE, for e.g. roachtests and
roachperf benchmarks.

Release justification: non-production code changes

Release note: None

sql/logictest: add metamorphic param for global MVCC range tombstone

This patch adds a metamorphic parameter for the SQL logic tests that
will randomly write a global MVCC range tombstone across the entire user
keyspace during cluster bootstrapping. This should not semantically
affect the test data written above it, but will activate MVCC range
tombstone code paths in the storage layer for testing.

Touches #84042.

Release justification: non-production code changes

Release note: None

@erikgrinaker erikgrinaker self-assigned this Aug 25, 2022
@erikgrinaker erikgrinaker requested review from a team as code owners August 25, 2022 13:54
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@erikgrinaker erikgrinaker force-pushed the logictest-mvcc-range-tombstones branch from 1744759 to ea3c48b Compare August 25, 2022 13:59
@erikgrinaker
Copy link
Contributor Author

Looks like this won't generate the config for 3node-tenant-range-tombstone for some reason. I have to run now, but would appreciate some early input on this @jordanlewis (or whoever else is appropriate), and I'll wrap it up when I'm back from PTO.

@jordanlewis
Copy link
Member

@rytaft could you please find an reviewer here?

Copy link
Member

@yuzefovich yuzefovich left a comment

Choose a reason for hiding this comment

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

Looks like this won't generate the config for 3node-tenant-range-tombstone for some reason.

My guess is that because you didn't explicitly specify this new config in any of the logic test files, there is no target that would trigger this generation. You might want to include this new config into ThreeNodeTenantDefaultConfigNames in logictestbase.go so that the new config would run against most logic test files. It's possible that you also need to make some adjustments to pkg/cmd/generate-logictest/main.go to include into ConfigOverrides - not sure about that one.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @erikgrinaker, @jordanlewis, and @tbg)


pkg/kv/kvserver/client_raft_test.go line 83 at r2 (raw file):

}

func TestXXX(t *testing.T) {

nit: this test seems out of place.

@erikgrinaker erikgrinaker force-pushed the logictest-mvcc-range-tombstones branch from ea3c48b to 254113a Compare August 26, 2022 11:39
@erikgrinaker erikgrinaker requested a review from a team as a code owner August 26, 2022 11:39
@erikgrinaker erikgrinaker removed the request for review from jordanlewis August 26, 2022 11:39
Copy link
Contributor Author

@erikgrinaker erikgrinaker left a comment

Choose a reason for hiding this comment

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

It's possible that you also need to make some adjustments to pkg/cmd/generate-logictest/main.go to include into ConfigOverrides

This did the trick, thanks!

I think this should be good to go now, but I mostly cargo-culted this so let me know if there are any other configs that would be more appropriate or anything.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @tbg)


pkg/kv/kvserver/client_raft_test.go line 83 at r2 (raw file):

Previously, yuzefovich (Yahor Yuzefovich) wrote…

nit: this test seems out of place.

Whoops, yeah, this was accidentally committed.

Copy link
Member

@yuzefovich yuzefovich left a comment

Choose a reason for hiding this comment

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

:lgtm:

Although it might be worth considering a somewhat different approach - rather than introducing some new configs that explicitly use the range tombstones, why not do that randomly on all existing configs? I.e. with 50% chance for each logic test run put the global range tombstone. This seems like it would give us better coverage (e.g. local and 5node configs would be used too) while also keeping the number of tests smaller.

Reviewed 7 of 9 files at r1, 31 of 31 files at r3, 32 of 32 files at r4, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @tbg)

This patch adds a set of testing knobs to enable writing an MVCC range
tombstone at the bottom of the keyspace during cluster bootstrapping.
This also subsumes the previous mechanism to trigger this from the
envvar `COCKROACH_GLOBAL_MVCC_RANGE_TOMBSTONE`, for e.g. roachtests and
roachperf benchmarks.

Release justification: non-production code changes

Release note: None
@erikgrinaker erikgrinaker force-pushed the logictest-mvcc-range-tombstones branch from 254113a to cf48165 Compare August 29, 2022 09:51
Copy link
Contributor Author

@erikgrinaker erikgrinaker left a comment

Choose a reason for hiding this comment

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

Yeah, I think you're right -- done!

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @tbg and @yuzefovich)

@erikgrinaker erikgrinaker changed the title sql/logictest: add MVCC range tombstone test configs sql/logictest: add metamorphic param for global MVCC range tombstone Aug 29, 2022
Copy link
Member

@tbg tbg left a comment

Choose a reason for hiding this comment

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

Pinged #flaky-test-fighter about version-upgrade failure on this PR.

I'll defer to @yuzefovich on the randomization. It seems to make sense - we don't expect any individual test to choke on these (ok maybe some will find a way to accidentally detect the tombstone), and an opt-out pattern would be preferable.

Ah, you just pushed that. :shipit:

Reviewed 7 of 9 files at r1, 31 of 31 files at r3, 31 of 31 files at r5, 31 of 31 files at r6, all commit messages.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @erikgrinaker)


pkg/server/config.go line 240 at r3 (raw file):

	// key-specific code paths in the storage layer. We'll also have to tweak
	// rangefeeds and batcheval to not choke on it.
	if envutil.EnvOrDefaultBool("COCKROACH_GLOBAL_MVCC_RANGE_TOMBSTONE", false) {

I thought we had some (linted) convention to put this in var declarations in the global scope, but I am evidently wrong since CI doesn't have a failed lint. Carry on, I guess?

This patch adds a metamorphic parameter for the SQL logic tests that
will randomly write a global MVCC range tombstone across the entire user
keyspace during cluster bootstrapping. This should not semantically
affect the test data written above it, but will activate MVCC range
tombstone code paths in the storage layer for testing.

Release justification: non-production code changes

Release note: None
@erikgrinaker erikgrinaker force-pushed the logictest-mvcc-range-tombstones branch from cf48165 to f6953e0 Compare August 29, 2022 09:54
Copy link
Contributor Author

@erikgrinaker erikgrinaker left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @tbg)


pkg/server/config.go line 240 at r3 (raw file):

Previously, tbg (Tobias Grieger) wrote…

I thought we had some (linted) convention to put this in var declarations in the global scope, but I am evidently wrong since CI doesn't have a failed lint. Carry on, I guess?

We do the same thing elsewhere, e.g. earlier in this file, so I figured it was fine -- especially since this is called once during server startup. I'd be more inclined to use a global var if we read it multiple times.

Copy link
Member

@yuzefovich yuzefovich 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 31 of 31 files at r5, 30 of 31 files at r6, 1 of 1 files at r7, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @tbg)

@erikgrinaker
Copy link
Contributor Author

TFTRs! CI failures are known flakes.

bors r=tbg,yuzefovich

@craig
Copy link
Contributor

craig bot commented Aug 29, 2022

Build succeeded:

@craig craig bot merged commit 9da058b into cockroachdb:master Aug 29, 2022
@erikgrinaker erikgrinaker deleted the logictest-mvcc-range-tombstones branch August 30, 2022 08:13
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.

5 participants