Skip to content

Commit 0b34063

Browse files
morningmanclaude
andcommitted
[fix](test) Wait for the meta-store write to land, not just leave the queue
FSFileCacheLeakCleanerTest's add_metadata_entry() waited for the meta store's write queue to drain as its "async write completed" barrier. But the async worker dequeues an operation *before* it issues the rocksdb Put, so an empty queue only proves the write is in flight, not that it is readable. If run_leak_cleanup() runs inside that window, approximate_entry_count() (which iterates rocksdb only, by design) sees zero metadata blocks and skips the cleanup entirely -- remove_orphan_and_tmp_files then finds its orphan and tmp files still on disk. The window is a few statements wide and never fired in per-file CI builds; the unity-batched IO objects shifted thread timing on the ASAN pipeline and hit it on the first round. Poll the store itself (get() reads only rocksdb, the same source approximate_entry_count() counts) instead of the queue size. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Gdfkk7RqgD5e3Uv7bTM3NV
1 parent 0838a27 commit 0b34063

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

be/test/io/cache/fs_file_cache_storage_leak_cleaner_test.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,10 @@ class FSFileCacheLeakCleanerTest : public BlockFileCacheTest {
131131
BlockMetaKey mkey(0, hash, offset);
132132
BlockMeta meta(FileCacheType::NORMAL, 16, 0);
133133
storage._meta_store->put(mkey, meta);
134-
// Wait for async write to complete for test stability
135-
for (int i = 0; i < 100 && storage._meta_store->get_write_queue_size() > 0; ++i) {
134+
// The async worker dequeues an operation before it lands in rocksdb,
135+
// so an empty write queue does not mean the entry is readable yet.
136+
// Poll the store itself: leak-scan decisions count rocksdb contents.
137+
for (int i = 0; i < 100 && !storage._meta_store->get(mkey).has_value(); ++i) {
136138
std::this_thread::sleep_for(std::chrono::milliseconds(50));
137139
}
138140
}

0 commit comments

Comments
 (0)