Ryan19929 opened a new pull request, #65642:
URL: https://github.com/apache/doris/pull/65642
### What problem does this PR solve?
Issue Number: #65632
Related PR: None
Problem Summary:
FE writes backup metadata and job information to staging directories under
`tmp_dir`, but these directories do not have a complete lifecycle management
mechanism.
Staging directories may remain after remote backups finish, local snapshots
expire or are evicted, journal replay creates files on another FE, or a
previous deletion attempt fails. These stale directories can accumulate
independently on each FE and consume disk space.
This PR centralizes staging directory cleanup in `BackupHandler`:
- Clean remote backup staging directories after the job reaches `FINISHED`
or `CANCELLED`.
- Clean local backup staging directories immediately after `CANCELLED`.
- Keep finished local snapshots until expiration or history eviction.
- Retry cleanup when a snapshot reader is active or directory deletion fails.
- Perform directory deletion outside the `BackupJob` monitor and snapshot
RPC reader thread.
- Avoid writing staging files from checkpoint replay.
- Periodically remove orphan staging directories using an independent,
configurable scan interval.
The local snapshot materialization path also pins the staging directory
while reading, rejects oversized uncompressed snapshots before loading them
into memory, and applies a bounded compressed-output size.
The orphan cleanup is controlled by:
- `backup_orphan_dir_keep_max_second`: minimum orphan retention period,
default 2 days.
- `backup_orphan_dir_cleanup_interval_second`: full orphan scan interval,
default 1 hour.
This PR does not change the backup staging path format, persisted
`BackupJob` fields, journal/image format, Thrift protocol, or local snapshot
indexing semantics.
### Release note
None
### Check List (For Author)
- Test <!-- At least one of them must be included. -->
- [ ] Regression test
- [ ] Unit Test
- [ ] Manual test (add detailed scripts or steps below)
- [ ] No need to test or manual test. Explain why:
- [ ] This is a refactor/code format and no logic has been changed.
- [ ] Previous test can cover this change.
- [ ] No code files have been changed.
- [ ] Other reason <!-- Add your reason? -->
- Behavior changed:
- [ ] No.
- [ ] Yes. <!-- Explain the behavior change -->
- Does this need documentation?
- [ ] No.
- [ ] Yes. <!-- Add document PR link here. eg:
https://github.com/apache/doris-website/pull/1214 -->
### Check List (For Reviewer who merge this PR)
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR should
merge into -->
--
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]