Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prefetch buffer may not contain all of requested data if EOF is hit (#…
…13376) Summary: There was a stress test that failed at the assertion check for `IsDataBlockInBuffer`. `IsDataBlockInBuffer` is too strict of a condition if we are trying to read past the end of the file. This seems to be a bug from the original 2019 commit siying@3737d06: https://github.com/siying/rocksdb/blob/4eb51130917c260f5637731cd77baaa45dfdc5ec/file/file_prefetch_buffer.cc#L130 If the caller tries requesting more bytes than are available, then we still return `n` bytes, even if the buffer really only contains `m < n` bytes. Pull Request resolved: #13376 Test Plan: I added a unit test which caused the original `IsDataBlockInBuffer ` assertion to fail. I also updated the unit test to check for the result size, which triggered the bug (without this fix) where we return a size of `n` even if less than `n` bytes exist. Reviewed By: anand1976 Differential Revision: D69269608 Pulled By: archang19 fbshipit-source-id: 1dc0d5930e2b73089850f6e996afbd6192cd5ac8
- Loading branch information