-
Notifications
You must be signed in to change notification settings - Fork 472
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(test): use fixed seed to improve reproducibility. #2557
Conversation
src/search/hnsw_indexer.h
Outdated
HnswIndex(const SearchKey& search_key, HnswVectorFieldMetadata* vector, engine::Storage* storage, | ||
std::random_device::result_type seed); | ||
HnswIndex(const SearchKey& search_key, HnswVectorFieldMetadata* vector, engine::Storage* storage) | ||
: HnswIndex(search_key, vector, storage, std::random_device()()) {} |
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.
Maybe we can use a single constructor with a default argument?
HnswIndex(const SearchKey& search_key,
HnswVectorFieldMetadata* vector,
engine::Storage* storage,
std::random_device::result_type seed = std::random_device()())
{
...
}
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.
Hi @Beihao-Zhou ,
Thanks for your review suggestions!
I have updated related constructors. 😊
Best Regards,
Edward
The rest LGTM :) |
Quality Gate failedFailed conditions |
Issue
Fix: #2550
Unit test's random generation may make result unstable to expected result.
Proposed Changes
Use fixed seed for hnsw index unit test for improving reproducibility.