platoneko commented on code in PR #24364: URL: https://github.com/apache/doris/pull/24364#discussion_r1356573062
########## be/src/io/cache/block/block_file_segment.cpp: ########## @@ -196,6 +196,36 @@ Status FileBlock::read_at(Slice buffer, size_t read_offset) { return st; } +bool FileBlock::change_cache_type(CacheType new_type) { + std::unique_lock segment_lock(_mutex); + if (new_type == _cache_type) { + return true; + } + if (_download_state == State::DOWNLOADED) { + std::error_code ec; + std::filesystem::rename(get_path_in_local_cache(), + _cache->get_path_in_local_cache(key(), offset(), new_type), ec); + if (ec) { + LOG(ERROR) << ec.message(); Review Comment: Add some context in log ########## be/src/io/fs/s3_file_writer.cpp: ########## @@ -85,11 +88,18 @@ S3FileWriter::S3FileWriter(std::string key, std::shared_ptr<S3FileSystem> fs, : FileWriter(fmt::format("s3://{}/{}", fs->s3_conf().bucket, key), fs), _bucket(fs->s3_conf().bucket), _key(std::move(key)), - _client(fs->get_client()) { + _client(fs->get_client()), + _expiration_time(opts ? opts->file_cache_expiration : 0), + _is_cold_data(opts ? opts->is_cold_data : true), + _disable_file_cache(!opts ? false : !opts->write_file_cache) { Review Comment: Rename to `_write_file_cache` ########## be/src/io/cache/block/block_file_cache.cpp: ########## @@ -65,6 +65,8 @@ std::string IFileCache::cache_type_to_string(CacheType type) { return "_disposable"; case CacheType::NORMAL: return ""; + case CacheType::TTL: Review Comment: // TODO: consider `std::string_view` ########## be/src/service/doris_main.cpp: ########## @@ -60,7 +60,7 @@ #include "common/signal_handler.h" #include "common/status.h" #include "io/cache/block/block_file_cache_factory.h" -#include "io/fs/s3_file_write_bufferpool.h" Review Comment: Why need to include this? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org