From 28fa66591a83b4fe3049bfb243ea5a3dfc828df8 Mon Sep 17 00:00:00 2001 From: Glauber Costa Date: Tue, 16 Oct 2018 14:10:04 -0400 Subject: [PATCH] sstables: print sstable path in case of an exception Without that, we don't know where to look for the problems Before: compaction failed: sstables::malformed_sstable_exception (Too big ttl: 3163676957) After: compaction_manager - compaction failed: sstables::malformed_sstable_exception (Too big ttl: 4294967295 in sstable /var/lib/scylla/data/system_traces/events-8826e8e9e16a372887533bc1fc713c25/mc-832-big-Data.db) Signed-off-by: Glauber Costa Message-Id: <20181016181004.17838-1-glauber@scylladb.com> (cherry picked from commit 7edae5421d3dddb99a5a1d1b8e23a515af74c73a) --- sstables/row.hh | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/sstables/row.hh b/sstables/row.hh index fb440c4d26..4afdca3dac 100644 --- a/sstables/row.hh +++ b/sstables/row.hh @@ -241,6 +241,7 @@ private: } _state = state::ROW_START; row_consumer& _consumer; + shared_sstable _sst; temporary_buffer _key; temporary_buffer _val; @@ -270,6 +271,14 @@ 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()); + } + } +private: + data_consumer::processing_result do_process_state(temporary_buffer& data) { #if 0 // Testing hack: call process() for tiny chunks separately, to verify // that primitive types crossing input buffer are handled correctly. @@ -508,13 +517,15 @@ public: return row_consumer::proceed::yes; } +public: data_consume_rows_context(const schema&, - const shared_sstable&, + const shared_sstable& sst, row_consumer& consumer, input_stream&& input, uint64_t start, uint64_t maxlen) : continuous_data_consumer(std::move(input), start, maxlen) - , _consumer(consumer) { + , _consumer(consumer) + , _sst(sst) { } void verify_end_state() { @@ -610,6 +621,7 @@ private: } _state = state::PARTITION_START; consumer_m& _consumer; + shared_sstable _sst; const serialization_header& _header; column_translation _column_translation; @@ -753,6 +765,14 @@ 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()); + } + } +private: + data_consumer::processing_result do_process_state(temporary_buffer& data) { switch (_state) { case state::PARTITION_START: partition_start_label: @@ -1277,6 +1297,7 @@ public: return row_consumer::proceed::yes; } +public: data_consume_rows_context_m(const schema& s, const shared_sstable& sst, @@ -1286,6 +1307,7 @@ public: uint64_t maxlen) : continuous_data_consumer(std::move(input), start, maxlen) , _consumer(consumer) + , _sst(sst) , _header(sst->get_serialization_header()) , _column_translation(sst->get_column_translation(s, _header)) , _liveness(_header)