YugabyteDB (2.13.0.0-b42, bfc6a6643e7399ac8a0e81d06a3ee6d6571b33ab)

Coverage Report

Created: 2022-03-09 17:30

/Users/deen/code/yugabyte-db/src/yb/rocksdb/compaction_job_stats.h
Line
Count
Source
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.
5
//
6
// The following only applies to changes made to this file as part of YugaByte development.
7
//
8
// Portions Copyright (c) YugaByte, Inc.
9
//
10
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
11
// in compliance with the License.  You may obtain a copy of the License at
12
//
13
// http://www.apache.org/licenses/LICENSE-2.0
14
//
15
// Unless required by applicable law or agreed to in writing, software distributed under the License
16
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
17
// or implied.  See the License for the specific language governing permissions and limitations
18
// under the License.
19
//
20
21
#pragma once
22
23
#include <string>
24
25
namespace rocksdb {
26
struct CompactionJobStats {
27
99.5k
  CompactionJobStats() { Reset(); }
28
  void Reset();
29
  // Aggregate the CompactionJobStats from another instance with this one
30
  void Add(const CompactionJobStats& stats);
31
32
  // the elapsed time in micro of this compaction.
33
  uint64_t elapsed_micros;
34
35
  // the number of compaction input records.
36
  uint64_t num_input_records;
37
  // the number of compaction input files.
38
  size_t num_input_files;
39
  // the number of compaction input files at the output level.
40
  size_t num_input_files_at_output_level;
41
42
  // the number of compaction output records.
43
  uint64_t num_output_records;
44
  // the number of compaction output files.
45
  size_t num_output_files;
46
47
  // true if the compaction is a manual compaction
48
  bool is_manual_compaction;
49
50
  // the size of the compaction input in bytes.
51
  uint64_t total_input_bytes;
52
  // the size of the compaction output in bytes.
53
  uint64_t total_output_bytes;
54
55
  // number of records being replaced by newer record associated with same key.
56
  // this could be a new value or a deletion entry for that key so this field
57
  // sums up all updated and deleted keys
58
  uint64_t num_records_replaced;
59
60
  // the sum of the uncompressed input keys in bytes.
61
  uint64_t total_input_raw_key_bytes;
62
  // the sum of the uncompressed input values in bytes.
63
  uint64_t total_input_raw_value_bytes;
64
65
  // the number of deletion entries before compaction. Deletion entries
66
  // can disappear after compaction because they expired
67
  uint64_t num_input_deletion_records;
68
  // number of deletion records that were found obsolete and discarded
69
  // because it is not possible to delete any more keys with this entry
70
  // (i.e. all possible deletions resulting from it have been completed)
71
  uint64_t num_expired_deletion_records;
72
73
  // number of corrupt keys (ParseInternalKey returned false when applied to
74
  // the key) encountered and written out.
75
  uint64_t num_corrupt_keys;
76
77
  // Following counters are only populated if
78
  // options.compaction_measure_io_stats = true;
79
80
  // Time spent on file's Append() call.
81
  uint64_t file_write_nanos;
82
83
  // Time spent on sync file range.
84
  uint64_t file_range_sync_nanos;
85
86
  // Time spent on file fsync.
87
  uint64_t file_fsync_nanos;
88
89
  // Time spent on preparing file write (falocate, etc)
90
  uint64_t file_prepare_write_nanos;
91
92
  // 0-terminated strings storing the first 8 bytes of the smallest and
93
  // largest key in the output.
94
  static const size_t kMaxPrefixLength = 8;
95
96
  std::string smallest_output_key_prefix;
97
  std::string largest_output_key_prefix;
98
};
99
}  // namespace rocksdb