From ecf9003860ac1d2a0e1bec5846c40fe24ce61e7e Mon Sep 17 00:00:00 2001 From: Andrew Kryczka Date: Mon, 22 Aug 2016 10:27:50 -0700 Subject: [PATCH] Fix bug in printing values for block-based table Summary: value is not an InternalKey, we do not need to decode it Test Plan: setup: $ ldb put --create_if_missing=true k v $ ldb put --db=./tmp --create_if_missing k v $ ldb compact --db=./tmp before: $ sst_dump --command=raw --file=./tmp/000004.sst ... terminate called after throwing an instance of 'std::length_error' after: $ ./sst_dump --command=raw --file=./tmp/000004.sst $ cat tmp/000004_dump.txt ... ASCII k : v ... Reviewers: sdong, yhchiang, IslamAbdelRahman Reviewed By: IslamAbdelRahman Subscribers: andrewkr, dhruba, leveldb Differential Revision: https://reviews.facebook.net/D62301 --- table/block_based_table_reader.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/table/block_based_table_reader.cc b/table/block_based_table_reader.cc index ec997251c..b29da97d9 100644 --- a/table/block_based_table_reader.cc +++ b/table/block_based_table_reader.cc @@ -1982,18 +1982,17 @@ Status BlockBasedTable::DumpDataBlocks(WritableFile* out_file) { } Slice key = datablock_iter->key(); Slice value = datablock_iter->value(); - InternalKey ikey, iValue; + InternalKey ikey; ikey.DecodeFrom(key); - iValue.DecodeFrom(value); out_file->Append(" HEX "); out_file->Append(ikey.user_key().ToString(true).c_str()); out_file->Append(": "); - out_file->Append(iValue.user_key().ToString(true).c_str()); + out_file->Append(value.ToString(true).c_str()); out_file->Append("\n"); std::string str_key = ikey.user_key().ToString(); - std::string str_value = iValue.user_key().ToString(); + std::string str_value = value.ToString(); std::string res_key(""), res_value(""); char cspace = ' '; for (size_t i = 0; i < str_key.size(); i++) {