From bd08374130a56b47635404d9dfc6cd17749b9867 Mon Sep 17 00:00:00 2001 From: Peter Dillinger Date: Mon, 7 Feb 2022 10:38:50 -0800 Subject: [PATCH] Add GetTemperature on existing files (#9498) Summary: For tiered storage Pull Request resolved: https://github.com/facebook/rocksdb/pull/9498 Test Plan: Just API placeholders for now Reviewed By: jay-zhuang Differential Revision: D33993094 Pulled By: pdillinger fbshipit-source-id: 3cf19a450c7232e05306e94018559b26e9fd35db --- include/rocksdb/file_system.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/include/rocksdb/file_system.h b/include/rocksdb/file_system.h index e6cf8f9ce..f1159f692 100644 --- a/include/rocksdb/file_system.h +++ b/include/rocksdb/file_system.h @@ -701,6 +701,13 @@ class FSSequentialFile { return IOStatus::NotSupported("PositionedRead"); } + // EXPERIMENTAL + // When available, returns the actual temperature for the file. This is + // useful in case some outside process moves a file from one tier to another, + // though the temperature is generally expected not to change while a file is + // open. + virtual Temperature GetTemperature() const { return Temperature::kUnknown; } + // If you're adding methods here, remember to add them to // SequentialFileWrapper too. }; @@ -818,6 +825,13 @@ class FSRandomAccessFile { return IOStatus::NotSupported("InvalidateCache not supported."); } + // EXPERIMENTAL + // When available, returns the actual temperature for the file. This is + // useful in case some outside process moves a file from one tier to another, + // though the temperature is generally expected not to change while a file is + // open. + virtual Temperature GetTemperature() const { return Temperature::kUnknown; } + // If you're adding methods here, remember to add them to // RandomAccessFileWrapper too. }; @@ -1102,6 +1116,13 @@ class FSRandomRWFile { virtual IOStatus Close(const IOOptions& options, IODebugContext* dbg) = 0; + // EXPERIMENTAL + // When available, returns the actual temperature for the file. This is + // useful in case some outside process moves a file from one tier to another, + // though the temperature is generally expected not to change while a file is + // open. + virtual Temperature GetTemperature() const { return Temperature::kUnknown; } + // If you're adding methods here, remember to add them to // RandomRWFileWrapper too. @@ -1418,6 +1439,9 @@ class FSSequentialFileWrapper : public FSSequentialFile { IODebugContext* dbg) override { return target_->PositionedRead(offset, n, options, result, scratch, dbg); } + Temperature GetTemperature() const override { + return target_->GetTemperature(); + } private: FSSequentialFile* target_; @@ -1466,6 +1490,9 @@ class FSRandomAccessFileWrapper : public FSRandomAccessFile { IOStatus InvalidateCache(size_t offset, size_t length) override { return target_->InvalidateCache(offset, length); } + Temperature GetTemperature() const override { + return target_->GetTemperature(); + } private: std::unique_ptr guard_; @@ -1629,6 +1656,9 @@ class FSRandomRWFileWrapper : public FSRandomRWFile { IOStatus Close(const IOOptions& options, IODebugContext* dbg) override { return target_->Close(options, dbg); } + Temperature GetTemperature() const override { + return target_->GetTemperature(); + } private: FSRandomRWFile* target_;