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

cloudimpl: cache suffix in remote file sst wrapper #59478

Merged
merged 2 commits into from
Jan 29, 2021

Conversation

dt
Copy link
Member

@dt dt commented Jan 27, 2021

Reading SSTs starts with multiple tiny reads in offsets near the end of the file.
If we can read that whole region once and fulfill those reads from a cached buffer,
we can avoid repeated RPCs.

Release note: none.

@dt dt requested review from adityamaru, miretskiy and a team January 27, 2021 15:14
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Contributor

@miretskiy miretskiy 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: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @adityamaru and @dt)


pkg/ccl/storageccl/import.go, line 409 at r1 (raw file):

// readAndCacheSuffix caches the `size` suffix of the file (which could the
// whole file) for use by later ReadAt calls to avoid making additional RPCs.
func (r *sstReader) readAndCacheSuffix(size int64) error {

Should we add a test for that?

Could be as simple as wrapping real sstReader w/ testReader which counts number of ReadAt calls, and then try reading a small sstable...

Release note: none.
Copy link
Member Author

@dt dt 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: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @adityamaru and @miretskiy)


pkg/ccl/storageccl/import.go, line 409 at r1 (raw file):

Previously, miretskiy (Yevgeniy Miretskiy) wrote…

Should we add a test for that?

Could be as simple as wrapping real sstReader w/ testReader which counts number of ReadAt calls, and then try reading a small sstable...

done.

@miretskiy miretskiy self-requested a review January 28, 2021 20:43
Copy link
Contributor

@miretskiy miretskiy left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 2 files at r3.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @adityamaru and @miretskiy)

Reading SSTs starts with multiple tiny reads in offsets near the end of the file.
If we can read that whole region once and fulfill those reads from a cached buffer,
we can avoid repeated RPCs.

Release note: none.
@dt
Copy link
Member Author

dt commented Jan 28, 2021

TFTR!

bors r+

@craig
Copy link
Contributor

craig bot commented Jan 28, 2021

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Jan 29, 2021

Build succeeded:

@craig craig bot merged commit 054c618 into cockroachdb:master Jan 29, 2021
@dt dt deleted the cached-suffix branch February 1, 2021 14:38
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