Uh oh!
There was an error while loading. Please reload this page.
[fix](job) Recover broker load from visible transaction - #66987
Conversation
…problem does this PR solve?\n\nIssue Number: N/A\n\nRelated PR: apache#66469\n\nProblem Summary: In cloud mode, a broker load transaction can become visible in meta service before FE persists the final load-job record. If FE restarts in that window, the replayed PENDING job begins the same label again and is cancelled after conflicting with its own visible transaction. Look up the label transaction, verify its callback belongs to the job, reuse PREPARE transactions, and finish the job from VISIBLE transactions while persisting the cloud final operation.\n\n### Release note\n\nFix broker load jobs being reported as cancelled after FE restart even though their transactions were already visible.\n\n### Check List (For Author)\n\n- Test: Unit Test\n - ./run-fe-ut.sh --run org.apache.doris.load.loadv2.BrokerLoadJobTest\n- Behavior changed: Yes. A replayed broker load adopts its own visible transaction and finishes successfully.\n- Does this need documentation: No
hello-stephen
commented
Aug 20, 2026
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
sollhui
commented
Aug 21, 2026
run buildall |
sollhui
commented
Aug 21, 2026
/review |
There was a problem hiding this comment.
Review outcome: request changes. The branch-local PREPARE/VISIBLE/foreign handling is covered, but the real replay lifecycle still has five correctness and persistence failures described inline.
Checkpoint conclusions:
- Goal and test proof: partially achieved; direct VISIBLE recovery works in the mock, but actual task ordering, durable COMMITTED, cancellation, and second replay remain unsafe.
- Scope and quality: the production change is focused and reuses existing transaction APIs; no unrelated change was found.
- Concurrency: attachment replay and FINISHED selection are not atomic with user cancellation.
- Lifecycle and cleanup: a reached base-job recovery removes the callback and the later pending callback is ignored; the suspected CopyJob hook issue was dismissed because no current replayed CopyJob can reach this branch.
- Configuration: no new option is added, but the existing default cloud lazy-commit setting exposes the COMMITTED failure.
- Compatibility and parallel paths: no API, protocol, storage-format, FE-BE variable, or rolling-version surface changes; local/cloud status mapping and all production subclasses were checked.
- Conditions and exceptions: null, foreign, aborted, and unknown transactions fail closed; source-discovery failures and owned COMMITTED are mishandled as noted inline.
- Tests and results: the Mockito tests cover only direct helper branches and omit real source ordering, a persistent COMMITTED txn, a real attachment, cancellation, durable final fields, and a second replay. Per the review-only runner instruction, no build or test was run.
- Observability and persistence: the adopted transaction ID is not replayable and recovered finish time is replaced with FE recovery time.
- Transaction/data correctness: an already successful or irrevocably committed load can be durably represented as CANCELLED.
- Performance: the added lookup is confined to the exceptional label-conflict path; no hot-path concern was found.
- Other issues: three review rounds converged with no additional distinct finding.
No additional user-provided focus was supplied.
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.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
hello-stephen
commented
Aug 21, 2026
FE UT Coverage ReportIncrement line coverage |
hello-stephen
commented
Aug 21, 2026
TPC-H: Total hot run time: 17519 ms |
hello-stephen
commented
Aug 21, 2026
TPC-DS: Total hot run time: 83960 ms |
### What problem does this PR solve? Issue Number: N/A Related PR: apache#66987 Problem Summary: The visible-transaction recovery added for broker load could race with cancellation and persisted neither the recovered transaction ID nor the Meta Service finish time. Make attachment replay and terminal-state selection atomic under the load-job lock, persist the recovered transaction ID in cloud end-load-job journals, and retain the transaction durable finish time. ### Release note None ### Check List (For Author) - Test: Unit Test - ./run-fe-ut.sh --run org.apache.doris.load.loadv2.BrokerLoadJobTest - Behavior changed: No. This completes the consistency and persistence guarantees of the recovery path added by the PR. - Does this need documentation: No
hello-stephen
commented
Aug 21, 2026
ClickBench: Total hot run time: 14.71 s |
9cf58df to
c3967b9Comparehello-stephen
commented
Aug 21, 2026
FE Regression Coverage ReportIncrement line coverage |
Uh oh!
There was an error while loading. Please reload this page.
### What problem does this PR solve? In cloud mode, a Broker Load transaction can become VISIBLE in Meta Service before FE persists the final Load Job record. If FE restarts in that window, the replayed PENDING job begins the same label again and is cancelled after conflicting with its own visible transaction. This change looks up the transaction by label, verifies that its callback ID belongs to the current Load Job, reuses PREPARE transactions, and finishes the job immediately when the transaction is already VISIBLE. For Cloud Broker Load, the final operation is persisted to EditLog. ### Release note Fix Broker Load jobs being reported as cancelled after FE restart even though their transactions were already visible.
Related PR: #66987 Problem Summary: In cloud mode, a Broker Load attempt can have many loading tasks queued in the FE executor. After the first task failure moves the job to RETRY, a queued task can currently move it back to LOADING. This allows several concurrent failures to enter the job-level retry path and wait on the shared idToTasks map. An older retry handler can consequently follow tasks from a newer attempt. If that newer attempt finishes successfully, the stale handler can overwrite FINISHED with PENDING, schedule another pending task, and reuse the already VISIBLE transaction. New rowsets are then rejected by Meta Service because the transaction is no longer PREPARED. This change closes the current attempt once the job enters RETRY and verifies that the job is still RETRY before scheduling the next PENDING attempt. It does not change transaction protocols, Meta Service behavior, or the non-cloud retry implementation. ### Release note Fix Cloud Broker Load jobs being retried after a later attempt already finished.
What problem does this PR solve?
In cloud mode, a Broker Load transaction can become VISIBLE in Meta Service before FE persists the final Load Job record. If FE restarts in that window, the replayed PENDING job begins the same label again and is cancelled after conflicting with its own visible transaction.
This change looks up the transaction by label, verifies that its callback ID belongs to the current Load Job, reuses PREPARE transactions, and finishes the job immediately when the transaction is already VISIBLE. For Cloud Broker Load, the final operation is persisted to EditLog.
Release note
Fix Broker Load jobs being reported as cancelled after FE restart even though their transactions were already visible.
Check List (For Author)
Test
./run-fe-ut.sh --run org.apache.doris.load.loadv2.BrokerLoadJobTestBehavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)