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
libradosstriper: conditional compile #18197
libradosstriper: conditional compile #18197
Conversation
@chardan could you offer more context in the commit message, w.r.t. why we shall disable libradosstriper by default? |
CMakeLists.txt
Outdated
@@ -614,3 +614,6 @@ add_tags(ctags | |||
EXCLUDE_OPTS ${CTAG_EXCLUDES} | |||
EXCLUDES "*.js" "*.css") | |||
add_custom_target(tags DEPENDS ctags) | |||
|
|||
option(WITH_LIBRADOSSTRIPER "Build with libradosstriper support." OFF) |
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.
Wouldn't this change the current upstream behavior?
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.
Yes-- looks like I thought the opposite of what we actually want-- fixed.
src/tools/CMakeLists.txt
Outdated
@@ -104,3 +111,5 @@ if(WITH_RBD) | |||
add_subdirectory(rbd_ggate) | |||
endif() | |||
endif(WITH_RBD) | |||
|
|||
|
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.
Adding gratuitous whitespace at end of file?
src/tools/rados/rados.cc
Outdated
@@ -3661,8 +3925,10 @@ int main(int argc, const char **argv) | |||
opts["target_locator"] = val; | |||
} else if (ceph_argparse_witharg(args, i, &val, "--target-nspace" , (char *)NULL)) { | |||
opts["target_nspace"] = val; | |||
#ifdef USE_LIBRADSSTRIPER |
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.
typo? Should it be #ifdef WITH_LIBRADOSSTRIPER
here?
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.
Good catch, thank you!
866f42c
to
91b70da
Compare
@smithfarm Thanks for your comments! Updated. |
323c860
to
cb83566
Compare
I'll point out a little implementation oddity, which is that there are some nested conditionals. This is technically redundant, but I'm ok leaving them there unless there are objections. (This is an ugly thing to do, I'm ok with it having an ugly, attention-getting implementation. Another, neater way to go about this is with the detail idiom, but I'd rather give all of the code TLC if we go that route.) |
@@ -2405,11 +2653,17 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts, | |||
string oid(nargs[1]); | |||
map<std::string, bufferlist> attrset; | |||
bufferlist bl; | |||
|
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.
@chardan i'd suggest use following pattern to avoid repeating.
#ifdef WITH_LIBRADOSSTRIPER
if (use_striper) {
ret = striper.getxattrs(oid, attrset);
} else
#endif
{
ret = io_ctx.getxattrs(oid, attrset);
}
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.
I considered that, but it risks introducing subtly different behavior in that the current implementation has both the presence of a striper object /and/ a runtime flag. That said, the flag will always be set to true if creating the striper succeeds. I'd rather see all the plumbing in here get reworked...
src/tools/rados/rados.cc
Outdated
@@ -373,6 +428,69 @@ static int do_copy_pool(Rados& rados, const char *src_pool, const char *target_p | |||
return 0; | |||
} | |||
|
|||
#ifndef USE_LIBIRADOSSTRIPER |
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.
where is USE_LIBIRADOSSTRIPER
defined?
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.
It is not, that's at typo. Good catch, thank you!
src/tools/CMakeLists.txt
Outdated
@@ -9,6 +9,11 @@ add_executable(rados ${rados_srcs}) | |||
target_link_libraries(rados librados global ${BLKID_LIBRARIES} ${CMAKE_DL_LIBS} radosstriper) | |||
install(TARGETS rados DESTINATION bin) | |||
|
|||
if(WITH_LIBRADOSSTRIPER) |
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.
could you avoid adding options to the command line, but instead define this in src/include/config-h.in.cmake
?
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.
I'm not completely clear on how cmakedefine works. If I opt for that, are all of those variables still things that can be changed from the command-line/do_cmake?
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.
(I will RTFM in the meantime.) It /looks/ like this isn't quite what we want. That lets you change the behavior by editing that file, but we want to be able to do it from the command-line via do_cmake.
@smithfarm Is that right? Would it be equally satisfactory to make this something we change in config-h.in.cmake?
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.
@tchaikov The idea was that we could control striper on/off from a %bcond
switch in the spec file.
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.
@chardan git grep -w WITH_BLKIN
for an example.
4b30d24
to
121ec3c
Compare
880788a
to
9aa4e32
Compare
@smithfarm / @tchaikov Okay, I think this should work! Please have a look. |
@chardan Please rebase? |
@chardan Also, please change the title of the 3rd commit to something other than ("compile fix"). There are some basic guidelines at https://github.com/ceph/ceph/blob/master/SubmittingPatches.rst#title-of-pull-requests-and-title-of-commits |
9aa4e32
to
32e56d7
Compare
Jenkins retest this please. |
32e56d7
to
5c00321
Compare
@@ -389,6 +389,13 @@ if(WITH_DPDK) | |||
endif() | |||
endif() | |||
|
|||
option(WITH_LIBRADOSSTRIPER "Build with libradosstriper support." ON) | |||
if(WITH_LIBRADOSSTRIPER) | |||
message(STATUS "Enabling libradosstriper in \"rados\" tool.") |
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.
@chardan Could you add "support" after "libradosstriper" in this line?
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.
I sure can!
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.
This doesn’t appear to have happened.
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.
Ah, now I see :-) @chardan Please add the word "support" as requested above
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.
Yeah, the threading display on my review is a bit weird.
I’m indifferent to the wording but noticed it was discussed and not done. :)
@@ -336,4 +335,7 @@ | |||
/* Defined if boost::context is available */ | |||
#cmakedefine HAVE_BOOST_CONTEXT | |||
|
|||
/* Define if libradosstriper is enabled: */ |
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.
@chardan change "Define" to "Defined" here?
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.
The style in the file isn't entirely consistent-- but I'll go with "defined".
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.
This doesn’t appear to have happened.
@@ -302,11 +350,17 @@ static int do_get(IoCtx& io_ctx, RadosStriper& striper, | |||
int ret; | |||
while (true) { | |||
bufferlist outdata; | |||
|
|||
#ifndef WITH_LIBRADOSSTRIPER | |||
ret = io_ctx.read(oid, outdata, op_size, offset); |
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.
@chardan since this is inside the #else // WITH_LIBRADOSSTRIPER
, the #ifndef WITH_LIBRADOSSTRIPER
will never be true and the preprocessor will always remove it, right?
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.
True, please refer to my note:
#18197 (comment)
I can remove them if you feel strongly about it (I agree it is gnarly and potentially confusing).
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.
I don’t understand this even after reading that note. This is a separate striper-aware compilation path; why would we add an implementation that doesn’t contain the striper?
removed my testing label because this cannot be tested at the same time as #19122 |
f512cb9
to
9281cfb
Compare
@tchaikov How is this looking to you? |
Signed-off-by: Jesse Williamson <jwilliamson@suse.de>
016252c
to
6b2aaef
Compare
… features Signed-off-by: Jesse Williamson <jwilliamson@suse.de>
Enable downstreams (such as SLE) to not ship libradosstriper. Fixes: https://tracker.ceph.com/issues/22750 Signed-off-by: Nathan Cutler <ncutler@suse.com>
Signed-off-by: Jesse Williamson <jwilliamson@suse.de>
Jenkins retest this please. |
http://pulpito.ceph.com/smithfarm-2018-02-21_22:45:50-rados-wip-smithfarm-testing-distro-basic-smithi/ Summary: rados suite passes with one failure in rados/standalone/scrub.yaml - not clear to me why this is failing |
@gregsfortytwo This has passed a rados suite (with one failure - see the previous comment). Can you review? |
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.
So, I guess this works. But I note two problems:
- it appears that users who attempt to invoke the striper when it has been disabled do not get an error message (because it still parses the flag), but merely a silent different behavior.
- we’ve duplicated all our IO function implementations. We’re going to get bugs as they diverge.
To avoid that, I’d suggest doing something like what we do with tcmalloc functionality. Add in a stub striper interface implementation that errors out whenever invoked, and if the striper is compiled out we construct one of those stub failure objects instead. Then in rados.cc we can (depending on implementation choices) either rely on that stub to inform the user they’ve messed up, or else bail out when they specify the striper and actually throw an assertion failure in the stub,
@@ -302,11 +350,17 @@ static int do_get(IoCtx& io_ctx, RadosStriper& striper, | |||
int ret; | |||
while (true) { | |||
bufferlist outdata; | |||
|
|||
#ifndef WITH_LIBRADOSSTRIPER | |||
ret = io_ctx.read(oid, outdata, op_size, offset); |
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.
I don’t understand this even after reading that note. This is a separate striper-aware compilation path; why would we add an implementation that doesn’t contain the striper?
@@ -389,6 +389,13 @@ if(WITH_DPDK) | |||
endif() | |||
endif() | |||
|
|||
option(WITH_LIBRADOSSTRIPER "Build with libradosstriper support." ON) | |||
if(WITH_LIBRADOSSTRIPER) | |||
message(STATUS "Enabling libradosstriper in \"rados\" tool.") |
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.
This doesn’t appear to have happened.
@@ -336,4 +335,7 @@ | |||
/* Defined if boost::context is available */ | |||
#cmakedefine HAVE_BOOST_CONTEXT | |||
|
|||
/* Define if libradosstriper is enabled: */ |
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.
This doesn’t appear to have happened.
@gregsfortytwo Regarding the status message in CMakeLists.txt, what do you mean by "This doesn't appear to have happened"? I see the status message in the build log:
|
Hi Greg, thanks for the useful feedback! I entirely agree that a stub implementation would be much tidier-- that's what I was suggesting in my note with "detail" implementations. I'm happy to do that, and while I'm at it have a look at some of the surrounding code. In any case, there's now officially enough confusion from the direction taken that it seems best to change it-- I'll look into this further next week. Thanks! |
Let's try this again. |
This PR affects the "rados" tool:
Please note that this PR is not meant to affect whether libradosstriper itself is built or linked, it is limited to governing the exposed features in the tool.
Fixes: https://tracker.ceph.com/issues/22750