gavinchou commented on code in PR #58903:
URL: https://github.com/apache/doris/pull/58903#discussion_r2605721896
##########
be/src/io/cache/block_file_cache.cpp:
##########
@@ -2203,18 +2279,24 @@ void BlockFileCache::run_background_block_lru_update() {
}
}
+ batch.clear();
+ batch.reserve(batch_limit);
+ size_t drained = _need_update_lru_blocks.drain(batch_limit, &batch);
+ if (drained == 0) {
+ *_need_update_lru_blocks_length_recorder <<
_need_update_lru_blocks.size();
+ continue;
+ }
+
int64_t duration_ns = 0;
{
SCOPED_CACHE_LOCK(_mutex, this);
SCOPED_RAW_TIMER(&duration_ns);
- while (batch_count < batch_limit &&
_need_update_lru_blocks.try_dequeue(block)) {
+ for (auto& block : batch) {
Review Comment:
release the _mutex for a while if the for loop takes too long.
```
start = now()
muetx.lock()
for () {
if (now() - start > 10ms) {
mtx.unlock();
sleep(1m);
mtx.lock();
start=now()
}
}
mtx.unlock();
--
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]