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 label deletion from an unordered map - [MOD-6710] #435

Merged
merged 4 commits into from
Feb 28, 2024

Conversation

GuyAv46
Copy link
Collaborator

@GuyAv46 GuyAv46 commented Feb 25, 2024

Describe the changes in the pull request

As stated in the documentation of the unordered map, iterators to an unordered map should be invalidated after reserving memory.

The bug was that we used the iterator we got from find() at the start of the function for deleting the IDs from the index and lastly deleting the label from the map.

Using the iterator returned from the previous lookup might be invalid as we might resize the index while deleting the IDs one by one.

The fix is to use a reference to the ids vector itself in the loop, and finally delete the label from the map using the label and not the iterator.

Mark if applicable

  • This PR introduces API changes
  • This PR introduces serialization changes

@GuyAv46 GuyAv46 added bug Something isn't working backport 0.7 labels Feb 25, 2024
@GuyAv46 GuyAv46 requested a review from alonre24 February 25, 2024 13:23
Copy link

codecov bot commented Feb 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.39%. Comparing base (182b87a) to head (510d39b).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #435      +/-   ##
==========================================
+ Coverage   95.37%   95.39%   +0.02%     
==========================================
  Files          66       66              
  Lines        4151     4148       -3     
==========================================
- Hits         3959     3957       -2     
+ Misses        192      191       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@GuyAv46 GuyAv46 changed the title Fix label deletion from an unordered map Fix label deletion from an unordered map - [MOD-6710] Feb 26, 2024
@GuyAv46 GuyAv46 added this pull request to the merge queue Feb 28, 2024
Merged via the queue into main with commit 0fca479 Feb 28, 2024
15 checks passed
@GuyAv46 GuyAv46 deleted the guyav-fix_deleteVector_hnsw_multi branch February 28, 2024 11:22
Copy link

Backport failed for 0.6, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin 0.6
git worktree add -d .worktree/backport-435-to-0.6 origin/0.6
cd .worktree/backport-435-to-0.6
git switch --create backport-435-to-0.6
git cherry-pick -x 6224f61a0ee38a4df5aa012bc9b15af425242335 3cb3b88d4066c8fa41cf8e45c8f27841c16c2c69 2cc216685db31538404ab91f6fd4da94cf475f13 510d39b8da5abd09dfcb90909e0fc0d891893474

Copy link

Successfully created backport PR for 0.7:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 0.6 backport 0.7 bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants