#include <vector>
#include "db/column_family.h"
-#include "db/dbformat.h"
#include "db/internal_stats.h"
#include "db/snapshot_impl.h"
#include "env/file_system_tracer.h"
#include "logging/event_logger.h"
#include "options/db_options.h"
#include "rocksdb/db.h"
-#include "rocksdb/env.h"
+#include "rocksdb/file_system.h"
#include "rocksdb/sst_file_writer.h"
#include "util/autovector.h"
namespace ROCKSDB_NAMESPACE {
class Directories;
+class SystemClock;
struct IngestedFileInfo {
// External file path
std::string file_checksum;
// The name of checksum function that generate the checksum
std::string file_checksum_func_name;
+ // The temperature of the file to be ingested
+ Temperature file_temperature = Temperature::kUnknown;
+ // Unique id of the file to be ingested
+ UniqueId64x2 unique_id{};
};
class ExternalSstFileIngestionJob {
public:
ExternalSstFileIngestionJob(
- Env* env, VersionSet* versions, ColumnFamilyData* cfd,
+ VersionSet* versions, ColumnFamilyData* cfd,
const ImmutableDBOptions& db_options, const EnvOptions& env_options,
SnapshotList* db_snapshots,
const IngestExternalFileOptions& ingestion_options,
Directories* directories, EventLogger* event_logger,
const std::shared_ptr<IOTracer>& io_tracer)
- : env_(env),
+ : clock_(db_options.clock),
fs_(db_options.fs, io_tracer),
versions_(versions),
cfd_(cfd),
ingestion_options_(ingestion_options),
directories_(directories),
event_logger_(event_logger),
- job_start_time_(env_->NowMicros()),
+ job_start_time_(clock_->NowMicros()),
consumed_seqno_count_(0),
io_tracer_(io_tracer) {
assert(directories != nullptr);
Status Prepare(const std::vector<std::string>& external_files_paths,
const std::vector<std::string>& files_checksums,
const std::vector<std::string>& files_checksum_func_names,
- uint64_t next_file_number, SuperVersion* sv);
+ const Temperature& file_temperature, uint64_t next_file_number,
+ SuperVersion* sv);
// Check if we need to flush the memtable before running the ingestion job
// This will be true if the files we are ingesting are overlapping with any
// Open the external file and populate `file_to_ingest` with all the
// external information we need to ingest this file.
Status GetIngestedFileInfo(const std::string& external_file,
+ uint64_t new_file_number,
IngestedFileInfo* file_to_ingest,
SuperVersion* sv);
- // Assign `file_to_ingest` the appropriate sequence number and the lowest
+ // Assign `file_to_ingest` the appropriate sequence number and the lowest
// possible level that it can be ingested to according to compaction_style.
// REQUIRES: Mutex held
Status AssignLevelAndSeqnoForIngestedFile(SuperVersion* sv,
template <typename TWritableFile>
Status SyncIngestedFile(TWritableFile* file);
- Env* env_;
+ SystemClock* clock_;
FileSystemPtr fs_;
VersionSet* versions_;
ColumnFamilyData* cfd_;