Skip to content

branch-4.1: [fix](fe) Persist routine load job before scheduling #67681 - #68560

Closed
github-actions[bot] wants to merge 1 commit into
branch-4.1from
auto-pick-67681-branch-4.1
Closed

github-actions[bot] wants to merge 1 commit into
branch-4.1from
auto-pick-67681-branch-4.1

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Cherry-picked from #67681

@github-actions
github-actions Bot requested a review from yiguolei as a code owner September 28, 2026 08:42
@hello-stephen

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@hello-stephen

Copy link
Copy Markdown
Contributor

run buildall

@0AyanamiRei

Copy link
Copy Markdown
Contributor

run feut

### What problem does this PR solve?

Issue Number: None

Related PR: None

Problem Summary:

Routine load creation published a mutable job to the scheduler before
serializing its create journal. The scheduler could change the job from
`NEED_SCHEDULE` to `RUNNING` before serialization, while runtime task
membership was not persisted. Replaying such a create record restored a
`RUNNING` job with no tasks. With stable source topology, the job could
remain stuck without consuming data.

This PR makes the create journal durable before publishing the job to
the scheduler. The scheduler cannot observe or mutate the job while its
initial `NEED_SCHEDULE` state is being serialized.

Before:

```text
publish job -> scheduler may change it to RUNNING -> serialize create journal
```

After:

```text
serialize create journal in NEED_SCHEDULE -> publish job -> scheduler creates tasks
```

The change does not modify `RoutineLoadJob.read()` or normalize states
during replay. There are no deployed historical Kinesis create records
that require compatibility recovery, and existing Kafka replay behavior
remains unchanged.

#### Separate cloud Kafka follow-up found during review

While evaluating a broader replay-time `RUNNING` to `NEED_SCHEDULE`
conversion, we found an independent ordering issue in cloud Kafka
automatic-partition recovery. `isKafkaPartitionsChanged()` can update
`currentKafkaPartitions` before `updateCloudProgress()` successfully
fetches the authoritative offset from Meta Service. If that fetch fails,
a later scheduler round can see stable topology and skip the Meta
Service retry. A recovery path that makes the job schedulable at that
point could create a task from stale FE metadata, repeat already
committed data, and regress stored routine-load progress.

This PR does not add that replay-time conversion and therefore does not
change or expose the cloud Kafka path. The cloud issue will be handled
separately by making authoritative Meta Service progress synchronization
a prerequisite for task creation and preserving the retry requirement
across scheduler rounds.
@yiguolei
yiguolei force-pushed the auto-pick-67681-branch-4.1 branch from 99a4299 to 8310bc0 Compare October 8, 2026 04:51
@yiguolei

yiguolei commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

run buildall

@0AyanamiRei

Copy link
Copy Markdown
Contributor

#68773

yiguolei pushed a commit that referenced this pull request Oct 13, 2026
…- #68560 (#68773)

### What problem does this PR solve?

Issue Number: None

Related PR: #67681, #68560

Problem Summary:

Manual backport of #67681 to branch-4.1, replacing the closed automatic
backport #68560.

Persist the routine load create journal before publishing the job to the
scheduler. This keeps the initial NEED_SCHEDULE state stable during
serialization and prevents replay from restoring a RUNNING job without
tasks.

Adapt RoutineLoadJobPersistenceTest to branch-4.1: use the Kafka classes
in their existing routineload package and remove unsupported Kinesis
references. The Kafka test retains assertions for
journal-before-publication ordering and successful scheduling after
publication. This addresses the test compilation failure in TeamCity
build 1062738.

### Release note

Fix routine load jobs potentially becoming stuck after replay due to
scheduling before the create journal is persisted.

### Check List (For Author)

- Test
    - [ ] Regression test
    - [x] Unit Test
    - [ ] Manual test
- Unit test adapted for branch-4.1. Local compilation and tests were not
run, as requested. `git diff --check` passed.

- Behavior changed:
    - [ ] No.
- [x] Yes. The create journal is persisted before the job becomes
visible to the scheduler.

- Does this need documentation?
    - [x] No.
    - [ ] Yes.

### Check List (For Reviewer who merge this PR)

- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label
yiguolei pushed a commit that referenced this pull request Oct 15, 2026
…- #68560 (#68773)

### What problem does this PR solve?

Issue Number: None

Related PR: #67681, #68560

Problem Summary:

Manual backport of #67681 to branch-4.1, replacing the closed automatic
backport #68560.

Persist the routine load create journal before publishing the job to the
scheduler. This keeps the initial NEED_SCHEDULE state stable during
serialization and prevents replay from restoring a RUNNING job without
tasks.

Adapt RoutineLoadJobPersistenceTest to branch-4.1: use the Kafka classes
in their existing routineload package and remove unsupported Kinesis
references. The Kafka test retains assertions for
journal-before-publication ordering and successful scheduling after
publication. This addresses the test compilation failure in TeamCity
build 1062738.

### Release note

Fix routine load jobs potentially becoming stuck after replay due to
scheduling before the create journal is persisted.

### Check List (For Author)

- Test
    - [ ] Regression test
    - [x] Unit Test
    - [ ] Manual test
- Unit test adapted for branch-4.1. Local compilation and tests were not
run, as requested. `git diff --check` passed.

- Behavior changed:
    - [ ] No.
- [x] Yes. The create journal is persisted before the job becomes
visible to the scheduler.

- Does this need documentation?
    - [x] No.
    - [ ] Yes.

### Check List (For Reviewer who merge this PR)

- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants