mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-15 09:22:55 +00:00
FileBlockReader::fill_buffer make it obvious that we need to switch to async API
This commit is contained in:
committed by
Arpad Müller
parent
cfabd8b598
commit
92b7d7f466
@@ -154,7 +154,7 @@ impl FileBlockReader<VirtualFile> {
|
||||
}
|
||||
|
||||
/// Read a page from the underlying file into given buffer.
|
||||
fn fill_buffer(&self, buf: &mut [u8], blkno: u32) -> Result<(), std::io::Error> {
|
||||
async fn fill_buffer(&self, buf: &mut [u8], blkno: u32) -> Result<(), std::io::Error> {
|
||||
assert!(buf.len() == PAGE_SZ);
|
||||
self.file.read_exact_at(buf, blkno as u64 * PAGE_SZ as u64)
|
||||
}
|
||||
@@ -178,7 +178,7 @@ impl FileBlockReader<VirtualFile> {
|
||||
ReadBufResult::Found(guard) => break Ok(guard.into()),
|
||||
ReadBufResult::NotFound(mut write_guard) => {
|
||||
// Read the page from disk into the buffer
|
||||
self.fill_buffer(write_guard.deref_mut(), blknum)?;
|
||||
self.fill_buffer(write_guard.deref_mut(), blknum).await?;
|
||||
write_guard.mark_valid();
|
||||
|
||||
// Swap for read lock
|
||||
|
||||
Reference in New Issue
Block a user