Skip to content

Commit 1492527

Browse files
author
apoorvsharma
committed
Modify hnsw update logic to unmark the deleted element
1 parent 2f55fe4 commit 1492527

File tree

2 files changed

+5
-45
lines changed

2 files changed

+5
-45
lines changed

TESTS.md

Lines changed: 0 additions & 44 deletions
This file was deleted.

hnswlib/hnswalg.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -987,11 +987,15 @@ namespace hnswlib {
987987
auto search = label_lookup_.find(label);
988988
if (search != label_lookup_.end()) {
989989
tableint existingInternalId = search->second;
990-
991990
templock_curr.unlock();
992991

993992
std::unique_lock <std::mutex> lock_el_update(link_list_update_locks_[(existingInternalId & (max_update_element_locks - 1))]);
993+
994+
if (isMarkedDeleted(existingInternalId)) {
995+
unmarkDeletedInternal(existingInternalId);
996+
}
994997
updatePoint(data_point, existingInternalId, 1.0);
998+
995999
return existingInternalId;
9961000
}
9971001

0 commit comments

Comments
 (0)