test/librbd/fsx: Use c++11 std::mt19937 generator instead of random_r()#6332
test/librbd/fsx: Use c++11 std::mt19937 generator instead of random_r()#6332idryomov merged 2 commits intoceph:masterfrom
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
src/test/librbd/fsx.cc
Outdated
…: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.