Save the last completion time for each cleanup operation performed on each optimization table. #3802
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why are the changes needed?
Close #3781.
Brief change log
To optimize table cleanup operations (Dangling-Delete_file cleanup, data expiration, orphan_file cleanup,snapshotsFile cleanup), the last cleanup time is saved. This ensures that after an AMS service restart, if a cleanup operation was completed just before the restart, the next cleanup operation will only be performed after exceeding the respective execution interval.
The execution flow is as follows:
Create the table table_cleanup_process to store the cleanup history of optimized tables.
During AMS initialization, batch query the cleanup history of optimized tables.
For optimization tables with a previous cleanup time, cache the cleanup history.
Determine whether the time interval since the last cleanup exceeds the cleanup operation execution interval.
For optimization tables exceeding the execution interval, execute the cleanup operation.
Otherwise, schedule for the next round of execution.
Since each table's cleanup operation takes varying durations, after a table's cleanup completes, update or insert the cleanup completion time in the table_cleanup_process table.
When an optimized table is deleted, its history in the table_cleanup_process must be removed.
How was this patch tested?
Add some test cases that check the changes thoroughly including negative and positive cases if possible
Add screenshots for manual tests if appropriate
Run test locally before making a pull request
Documentation