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

test/librbd/fsx: Use c++11 std::mt19937 generator instead of random_r() #6332

Merged
merged 2 commits into from Jan 12, 2016

Conversation

dx9
Copy link
Contributor

@dx9 dx9 commented Oct 21, 2015

Is it possible to use random instead of random_r? random_r is a glibc extension, musl libc doesn't implement it.

Signed-off-by: John Coyle <dx9err@gmail.com>
@dx9 dx9 changed the title test/librbd/fsx: use random instead random_r test/librbd/fsx: use random instead of random_r Oct 21, 2015
@gregsfortytwo
Copy link
Member

@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...

@ghost ghost added cleanup tests labels Oct 28, 2015
@idryomov
Copy link
Contributor

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.

@dx9
Copy link
Contributor Author

dx9 commented Nov 14, 2015

@idryomov What do you think about using a boost RNG?

@idryomov
Copy link
Contributor

@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...

@dx9
Copy link
Contributor Author

dx9 commented Nov 15, 2015

@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.

@dx9 dx9 force-pushed the wip-12406-test_librdb_fsx branch from c9c0848 to 0a6b897 Compare December 8, 2015 16:03
@dx9 dx9 changed the title test/librbd/fsx: use random instead of random_r test/librbd/fsx: musl libc doesn't implement random_r. Use c++11 std::mt19937 generator instead. Dec 8, 2015
@dx9 dx9 force-pushed the wip-12406-test_librdb_fsx branch from 0a6b897 to c103fcb Compare December 8, 2015 17:44
prterr("setstate_r");
exit(1);
}
random_generator.seed(seed);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation?

@idryomov idryomov self-assigned this Dec 8, 2015
…:mt19937 generator instead.

Signed-off-by: John Coyle <dx9err@gmail.com>
@dx9 dx9 force-pushed the wip-12406-test_librdb_fsx branch from c103fcb to 1df9705 Compare December 9, 2015 00:54
@liewegas
Copy link
Member

liewegas commented Jan 8, 2016

@idryomov ping

@jdurgin jdurgin added the rbd label Jan 8, 2016
idryomov added a commit that referenced this pull request Jan 12, 2016
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>
@idryomov idryomov merged commit e5e1c44 into ceph:master Jan 12, 2016
@ghost ghost changed the title test/librbd/fsx: musl libc doesn't implement random_r. Use c++11 std::mt19937 generator instead. test/librbd/fsx: Use c++11 std::mt19937 generator instead of random_r() Feb 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants