Skip to content

storage/engine: fix pebbleBatch.iter reuse#41896

Merged
petermattis merged 1 commit intocockroachdb:masterfrom
petermattis:pmattis/pebble-batch-iterator
Oct 24, 2019
Merged

storage/engine: fix pebbleBatch.iter reuse#41896
petermattis merged 1 commit intocockroachdb:masterfrom
petermattis:pmattis/pebble-batch-iterator

Conversation

@petermattis
Copy link
Copy Markdown
Collaborator

pebbleBatch.NewIterator was setting pebbleBatch.iter.inuse = true,
and then calling pebbleIterator.init which was clearing that
field. This was broken by #41859 which refactored how pebbleBatch
iterator reuse works.

Fixes #41899

@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@petermattis
Copy link
Copy Markdown
Collaborator Author

Hrmm, this is still broken. Now in a different way. Hold off on reviewing.

`pebbleBatch.NewIterator` was setting `pebbleBatch.iter.inuse = true`,
and then calling `pebbleIterator.init` which was clearing that
field. This was broken by cockroachdb#41859 which refactored how `pebbleBatch`
iterator reuse works.

Added separate cached prefix and normal iterators to
`pebble{Batch,ReadOnly}`. Various bits of higher-level code expect to be
able to have a prefix and normal iterator open at the same time. In
particularly, this comes up during intent resolution. This also mimics
our usage of RocksDB which seems desirable in the short term even though
the semantics of having two cached iterators is slightly odd.

Fixes cockroachdb#41899
@petermattis petermattis force-pushed the pmattis/pebble-batch-iterator branch from 09131bf to 550d483 Compare October 24, 2019 15:09
Copy link
Copy Markdown
Collaborator Author

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

Ok, all fixed up. This is ready for a look.

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


pkg/storage/engine/pebble_batch.go, line 27 at r1 (raw file):

	buf          []byte
	prefixIter   pebbleIterator
	normalIter   pebbleIterator

@itsbilal I had to go ahead and do this because TestMVCCOpLogWriter/pebble was failing.

Copy link
Copy Markdown
Contributor

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

:lgtm:

Reviewed 4 of 4 files at r1.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @petermattis and @sumeerbhola)


pkg/storage/engine/pebble_batch.go, line 27 at r1 (raw file):

Previously, petermattis (Peter Mattis) wrote…

@itsbilal I had to go ahead and do this because TestMVCCOpLogWriter/pebble was failing.

Sounds good, thanks for doing this!

@petermattis
Copy link
Copy Markdown
Collaborator Author

TFTR!

@petermattis petermattis merged commit fad4071 into cockroachdb:master Oct 24, 2019
@petermattis petermattis deleted the pmattis/pebble-batch-iterator branch October 24, 2019 18:35
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.

storage: remove end-key comparison in ComputeStatsForRange

3 participants