-
Notifications
You must be signed in to change notification settings - Fork 659
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
Fix addPoint logic when replace_deleted
is enabled
#541
base: develop
Are you sure you want to change the base?
Conversation
} | ||
|
||
std::cout << "Adding update batch" << std::endl; | ||
for(int row; row < num_elements; row++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to initialize row
in the for loop
int row = 0;
std::cout << "Updating index size" << std::endl; | ||
size_t curr_ele_count = alg_hnsw->getCurrentElementCount(); | ||
if(curr_ele_count + max_elements > alg_hnsw->getMaxElements()) { | ||
alg_hnsw->resizeIndex((curr_ele_count + max_elements) * 1.3); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can remove it because we deleted a first half of the elements and we have enough space in the index to insert new elements.
What do you think about it?
if(label_replaced_lookup != label_lookup_.end() && label_replaced_lookup->second == internal_id_replaced) { | ||
label_lookup_.erase(label_replaced); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add exception if the condition is not true. Like
else {
throw std::runtime_error("Label lookup table is broken");
}
When adding points with
replace_deleted
enabled, currently we don't check:2 .if the label we are going to replace is already re-added to index after deletion
This PR fixes those problems.
cc: @yurymalkov