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
main
Feng Zhu 10 years ago
parent 5e3d5c5f6e
commit 1129921e9b
  1. 1
      db/db_impl.cc
  2. 6
      db/version_set.cc
  3. 9
      table/format.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<WritableFile> file;
Status s = env_->NewWritableFile(

@ -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<WritableFile> 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_));

@ -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<size_t>(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();

Loading…
Cancel
Save