JNSimba opened a new pull request, #62747:
URL: https://github.com/apache/doris/pull/62747

   ### What problem does this PR solve?
   
   Issue Number: close #xxx
   
   Related PR: #xxx
   
   Problem Summary:
   
   StreamingInsertJob currently has no way to bind to a specific compute_group
   (cloud cluster). In multi-cluster cloud deployments this forces all streaming
   jobs to share whatever cluster the Coordinator happens to resolve at task 
time,
   making per-job resource isolation impossible.
   
   This PR adds a `compute_group` job property so users can pin a
   StreamingInsertJob to a specific compute_group, consistent with RoutineLoad's
   name-based binding model (aligned with PR #52911 which migrated RoutineLoad
   to name-based cluster lookup).
   
   **Behavior**
   
   - **CREATE**: resolve `compute_group` from property first, else fall back to
     `ConnectContext.getCloudCluster()` (covers SessionVariable / ctx cache /
     UserProperty / default). Cloud mode only; non-cloud mode rejects the 
property.
   - **ALTER**: validate the new cluster exists. `AlterJobCommand.validate()`
     already enforces PAUSED state upstream. Switching takes effect at the next
     task boundary — no half-state, no in-flight task interruption.
   - **Runtime**:
     - TVF path: `StreamingInsertTask.before()` calls `ctx.setCloudCluster(...)`
       so the INSERT Coordinator selects BEs from the bound cluster.
     - Non-TVF path: `StreamingJobUtils.selectBackend(cloudCluster)` uses
       `CloudSystemInfoService.getBackendsByClusterName()` directly. The 5
       RPC sites in `JdbcSourceOffsetProvider` (fetchRemoteMeta / compareOffset 
/
       snapshot / binlog) also route through the bound cluster.
   - **Persistence**: `@SerializedName("ccn")` on 
`StreamingInsertJob.cloudCluster`
     (mirrors RoutineLoad's `ccn` field); provider-side `cloudCluster` is
     `transient` and pushed from the job at init / Gson restore / alter.
   - **Upgrade-safe**: old jobs without the `ccn` field resolve to `null` and
     fall back to the previous global BE selection — no migration needed.
   
   **Usage**
   
   ```sql
   -- CREATE bound to a specific compute_group
   CREATE JOB my_job
   ON STREAMING
   PROPERTIES ("compute_group" = "my_cg")
   DO INSERT INTO t1 SELECT * FROM S3(...);
   
   -- ALTER to a different compute_group (requires PAUSED)
   PAUSE JOB where jobname = 'my_job';
   ALTER JOB my_job PROPERTIES ("compute_group" = "another_cg");
   RESUME JOB where jobname = 'my_job';
   ```
   
   ### Release note
   
   StreamingInsertJob now supports `compute_group` property to bind a job to a
   specific cloud cluster. Works on CREATE and ALTER.
   
   ### Check List (For Author)
   
   - Test
       - [x] 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
   
   - Behavior changed:
       - [ ] No.
       - [x] Yes. StreamingInsertJob now accepts and persists the
         `compute_group` job property. Old jobs without this property fall
         back to the previous behavior — no migration required.
   
   - Does this need documentation?
       - [ ] No.
       - [x] Yes.
   
   ### Check List (For Reviewer who merge this PR)
   
   - [ ] Confirm the release note
   - [ ] Confirm test cases
   - [ ] Confirm document
   - [ ] Add branch pick label


-- 
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]

Reply via email to