sstables: Return tuple from parse_path() without ks.cf hints
There are two path parsers. One of them accepts keyspace and table names and the other one doesn't. The latter is then supposed to parse the ks.cf pair from path and put it on the descriptor. This patch makes this method return ks.cf so that later it will be possible to remove these strings from the desctiptor itself. Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
This commit is contained in:
@@ -36,7 +36,9 @@ struct entry_descriptor {
|
||||
: sstdir(sstdir), ks(ks), cf(cf), generation(generation), version(version), format(format), component(component) {}
|
||||
};
|
||||
|
||||
entry_descriptor parse_path(const std::filesystem::path& sst_path);
|
||||
// Parses sstable file path extracting entry_descriptor from it. Returns the descriptor
|
||||
// and the keyspace.table pair of strings.
|
||||
std::tuple<entry_descriptor, sstring, sstring> parse_path(const std::filesystem::path& sst_path);
|
||||
|
||||
// Use the given ks and cf and don't attempt to extract it from the dir path.
|
||||
// This allows loading sstables from any path, but the filename still has to be valid.
|
||||
|
||||
@@ -270,7 +270,7 @@ future<> sstable_directory::filesystem_components_lister::process(sstable_direct
|
||||
break;
|
||||
}
|
||||
auto component_path = _directory / de->name;
|
||||
auto comps = sstables::parse_path(component_path);
|
||||
auto [ comps, ks, cf ] = sstables::parse_path(component_path);
|
||||
handle(std::move(comps), component_path);
|
||||
}
|
||||
} catch (...) {
|
||||
@@ -444,7 +444,8 @@ sstable_directory::collect_output_unshared_sstables(std::vector<sstables::shared
|
||||
}
|
||||
|
||||
dirlog.trace("Collected output SSTable {} is remote. Storing it", sst->get_filename());
|
||||
_unshared_remote_sstables[shard].push_back(sstables::parse_path(_sstable_dir / sst->component_basename(component_type::Data)));
|
||||
auto [ desc, ks, cf ] = sstables::parse_path(_sstable_dir / sst->component_basename(component_type::Data));
|
||||
_unshared_remote_sstables[shard].push_back(std::move(desc));
|
||||
return make_ready_future<>();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2163,8 +2163,9 @@ static entry_descriptor make_entry_descriptor(std::string_view sstdir, std::stri
|
||||
return entry_descriptor(sstdir, ks, cf, generation_type::from_string(generation), version, format_from_string(format), sstable::component_from_sstring(version, component));
|
||||
}
|
||||
|
||||
entry_descriptor parse_path(const std::filesystem::path& sst_path) {
|
||||
return make_entry_descriptor(sst_path.parent_path().native(), sst_path.filename().native(), nullptr, nullptr);
|
||||
std::tuple<entry_descriptor, sstring, sstring> parse_path(const std::filesystem::path& sst_path) {
|
||||
auto desc = make_entry_descriptor(sst_path.parent_path().native(), sst_path.filename().native(), nullptr, nullptr);
|
||||
return std::make_tuple(desc, desc.ks, desc.cf);
|
||||
}
|
||||
|
||||
entry_descriptor parse_path(const std::filesystem::path& sst_path, sstring ks, sstring cf) {
|
||||
|
||||
@@ -215,7 +215,7 @@ std::optional<schema_with_source> try_load_schema_autodetect(const bpo::variable
|
||||
if (app_config.count("sstables")) {
|
||||
try {
|
||||
auto sst_path = std::filesystem::path(app_config["sstables"].as<std::vector<sstring>>().front());
|
||||
auto ed = sstables::parse_path(sst_path);
|
||||
auto [ed, ks, cf] = sstables::parse_path(sst_path);
|
||||
const auto sst_dir_path = std::filesystem::path(sst_path).remove_filename();
|
||||
std::filesystem::path data_dir_path;
|
||||
// Detect whether sstable is in root table directory, or in a sub-directory
|
||||
|
||||
Reference in New Issue
Block a user