Skip to content
31 changes: 0 additions & 31 deletions be/src/cloud/cloud_storage_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,42 +300,11 @@ Status CloudStorageEngine::start_bg_threads(std::shared_ptr<WorkloadGroup> wg_sp
"StorageEngine", "lease_compaction_thread",
[this]() { this->_lease_compaction_thread_callback(); }, &_bg_threads.emplace_back()));

if (config::file_cache_ttl_valid_check_interval_second != 0) {
RETURN_IF_ERROR(Thread::create(
"StorageEngine", "check_file_cache_ttl_block_valid_thread",
[this]() { this->_check_file_cache_ttl_block_valid(); },
&_bg_threads.emplace_back()));
LOG(INFO) << "check file cache ttl block valid thread started";
}

LOG(INFO) << "lease compaction thread started";

return Status::OK();
}

void CloudStorageEngine::_check_file_cache_ttl_block_valid() {
int64_t interval_seconds = config::file_cache_ttl_valid_check_interval_second / 2;
auto check_ttl = [](const std::weak_ptr<CloudTablet>& tablet_wk) {
auto tablet = tablet_wk.lock();
if (!tablet) return;
if (tablet->tablet_meta()->ttl_seconds() == 0) return;
auto rowsets = tablet->get_snapshot_rowset();
for (const auto& rowset : rowsets) {
int64_t ttl_seconds = tablet->tablet_meta()->ttl_seconds();
if (rowset->newest_write_timestamp() + ttl_seconds <= UnixSeconds()) continue;
for (uint32_t seg_id = 0; seg_id < rowset->num_segments(); seg_id++) {
auto hash = Segment::file_cache_key(rowset->rowset_id().to_string(), seg_id);
auto* file_cache = io::FileCacheFactory::instance()->get_by_path(hash);
file_cache->update_ttl_atime(hash);
}
}
};
while (!_stop_background_threads_latch.wait_for(std::chrono::seconds(interval_seconds))) {
auto weak_tablets = tablet_mgr().get_weak_tablets();
std::for_each(weak_tablets.begin(), weak_tablets.end(), check_ttl);
}
}

void CloudStorageEngine::sync_storage_vault() {
cloud::StorageVaultInfos vault_infos;
bool enable_storage_vault = false;
Expand Down
1 change: 0 additions & 1 deletion be/src/cloud/cloud_storage_engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ class CloudStorageEngine final : public BaseStorageEngine {
ThreadPool& calc_tablet_delete_bitmap_task_thread_pool() const {
return *_calc_tablet_delete_bitmap_task_thread_pool;
}
void _check_file_cache_ttl_block_valid();

std::optional<StorageResource> get_storage_resource(const std::string& vault_id) {
VLOG_DEBUG << "Getting storage resource for vault_id: " << vault_id;
Expand Down
4 changes: 3 additions & 1 deletion be/src/cloud/cloud_tablet_mgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,9 @@ void CloudTabletMgr::vacuum_stale_rowsets(const CountDownLatch& stop_latch) {

num_vacuumed += t->delete_expired_stale_rowsets();
}
LOG_INFO("finish vacuum stale rowsets").tag("num_vacuumed", num_vacuumed);
LOG_INFO("finish vacuum stale rowsets")
.tag("num_vacuumed", num_vacuumed)
.tag("num_tablets", tablets_to_vacuum.size());
}

std::vector<std::weak_ptr<CloudTablet>> CloudTabletMgr::get_weak_tablets() {
Expand Down
3 changes: 1 addition & 2 deletions be/src/common/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1050,16 +1050,15 @@ DEFINE_mInt32(file_cache_enter_disk_resource_limit_mode_percent, "88");
DEFINE_mInt32(file_cache_exit_disk_resource_limit_mode_percent, "80");
DEFINE_mBool(enable_read_cache_file_directly, "false");
DEFINE_mBool(file_cache_enable_evict_from_other_queue_by_size, "true");
DEFINE_mInt64(file_cache_ttl_valid_check_interval_second, "0"); // zero for not checking
// If true, evict the ttl cache using LRU when full.
// Otherwise, only expiration can evict ttl and new data won't add to cache when full.
DEFINE_Bool(enable_ttl_cache_evict_using_lru, "true");
DEFINE_mBool(enbale_dump_error_file, "true");
// limit the max size of error log on disk
DEFINE_mInt64(file_cache_error_log_limit_bytes, "209715200"); // 200MB
DEFINE_mInt64(cache_lock_long_tail_threshold, "1000");
DEFINE_Int64(file_cache_recycle_keys_size, "1000000");
DEFINE_mBool(enable_file_cache_keep_base_compaction_output, "false");
DEFINE_mInt64(file_cache_remove_block_qps_limit, "1000");

DEFINE_mInt32(index_cache_entry_stay_time_after_lookup_s, "1800");
DEFINE_mInt32(inverted_index_cache_stale_sweep_time_sec, "600");
Expand Down
4 changes: 1 addition & 3 deletions be/src/common/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -1090,23 +1090,21 @@ DECLARE_Int32(file_cache_enter_disk_resource_limit_mode_percent);
DECLARE_Int32(file_cache_exit_disk_resource_limit_mode_percent);
DECLARE_mBool(enable_read_cache_file_directly);
DECLARE_Bool(file_cache_enable_evict_from_other_queue_by_size);
DECLARE_mInt64(file_cache_ttl_valid_check_interval_second);
// If true, evict the ttl cache using LRU when full.
// Otherwise, only expiration can evict ttl and new data won't add to cache when full.
DECLARE_Bool(enable_ttl_cache_evict_using_lru);
DECLARE_mBool(enbale_dump_error_file);
// limit the max size of error log on disk
DECLARE_mInt64(file_cache_error_log_limit_bytes);
DECLARE_mInt64(cache_lock_long_tail_threshold);
DECLARE_Int64(file_cache_recycle_keys_size);
// Base compaction may retrieve and produce some less frequently accessed data,
// potentially affecting the file cache hit rate.
// This configuration determines whether to retain the output within the file cache.
// Make your choice based on the following considerations:
// If your file cache is ample enough to accommodate all the data in your database,
// enable this option; otherwise, it is recommended to leave it disabled.
DECLARE_mBool(enable_file_cache_keep_base_compaction_output);

DECLARE_mInt64(file_cache_remove_block_qps_limit);
// inverted index searcher cache
// cache entry stay time after lookup
DECLARE_mInt32(index_cache_entry_stay_time_after_lookup_s);
Expand Down
Loading
Loading