From d8c73f543cdb1a131291913b770134db340a96e6 Mon Sep 17 00:00:00 2001 From: Tanuj Nayak Date: Tue, 2 Dec 2025 16:37:51 -0800 Subject: [PATCH] [BUG]: Prevent hnsw cleanup if use_direct_hnsw is true --- rust/index/src/hnsw_provider.rs | 2 +- rust/worker/src/execution/orchestration/compact.rs | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/rust/index/src/hnsw_provider.rs b/rust/index/src/hnsw_provider.rs index ff6344d8976..32aa0fe2687 100644 --- a/rust/index/src/hnsw_provider.rs +++ b/rust/index/src/hnsw_provider.rs @@ -60,7 +60,7 @@ pub struct HnswIndexProvider { // TODO(tanujnay112): This feature flag is a temporary measure to gate // the hnsw loading from memory feature. Remove this after that feature // stabilizes. - use_direct_hnsw: bool, + pub use_direct_hnsw: bool, } pub struct HnswIndexFlusher { diff --git a/rust/worker/src/execution/orchestration/compact.rs b/rust/worker/src/execution/orchestration/compact.rs index ee99fc7b626..b1d498248e9 100644 --- a/rust/worker/src/execution/orchestration/compact.rs +++ b/rust/worker/src/execution/orchestration/compact.rs @@ -834,6 +834,11 @@ impl CompactionContext { } pub(crate) async fn cleanup(self) { + if self.hnsw_provider.use_direct_hnsw { + return; + } + + // TODO(tanujnay112): Remove when use_direct_hnsw is fully deprecated for hnsw_index_uuid in self.hnsw_index_uuids { let _ = HnswIndexProvider::purge_one_id( self.hnsw_provider.temporary_storage_path.as_path(),