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

ef_ race condition #64

Open
SeanU opened this issue Oct 11, 2018 · 2 comments
Open

ef_ race condition #64

SeanU opened this issue Oct 11, 2018 · 2 comments

Comments

@SeanU
Copy link

SeanU commented Oct 11, 2018

There seems to be a race condition around the ef_ search parameter. If I've got two threads running searches concurrently, it's possible that thread A could try to set it to one value, and then have thread B change it to something else before it is able to execute the search.

I'd like to resolve it by adding an ef parameter to searchKnn:

std::priority_queue<std::pair<dist_t, labeltype >> searchKnn(void *query_data, size_t k, size_t ef);

and then adding an overload that has the current signature, and just passes the current value of ef_ in. This would mostly preserve the current behavior for existing code, while adding the option to override that setting for individual searches.

There would be some minor behavior change as a result of reducing the size of the window for that race condition. I assume that would be acceptable?

@yurymalkov
Copy link
Member

@SeanU, thank you for the suggestion!
Sounds great. Can you make a pool request?

@SeanU
Copy link
Author

SeanU commented Oct 12, 2018

Yeah, absolutely. I’ll try to get it done this weekend.

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

No branches or pull requests

2 participants