// Copyright (c) 2014 The LevelDB Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. See the AUTHORS file for names of contributors.
+//
+// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
#pragma once
#include "rocksdb/status.h"
#include "rocksdb/table_properties.h"
-namespace rocksdb {
+namespace ROCKSDB_NAMESPACE {
typedef std::unordered_map<std::string, std::shared_ptr<const TableProperties>>
TablePropertiesCollection;
kFlush,
// Compaction caused by external sst file ingestion
kExternalSstIngestion,
+ // Compaction due to SST file being too old
+ kPeriodicCompaction,
// total number of compaction reasons, new reasons must be added above this.
kNumOfReasons,
};
std::string cf_name;
// the path to the newly created file
std::string file_path;
+ // the file number of the newly created file
+ uint64_t file_number;
+ // the oldest blob file referenced by the newly created file
+ uint64_t oldest_blob_file_number;
// the id of the thread that completed this flush job.
uint64_t thread_id;
// the job id, which is unique in the same thread.
FlushReason flush_reason;
};
-struct CompactionJobInfo {
- CompactionJobInfo() = default;
- explicit CompactionJobInfo(const CompactionJobStats& _stats)
- : stats(_stats) {}
+struct CompactionFileInfo {
+ // The level of the file.
+ int level;
+
+ // The file number of the file.
+ uint64_t file_number;
+ // The file number of the oldest blob file this SST file references.
+ uint64_t oldest_blob_file_number;
+};
+
+struct CompactionJobInfo {
// the id of the column family where the compaction happened.
uint32_t cf_id;
// the name of the column family where the compaction happened.
int base_input_level;
// the output level of the compaction.
int output_level;
- // the names of the compaction input files.
+
+ // The following variables contain information about compaction inputs
+ // and outputs. A file may appear in both the input and output lists
+ // if it was simply moved to a different level. The order of elements
+ // is the same across input_files and input_file_infos; similarly, it is
+ // the same across output_files and output_file_infos.
+
+ // The names of the compaction input files.
std::vector<std::string> input_files;
- // the names of the compaction output files.
+ // Additional information about the compaction input files.
+ std::vector<CompactionFileInfo> input_file_infos;
+
+ // The names of the compaction output files.
std::vector<std::string> output_files;
+
+ // Additional information about the compaction output files.
+ std::vector<CompactionFileInfo> output_file_infos;
+
// Table properties for input and output tables.
// The map is keyed by values from input_files and output_files.
TablePropertiesCollection table_properties;
#else
class EventListener {};
+struct FlushJobInfo {};
#endif // ROCKSDB_LITE
-} // namespace rocksdb
+} // namespace ROCKSDB_NAMESPACE