mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-12 19:02:12 +00:00
replica,sstables: Move format_table_directory_name()
Now this helper is not needed in replica code, as all manipulations of tables' sstables now sit in the sstables/storage.cc. Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
This commit is contained in:
@@ -31,7 +31,6 @@
|
||||
#include <seastar/coroutine/as_future.hh>
|
||||
#include <seastar/core/reactor.hh>
|
||||
#include <seastar/core/metrics.hh>
|
||||
#include <boost/algorithm/string/erase.hpp>
|
||||
#include "sstables/sstables.hh"
|
||||
#include "sstables/sstables_manager.hh"
|
||||
#include <boost/range/adaptor/map.hpp>
|
||||
@@ -2555,12 +2554,6 @@ std::pair<sstring, table_id> parse_table_directory_name(const sstring& directory
|
||||
return std::make_pair(directory_name.substr(0, pos), table_id(utils::UUID(directory_name.substr(pos + 1))));
|
||||
}
|
||||
|
||||
sstring format_table_directory_name(sstring name, table_id id) {
|
||||
auto uuid_sstring = id.to_sstring();
|
||||
boost::erase_all(uuid_sstring, "-");
|
||||
return format("{}-{}", name, uuid_sstring);
|
||||
}
|
||||
|
||||
future<std::unordered_map<sstring, database::snapshot_details>> database::get_snapshot_details() {
|
||||
std::vector<sstring> data_dirs = _cfg.data_file_directories();
|
||||
std::unordered_map<sstring, snapshot_details> details;
|
||||
|
||||
@@ -1891,10 +1891,8 @@ public:
|
||||
future<> clear_inactive_reads_for_tablet(table_id table, dht::token_range tablet_range);
|
||||
};
|
||||
|
||||
// A pair of helper functions to make directory name for a table
|
||||
// out of its name and uuid, and to parse the directory name back
|
||||
// into name and uuid of the table
|
||||
sstring format_table_directory_name(sstring name, table_id id);
|
||||
// A helper function to parse the directory name back
|
||||
// into name and uuid of the table (see format_table_directory_name())
|
||||
std::pair<sstring, table_id> parse_table_directory_name(const sstring&);
|
||||
|
||||
} // namespace replica
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
#include <cerrno>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/algorithm/string/erase.hpp>
|
||||
|
||||
#include <exception>
|
||||
#include <stdexcept>
|
||||
@@ -33,7 +34,6 @@
|
||||
#include "utils/s3/client.hh"
|
||||
#include "utils/exceptions.hh"
|
||||
#include "utils/to_string.hh"
|
||||
#include "replica/database.hh" // need to move format_table_directory_name here eventually
|
||||
|
||||
#include "checked-file-impl.hh"
|
||||
|
||||
@@ -681,10 +681,16 @@ std::unique_ptr<sstables::storage> make_storage(sstables_manager& manager, const
|
||||
}, s_opts.value);
|
||||
}
|
||||
|
||||
static sstring format_table_directory_name(sstring name, table_id id) {
|
||||
auto uuid_sstring = id.to_sstring();
|
||||
boost::erase_all(uuid_sstring, "-");
|
||||
return format("{}-{}", name, uuid_sstring);
|
||||
}
|
||||
|
||||
future<lw_shared_ptr<const data_dictionary::storage_options>> init_table_storage(const sstables_manager& mgr, const schema& s, const data_dictionary::storage_options::local& so) {
|
||||
std::vector<sstring> dirs;
|
||||
for (const auto& dd : mgr.config().data_file_directories()) {
|
||||
auto dir = format("{}/{}/{}", dd, s.ks_name(), replica::format_table_directory_name(s.cf_name(), s.id()));
|
||||
auto dir = format("{}/{}/{}", dd, s.ks_name(), format_table_directory_name(s.cf_name(), s.id()));
|
||||
dirs.emplace_back(std::move(dir));
|
||||
}
|
||||
co_await coroutine::parallel_for_each(dirs, [] (sstring dir) -> future<> {
|
||||
|
||||
Reference in New Issue
Block a user