From ef76cdb2c79688fcdf11f41eab19cd39f07bffd1 Mon Sep 17 00:00:00 2001 From: "Raphael S. Carvalho" Date: Mon, 28 Jun 2021 12:54:13 -0300 Subject: [PATCH] sstables: Attach sstable name to exception triggered in sstable mutation reader When compaction fails due to a failure that comes from a specific sstable, like on data corruption, the log isn't telling which sstable contributed to that. Let's always attach the sstable name to the exception triggered in sstable mutation reader. Exceptions in la and mx consumer attached sst name, but now only sst mutation reader will do it so as to avoid duplicating the sst name. Now: ERROR 2021-06-11 16:07:34,489 [shard 0] compaction_manager - compaction failed: sstables::malformed_sstable_exception (Failed to read partition from SSTable /home/.../md-74-big-Data.db due to compressed chunk of size 3735 at file offset 406491 failed checksum, expected=0, actual=1422312584): retrying Signed-off-by: Raphael S. Carvalho --- sstables/kl/reader.cc | 6 ++++++ sstables/kl/reader_impl.hh | 6 +----- sstables/mx/reader.cc | 12 +++++++----- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/sstables/kl/reader.cc b/sstables/kl/reader.cc index e6dd356544..18eae4b64b 100644 --- a/sstables/kl/reader.cc +++ b/sstables/kl/reader.cc @@ -1120,6 +1120,12 @@ public: }); }); } + }).then_wrapped([this] (future<> f) { + try { + f.get(); + } catch(sstables::malformed_sstable_exception& e) { + throw sstables::malformed_sstable_exception(format("Failed to read partition from SSTable {} due to {}", _sst->get_filename(), e.what())); + } }); } virtual future<> next_partition() override { diff --git a/sstables/kl/reader_impl.hh b/sstables/kl/reader_impl.hh index 52eba9caaf..06dcad0bc2 100644 --- a/sstables/kl/reader_impl.hh +++ b/sstables/kl/reader_impl.hh @@ -189,11 +189,7 @@ public: // leave only the unprocessed part. The caller must handle calling // process() again, and/or refilling the buffer, as needed. data_consumer::processing_result process_state(temporary_buffer& data) { - try { - return do_process_state(data); - } catch (malformed_sstable_exception& exp) { - throw malformed_sstable_exception(exp.what(), _sst->get_filename()); - } + return do_process_state(data); } private: data_consumer::processing_result do_process_state(temporary_buffer& data) { diff --git a/sstables/mx/reader.cc b/sstables/mx/reader.cc index e7ac5d1144..437c1774ca 100644 --- a/sstables/mx/reader.cc +++ b/sstables/mx/reader.cc @@ -337,11 +337,7 @@ public: } data_consumer::processing_result process_state(temporary_buffer& data) { - try { - return do_process_state(data); - } catch (malformed_sstable_exception& exp) { - throw malformed_sstable_exception(exp.what(), _sst->get_filename()); - } + return do_process_state(data); } private: data_consumer::processing_result do_process_state(temporary_buffer& data) { @@ -1834,6 +1830,12 @@ public: }); }); } + }).then_wrapped([this] (future<> f) { + try { + f.get(); + } catch(sstables::malformed_sstable_exception& e) { + throw sstables::malformed_sstable_exception(format("Failed to read partition from SSTable {} due to {}", _sst->get_filename(), e.what())); + } }); } virtual future<> next_partition() override {