@@ -3655,3 +3655,26 @@ TYPED_TEST(HNSWTieredIndexTestBasic, deleteBothAsyncAndInplaceMulti) {
36553655 // Id 1 is now ready due to the deletion of 0 and its associated jobs.
36563656 ASSERT_EQ (tiered_index->readySwapJobs , 1 );
36573657}
3658+
3659+ TYPED_TEST (HNSWTieredIndexTestBasic, deleteInplaceMultiSwapId) {
3660+ // Create TieredHNSW index instance with a mock queue.
3661+ size_t dim = 4 ;
3662+ HNSWParams params = {
3663+ .type = TypeParam::get_index_type (), .dim = dim, .metric = VecSimMetric_L2, .multi = true };
3664+ VecSimParams hnsw_params = CreateParams (params);
3665+
3666+ auto mock_thread_pool = tieredIndexMock ();
3667+
3668+ auto *tiered_index = this ->CreateTieredHNSWIndex (hnsw_params, mock_thread_pool);
3669+ auto allocator = tiered_index->getAllocator ();
3670+
3671+ // Insert three vector to HNSW - first and last under the same label.
3672+ GenerateAndAddVector<TEST_DATA_T>(tiered_index->backendIndex , dim, 0 );
3673+ GenerateAndAddVector<TEST_DATA_T>(tiered_index->backendIndex , dim, 1 );
3674+ GenerateAndAddVector<TEST_DATA_T>(tiered_index->backendIndex , dim, 0 );
3675+ tiered_index->setWriteMode (VecSim_WriteInPlace);
3676+ // Delete in-place and validate that the second id of label 0 swapped properly with the last id
3677+ // before the deletion, and that eventually entry point was set correctly,
3678+ ASSERT_EQ (tiered_index->deleteVector (0 ), 2 );
3679+ ASSERT_EQ (tiered_index->getHNSWIndex ()->safeGetEntryPointState ().first , 0 );
3680+ }
0 commit comments