-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add patch to fix segfault in nmslib during ingestion
Signed-off-by: John Mazanec <[email protected]>
- Loading branch information
1 parent
bfcf7dc
commit 9b66eb1
Showing
5 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
jni/patches/nmslib/0001-Initialize-maxlevel-during-add-from-enterpoint-level.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
From aa1ca485c0ab8b79dae1fb5c1567149c5f61b533 Mon Sep 17 00:00:00 2001 | ||
From: John Mazanec <[email protected]> | ||
Date: Thu, 14 Mar 2024 12:22:06 -0700 | ||
Subject: [PATCH] Initialize maxlevel during add from enterpoint->level | ||
|
||
Signed-off-by: John Mazanec <[email protected]> | ||
--- | ||
similarity_search/src/method/hnsw.cc | 6 +++++- | ||
1 file changed, 5 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/similarity_search/src/method/hnsw.cc b/similarity_search/src/method/hnsw.cc | ||
index 35b372c..e9a725e 100644 | ||
--- a/similarity_search/src/method/hnsw.cc | ||
+++ b/similarity_search/src/method/hnsw.cc | ||
@@ -542,8 +542,12 @@ namespace similarity { | ||
|
||
NewElement->init(curlevel, maxM_, maxM0_); | ||
|
||
- int maxlevelcopy = maxlevel_; | ||
+ // Get the enterpoint at this moment and then use it to set the | ||
+ // max level that is used. Copying maxlevel from this->maxlevel_ | ||
+ // can lead to race conditions during concurrent insertion. See: | ||
+ // https://github.com/nmslib/nmslib/issues/544 | ||
HnswNode *ep = enterpoint_; | ||
+ int maxlevelcopy = ep->level; | ||
if (curlevel < maxlevelcopy) { | ||
const Object *currObj = ep->getData(); | ||
|
||
-- | ||
2.39.3 (Apple Git-146) | ||
|