sstables: Rename filename($component) calls to ${component}_filename()

There's a generic sstable::filename(component_type) method that returns
a file name for the given component. For "popular" components, namely
TOC, Data and Index there are dedicated sstable methods to get their
names. Fix existing callers of the generic method to use the former.
It's shorter, nicer and makes further patching simpler.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
This commit is contained in:
Pavel Emelyanov
2025-03-06 15:15:49 +03:00
parent e6898a8854
commit dcc9167734
3 changed files with 7 additions and 7 deletions

View File

@@ -884,17 +884,17 @@ void writer::init_file_writers() {
auto out = _sst._storage->make_data_or_index_sink(_sst, component_type::Data).get();
if (!_compression_enabled) {
_data_writer = std::make_unique<crc32_checksummed_file_writer>(std::move(out), _sst.sstable_buffer_size, _sst.filename(component_type::Data));
_data_writer = std::make_unique<crc32_checksummed_file_writer>(std::move(out), _sst.sstable_buffer_size, _sst.get_filename());
} else {
_data_writer = std::make_unique<file_writer>(
make_compressed_file_m_format_output_stream(
output_stream<char>(std::move(out)),
&_sst._components->compression,
_sst._schema->get_compressor_params()), _sst.filename(component_type::Data));
_sst._schema->get_compressor_params()), _sst.get_filename());
}
out = _sst._storage->make_data_or_index_sink(_sst, component_type::Index).get();
_index_writer = std::make_unique<file_writer>(output_stream<char>(std::move(out)), _sst.filename(component_type::Index));
_index_writer = std::make_unique<file_writer>(output_stream<char>(std::move(out)), _sst.index_filename());
}
std::unique_ptr<file_writer> writer::close_writer(std::unique_ptr<file_writer>& w) {

View File

@@ -838,16 +838,16 @@ future<> sstable::read_toc() noexcept {
_recognized_components.insert(reverse_map(c, sstable_version_constants::get_component_map(_version)));
} catch (std::out_of_range& oor) {
_unrecognized_components.push_back(c);
sstlog.info("Unrecognized TOC component was found: {} in sstable {}", c, filename(component_type::TOC));
sstlog.info("Unrecognized TOC component was found: {} in sstable {}", c, toc_filename());
}
}
if (!_recognized_components.size()) {
throw malformed_sstable_exception("Empty TOC", filename(component_type::TOC));
throw malformed_sstable_exception("Empty TOC", toc_filename());
}
});
} catch (std::system_error& e) {
if (e.code() == std::error_code(ENOENT, std::system_category())) {
throw malformed_sstable_exception(filename(component_type::TOC) + ": file not found");
throw malformed_sstable_exception(toc_filename() + ": file not found");
}
throw;
}

View File

@@ -155,7 +155,7 @@ public:
void rewrite_toc_without_component(component_type component) {
SCYLLA_ASSERT(component != component_type::TOC);
_sst->_recognized_components.erase(component);
remove_file(_sst->filename(component_type::TOC)).get();
remove_file(_sst->toc_filename()).get();
_sst->_storage->open(*_sst);
_sst->seal_sstable(false).get();
}