1 // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
2 // This source code is licensed under the BSD-style license found in the
3 // LICENSE file in the root directory of this source tree. An additional grant
4 // of patent rights can be found in the PATENTS file in the same directory.
12 struct CompactionJobStats
{
13 CompactionJobStats() { Reset(); }
15 // Aggregate the CompactionJobStats from another instance with this one
16 void Add(const CompactionJobStats
& stats
);
18 // the elapsed time in micro of this compaction.
19 uint64_t elapsed_micros
;
21 // the number of compaction input records.
22 uint64_t num_input_records
;
23 // the number of compaction input files.
24 size_t num_input_files
;
25 // the number of compaction input files at the output level.
26 size_t num_input_files_at_output_level
;
28 // the number of compaction output records.
29 uint64_t num_output_records
;
30 // the number of compaction output files.
31 size_t num_output_files
;
33 // true if the compaction is a manual compaction
34 bool is_manual_compaction
;
36 // the size of the compaction input in bytes.
37 uint64_t total_input_bytes
;
38 // the size of the compaction output in bytes.
39 uint64_t total_output_bytes
;
41 // number of records being replaced by newer record associated with same key.
42 // this could be a new value or a deletion entry for that key so this field
43 // sums up all updated and deleted keys
44 uint64_t num_records_replaced
;
46 // the sum of the uncompressed input keys in bytes.
47 uint64_t total_input_raw_key_bytes
;
48 // the sum of the uncompressed input values in bytes.
49 uint64_t total_input_raw_value_bytes
;
51 // the number of deletion entries before compaction. Deletion entries
52 // can disappear after compaction because they expired
53 uint64_t num_input_deletion_records
;
54 // number of deletion records that were found obsolete and discarded
55 // because it is not possible to delete any more keys with this entry
56 // (i.e. all possible deletions resulting from it have been completed)
57 uint64_t num_expired_deletion_records
;
59 // number of corrupt keys (ParseInternalKey returned false when applied to
60 // the key) encountered and written out.
61 uint64_t num_corrupt_keys
;
63 // Following counters are only populated if
64 // options.report_bg_io_stats = true;
66 // Time spent on file's Append() call.
67 uint64_t file_write_nanos
;
69 // Time spent on sync file range.
70 uint64_t file_range_sync_nanos
;
72 // Time spent on file fsync.
73 uint64_t file_fsync_nanos
;
75 // Time spent on preparing file write (falocate, etc)
76 uint64_t file_prepare_write_nanos
;
78 // 0-terminated strings storing the first 8 bytes of the smallest and
79 // largest key in the output.
80 static const size_t kMaxPrefixLength
= 8;
82 std::string smallest_output_key_prefix
;
83 std::string largest_output_key_prefix
;
85 // number of single-deletes which do not meet a put
86 uint64_t num_single_del_fallthru
;
88 // number of single-deletes which meet something other than a put
89 uint64_t num_single_del_mismatch
;
91 } // namespace rocksdb