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

Fix addPoint logic when replace_deleted is enabled #541

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

ozanarmagan
Copy link

When adding points with replace_deleted enabled, currently we don't check:

  1. if the added label is already in the index
    2 .if the label we are going to replace is already re-added to index after deletion

This PR fixes those problems.

cc: @yurymalkov

}

std::cout << "Adding update batch" << std::endl;
for(int row; row < num_elements; row++) {
Copy link
Contributor

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;

Comment on lines +50 to +54
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);
}
Copy link
Contributor

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?

Comment on lines +989 to +991
if(label_replaced_lookup != label_lookup_.end() && label_replaced_lookup->second == internal_id_replaced) {
label_lookup_.erase(label_replaced);
}
Copy link
Contributor

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");
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants