Skip to content

Commit 700abfa

Browse files
authored
[BUG]: spann flusher should flush the cleaned up hnsw if applicable (#5984)
## Description of changes _Summarize the changes made by this PR._ - Improvements & Bug fixes - There was a bug with direct_hnsw wherein it was always passing the non cleaned up hnsw index to the flusher. Fixes it by passing the right index - New functionality - ... ## Test plan _How are these changes tested?_ - [x] Tests pass locally with `pytest` for python, `yarn test` for js, `cargo test` for rust ## Migration plan None ## Observability plan None ## Documentation Changes None
1 parent c9b3b56 commit 700abfa

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

rust/index/src/spann/types.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2380,7 +2380,7 @@ impl SpannIndexWriter {
23802380
tracing::info!("Committed max head id");
23812381

23822382
// Hnsw.
2383-
let (hnsw_id, prefix_path) = {
2383+
let (hnsw_id, prefix_path, hnsw_index) = {
23842384
let stopwatch = Stopwatch::new(
23852385
&self.metrics.hnsw_commit_latency,
23862386
&[],
@@ -2403,15 +2403,15 @@ impl SpannIndexWriter {
24032403
(id, prefix_path, self.hnsw_index.clone())
24042404
}
24052405
};
2406-
self.hnsw_provider.commit(hnsw_index).map_err(|e| {
2406+
self.hnsw_provider.commit(hnsw_index.clone()).map_err(|e| {
24072407
tracing::error!("Error committing hnsw index: {}", e);
24082408
SpannIndexWriterError::HnswIndexCommitError(e)
24092409
})?;
24102410
tracing::info!(
24112411
"Committed hnsw index in {} ms",
24122412
stopwatch.elapsed_micros() / 1000
24132413
);
2414-
(hnsw_id, prefix_path)
2414+
(hnsw_id, prefix_path, hnsw_index)
24152415
};
24162416

24172417
Ok(SpannIndexFlusher {
@@ -2422,7 +2422,7 @@ impl SpannIndexWriter {
24222422
provider: self.hnsw_provider,
24232423
prefix_path,
24242424
index_id: hnsw_id,
2425-
hnsw_index: self.hnsw_index,
2425+
hnsw_index,
24262426
},
24272427
metrics: SpannIndexFlusherMetrics {
24282428
pl_flush_latency: self.metrics.pl_flush_latency.clone(),

0 commit comments

Comments
 (0)