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

table cache: use a long-lived ReaderProvider #4154

Merged
merged 1 commit into from
Nov 12, 2024

Conversation

RaduBerinde
Copy link
Member

An sstable.ReaderProvider is necessary whenever an sstable has value
blocks. Currently, we allocate one every time we create a point
iterator.

This commit makes the tableCacheShardReaderProvider usable in
parallel and maintains a long-lived instance in the tableCacheValue.

@RaduBerinde RaduBerinde requested a review from a team as a code owner November 10, 2024 15:07
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@RaduBerinde RaduBerinde added the o-perf-efficiency Related to performance efficiency label Nov 10, 2024
Copy link
Collaborator

@sumeerbhola sumeerbhola 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 3 of 3 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @jbowens and @RaduBerinde)


table_cache.go line 706 at r1 (raw file):

	// Calling findNode gives us the responsibility of decrementing v's
	// refCount.
	v := rp.c.findNodeInternal(ctx, rp.backingFileNum, rp.dbOpts)

Consider adding a comment that fineNodeInternal can do IO, in order to initialize a Reader, and that we are deliberately holding rp.mu while doing so, in that concurrent calls to GetReader will block until this initialization is done.

An `sstable.ReaderProvider` is necessary whenever an sstable has value
blocks. Currently, we allocate one every time we create a point
iterator.

This commit makes the `tableCacheShardReaderProvider` usable in
parallel and maintains a long-lived instance in the `tableCacheValue`.
Copy link
Member Author

@RaduBerinde RaduBerinde 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: all files reviewed, 1 unresolved discussion (waiting on @jbowens and @sumeerbhola)


table_cache.go line 706 at r1 (raw file):

Previously, sumeerbhola wrote…

Consider adding a comment that fineNodeInternal can do IO, in order to initialize a Reader, and that we are deliberately holding rp.mu while doing so, in that concurrent calls to GetReader will block until this initialization is done.

Done. TFTR!

@RaduBerinde RaduBerinde merged commit 048f275 into cockroachdb:master Nov 12, 2024
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
o-perf-efficiency Related to performance efficiency
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants