From b648401adbb50f7c56f274f5b18500168be8a088 Mon Sep 17 00:00:00 2001 From: Abhishek Kona Date: Mon, 19 Nov 2012 10:46:36 -0800 Subject: [PATCH] Fix LDB dumpwal to print the messages as in the file. Summary: StringStream.clear() does not clear the stream. It sets some flags. Who knew? Fixing that is not printing the stuff again and again. Test Plan: ran it on a local db Reviewers: dhruba, emayanke Reviewed By: dhruba Differential Revision: https://reviews.facebook.net/D6795 --- util/ldb_cmd.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/util/ldb_cmd.cc b/util/ldb_cmd.cc index 60c3f9b43..acbef77ec 100644 --- a/util/ldb_cmd.cc +++ b/util/ldb_cmd.cc @@ -390,10 +390,10 @@ void WALDumper::DoCommand() { Slice record; std::stringstream row; if (print_header_) { - std::cout<<"Sequence,Count,ByteSize\n"; + std::cout<<"Sequence,Count,ByteSize,Physical Offset\n"; } while(reader.ReadRecord(&record, &scratch)) { - row.clear(); + row.str(""); if (record.size() < 12) { reporter.Corruption( record.size(), Status::Corruption("log record too small")); @@ -401,7 +401,8 @@ void WALDumper::DoCommand() { WriteBatchInternal::SetContents(&batch, record); row<