From 1129921e9b6baae14c207ed0ad70c8832eaf390f Mon Sep 17 00:00:00 2001 From: Feng Zhu Date: Mon, 4 Aug 2014 11:25:42 -0700 Subject: [PATCH] logging_when_create_and_delete_manifest Summary: 1. logging when create and delete manifest file 2. fix formating in table/format.cc Test Plan: make all check run db_bench, track the LOG file. Reviewers: ljin, yhchiang, igor, yufei.zhu, sdong Reviewed By: sdong Subscribers: leveldb Differential Revision: https://reviews.facebook.net/D21009 --- db/db_impl.cc | 1 + db/version_set.cc | 6 ++++++ table/format.cc | 9 ++++----- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/db/db_impl.cc b/db/db_impl.cc index 09ea62ef9..fa7f0b883 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -450,6 +450,7 @@ Status DBImpl::NewDB() { new_db.SetNextFile(2); new_db.SetLastSequence(0); + Log(options_.info_log, "Creating manifest 1 \n"); const std::string manifest = DescriptorFileName(dbname_, 1); unique_ptr file; Status s = env_->NewWritableFile( diff --git a/db/version_set.cc b/db/version_set.cc index ff44aeed4..9aa05a863 100644 --- a/db/version_set.cc +++ b/db/version_set.cc @@ -1881,6 +1881,9 @@ Status VersionSet::LogAndApply(ColumnFamilyData* column_family_data, // This is fine because everything inside of this block is serialized -- // only one thread can be here at the same time if (new_descriptor_log) { + // create manifest file + Log(options_->info_log, + "Creating manifest %" PRIu64 "\n", pending_manifest_file_number_); unique_ptr descriptor_file; s = env_->NewWritableFile( DescriptorFileName(dbname_, pending_manifest_file_number_), @@ -2002,6 +2005,9 @@ Status VersionSet::LogAndApply(ColumnFamilyData* column_family_data, column_family_data->GetName().c_str()); delete v; if (new_descriptor_log) { + Log(options_->info_log, + "Deleting manifest %" PRIu64 " current manifest %" PRIu64 "\n", + manifest_file_number_, pending_manifest_file_number_); descriptor_log_.reset(); env_->DeleteFile( DescriptorFileName(dbname_, pending_manifest_file_number_)); diff --git a/table/format.cc b/table/format.cc index c472169a4..a642965d5 100644 --- a/table/format.cc +++ b/table/format.cc @@ -208,9 +208,8 @@ Status ReadFooterFromFile(RandomAccessFile* file, // contents is the result of reading. // According to the implementation of file->Read, contents may not point to buf Status ReadBlock(RandomAccessFile* file, const Footer& footer, - const ReadOptions& options, const BlockHandle& handle, - Slice* contents, // result of reading, - char* buf) { + const ReadOptions& options, const BlockHandle& handle, + Slice* contents, /* result of reading */ char* buf) { size_t n = static_cast(handle.size()); PERF_TIMER_AUTO(block_read_time); @@ -256,8 +255,8 @@ Status ReadBlock(RandomAccessFile* file, const Footer& footer, // Decompress a block according to params // May need to malloc a space for cache usage Status DecompressBlock(BlockContents* result, size_t block_size, - bool do_uncompress, const char* buf, - const Slice& contents, bool use_stack_buf) { + bool do_uncompress, const char* buf, + const Slice& contents, bool use_stack_buf) { Status s; size_t n = block_size; const char* data = contents.data();