3434#include " common/status.h"
3535#include " gutil/port.h"
3636#include " inverted_index_fs_directory.h"
37- #include " io/cache/block_file_cache.h"
38- #include " io/cache/block_file_cache_factory.h"
3937#include " io/fs/file_system.h"
4038#include " io/fs/file_writer.h"
4139#include " io/fs/local_file_system.h"
@@ -198,7 +196,7 @@ Status SegmentWriter::init(const std::vector<uint32_t>& col_ids, bool has_key) {
198196 if (_opts.compression_type == UNKNOWN_COMPRESSION ) {
199197 _opts.compression_type = _tablet_schema->compression_type ();
200198 }
201- auto create_column_writer = [&](uint32_t cid, const auto & column) -> auto {
199+ auto create_column_writer = [&](uint32_t cid, const auto & column) -> auto {
202200 ColumnWriterOptions opts;
203201 opts.meta = _footer.add_columns ();
204202
@@ -1115,7 +1113,6 @@ Status SegmentWriter::finalize(uint64_t* segment_file_size, uint64_t* index_size
11151113 }
11161114 // write data
11171115 RETURN_IF_ERROR (finalize_columns_data ());
1118- uint64_t index_start = _file_writer->bytes_appended ();
11191116 // write index
11201117 RETURN_IF_ERROR (finalize_columns_index (index_size));
11211118 // write footer
@@ -1125,19 +1122,6 @@ Status SegmentWriter::finalize(uint64_t* segment_file_size, uint64_t* index_size
11251122 LOG (INFO ) << " segment flush consumes a lot time_ns " << timer.elapsed_time ()
11261123 << " , segmemt_size " << *segment_file_size;
11271124 }
1128- // change cache time to index
1129- if (config::is_cloud_mode ()) {
1130- // TODO(): check if the expiration time is 0, 只修改normal的cache 别的都不修改
1131- // Use path to calculate the Cache Hash
1132- auto cache_key = io::BlockFileCache::hash (_file_writer->path ().filename ().native ());
1133- auto * cache = io::FileCacheFactory::instance ()->get_by_path (cache_key);
1134- io::CacheContext ctx;
1135- ctx.cache_type = io::FileCacheType::NORMAL ;
1136- auto holder = cache->get_or_set (cache_key, index_start, *index_size, ctx);
1137- for (auto & segment : holder.file_blocks ) {
1138- static_cast <void >(segment->change_cache_type_self (io::FileCacheType::INDEX ));
1139- }
1140- }
11411125 return Status::OK ();
11421126}
11431127
0 commit comments