freemandealer commented on code in PR #64798:
URL: https://github.com/apache/doris/pull/64798#discussion_r3475082402
##########
be/src/io/cache/lru_queue_recorder.cpp:
##########
@@ -58,54 +58,62 @@ size_t LRUQueueRecorder::replay_queue_event(FileCacheType
type) {
CacheLRULogQueue& log_queue = get_lru_log_queue(type);
LRUQueue& shadow_queue = get_shadow_queue(type);
- std::lock_guard<std::mutex> lru_log_lock(_mutex_lru_log);
- std::unique_ptr<CacheLRULog> log;
+ size_t idx = file_cache_type_index(type);
size_t replayed = 0;
- while (log_queue.try_dequeue(log)) {
- release_lru_log_queue_slot(type);
- ++replayed;
- try {
- switch (log->type) {
- case CacheLRULogType::ADD: {
- shadow_queue.add(log->hash, log->offset, log->size,
lru_log_lock);
- break;
- }
- case CacheLRULogType::REMOVE: {
- auto it = shadow_queue.get(log->hash, log->offset,
lru_log_lock);
- if (it != std::list<LRUQueue::FileKeyAndOffset>::iterator()) {
- shadow_queue.remove(it, lru_log_lock);
- } else {
- LOG(WARNING) << "REMOVE failed, doesn't exist in shadow
queue";
+ {
+ std::lock_guard<std::mutex> lru_log_lock(_mutex_lru_log);
+ std::unique_ptr<CacheLRULog> log;
+ while (log_queue.try_dequeue(log)) {
+ release_lru_log_queue_slot(type);
+ ++replayed;
+ try {
+ switch (log->type) {
+ case CacheLRULogType::ADD: {
+ shadow_queue.add(log->hash, log->offset, log->size,
lru_log_lock);
+ limit_shadow_queue_size(shadow_queue, lru_log_lock);
Review Comment:
not a problem introduced by this PR but it's a good suggestion. I'll do it
on a seperate PR. This PR will be kept same with branch-3.0
--
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]