Skip to content

Commit

Permalink
Fix test failure
Browse files Browse the repository at this point in the history
  • Loading branch information
sanketkedia committed Dec 5, 2024
1 parent 57b037a commit 4223b54
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions rust/index/src/spann/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1674,22 +1674,32 @@ mod tests {
{
// Posting list should have 100 points.
let pl_read_guard = writer.posting_list_writer.lock().await;
let pl = pl_read_guard
let pl1 = pl_read_guard
.get_owned::<u32, &SpannPostingList<'_>>("", emb_1_id)
.await
.expect("Error getting posting list")
.unwrap();
assert_eq!(pl.0.len(), 100);
assert_eq!(pl.1.len(), 100);
assert_eq!(pl.2.len(), 200);
let pl = pl_read_guard
let pl2 = pl_read_guard
.get_owned::<u32, &SpannPostingList<'_>>("", emb_2_id)
.await
.expect("Error getting posting list")
.unwrap();
assert_eq!(pl.0.len(), 1);
assert_eq!(pl.1.len(), 1);
assert_eq!(pl.2.len(), 2);
// Only two combinations possible.
if pl1.0.len() == 100 {
assert_eq!(pl1.1.len(), 100);
assert_eq!(pl1.2.len(), 200);
assert_eq!(pl2.0.len(), 1);
assert_eq!(pl2.1.len(), 1);
assert_eq!(pl2.2.len(), 2);
} else if pl2.0.len() == 100 {
assert_eq!(pl2.1.len(), 100);
assert_eq!(pl2.2.len(), 200);
assert_eq!(pl1.0.len(), 1);
assert_eq!(pl1.1.len(), 1);
assert_eq!(pl1.2.len(), 2);
} else {
panic!("Invalid posting list lengths");
}
}
// Next insert 99 points in the region of (1000.0, 1000.0)
for i in 102..=200 {
Expand Down Expand Up @@ -2029,7 +2039,7 @@ mod tests {
version_map_guard.versions_map.insert(100 + point as u32, 1);
}
}
// Delete 60 points each from the centers. Since merge_threshold is 40, this should
// Delete 60 points each from the centers. Since merge_threshold is 50, this should
// trigger a merge between the two centers.
for point in 1..=60 {
writer
Expand Down

0 comments on commit 4223b54

Please sign in to comment.