freemandealer commented on code in PR #46561:
URL: https://github.com/apache/doris/pull/46561#discussion_r1922981585
##########
be/src/io/cache/block_file_cache.cpp:
##########
@@ -1789,9 +1718,41 @@ void BlockFileCache::run_background_operation() {
if (cur_time < begin->first) {
break;
}
- remove_if_ttl_file_unlock(begin->second, false, cache_lock);
+ remove_if_ttl_file_blocks(begin->second, false, cache_lock,
false);
+ }
+ }
+ }
+}
+
+void BlockFileCache::run_background_gc() {
+ FileCacheKey key;
+ static const size_t interval_ms = 100;
+ const size_t batch_limit = config::file_cache_remove_block_qps_limit *
interval_ms / 1000;
+ size_t batch_count = 0;
+ while (!_close) {
+ {
+ std::unique_lock close_lock(_close_mtx);
+ _close_cv.wait_for(close_lock,
std::chrono::milliseconds(interval_ms));
+ if (_close) {
+ break;
+ }
+ }
+ while (_recycle_keys.try_dequeue(key)) {
+ if (batch_count >= batch_limit) {
+ break;
+ }
+
+ int64_t duration_ns = 0;
+ SCOPED_RAW_TIMER(&duration_ns);
+ Status st = _storage->remove(key);
+ *_storage_async_remove_latency << duration_ns;
Review Comment:
> microseconds is enough, and easy to keep consistent with existing latency
unit
OK, another monitor PR is on the way. Do it later.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]