Skip to content

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

Merged
idryomov merged 2 commits into
ceph:masterfrom
dx9:wip-12406-test_librdb_fsx
Jan 12, 2016
Merged

idryomov merged 2 commits into
ceph:masterfrom
dx9:wip-12406-test_librdb_fsx

Conversation

@dx9

@dx9 dx9 commented Oct 21, 2015

Copy link
Copy Markdown
Contributor

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

@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
Copy Markdown
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
Copy Markdown
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

dx9 commented Nov 14, 2015

Copy link
Copy Markdown
Contributor Author

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

@idryomov

Copy link
Copy Markdown
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

dx9 commented Nov 15, 2015

Copy link
Copy Markdown
Contributor Author

@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
Comment thread src/test/librbd/fsx.cc Outdated

Copy link
Copy Markdown
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 <[email protected]>
@dx9
dx9 force-pushed the wip-12406-test_librdb_fsx branch from c103fcb to 1df9705 Compare December 9, 2015 00:54
@liewegas

liewegas commented Jan 8, 2016

Copy link
Copy Markdown
Member

@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 <[email protected]>
@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

Development

Successfully merging this pull request may close these issues.

6 participants