Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions be/src/common/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1090,6 +1090,8 @@ DEFINE_mInt64(cache_lock_held_long_tail_threshold_us, "30000000");
DEFINE_mBool(enable_file_cache_keep_base_compaction_output, "false");
DEFINE_mInt64(file_cache_remove_block_qps_limit, "1000");
DEFINE_mInt64(file_cache_background_gc_interval_ms, "100");
DEFINE_mInt64(file_cache_background_monitor_interval_ms, "5000");
DEFINE_mInt64(file_cache_background_ttl_gc_interval_ms, "20000");

DEFINE_mInt32(index_cache_entry_stay_time_after_lookup_s, "1800");
DEFINE_mInt32(inverted_index_cache_stale_sweep_time_sec, "600");
Expand Down
2 changes: 2 additions & 0 deletions be/src/common/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -1135,6 +1135,8 @@ DECLARE_mInt64(cache_lock_held_long_tail_threshold_us);
DECLARE_mBool(enable_file_cache_keep_base_compaction_output);
DECLARE_mInt64(file_cache_remove_block_qps_limit);
DECLARE_mInt64(file_cache_background_gc_interval_ms);
DECLARE_mInt64(file_cache_background_monitor_interval_ms);
DECLARE_mInt64(file_cache_background_ttl_gc_interval_ms);
// inverted index searcher cache
// cache entry stay time after lookup
DECLARE_mInt32(index_cache_entry_stay_time_after_lookup_s);
Expand Down
14 changes: 7 additions & 7 deletions be/src/io/cache/block_file_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1773,9 +1773,9 @@ void BlockFileCache::check_need_evict_cache_in_advance() {
}

