Fix addPoint logic when replace_deleted is enabled#541
Open
ozanarmagan wants to merge 1 commit intonmslib:developfrom
Open
Fix addPoint logic when replace_deleted is enabled#541ozanarmagan wants to merge 1 commit intonmslib:developfrom
replace_deleted is enabled#541ozanarmagan wants to merge 1 commit intonmslib:developfrom
Conversation
dyashuni
reviewed
Mar 31, 2024
| } | ||
|
|
||
| std::cout << "Adding update batch" << std::endl; | ||
| for(int row; row < num_elements; row++) { |
Contributor
There was a problem hiding this comment.
need to initialize row in the for loop
int row = 0;
dyashuni
reviewed
Mar 31, 2024
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); | ||
| } |
Contributor
There was a problem hiding this comment.
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?
dyashuni
reviewed
Apr 1, 2024
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); | ||
| } |
Contributor
There was a problem hiding this comment.
Can you add exception if the condition is not true. Like
else {
throw std::runtime_error("Label lookup table is broken");
}
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When adding points with
replace_deletedenabled, 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