1 // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
2 // This source code is licensed under both the GPLv2 (found in the
3 // COPYING file in the root directory) and Apache 2.0 License
4 // (found in the LICENSE.Apache file in the root directory).
12 #include "rocksdb/rocksdb_namespace.h"
14 namespace ROCKSDB_NAMESPACE
{
15 struct CompactionJobStats
{
16 CompactionJobStats() { Reset(); }
18 // Aggregate the CompactionJobStats from another instance with this one
19 void Add(const CompactionJobStats
& stats
);
21 // the elapsed time of this compaction in microseconds.
22 uint64_t elapsed_micros
;
24 // the elapsed CPU time of this compaction in microseconds.
27 // the number of compaction input records.
28 uint64_t num_input_records
;
29 // the number of blobs read from blob files
30 uint64_t num_blobs_read
;
31 // the number of compaction input files (table files)
32 size_t num_input_files
;
33 // the number of compaction input files at the output level (table files)
34 size_t num_input_files_at_output_level
;
36 // the number of compaction output records.
37 uint64_t num_output_records
;
38 // the number of compaction output files (table files)
39 size_t num_output_files
;
40 // the number of compaction output files (blob files)
41 size_t num_output_files_blob
;
43 // true if the compaction is a full compaction (all live SST files input)
44 bool is_full_compaction
;
45 // true if the compaction is a manual compaction
46 bool is_manual_compaction
;
48 // the total size of table files in the compaction input
49 uint64_t total_input_bytes
;
50 // the total size of blobs read from blob files
51 uint64_t total_blob_bytes_read
;
52 // the total size of table files in the compaction output
53 uint64_t total_output_bytes
;
54 // the total size of blob files in the compaction output
55 uint64_t total_output_bytes_blob
;
57 // number of records being replaced by newer record associated with same key.
58 // this could be a new value or a deletion entry for that key so this field
59 // sums up all updated and deleted keys
60 uint64_t num_records_replaced
;
62 // the sum of the uncompressed input keys in bytes.
63 uint64_t total_input_raw_key_bytes
;
64 // the sum of the uncompressed input values in bytes.
65 uint64_t total_input_raw_value_bytes
;
67 // the number of deletion entries before compaction. Deletion entries
68 // can disappear after compaction because they expired
69 uint64_t num_input_deletion_records
;
70 // number of deletion records that were found obsolete and discarded
71 // because it is not possible to delete any more keys with this entry
72 // (i.e. all possible deletions resulting from it have been completed)
73 uint64_t num_expired_deletion_records
;
75 // number of corrupt keys (ParseInternalKey returned false when applied to
76 // the key) encountered and written out.
77 uint64_t num_corrupt_keys
;
79 // Following counters are only populated if
80 // options.report_bg_io_stats = true;
82 // Time spent on file's Append() call.
83 uint64_t file_write_nanos
;
85 // Time spent on sync file range.
86 uint64_t file_range_sync_nanos
;
88 // Time spent on file fsync.
89 uint64_t file_fsync_nanos
;
91 // Time spent on preparing file write (fallocate, etc)
92 uint64_t file_prepare_write_nanos
;
94 // 0-terminated strings storing the first 8 bytes of the smallest and
95 // largest key in the output.
96 static const size_t kMaxPrefixLength
= 8;
98 std::string smallest_output_key_prefix
;
99 std::string largest_output_key_prefix
;
101 // number of single-deletes which do not meet a put
102 uint64_t num_single_del_fallthru
;
104 // number of single-deletes which meet something other than a put
105 uint64_t num_single_del_mismatch
;
107 // TODO: Add output_to_penultimate_level output information
109 } // namespace ROCKSDB_NAMESPACE