void BlockFileCache::run_background_monitor() {
int64_t interval_time_seconds = 20;
while (!_close) {
TEST_SYNC_POINT_CALLBACK("BlockFileCache::set_sleep_time", &interval_time_seconds);
int64_t interval_ms = config::file_cache_background_monitor_interval_ms;
TEST_SYNC_POINT_CALLBACK("BlockFileCache::set_sleep_time", &interval_ms);
check_disk_resource_limit();
if (config::enable_evict_file_cache_in_advance) {
check_need_evict_cache_in_advance();
Expand All @@ -1785,7 +1785,7 @@ void BlockFileCache::run_background_monitor() {

{
std::unique_lock close_lock(_close_mtx);
_close_cv.wait_for(close_lock, std::chrono::seconds(interval_time_seconds));
_close_cv.wait_for(close_lock, std::chrono::milliseconds(interval_ms));
if (_close) {
break;
}
Expand Down Expand Up @@ -1830,12 +1830,12 @@ void BlockFileCache::run_background_monitor() {
}

void BlockFileCache::run_background_ttl_gc() { // TODO(zhengyu): fix!
int64_t interval_time_seconds = 20;
while (!_close) {
TEST_SYNC_POINT_CALLBACK("BlockFileCache::set_sleep_time", &interval_time_seconds);
int64_t interval_ms = config::file_cache_background_ttl_gc_interval_ms;
TEST_SYNC_POINT_CALLBACK("BlockFileCache::set_sleep_time", &interval_ms);
{
std::unique_lock close_lock(_close_mtx);
_close_cv.wait_for(close_lock, std::chrono::seconds(interval_time_seconds));
_close_cv.wait_for(close_lock, std::chrono::milliseconds(interval_ms));
if (_close) {
break;
}
Expand All @@ -1858,7 +1858,7 @@ void BlockFileCache::run_background_gc() {
FileCacheKey key;
size_t batch_count = 0;
while (!_close) {
size_t interval_ms = config::file_cache_background_gc_interval_ms;
int64_t interval_ms = config::file_cache_background_gc_interval_ms;
size_t batch_limit = config::file_cache_remove_block_qps_limit * interval_ms / 1000;
{
std::unique_lock close_lock(_close_mtx);
Expand Down
14 changes: 7 additions & 7 deletions be/test/io/cache/block_file_cache_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2173,7 +2173,7 @@ TEST_F(BlockFileCacheTest, ttl_normal) {
SyncPoint::CallbackGuard guard1;
sp->set_call_back(
"BlockFileCache::set_sleep_time",
[](auto&& args) { *try_any_cast<int64_t*>(args[0]) = 1; }, &guard1);
[](auto&& args) { *try_any_cast<int64_t*>(args[0]) = 1000; }, &guard1);
sp->enable_processing();
TUniqueId query_id;
query_id.hi = 1;
Expand Down Expand Up @@ -2272,7 +2272,7 @@ TEST_F(BlockFileCacheTest, ttl_modify) {
SyncPoint::CallbackGuard guard1;
sp->set_call_back(
"BlockFileCache::set_sleep_time",
[](auto&& args) { *try_any_cast<int64_t*>(args[0]) = 1; }, &guard1);
[](auto&& args) { *try_any_cast<int64_t*>(args[0]) = 1000; }, &guard1);
sp->enable_processing();
TUniqueId query_id;
query_id.hi = 1;
Expand Down Expand Up @@ -2355,7 +2355,7 @@ TEST_F(BlockFileCacheTest, ttl_modify_memory_storage) {
SyncPoint::CallbackGuard guard1;
sp->set_call_back(
"BlockFileCache::set_sleep_time",
[](auto&& args) { *try_any_cast<int64_t*>(args[0]) = 1; }, &guard1);
[](auto&& args) { *try_any_cast<int64_t*>(args[0]) = 1000; }, &guard1);
sp->enable_processing();
TUniqueId query_id;
query_id.hi = 1;
Expand Down Expand Up @@ -2996,7 +2996,7 @@ TEST_F(BlockFileCacheTest, recyle_cache_async_ttl) {
SyncPoint::CallbackGuard guard1;
sp->set_call_back(
"BlockFileCache::set_sleep_time",
[](auto&& args) { *try_any_cast<int64_t*>(args[0]) = 1; }, &guard1);
[](auto&& args) { *try_any_cast<int64_t*>(args[0]) = 1000; }, &guard1);
SyncPoint::CallbackGuard guard2;
sp->set_call_back(
"BlockFileCache::set_remove_batch",
Expand Down Expand Up @@ -3126,7 +3126,7 @@ TEST_F(BlockFileCacheTest, test_factory_1) {
SyncPoint::CallbackGuard guard1;
sp->set_call_back(
"BlockFileCache::set_sleep_time",
[](auto&& args) { *try_any_cast<int64_t*>(args[0]) = 1; }, &guard1);
[](auto&& args) { *try_any_cast<int64_t*>(args[0]) = 1000; }, &guard1);
SyncPoint::CallbackGuard guard2;
sp->set_call_back(
"BlockFileCache::set_remove_batch",
Expand Down Expand Up @@ -4899,7 +4899,7 @@ TEST_F(BlockFileCacheTest, reset_capacity) {
sp->clear_call_back("BlockFileCache::set_sleep_time");
}};
sp->set_call_back("BlockFileCache::set_sleep_time",
[](auto&& args) { *try_any_cast<int64_t*>(args[0]) = 1; });
[](auto&& args) { *try_any_cast<int64_t*>(args[0]) = 1000; });
sp->set_call_back("BlockFileCache::set_remove_batch",
[](auto&& args) { *try_any_cast<int*>(args[0]) = 2; });
sp->enable_processing();
Expand Down Expand Up @@ -6751,7 +6751,7 @@ TEST_F(BlockFileCacheTest, evict_in_advance) {
SyncPoint::CallbackGuard guard1;
sp->set_call_back(
"BlockFileCache::set_sleep_time",
[](auto&& args) { *try_any_cast<int64_t*>(args[0]) = 1; }, &guard1);
[](auto&& args) { *try_any_cast<int64_t*>(args[0]) = 1000; }, &guard1);
sp->enable_processing();
fs::create_directories(cache_base_path);
TUniqueId query_id;
Expand Down
Loading