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
test/librbd/fsx: Use c++11 std::mt19937 generator instead of random_r() #6332
Conversation
Signed-off-by: John Coyle <dx9err@gmail.com>
@liewegas this is another one of the Alpine PRs. I'm not sure if this code requires the (multi-threading safe) random_r or not... |
random_r was added on purpose, to make sure fsx failures can actually be reproduced, see abdb168. IIRC the issue was librados stealing random numbers from fsx, in particular when running with ms_inject_socket_failures enabled. Since of the two it is fsx that cares about reproducible sequences, I went for a private context within fsx. |
@idryomov What do you think about using a boost RNG? |
@dx9 Back then fsx was a C file, but now it's actually a .cc compiled with a C++ compiler, so if it helps your project, I'd fine with boost (c++11 random would be even better). As long you carefully test your change - we only look at fsx when something else had already failed... |
@idryomov cool, I'll look at updating the pr using c++11 random. Thanks for the feedback. I may have some more questions about how to test this properly. |
c9c0848
to
0a6b897
Compare
0a6b897
to
c103fcb
Compare
prterr("setstate_r"); | ||
exit(1); | ||
} | ||
random_generator.seed(seed); | ||
|
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.
Indentation?
…:mt19937 generator instead. Signed-off-by: John Coyle <dx9err@gmail.com>
c103fcb
to
1df9705
Compare
@idryomov ping |
test/librbd/fsx: Use c++11 std::mt19937 generator instead of random_r() Improve portability - random_r() is GNU-specific. Reviewed-by: Ilya Dryomov <idryomov@gmail.com>
Is it possible to use random instead of random_r? random_r is a glibc extension, musl libc doesn't implement it.