[crl-release-21.1] *: Skip first iteration of read sample #1101
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport of #1098.
Currently, we always sample on the first read in a newly-opened
iterator, for determining read compactions. This is because the
zero value of
bytesUntilReadSample
is always less than the bytes read. In cases where iterators are
short-lived, such as in ycsb workloads, this makes a greater proportion
of reads sampled than we'd like them to be, and it also makes any
changes to the sampling rate less effective.
This change updates Iterator to detect and skip the first time
it tries to sample a read on a newly-opened iterator.
Also makes a change to use
ints
instead ofuints
whencopying over options, to allow for disabling read sampling
by specifying a negative value for ReadSamplingMultiplier
if necessary.
When this change was tested with cockroachdb master, this
performance improvement was had on roachtests compared to
a clean master: