Move append_vec buffered reader overflow handling to a struct#7058
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #7058 +/- ##
=======================================
Coverage 83.2% 83.2%
=======================================
Files 853 853
Lines 374799 374882 +83
=======================================
+ Hits 311897 311982 +85
+ Misses 62902 62900 -2 🚀 New features to boost your workflow:
|
Are these code paths missing test coverage?
|
brooksprumo
left a comment
There was a problem hiding this comment.
Looking good. I still plan to do another pass.
Also, what's the plan/next steps for this code? Are there further refactorings coming?
|
We are getting close to the target shape. I know I've been going back and forth with this code and traits, but it's probably an easier to understand way than dumping both refactor and functional changes into a single PR.
Right, those code-paths are not used in prod and are there mostly for satisfying trait inheritance, but they should be correct - I added a test that mixes all 3 kinds of access patterns (Read, BufRead and RequiredLenBufRead), though I'm not sure how to access a new coverage report with the new changes... |
|
And the further work will be to implement FileBufRead using io_uring multi-file read-ahead reader (needs rebase and updates, but the basic functionality is already in #6878), which paired with BufReaderWithOverflow can be used for scanning full accounts storage data with background IO. |
brooksprumo
left a comment
There was a problem hiding this comment.
![]()
@kskalski went over the PR with me on zoom. Thanks!
Problem
Ownership, handling and capacity management of overflow buffer for filling contiguous account data during full accounts-db scan is interleaved between buffered_reader and append_vec modules.
This:
scan_accounts_stored_metaSummary of Changes
BufReaderWithOverflowis added that encapsulates the dynamically allocated overflow buffer with capacity limitsfill_buf_required_or_overflowfunction is removed andContiguousBufFileReadtrait is renamed toRequiredLenBufReadFileBufReadtrait is separated fromContiguousBufFileReadto independently provide file offset tracking (this is also going to support multi-file navigation needed to share buffer across files)BufReaderWithOverflowandBufferedReader'sReadimpl, which fills provided buffer with existing valid bytes + read directly from file into provided buf