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

storage/metamorphic: Run pebble with different options #46057

Merged
merged 1 commit into from
Mar 17, 2020

Conversation

itsbilal
Copy link
Contributor

This change updates the MVCC metamorphic tests to run Pebble
with different, random options, as well as one configuration
that seems to uncover many issues (the one with low
TargetFileSizes on all levels).

Also fixes batchCommitOp to actually commit the batch
passed in.

Release note: None

Release justification: Safe for this release because it only
updates testing code.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@itsbilal
Copy link
Contributor Author

This uncovered one issue in MVCCReverseScanning where we return incorrect key/value byte slices that happen to be right at the start of an L6 SSTable. It'll probably fail CI since it's pretty reproducible, until I investigate and fix that. But otherwise this is the general idea.

Copy link
Collaborator

@petermattis petermattis left a comment

Choose a reason for hiding this comment

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

Looks good. Interested to find out what the reverse scanning problem is.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @itsbilal, @petermattis, and @sumeerbhola)


pkg/storage/metamorphic/generator.go, line 91 at r1 (raw file):

	opts.LBaseMaxBytes = rngIntRange(rng, 1 << 8, 128 << 20)
	opts.L0CompactionThreshold = int(rngIntRange(rng, 1, 8))
	opts.L0StopWritesThreshold = int(rngIntRange(rng, 1, 32))

I think there are constraints on the relationships of some of these settings. Take a look at pebble/internal/metamorphic/options.go:randomOptions().


pkg/storage/metamorphic/operations.go, line 441 at r1 (raw file):

	}
	batch := b.m.getReadWriter(b.id).(storage.Batch)
	if err := batch.Commit(true); err != nil {

We weren't committing batches before?


pkg/storage/metamorphic/operations.go, line 442 at r1 (raw file):

	batch := b.m.getReadWriter(b.id).(storage.Batch)
	if err := batch.Commit(true); err != nil {
		return fmt.Sprintf("error: %s", err.Error())

This can probably just be return err.Error().

Copy link
Contributor Author

@itsbilal itsbilal left a comment

Choose a reason for hiding this comment

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

Tests should be fixed once I rebase this on #46160 . For the record, the reverse scanning problem I alluded to above was cockroachdb/pebble#572 .

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @petermattis and @sumeerbhola)


pkg/storage/metamorphic/generator.go, line 91 at r1 (raw file):

Previously, petermattis (Peter Mattis) wrote…

I think there are constraints on the relationships of some of these settings. Take a look at pebble/internal/metamorphic/options.go:randomOptions().

Done. I matched the style there of doing 1 << rngIntRange(x,y) instead of rngIntRange(1 << x, 1 << y), as well as ensured that all of these adhere to the bounds specified there.


pkg/storage/metamorphic/operations.go, line 441 at r1 (raw file):

Previously, petermattis (Peter Mattis) wrote…

We weren't committing batches before?

We were, until the big generation/execution refactor where I forgot to copy this over. My bad. Turns out we did uncover some bugs as a result of not committing batches; the ingestion range tombstone elision one would be much harder to detect if we were committing all batches, since it increased the proportion of ingestions to puts. Note that puts right on the engine were always going through.


pkg/storage/metamorphic/operations.go, line 442 at r1 (raw file):

Previously, petermattis (Peter Mattis) wrote…

This can probably just be return err.Error().

Done.

@itsbilal itsbilal force-pushed the meta-tests-var-opts branch from 79dabd6 to e4ab0aa Compare March 16, 2020 21:11
Copy link
Collaborator

@petermattis petermattis left a comment

Choose a reason for hiding this comment

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

:lgtm:

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


pkg/storage/metamorphic/generator.go, line 91 at r1 (raw file):

Previously, itsbilal (Bilal Akhtar) wrote…

Done. I matched the style there of doing 1 << rngIntRange(x,y) instead of rngIntRange(1 << x, 1 << y), as well as ensured that all of these adhere to the bounds specified there.

Do you need something like:

	if opts.L0StopWritesThreshold < opts.L0CompactionThreshold {
		opts.L0StopWritesThreshold = opts.L0CompactionThreshold
	}

pkg/storage/metamorphic/generator.go, line 115 at r2 (raw file):

	defer opts.Cache.Unref()

	fmt.Printf("pebble options:\n%s\n", opts.String())

Did you intend to leave this in the code?

This change updates the MVCC metamorphic tests to run Pebble
with different, random options, as well as one configuration
that seems to uncover many issues (the one with low
TargetFileSizes on all levels).

Also fixes batchCommitOp to actually commit the batch
passed in.

Release note: None

Release justification: Safe for this release because it only
updates testing code.
@itsbilal itsbilal force-pushed the meta-tests-var-opts branch from e4ab0aa to 2f3353f Compare March 17, 2020 14:31
Copy link
Contributor Author

@itsbilal itsbilal left a comment

Choose a reason for hiding this comment

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

TFTR!

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


pkg/storage/metamorphic/generator.go, line 91 at r1 (raw file):

Previously, petermattis (Peter Mattis) wrote…

Do you need something like:

	if opts.L0StopWritesThreshold < opts.L0CompactionThreshold {
		opts.L0StopWritesThreshold = opts.L0CompactionThreshold
	}

Right, didn't realize that case could happen. Done.


pkg/storage/metamorphic/generator.go, line 115 at r2 (raw file):

Previously, petermattis (Peter Mattis) wrote…

Did you intend to leave this in the code?

Since it's also present in the OPTIONS file, not really. Removed.

@itsbilal
Copy link
Contributor Author

bors r+

@craig
Copy link
Contributor

craig bot commented Mar 17, 2020

Build succeeded

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