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

kvserver: simplify testContext #72392

Merged
merged 7 commits into from
Nov 4, 2021
Merged

Conversation

tbg
Copy link
Member

@tbg tbg commented Nov 3, 2021

See individual commits for details. I just spent some time cleaning up
createTestStore (#72383) and I noticed that testContext is much more
heavily used and has accumulated quite a bit of detritus.

I hope to ultimately make it use createTestStore but that will be for
another day.


  • kvserver: remove two uses of bootstrapRangeOnly
  • kvserver: remove TestReplicaLaziness
  • kvserver: remove testContext.bootstrapMode
  • kvserver: drop useless on-disk engine in a test
  • kvserver: simplify testContext
  • kvserver: fix up TestRaftSSTableSideloading
  • kvserver: prevent pre-populating testContext.eng

Release note: None

@tbg tbg requested a review from a team as a code owner November 3, 2021 15:43
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@tbg tbg force-pushed the testctx-simplify branch from 4f02388 to 23010a2 Compare November 3, 2021 16:37
Copy link
Contributor

@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.

LGTM at a glance.

tbg added 7 commits November 4, 2021 10:06
This is a deprecated testing tool that complicates `testContext`. This
commit phases it out in two out of three tests that use it.

Release note: None
This artificial test wasn't adding anything. Besides, we are not very
concerned about whether the raft groups are initialized lazily or not.
One could argue that at this point the laziness is a problem since it
can make things look good when the system would become unstable once
all raft groups are initialized.

In practice, the queues go through all replicas every ~10 minutes anyway
and after that has happened once, all raft groups will have been
instantiated.

Since this test uses the deprecated mode `bootstrapRangeOnly`, remove
it.

Release note: None
This is the reward for the preceding two commits.

Release note: None
It supports pre-populating fields where this is never used, and if it
were used who knows how well it would work. Better remove it now.

Release note: None
This test originally verified that SSTs that would be sent as part of
the raft log in a raft snapshot would be correctly inlined. But it has
been fooling itself for a long time, since snapshots haven't had a log
(in this test) for 1-2 years at this point. The test ended up using a
for loop that never went anywhere and a resulting index of zero and
just happened to never return a failing result.

Replace it with a more useful test verifying that we can propose and
read back a sideloaded proposal, the main bit of logic I wanted to
preserve is a test for an idiosyncracy of `entries()` when no sideloaded
storage is provided, in which case it can't add to the raft entry cache
for fear of putting a non-inlined entry there.

As a little additional upshot, there was no reason for this test to
use an on-disk engine (anymore), since the sideloaded storage is
backed by the pebble instance as well.

Release note: None
This functionality was no longer used and is now removed.

Release note: None
@tbg tbg force-pushed the testctx-simplify branch from 23010a2 to 4b796ba Compare November 4, 2021 09:06
@tbg
Copy link
Member Author

tbg commented Nov 4, 2021

TFTR!

bors r=erikgrinaker

@craig
Copy link
Contributor

craig bot commented Nov 4, 2021

Build succeeded:

@craig craig bot merged commit b4dc3eb into cockroachdb:master Nov 4, 2021
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.

3 participants