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


##########
be/src/io/cache/block_file_cache_ttl_mgr.cpp:
##########
@@ -238,9 +244,10 @@ void 
BlockFileCacheTtlMgr::run_backgroud_update_ttl_info_map() {
                             }
                         }
                     } else {
-                        // Remove from TTL map if TTL is 0
-                        _ttl_info_map.erase(tablet_id);
-                        need_convert_from_ttl = true;
+                        // Periodically reconcile blocks restored from 
persisted TTL metadata,
+                        // because _ttl_info_map is rebuilt only in memory 
after restart.
+                        need_convert_from_ttl =
+                                _ttl_info_map.erase(tablet_id) > 0 || 
need_full_reconcile;

Review Comment:
   This still misses the restart case unless some later read registers the 
tablet id. The update loop copies only `_tablet_id_set` into 
`tablet_ids_to_process`, so `need_full_reconcile` is never evaluated for tablet 
ids that were restored only from persisted cache metadata. The RocksDB restore 
path builds `CacheContext::tablet_id` from the meta key and calls 
`mgr->add_cell(...)` directly, but that path does not call 
`_ttl_mgr->register_tablet_id()`; registration only happens from the 
`get_or_set()` split path. Because `_ttl_mgr` is created after 
`_storage->init(this)`, a BE restart can reload a TTL block for a tablet whose 
current `ttl_seconds` is 0, never seed `_tablet_id_set`, and leave the block in 
the TTL queue until a future query happens to register that tablet. The new 
test also calls `register_tablet_id()` manually, so it does not cover that 
restart-only state. Please seed/register tablet ids during metadata restore, or 
make the periodic reconcile enumerate persisted metadata
  directly.



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