Skip to content

Commit c0064a4

Browse files
committed
Update and fix tiered svs tests
1 parent 9b22fe8 commit c0064a4

File tree

2 files changed

+856
-1255
lines changed

2 files changed

+856
-1255
lines changed

src/VecSim/algorithms/svs/svs_tiered.h

+1-5
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,6 @@ class TieredSVSIndex : public VecSimTieredIndex<DataType, float> {
200200
auto batch_res = new VecSimQueryReply(allocator);
201201
auto [from_svs, from_flat] =
202202
merge_results<false>(batch_res->results, svs_results, flat_results, n_res);
203-
merge_results<false>(batch_res->results, svs_results, flat_results, n_res);
204203

205204
// We're on a single-value index, update the set of results returned from the FLAT index
206205
// before popping them, to prevent them to be returned from the SVS index in later
@@ -536,10 +535,7 @@ class TieredSVSIndex : public VecSimTieredIndex<DataType, float> {
536535
{
537536
std::scoped_lock lock(this->flatIndexGuard, this->mainIndexGuard, this->journal_mutex);
538537
ret = this->frontendIndex->addVector(blob, label);
539-
ret -= svs_index->deleteVectors(&label, 1);
540-
// The case when exists in both indicies (ret = 0-1) should not happen
541-
// elsewhere search queries may return wrong result.
542-
assert(ret >= 0 && "addVector: vector duplication in both indices");
538+
ret = std::max(ret - svs_index->deleteVectors(&label, 1), 0);
543539
journal.emplace_back(label, true);
544540
index_update_needed = this->backendIndex->indexSize() > 0 ||
545541
this->journal.size() >= this->updateJobThreshold;

0 commit comments

Comments
 (0)