From e8019ee3b91c837a32d83a49ba72904691a956bb Mon Sep 17 00:00:00 2001 From: overtrue <1472352+overtrue@users.noreply.github.com> Date: Wed, 2 Dec 2026 07:10:00 +0800 Subject: [PATCH] fix(ecstore): bound readahead on cold shard window reads --- crates/ecstore/src/disk/local.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/ecstore/src/disk/local.rs b/crates/ecstore/src/disk/local.rs index e7732515ff..26c1781039 100644 --- a/crates/ecstore/src/disk/local.rs +++ b/crates/ecstore/src/disk/local.rs @@ -15274,11 +15274,12 @@ async fn batch_shard_pread_blocking(requests: Vec) - metrics.as_deref(), LocalBatchReadStage::Read, || { - // Preload the requested window before reading it. Kernel - // readahead is advisory and may still extend past the - // window, so the tail is reclaimed after the read below. + // Preload just this window. Disable automatic readahead + // on this descriptor so pread does not start a second + // read past the window while the explicit hint is in flight. #[cfg(target_os = "linux")] if let (Ok(start), Ok(len)) = (u64::try_from(offset), u64::try_from(length)) { + let _ = rustix::fs::fadvise(&file, 0, None, rustix::fs::Advice::Random); let _ = rustix::fs::fadvise( &file, start,