From 75aeb811a638e8b4b5d518955a9b701311817410 Mon Sep 17 00:00:00 2001 From: Evan Culver Date: Tue, 7 Jan 2025 17:13:48 -0800 Subject: [PATCH] [BUG] Use len_with_deleted instead of len (#3431) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description of changes This is a follow-up from #3424 - where I had added code to fix the bug in compaction but then forgot to replace the method at the actual callsite with the new method 🤦🏼 . This updates the problem code to use `len_with_deleted` instead of just `len` so that the resize actually gets triggered. Some additional context: we decided not to change the behavior of the existing `len` method in case other callers were depending on existing behavior. In other words, we didn't want to introduce accidentally introduce bugs that were relying on the "buggy" code. --- rust/worker/src/segment/distributed_hnsw_segment.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust/worker/src/segment/distributed_hnsw_segment.rs b/rust/worker/src/segment/distributed_hnsw_segment.rs index fc827209093..d31d9e8f211 100644 --- a/rust/worker/src/segment/distributed_hnsw_segment.rs +++ b/rust/worker/src/segment/distributed_hnsw_segment.rs @@ -210,7 +210,7 @@ impl DistributedHNSWSegmentWriter { let embedding = record.merged_embeddings_ref(); let mut index = self.index.inner.upgradable_read(); - let index_len = index.len(); + let index_len = index.len_with_deleted(); let index_capacity = index.capacity(); if index_len + 1 > index_capacity { index.with_upgraded(|index| {