github-actions[bot] commented on code in PR #64381:
URL: https://github.com/apache/doris/pull/64381#discussion_r3388752087


##########
be/src/io/cache/lru_queue_recorder.cpp:
##########
@@ -17,27 +17,53 @@
 
 #include "io/cache/lru_queue_recorder.h"
 
+#include "common/check.h"
+#include "common/config.h"
 #include "io/cache/block_file_cache.h"
 #include "io/cache/file_cache_common.h"
 
 namespace doris::io {
 
+namespace {
+
+size_t file_cache_type_index(FileCacheType type) {
+    return static_cast<size_t>(type);
+}
+
+} // namespace
+
 void LRUQueueRecorder::record_queue_event(FileCacheType type, CacheLRULogType 
log_type,
                                           const UInt128Wrapper hash, const 
size_t offset,
                                           const size_t size) {
-    CacheLRULogQueue& log_queue = get_lru_log_queue(type);
-    log_queue.enqueue(std::make_unique<CacheLRULog>(log_type, hash, offset, 
size));
+    if (config::file_cache_background_lru_dump_tail_record_num <= 0) {
+        return;
+    }
     ++(_lru_queue_update_cnt_from_last_dump[type]);
+    auto log = std::make_unique<CacheLRULog>(log_type, hash, offset, size);
+    if (!reserve_lru_log_queue_slot(type)) {
+        return;

Review Comment:
   This return (and the `tail_record_num <= 0` return above) silently drops a 
state mutation while the shadow queue remains eligible for future dumps. The 
dump thread persists `_recorder->get_shadow_queue(type)`, and `restore_queue()` 
later trusts that dump before storage initialization. A concrete failure is: an 
ADD for block A has already been replayed into the shadow queue; the real cache 
removes A; the REMOVE record is skipped because this queue is full (or 
recording was temporarily disabled); the next dump writes A; after restart 
`restore_queue()` calls `add_cell(... DOWNLOADED ...)` for A even though the 
storage metadata/file may have been removed, and 
`load_cache_info_into_memory_*()` will not clear it. Please either avoid loss 
for state-changing records or mark/rebuild the affected shadow queue before any 
future dump after a dropped record.



-- 
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]

Reply via email to