rocksdb/include/rocksdb/compaction_job_stats.h
Yueh-Hsuan Chiang fe5c6321cb Allow EventListener::OnCompactionCompleted to return CompactionJobStats.
Summary:
Allow EventListener::OnCompactionCompleted to return CompactionJobStats,
which contains useful information about a compaction.

Example CompactionJobStats returned by OnCompactionCompleted():
    smallest_output_key_prefix 05000000
    largest_output_key_prefix 06990000
    elapsed_time 42419
    num_input_records 300
    num_input_files 3
    num_input_files_at_output_level 2
    num_output_records 200
    num_output_files 1
    actual_bytes_input 167200
    actual_bytes_output 110688
    total_input_raw_key_bytes 5400
    total_input_raw_value_bytes 300000
    num_records_replaced 100
    is_manual_compaction 1

Test Plan: Developed a mega test in db_test which covers 20 variables in CompactionJobStats.

Reviewers: rven, igor, anthony, sdong

Reviewed By: sdong

Subscribers: tnovak, dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D38463
2015-06-02 17:07:16 -07:00

52 lines
1.6 KiB
C++

// Copyright (c) 2013, 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>
namespace rocksdb {
struct CompactionJobStats {
CompactionJobStats() { Reset(); }
void Reset();
// 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
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;
// 0-terminated strings storing the first 8 bytes of the smallest and
// largest key in the output.
char smallest_output_key_prefix[9];
char largest_output_key_prefix[9];
};
} // namespace rocksdb