sstables: update_info_for_opened_data: reindent

Recover much-needed indent levels for future use.
This commit is contained in:
Avi Kivity
2022-12-12 22:30:16 +02:00
parent eace9a226c
commit c728de8533

View File

@@ -1400,67 +1400,55 @@ future<> sstable::open_data() noexcept {
future<> sstable::update_info_for_opened_data() {
struct stat st = co_await _data_file.stat();
{
if (this->has_component(component_type::CompressionInfo)) {
_components->compression.update(st.st_size);
}
_data_file_size = st.st_size;
_data_file_write_time = db_clock::from_time_t(st.st_mtime);
auto size = co_await _index_file.size();
{
_index_file_size = size;
assert(!_cached_index_file);
_cached_index_file = seastar::make_shared<cached_file>(_index_file,
index_page_cache_metrics,
_manager.get_cache_tracker().get_lru(),
_manager.get_cache_tracker().region(),
_index_file_size);
_index_file = make_cached_seastar_file(*_cached_index_file);
}
if (this->has_component(component_type::Filter)) {
auto size = co_await io_check([&] {
return file_size(this->filename(component_type::Filter));
});
{
_filter_file_size = size;
}
}
if (this->has_component(component_type::CompressionInfo)) {
_components->compression.update(st.st_size);
}
{
this->set_min_max_position_range();
this->set_first_and_last_keys();
_run_identifier = _components->scylla_metadata->get_optional_run_identifier().value_or(run_id::create_random_id());
_data_file_size = st.st_size;
_data_file_write_time = db_clock::from_time_t(st.st_mtime);
// Get disk usage for this sstable (includes all components).
_bytes_on_disk = 0;
for (component_type c : _recognized_components) {
uint64_t bytes = co_await this->sstable_write_io_check(coroutine::lambda([&] () -> future<uint64_t> {
future<seastar::stat_data> f = co_await coroutine::as_future(file_stat(this->filename(c)));
{
if (f.failed()) [[unlikely]] {
try {
std::rethrow_exception(f.get_exception());
} catch (const std::system_error& ex) {
// ignore summary that isn't present in disk but was previously generated by read_summary().
if (ex.code().value() == ENOENT && c == component_type::Summary && _components->summary.memory_footprint()) {
co_return 0;
}
co_return coroutine::exception(std::make_exception_ptr(ex));
}
auto size = co_await _index_file.size();
_index_file_size = size;
assert(!_cached_index_file);
_cached_index_file = seastar::make_shared<cached_file>(_index_file,
index_page_cache_metrics,
_manager.get_cache_tracker().get_lru(),
_manager.get_cache_tracker().region(),
_index_file_size);
_index_file = make_cached_seastar_file(*_cached_index_file);
if (this->has_component(component_type::Filter)) {
auto size = co_await io_check([&] {
return file_size(this->filename(component_type::Filter));
});
_filter_file_size = size;
}
this->set_min_max_position_range();
this->set_first_and_last_keys();
_run_identifier = _components->scylla_metadata->get_optional_run_identifier().value_or(run_id::create_random_id());
// Get disk usage for this sstable (includes all components).
_bytes_on_disk = 0;
for (component_type c : _recognized_components) {
uint64_t bytes = co_await this->sstable_write_io_check(coroutine::lambda([&] () -> future<uint64_t> {
future<seastar::stat_data> f = co_await coroutine::as_future(file_stat(this->filename(c)));
if (f.failed()) [[unlikely]] {
try {
std::rethrow_exception(f.get_exception());
} catch (const std::system_error& ex) {
// ignore summary that isn't present in disk but was previously generated by read_summary().
if (ex.code().value() == ENOENT && c == component_type::Summary && _components->summary.memory_footprint()) {
co_return 0;
}
co_return f.get0().allocated_size;
co_return coroutine::exception(std::make_exception_ptr(ex));
}
}));
{
_bytes_on_disk += bytes;
}
}
}
{
co_await load_first_and_last_position_in_partition();
co_return f.get0().allocated_size;
}));
_bytes_on_disk += bytes;
}
co_await load_first_and_last_position_in_partition();
}
future<> sstable::create_data() noexcept {