Uh oh!
There was an error while loading. Please reload this page.
[fix](recycler) Add recycle state for rs meta to avoid data loss - #58459
Conversation
hello-stephen
commented
Nov 27, 2025
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
| optional RecycleStatePB recycle_state = 111; | ||
| } | ||
| enum RecycleStatePB { |
There was a problem hiding this comment.
add scope to this state, easily to be conflict
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
a97bb6b to
331af0cCompare1914e9e to
ee7e572Compareee7e572 to
97b9243Comparewyxxxcat
commented
Dec 16, 2025
run buildall |
hello-stephen
commented
Dec 16, 2025
FE UT Coverage ReportIncrement line coverage `` 🎉 |
doris-robot
commented
Dec 16, 2025
TPC-H: Total hot run time: 36404 ms |
doris-robot
commented
Dec 16, 2025
TPC-DS: Total hot run time: 177868 ms |
doris-robot
commented
Dec 16, 2025
ClickBench: Total hot run time: 28.43 s |
hello-stephen
commented
Dec 16, 2025
BE UT Coverage ReportIncrement line coverage Increment coverage report
|
hello-stephen
commented
Jan 7, 2026
BE UT Coverage ReportIncrement line coverage Increment coverage report
|
hello-stephen
commented
Jan 7, 2026
BE Regression && UT Coverage ReportIncrement line coverage Increment coverage report
|
PR approved by at least one committer and no changes requested. |
Uh oh!
There was an error while loading. Please reload this page.
…che#58459) Add a `RECYCLE` state for rowset/meta (rs meta) and update the recycler logic to mark metadata as `RECYCLE` before final deletion. This reduces the risk of accidental data loss. ## Problem The recycler sometimes deletes rs meta too early (race conditions, restarts, or recovery cases), which can cause metadata and file inconsistencies or data loss. ## Solution - Introduce a `RECYCLE` intermediate state for rs meta. - When an item is chosen for cleanup, mark it `RECYCLE` and record a timestamp. - Only perform the final delete after a confirmation window or additional checks. - Make recovery/restart logic treat `RECYCLE` items as recoverable until final deletion. ## Main changes - Add `RECYCLE` to the rs meta state enum. - Update metadata APIs to set/query `RECYCLE`. - Update recycler to use two-step deletion: ***mark -> confirm -> abort txn/job and delete***. - Add logs and tests for the new flow. ## Test case ``` 1. begin_txn -> prepare_rowset -> force_recycle -> commit_rowset -> commit_txn 2. start_job -> prepare_rowset -> force_recycle -> commit_rowset -> finish_job Rowset will be marked as recycled to prevent commit_rowset and finish job/txn 3. begin_txn -> prepare_rowset -> commit_rowset -> force_recycle -> commit_txn 4. start_job -> prepare_rowset -> commit_rowset -> force_recycle -> finish_job Rowset will be marked as recycled to prevent finish job/txn 5. begin_txn -> prepare_rowset -> force_recycle * 2 -> commit_rowset -> commit_txn 6. start_job -> prepare_rowset -> force_recycle * 2 -> commit_rowset -> finish_job 7. begin_txn -> prepare_rowset -> commit_rowset -> force_recycle * 2 -> commit_txn 9. start_job -> prepare_rowset -> commit_rowset -> force_recycle * 2 -> finish_job 10. delete_job -> commit_rowset -> force_recycle * 2 -> finish_job 11. delete_job -> prepare_rowset -> commit_rowset -> force_recycle * 2 -> finish_job 12. delete_job -> prepare_rowset -> force_recycle * 2 -> commit_rowset -> finish_job Double recycle job will mark rowset as recycled and abort job/txn, then delete data and kv ```
…che#58459) Add a `RECYCLE` state for rowset/meta (rs meta) and update the recycler logic to mark metadata as `RECYCLE` before final deletion. This reduces the risk of accidental data loss. ## Problem The recycler sometimes deletes rs meta too early (race conditions, restarts, or recovery cases), which can cause metadata and file inconsistencies or data loss. ## Solution - Introduce a `RECYCLE` intermediate state for rs meta. - When an item is chosen for cleanup, mark it `RECYCLE` and record a timestamp. - Only perform the final delete after a confirmation window or additional checks. - Make recovery/restart logic treat `RECYCLE` items as recoverable until final deletion. ## Main changes - Add `RECYCLE` to the rs meta state enum. - Update metadata APIs to set/query `RECYCLE`. - Update recycler to use two-step deletion: ***mark -> confirm -> abort txn/job and delete***. - Add logs and tests for the new flow. ## Test case ``` 1. begin_txn -> prepare_rowset -> force_recycle -> commit_rowset -> commit_txn 2. start_job -> prepare_rowset -> force_recycle -> commit_rowset -> finish_job Rowset will be marked as recycled to prevent commit_rowset and finish job/txn 3. begin_txn -> prepare_rowset -> commit_rowset -> force_recycle -> commit_txn 4. start_job -> prepare_rowset -> commit_rowset -> force_recycle -> finish_job Rowset will be marked as recycled to prevent finish job/txn 5. begin_txn -> prepare_rowset -> force_recycle * 2 -> commit_rowset -> commit_txn 6. start_job -> prepare_rowset -> force_recycle * 2 -> commit_rowset -> finish_job 7. begin_txn -> prepare_rowset -> commit_rowset -> force_recycle * 2 -> commit_txn 9. start_job -> prepare_rowset -> commit_rowset -> force_recycle * 2 -> finish_job 10. delete_job -> commit_rowset -> force_recycle * 2 -> finish_job 11. delete_job -> prepare_rowset -> commit_rowset -> force_recycle * 2 -> finish_job 12. delete_job -> prepare_rowset -> force_recycle * 2 -> commit_rowset -> finish_job Double recycle job will mark rowset as recycled and abort job/txn, then delete data and kv ```
when enable_recycle_delete_rowset_key_check is false, idempotent check is invalid bug pr related: #58459
when enable_recycle_delete_rowset_key_check is false, idempotent check is invalid bug pr related: #58459
when enable_recycle_delete_rowset_key_check is false, idempotent check is invalid bug pr related: #58459
when enable_recycle_delete_rowset_key_check is false, idempotent check is invalid bug pr related: apache#58459
…ally reading key (#62476) fix: #58459 This PR reduces point-read overhead in Cloud recycler rowset cleanup. Previously, each scanned rowset could immediately trigger metadata reads/writes to mark it as recycled or abort its related transaction/job. The new flow records rowset keys during scanning, then batch-processes recycled marks and deferred abort tasks in worker batches. Prepare rowset deletion is also deferred so the recycler re-reads the latest metadata before deleting data. This keeps the existing recycle safety semantics while reducing per-rowset KV operations during large recycle scans. **Release mode test** Recycling 10,000 rowsets, after enabling `enable_mark_delete_rowset_before_recycle` and `enable_abort_txn_and_job_for_delete_rowset_before_recycle`, the processing time increased by approximately 10%. **3514 ms -> 175 ms(mark) + 3811(abort and recycle)**
…ally reading key (#62476) fix: #58459 This PR reduces point-read overhead in Cloud recycler rowset cleanup. Previously, each scanned rowset could immediately trigger metadata reads/writes to mark it as recycled or abort its related transaction/job. The new flow records rowset keys during scanning, then batch-processes recycled marks and deferred abort tasks in worker batches. Prepare rowset deletion is also deferred so the recycler re-reads the latest metadata before deleting data. This keeps the existing recycle safety semantics while reducing per-rowset KV operations during large recycle scans. **Release mode test** Recycling 10,000 rowsets, after enabling `enable_mark_delete_rowset_before_recycle` and `enable_abort_txn_and_job_for_delete_rowset_before_recycle`, the processing time increased by approximately 10%. **3514 ms -> 175 ms(mark) + 3811(abort and recycle)**
…ally reading key (#62476) fix: #58459 This PR reduces point-read overhead in Cloud recycler rowset cleanup. Previously, each scanned rowset could immediately trigger metadata reads/writes to mark it as recycled or abort its related transaction/job. The new flow records rowset keys during scanning, then batch-processes recycled marks and deferred abort tasks in worker batches. Prepare rowset deletion is also deferred so the recycler re-reads the latest metadata before deleting data. This keeps the existing recycle safety semantics while reducing per-rowset KV operations during large recycle scans. **Release mode test** Recycling 10,000 rowsets, after enabling `enable_mark_delete_rowset_before_recycle` and `enable_abort_txn_and_job_for_delete_rowset_before_recycle`, the processing time increased by approximately 10%. **3514 ms -> 175 ms(mark) + 3811(abort and recycle)**
What problem does this PR solve?
Summary
Add a
RECYCLEstate for rowset/meta (rs meta) and update the recycler logic to mark metadata asRECYCLEbefore final deletion. This reduces the risk of accidental data loss.Problem
The recycler sometimes deletes rs meta too early (race conditions, restarts, or recovery cases), which can cause metadata and file inconsistencies or data loss.
Solution
RECYCLEintermediate state for rs meta.RECYCLEand record a timestamp.RECYCLEitems as recoverable until final deletion.Main changes
RECYCLEto the rs meta state enum.RECYCLE.Test case
Problem Summary:
Release note
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)