Closed laurynas-biveinis closed 3 months ago
@luqun has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.
Looks like there are some compilation error, maybe different gcc version?
storage/rocksdb/clone/common.h:403:12: error: call to non-‘constexpr’ function ‘std::cxx11::basic_string<_CharT, _Traits, _Alloc>::operator sv_type() const [with _CharT = char; _Traits = std::char_traits
storage/rocksdb/clone/donor.cc:90:12: error: call to non-‘constexpr’ function ‘std::cxx11::basic_string<_CharT, _Traits, _Alloc>::operator sv_type() const [with _CharT = char; _Traits = std::char_traits
storage/rocksdb/clone/client.cc:119:12: error: call to non-‘constexpr’ function ‘std::cxx11::basic_string<_CharT, _Traits, _Alloc>::operator sv_type() const [with _CharT = char; _Traits = std::char_traits
@laurynas-biveinis has updated the pull request. You must reimport the pull request before landing.
@luqun, rebased and updated the PR, should be fixed now
@luqun has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.
The PR passes calls data() on string_views and passes such pointers where null-terminated strings are expected. Since string_views are length-based, they are not guaranteed to be null-terminated. All string views are created from C or C++ strings here are, in fact, null terminated, but this is not a good practice to rely on that.
@laurynas-biveinis has updated the pull request. You must reimport the pull request before landing.
Removed the incorrect uses of string_view::data
in the contexts where null-terminated strings were expected. The patch is smaller now and ready for review
@luqun has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.
This pull request has been merged in facebook/mysql-5.6@869b0c6511c6f1960dc17a7e96bc6b58b51106d4.
std::string_view has several advantages over std::string char char *:
In converting clone code, also convert some utility functions that also called from elsewhere. In particular, convert rocksdb_datadir and rocksdb_wal_dir sysvars to be std::string_views, keeping the pointer-to-char variables only for interfacing with the MYSQL_SYSVAR macros.