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

Explain why RandomAccessFileReader* is not passed into FilePrefetchBuffer constructor #13159

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

archang19
Copy link
Contributor

Summary

In #13118 (comment), we decided to make a separate follow-up PR that refactors FilePrefetchBuffer to determine use_fs_buffer once at construction time.

The change would have involved passing in the RandomAccessFileReader* directly to the constructor, and using that to determine use_fs_buffer. This would avoid repeatedly calling UseFSBuffer(RandomAccessFileReader* reader) during the actual prefetch requests.

I started working on this refactoring change but ran into issues with these 2 files, which used GetOrCreatePrefetchBuffer

As I explained in the added code comments, sometimes the RandomAccessFileReader* is not available when we construct the FilePrefetchBuffer, so although it is not the most elegant, I think right now it makes sense to pass in the reader into the Prefetch / PrefetchAsync / TryReadFromCache calls. Maybe there is a workaround but I don't think the refactor would be worth it.

Test Plan

N/A (comments)

@archang19 archang19 changed the title Explain why RandomAccessFileReader* is not passed directly into constructor Explain why RandomAccessFileReader* is not passed into FilePrefetchBuffer constructor Nov 25, 2024
@facebook-github-bot
Copy link
Contributor

@archang19 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@archang19 archang19 marked this pull request as ready for review November 25, 2024 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants