Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Explain why RandomAccessFileReader* is not passed into FilePrefetchBu…
…ffer constructor (#13159) 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` - https://github.com/facebook/rocksdb/blob/main/db/compaction/compaction_iterator.cc - https://github.com/facebook/rocksdb/blob/main/db/merge_helper.cc 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. Pull Request resolved: #13159 Test Plan: N/A (comments) Reviewed By: anand1976 Differential Revision: D66473731 Pulled By: archang19 fbshipit-source-id: ce3473694c2cd82513da1a76ad5995afa5bc9cfa
- Loading branch information