From 84c3577af98a88b5fc8e6b077594b8b8acf083c9 Mon Sep 17 00:00:00 2001 From: qinzuoyan Date: Thu, 16 Jul 2015 12:02:03 +0800 Subject: [PATCH 1/2] fix append bug in DumpDBFileSummary() --- util/db_info_dumper.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/db_info_dumper.cc b/util/db_info_dumper.cc index 7b77b12b4..1da4a09a3 100644 --- a/util/db_info_dumper.cc +++ b/util/db_info_dumper.cc @@ -65,7 +65,7 @@ void DumpDBFileSummary(const DBOptions& options, const std::string& dbname) { char str[8]; snprintf(str, sizeof(str), "%" PRIu64, file_size); wal_info.append(file).append(" size: "). - append(str, sizeof(str)).append(" ;"); + append(str).append(" ; "); break; case kTableFile: if (++file_num < 10) { @@ -118,7 +118,7 @@ void DumpDBFileSummary(const DBOptions& options, const std::string& dbname) { char str[8]; snprintf(str, sizeof(str), "%" PRIu64, file_size); wal_info.append(file).append(" size: "). - append(str, sizeof(str)).append(" ;"); + append(str).append(" ; "); } } } From 487bba4348bb182fd07327c876eda7e7803e5577 Mon Sep 17 00:00:00 2001 From: qinzuoyan Date: Thu, 16 Jul 2015 13:56:17 +0800 Subject: [PATCH 2/2] extend temp str buffer size --- util/db_info_dumper.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/db_info_dumper.cc b/util/db_info_dumper.cc index 1da4a09a3..e29ffe7be 100644 --- a/util/db_info_dumper.cc +++ b/util/db_info_dumper.cc @@ -62,7 +62,7 @@ void DumpDBFileSummary(const DBOptions& options, const std::string& dbname) { break; case kLogFile: env->GetFileSize(dbname + "/" + file, &file_size); - char str[8]; + char str[16]; snprintf(str, sizeof(str), "%" PRIu64, file_size); wal_info.append(file).append(" size: "). append(str).append(" ; "); @@ -115,7 +115,7 @@ void DumpDBFileSummary(const DBOptions& options, const std::string& dbname) { if (ParseFileName(file, &number, &type)) { if (type == kLogFile) { env->GetFileSize(options.wal_dir + "/" + file, &file_size); - char str[8]; + char str[16]; snprintf(str, sizeof(str), "%" PRIu64, file_size); wal_info.append(file).append(" size: "). append(str).append(" ; ");