|
|
|
// Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
|
|
|
|
// This source code is licensed under the BSD-style license found in the
|
|
|
|
// LICENSE file in the root directory of this source tree. An additional grant
|
|
|
|
// of patent rights can be found in the PATENTS file in the same directory.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
namespace rocksdb {
|
|
|
|
struct CompactionJobStats {
|
|
|
|
CompactionJobStats() { Reset(); }
|
|
|
|
void Reset();
|
|
|
|
// Aggregate the CompactionJobStats from another instance with this one
|
|
|
|
void Add(const CompactionJobStats& stats);
|
|
|
|
|
|
|
|
// the elapsed time in micro of this compaction.
|
|
|
|
uint64_t elapsed_micros;
|
|
|
|
|
|
|
|
// the number of compaction input records.
|
|
|
|
uint64_t num_input_records;
|
|
|
|
// the number of compaction input files.
|
|
|
|
size_t num_input_files;
|
|
|
|
// the number of compaction input files at the output level.
|
|
|
|
size_t num_input_files_at_output_level;
|
|
|
|
|
|
|
|
// the number of compaction output records.
|
|
|
|
uint64_t num_output_records;
|
|
|
|
// the number of compaction output files.
|
|
|
|
size_t num_output_files;
|
|
|
|
|
|
|
|
// true if the compaction is a manual compaction
|
|
|
|
bool is_manual_compaction;
|
|
|
|
|
|
|
|
// the size of the compaction input in bytes.
|
|
|
|
uint64_t total_input_bytes;
|
|
|
|
// the size of the compaction output in bytes.
|
|
|
|
uint64_t total_output_bytes;
|
|
|
|
|
|
|
|
// number of records being replaced by newer record associated with same key.
|
|
|
|
// this could be a new value or a deletion entry for that key so this field
|
|
|
|
// sums up all updated and deleted keys
|
|
|
|
uint64_t num_records_replaced;
|
|
|
|
|
|
|
|
// the sum of the uncompressed input keys in bytes.
|
|
|
|
uint64_t total_input_raw_key_bytes;
|
|
|
|
// the sum of the uncompressed input values in bytes.
|
|
|
|
uint64_t total_input_raw_value_bytes;
|
|
|
|
|
|
|
|
// the number of deletion entries before compaction. Deletion entries
|
|
|
|
// can disappear after compaction because they expired
|
|
|
|
uint64_t num_input_deletion_records;
|
|
|
|
// number of deletion records that were found obsolete and discarded
|
|
|
|
// because it is not possible to delete any more keys with this entry
|
|
|
|
// (i.e. all possible deletions resulting from it have been completed)
|
|
|
|
uint64_t num_expired_deletion_records;
|
|
|
|
|
|
|
|
// number of corrupt keys (ParseInternalKey returned false when applied to
|
|
|
|
// the key) encountered and written out.
|
|
|
|
uint64_t num_corrupt_keys;
|
|
|
|
|
Add options.compaction_measure_io_stats to print write I/O stats in compactions
Summary:
Add options.compaction_measure_io_stats to print out / pass to listener accumulated time spent on write calls. Example outputs in info logs:
2015/08/12-16:27:59.463944 7fd428bff700 (Original Log Time 2015/08/12-16:27:59.463922) EVENT_LOG_v1 {"time_micros": 1439422079463897, "job": 6, "event": "compaction_finished", "output_level": 1, "num_output_files": 4, "total_output_size": 6900525, "num_input_records": 111483, "num_output_records": 106877, "file_write_nanos": 15663206, "file_range_sync_nanos": 649588, "file_fsync_nanos": 349614797, "file_prepare_write_nanos": 1505812, "lsm_state": [2, 4, 0, 0, 0, 0, 0]}
Add two more counters in iostats_context.
Also add a parameter of db_bench.
Test Plan: Add a unit test. Also manually verify LOG outputs in db_bench
Subscribers: leveldb, dhruba
Differential Revision: https://reviews.facebook.net/D44115
9 years ago
|
|
|
// Following counters are only populated if
|
|
|
|
// options.report_bg_io_stats = true;
|
Add options.compaction_measure_io_stats to print write I/O stats in compactions
Summary:
Add options.compaction_measure_io_stats to print out / pass to listener accumulated time spent on write calls. Example outputs in info logs:
2015/08/12-16:27:59.463944 7fd428bff700 (Original Log Time 2015/08/12-16:27:59.463922) EVENT_LOG_v1 {"time_micros": 1439422079463897, "job": 6, "event": "compaction_finished", "output_level": 1, "num_output_files": 4, "total_output_size": 6900525, "num_input_records": 111483, "num_output_records": 106877, "file_write_nanos": 15663206, "file_range_sync_nanos": 649588, "file_fsync_nanos": 349614797, "file_prepare_write_nanos": 1505812, "lsm_state": [2, 4, 0, 0, 0, 0, 0]}
Add two more counters in iostats_context.
Also add a parameter of db_bench.
Test Plan: Add a unit test. Also manually verify LOG outputs in db_bench
Subscribers: leveldb, dhruba
Differential Revision: https://reviews.facebook.net/D44115
9 years ago
|
|
|
|
|
|
|
// Time spent on file's Append() call.
|
|
|
|
uint64_t file_write_nanos;
|
|
|
|
|
|
|
|
// Time spent on sync file range.
|
|
|
|
uint64_t file_range_sync_nanos;
|
|
|
|
|
|
|
|
// Time spent on file fsync.
|
|
|
|
uint64_t file_fsync_nanos;
|
|
|
|
|
|
|
|
// Time spent on preparing file write (falocate, etc)
|
|
|
|
uint64_t file_prepare_write_nanos;
|
|
|
|
|
|
|
|
// 0-terminated strings storing the first 8 bytes of the smallest and
|
|
|
|
// largest key in the output.
|
|
|
|
static const size_t kMaxPrefixLength = 8;
|
|
|
|
|
|
|
|
std::string smallest_output_key_prefix;
|
|
|
|
std::string largest_output_key_prefix;
|
|
|
|
|
|
|
|
// number of single-deletes which do not meet a put
|
|
|
|
uint64_t num_single_del_fallthru;
|
|
|
|
|
|
|
|
// number of single-deletes which meet something other than a put
|
|
|
|
uint64_t num_single_del_mismatch;
|
|
|
|
};
|
|
|
|
} // namespace rocksdb
|