Skip to content

Commit b1585e1

Browse files
[fix](filecache) correct ttl metrics (#60252)
add changing type to Normal when TTL type & TTL set to 0 to make ttl queueu size correct
1 parent 84f3725 commit b1585e1

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

‎be/src/io/cache/block_file_cache_ttl_mgr.cpp‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ void BlockFileCacheTtlMgr::run_backgroud_update_ttl_info_map() {
180180
}
181181

182182
// Update TTL info map
183+
bool need_convert_from_ttl = false;
183184
{
184185
std::lock_guard<std::mutex> lock(_ttl_info_mutex);
185186
if (ttl > 0) {
@@ -204,6 +205,19 @@ void BlockFileCacheTtlMgr::run_backgroud_update_ttl_info_map() {
204205
} else {
205206
// Remove from TTL map if TTL is 0
206207
_ttl_info_map.erase(tablet_id);
208+
need_convert_from_ttl = true;
209+
}
210+
}
211+
212+
if (need_convert_from_ttl) {
213+
FileBlocks blocks = get_file_blocks_from_tablet_id(tablet_id);
214+
for (auto& block : blocks) {
215+
if (block->cache_type() == FileCacheType::TTL) {
216+
auto st = block->change_cache_type(FileCacheType::NORMAL);
217+
if (!st.ok()) {
218+
LOG(WARNING) << "Failed to convert block back to NORMAL cache_type";
219+
}
220+
}
207221
}
208222
}
209223
}

0 commit comments

Comments
 (0)