Repository navigation
rgw: migrate from boost::variant to std::variant - #63179
Conversation
|
I think replacing boost::variant with std::variant doesn't have a large benefits being claimed. I don't mind doing it, but I somewhat object to the propaganda |
mattbenjamin
left a comment
There was a problem hiding this comment.
please restore the inlining of RGWListBucketsRequest::eof() and RGWReaddirRequest::eof()
|
to clarify, I support the change to std::variant, it's always generally preferable to use the std forms when comparable |
i dropped the "benefits" section from the commit message. hope it's less exaggerating now. |
done. |
|
v2:
|
|
@mattbenjamin hi Matt, thank you for your review. could you please take another look? |
|
jenkins test make check |
|
|
@mattbenjamin hi Matt, could you please take a look? |
There was a problem hiding this comment.
Can we add std:: to the get_if calls for consistency?
There was a problem hiding this comment.
yes, we can! updated.
Move RGWListBucketsRequest::eof() and RGWReaddirRequest::eof() implementations from header to rgw/rgw_file.cc for better consistency with our custom RGWFileHandle::readdir_offset formatting. Previously, these functions relied on boost::variant's global operator<<, but we have our own specialized operator<< for readdir_offset in rgw_file_int.h. Our implementation is optimized for the case where readdir_offset contains a const char* and uses unlikely() for performance, unlike boost's default formatter. By moving implementations to the .cc file (after our custom operator<< definition), we ensure they use our formatting logic and resolve potential conflicts. This also properly addresses the fact that friend declarations don't serve as function declarations. This change also paves the road to migrate from boost::variant to std::variant, which does not provide the global operator<<, so we will have to use our operator<< overload. To preserve the previous inline behavior, both functions are explicitly marked with the 'inline' keyword. Verification of inlining was performed using: ``` readelf -s -W --demangle build/src/rgw/CMakeFiles/rgw_a.dir/rgw_file.cc.o | grep "Request::eof" ``` With `CMAKE_BUILD_TYPE=RelWithDebInfo`, both functions are confirmed to be inlined as they don't appear in the symbol table, maintaining existing behavior. Signed-off-by: Kefu Chai <[email protected]>
Replacing boost::variant with std::variant throughout the cephfs related codebase. This change is part of our ongoing effort to reduce third-party dependencies by leveraging C++ standard library alternatives where possible. Signed-off-by: Kefu Chai <[email protected]>
276501e to
ad71a82
Compare
|
changelog:
|
|
@mattbenjamin @ceph/rgw hi rgw developers, could you please help review this change? |
|
jenkins test api |
replacing boost::variant with std::variant throughout the rgw codebase. This change is part of our ongoing effort to reduce third-party dependencies by leveraging C++ standard library alternatives where possible.
Contribution Guidelines
To sign and title your commits, please refer to Submitting Patches to Ceph.
If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins test classic perfJenkins Job | Jenkins Job Definitionjenkins test crimson perfJenkins Job | Jenkins Job Definitionjenkins test signedJenkins Job | Jenkins Job Definitionjenkins test make checkJenkins Job | Jenkins Job Definitionjenkins test make check arm64Jenkins Job | Jenkins Job Definitionjenkins test submodulesJenkins Job | Jenkins Job Definitionjenkins test dashboardJenkins Job | Jenkins Job Definitionjenkins test dashboard cephadmJenkins Job | Jenkins Job Definitionjenkins test apiJenkins Job | Jenkins Job Definitionjenkins test docsReadTheDocs | Github Workflow Definitionjenkins test ceph-volume allJenkins Jobs | Jenkins Jobs Definitionjenkins test windowsJenkins Job | Jenkins Job Definitionjenkins test rook e2eJenkins Job | Jenkins Job Definition