From 7c3cc770829d4219122618b8482a928bea3a49d6 Mon Sep 17 00:00:00 2001 From: Aditya Mukhopadhyay Date: Thu, 8 Oct 2026 10:22:53 +0530 Subject: [PATCH] ci(bench): fsync the copied file fixture before measuring (#426) (#481) populate_file copies a prebuilt fixture (#393) but never synced the copy, so its dirty pages were still being written back while insert_file measured. Every WAL fsync waited on that writeback: the 1m copy made insert_file/*/1m 3-10x slower on about half the nightly runs since 2026-09-27, with 100k and smaller unaffected. Not a library regression: 84bf375 -> ab65350 changed no src/ file. Refs #426 Claude-Session: https://claude.ai/code/session_015GgLEs8YozJjYhwPEYgTUn Co-authored-by: Claude Opus 5.5 --- benches/helpers/mod.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/benches/helpers/mod.rs b/benches/helpers/mod.rs index 44bccf0ef..918b115ba 100644 --- a/benches/helpers/mod.rs +++ b/benches/helpers/mod.rs @@ -28,6 +28,11 @@ pub fn populate_in_memory(n: usize) -> Arc { /// so building the file each time rebuilt 1m facts ~11 times per benchmark and /// ran `insert_file` for hours (#393). The file for each `n` is built once and /// copied to `path`; every caller still gets a fresh, identical file. +/// +/// The copy is fsynced before returning. Otherwise its dirty pages are still +/// being written back while the benchmark runs, and every WAL fsync waits on +/// that writeback: the 1m copy made `insert_file/*/1m` 3-10x slower on about +/// half the nightly runs (#426). pub fn populate_file(n: usize, path: &str) { let mut fixtures = FILE_FIXTURES.lock().unwrap(); let fixtures = fixtures.get_or_insert_with(|| FileFixtures { @@ -47,6 +52,7 @@ pub fn populate_file(n: usize, path: &str) { template }); std::fs::copy(template, path).unwrap(); + std::fs::File::open(path).unwrap().sync_all().unwrap(); } /// Delete the files built by [`populate_file`]. Statics are not dropped at