From 24b7aa56dbeddfc8718861d6bd674c9a74fa50ed Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Wed, 26 Sep 2018 15:32:22 -0700 Subject: [PATCH] modules/console: Improve output of db__txn cmd. --- modules/console.cc | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/modules/console.cc b/modules/console.cc index 66ba8ab6a..4db85e9af 100644 --- a/modules/console.cc +++ b/modules/console.cc @@ -2364,10 +2364,29 @@ try for_each(txn, [&out, &seqnum] (const db::delta &delta) { + const string_view &dkey + { + std::get(delta) + }; + + // !!! Assumption based on the events database schema. If the + // key is 8 bytes we assume it's an event::idx in binary. No + // other columns have 8 byte keys; instead they have plaintext + // event_id amalgams with some binary characters which are simply + // not displayed by the ostream. We could have a switch here to + // use m::dbs's key parsers based on the column name but that is + // not done here yet. + const string_view &key + { + dkey.size() == 8? + lex_cast(uint64_t(byte_view(dkey))): + dkey + }; + out << std::setw(12) << std::right << seqnum << " : " << std::setw(8) << std::left << reflect(std::get(delta)) << " " << std::setw(18) << std::right << std::get(delta) << " " - << std::get(delta) + << key << std::endl; }); }});