Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support in-place update operation for hnsw #196

Merged
merged 1 commit into from
Dec 26, 2024

Conversation

ShawnShawnYou
Copy link
Collaborator

@ShawnShawnYou ShawnShawnYou commented Dec 9, 2024

@@ -637,6 +637,90 @@ TEST_CASE("remove vectors from the index", "[ft][index]") {
}
}

TEST_CASE("update vectors from the index", "[ft][index]") {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add thread-safe testing for hnsw

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@ShawnShawnYou ShawnShawnYou force-pushed the support-update-fresh-hnsw branch 2 times, most recently from 7b2ac3e to 9bce756 Compare December 23, 2024 07:28
Copy link
Collaborator

@inabao inabao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

tests/test_index_old.cpp Outdated Show resolved Hide resolved
include/vsag/index.h Show resolved Hide resolved
tests/test_multi_thread.cpp Show resolved Hide resolved
include/vsag/index.h Show resolved Hide resolved
src/algorithm/hnswlib/hnswalg.cpp Show resolved Hide resolved
src/algorithm/hnswlib/hnswalg.cpp Show resolved Hide resolved
include/vsag/index.h Show resolved Hide resolved
if (iter == label_lookup_.end()) {
throw std::runtime_error("no label in HNSW");
} else {
internal_id = iter->second;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merge internal_id define to here
InnerIdType internal_id = iter->second;

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

src/algorithm/hnswlib/hnswalg.cpp Show resolved Hide resolved
std::unique_lock<std::mutex> lock(global_);
auto iter = label_lookup_.find(label);
if (iter == label_lookup_.end()) {
throw std::runtime_error("no label in HNSW");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: add the label id content to error message ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

}

try {
std::unique_lock lock(rw_mutex_);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the lock is not necessary ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

src/index/hnsw.cpp Show resolved Hide resolved
@ShawnShawnYou ShawnShawnYou force-pushed the support-update-fresh-hnsw branch from 9bce756 to 5bc7f48 Compare December 24, 2024 07:55
@ShawnShawnYou ShawnShawnYou force-pushed the support-update-fresh-hnsw branch from b67a25d to 7b01e1f Compare December 24, 2024 09:53
Copy link
Collaborator

@jiaweizone jiaweizone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Signed-off-by: zhongxiaoyao.zxy <[email protected]>
@ShawnShawnYou ShawnShawnYou force-pushed the support-update-fresh-hnsw branch from 7b01e1f to c81a417 Compare December 25, 2024 06:52
Copy link
Collaborator

@LHT129 LHT129 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ShawnShawnYou ShawnShawnYou merged commit 2705ccb into main Dec 26, 2024
8 checks passed
@ShawnShawnYou ShawnShawnYou deleted the support-update-fresh-hnsw branch December 26, 2024 02:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants