sstable: Remove temp_... stuff from sstable

There's a bunch of helpers around XFS-specific temp-dir sitting in
publie sstable part. Drop it altogether, no code needs it for real.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
This commit is contained in:
Pavel Emelyanov
2022-12-06 13:58:48 +03:00
parent adba24d8ae
commit a46d378bee
3 changed files with 11 additions and 17 deletions

View File

@@ -143,7 +143,8 @@ future<> sstable::rename_new_sstable_component_file(sstring from_name, sstring t
future<file> sstable::filesystem_storage::open_component(const sstable& sst, component_type type, open_flags flags, file_open_options options, bool check_integrity) {
auto create_flags = open_flags::create | open_flags::exclusive;
auto readonly = (flags & create_flags) != create_flags;
auto name = !readonly && temp_dir ? sst.temp_filename(type) : sst.filename(type);
auto tgt_dir = !readonly && temp_dir ? dir + "/" + sstable::sst_dir_basename(sst._generation) : dir;
auto name = sst.filename(tgt_dir, type);
auto f = open_sstable_component_file_non_checked(name, flags, options, check_integrity);

View File

@@ -367,10 +367,6 @@ public:
return fmt::format("{}.sstable", gen);
}
static sstring temp_sst_dir(const sstring& dir, generation_type gen) {
return dir + "/" + sst_dir_basename(gen);
}
static bool is_temp_dir(const fs::path& dirpath)
{
return dirpath.extension().string() == ".sstable";
@@ -507,10 +503,6 @@ private:
return _storage.dir;
}
sstring temp_filename(component_type f) const {
return filename(temp_sst_dir(_storage.dir, _generation), f);
}
size_t sstable_buffer_size;
static std::unordered_map<version_types, sstring, enum_hash<version_types>> _version_string;

View File

@@ -307,12 +307,13 @@ SEASTAR_THREAD_TEST_CASE(test_distributed_loader_with_incomplete_sstables) {
require_exist(file_name, true);
};
auto temp_sst_dir = sst::temp_sst_dir(sst_dir, generation_from_value(2));
touch_dir(temp_sst_dir);
auto temp_sst_dir_2 = sst_dir + "/" + sst::sst_dir_basename(generation_from_value(2));
touch_dir(temp_sst_dir_2);
temp_sst_dir = sst::temp_sst_dir(sst_dir, generation_from_value(3));
touch_dir(temp_sst_dir);
auto temp_file_name = sst::filename(temp_sst_dir, ks, cf, sst::version_types::mc, generation_from_value(3), sst::format_types::big, component_type::TemporaryTOC);
auto temp_sst_dir_3 = sst_dir + "/" + sst::sst_dir_basename(generation_from_value(3));
touch_dir(temp_sst_dir_3);
auto temp_file_name = sst::filename(temp_sst_dir_3, ks, cf, sst::version_types::mc, generation_from_value(3), sst::format_types::big, component_type::TemporaryTOC);
touch_file(temp_file_name);
temp_file_name = sst::filename(sst_dir, ks, cf, sst::version_types::mc, generation_from_value(4), sst::format_types::big, component_type::TemporaryTOC);
@@ -320,9 +321,9 @@ SEASTAR_THREAD_TEST_CASE(test_distributed_loader_with_incomplete_sstables) {
temp_file_name = sst::filename(sst_dir, ks, cf, sst::version_types::mc, generation_from_value(4), sst::format_types::big, component_type::Data);
touch_file(temp_file_name);
do_with_cql_env_thread([&sst_dir, &ks, &cf, &require_exist] (cql_test_env& e) {
require_exist(sst::temp_sst_dir(sst_dir, generation_from_value(2)), false);
require_exist(sst::temp_sst_dir(sst_dir, generation_from_value(3)), false);
do_with_cql_env_thread([&sst_dir, &ks, &cf, &require_exist, &temp_sst_dir_2, &temp_sst_dir_3] (cql_test_env& e) {
require_exist(temp_sst_dir_2, false);
require_exist(temp_sst_dir_3, false);
require_exist(sst::filename(sst_dir, ks, cf, sst::version_types::mc, generation_from_value(4), sst::format_types::big, component_type::TemporaryTOC), false);
require_exist(sst::filename(sst_dir, ks, cf, sst::version_types::mc, generation_from_value(4), sst::format_types::big, component_type::Data), false);