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

Flaky test in HNSW index unit test #2550

Closed
1 of 2 tasks
git-hulk opened this issue Sep 21, 2024 · 4 comments · Fixed by #2557
Closed
1 of 2 tasks

Flaky test in HNSW index unit test #2550

git-hulk opened this issue Sep 21, 2024 · 4 comments · Fixed by #2557
Assignees
Labels
bug type bug

Comments

@git-hulk
Copy link
Member

Search before asking

  • I had searched in the issues and found no similar issues.

Version

unstable

Minimal reproduce step

See https://github.com/apache/kvrocks/actions/runs/10971334789/job/30466698610?pr=2538#step:15:173

What did you expect to see?

CI passed

What did you see instead?

CI failure

Anything Else?

No response

Are you willing to submit a PR?

  • I'm willing to submit a PR!
@git-hulk git-hulk added the bug type bug label Sep 21, 2024
@LindaSummer
Copy link
Contributor

Hi @git-hulk ,

I want to follow up this issue. 😊
Can it be assigned to me?

Best Regards,
Edward

@git-hulk
Copy link
Member Author

@LindaSummer Sure, thank you!

@LindaSummer
Copy link
Contributor

LindaSummer commented Sep 26, 2024

Hi @Beihao-Zhou ,

Sorry to bother you.
Please correct me if my analysis is incorrect. 😊

The GitHub Action's log is Layer: 4 Frequency: 458 Expected: 411.52266242457773.
If I understand correctly, this expected value should be $(3{^-4}-3{^-5})*50000=411.5226337448559$.

Since we use a random seed from random_device.

std::random_device rand_dev;
generator = std::mt19937(rand_dev());

We can't reproduce the same generation sequence and in my knowledge the generation result may not be same as expected.

Could I use a fixed rand seed for unit test startup initialization to solve this issue?

I think it will improve the reproducing ability for test cases.

Best Regards,
Edward

@Beihao-Zhou
Copy link
Member

Thanks for looking into the issue! @LindaSummer
Yes sure, I think you can change the interface a bit to pass in the fixed seed. For the current unit tests, I just set a relatively low threshold so that in majority times it can pass even if it's randomized.
Thanks again for fixing it!

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

Successfully merging a pull request may close this issue.

3 participants