fix(mito): honor unknown file lingering time#8365
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the garbage collection (GC) logic for Mito engine files. Specifically, it changes the default unknown_file_lingering_time from 1 hour to 1 day to prevent accidental deletion of pre-manifest files, and updates should_delete_file to check the object's last_modified timestamp against this TTL for active regions. It also refactors the GC worker code to extract list_to_be_deleted_files_impl and filter_deletable_files as standalone functions, accompanied by comprehensive unit tests. The review feedback suggests making list_to_be_deleted_files_impl synchronous, as it contains no asynchronous operations, which would eliminate unnecessary future-polling overhead in both the production code and the newly added tests.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Signed-off-by: discord9 <discord9@163.com>
Signed-off-by: discord9 <discord9@163.com>
Signed-off-by: discord9 <discord9@163.com>
Signed-off-by: discord9 <discord9@163.com>
275b984 to
f28591b
Compare
Signed-off-by: discord9 <discord9@163.com>
Signed-off-by: discord9 <discord9@163.com>
Signed-off-by: discord9 <discord9@163.com>
Signed-off-by: discord9 <discord9@163.com>
I hereby agree to the terms of the GreptimeDB CLA.
Refer to a related PR or issue link (optional)
N/A
What's changed and what's your intention?
This PR restores the intended behavior of
region_engine.mito.gc.unknown_file_lingering_timefor full-listing GC.last_modifiedtimestamp is older thannow - unknown_file_lingering_time.lingering_timeeligibility and are not affected byunknown_file_lingering_time.unknown_file_lingering_timeis changed from1hto1dto reduce risk of deleting pre-manifest files from long-running flush/compaction.Verification performed:
cargo test -p mito2 -- "gc::worker_test" --nocapturecargo check -p mito2 --testsgit diff --checkPR Checklist
Please convert it to a draft if some of the following conditions are not met.