Skip to content

Commit

Permalink
[BUG] Use len_with_deleted instead of len (#3431)
Browse files Browse the repository at this point in the history
## 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.
  • Loading branch information
eculver authored Jan 8, 2025
1 parent 818bb3d commit 75aeb81
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion rust/worker/src/segment/distributed_hnsw_segment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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| {
Expand Down

0 comments on commit 75aeb81

Please sign in to comment.