1 //  Copyright (c) 2016-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).
5 
6 #pragma once
7 
8 #include "rocksdb/rocksdb_namespace.h"
9 
10 struct CompactionIterationStats {
11   // Compaction statistics
12 
13   // Doesn't include records skipped because of
14   // CompactionFilter::Decision::kRemoveAndSkipUntil.
15   int64_t num_record_drop_user = 0;
16 
17   int64_t num_record_drop_hidden = 0;
18   int64_t num_record_drop_obsolete = 0;
19   int64_t num_record_drop_range_del = 0;
20   int64_t num_range_del_drop_obsolete = 0;
21   // Deletions obsoleted before bottom level due to file gap optimization.
22   int64_t num_optimized_del_drop_obsolete = 0;
23   uint64_t total_filter_time = 0;
24 
25   // Input statistics
26   // TODO(noetzli): The stats are incomplete. They are lacking everything
27   // consumed by MergeHelper.
28   uint64_t num_input_records = 0;
29   uint64_t num_input_deletion_records = 0;
30   uint64_t num_input_corrupt_records = 0;
31   uint64_t total_input_raw_key_bytes = 0;
32   uint64_t total_input_raw_value_bytes = 0;
33 
34   // Single-Delete diagnostics for exceptional situations
35   uint64_t num_single_del_fallthru = 0;
36   uint64_t num_single_del_mismatch = 0;
37 };
38