zhangshenghang opened a new pull request, #13757:
URL: https://github.com/apache/seatunnel/pull/13757

   Yes — this change contributes to **Apache SeaTunnel** (Zeta engine E2E 
coverage).
   
   ### Motivation
   
   `SinkWriter` creation runs inside `SinkFlowLifeCycle#restoreState`, which 
the master calls for
   the initial deployment (with an empty state list) and again after every 
pipeline restore. A throw
   there is a deployment-time failure: the task group never reaches `RUNNING` 
and no checkpoint can
   prove progress. The engine must treat it like any other recoverable pipeline 
failure and spend one
   `job.retry.times` attempt per redeployment, releasing the pipeline's fixed 
slots in between.
   
   Two regressions in that path are invisible to every functional E2E test:
   
   - a deployment failure classified as terminal fails the job on the first 
attempt while the retry
     budget is still unused;
   - a redeployment that does not release the old fixed slots leaks capacity on 
every attempt until
     the pool is empty, although the job still "works" on a cluster with spare 
capacity.
   
   ### Change
   
   Test-only addition under 
`seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base`:
   
   - `DeploymentFailureRetryIT` compares the two sides of the restore budget on 
a single hybrid Zeta
     node with a fixed-slot pool (`dynamic-slot=false`, `slot-num=4`, 
`ScheduleStrategy.WAIT`), a
     parallel-1 STREAMING `FakeSource` pipeline and a test-only sink whose 
writer creation is armed to
     fail for the first N attempts:
     - `job.retry.times=3` with 2 injected failures: the job must consume 
exactly three deployment
       attempts (initial + two restores), open exactly one writer, stay 
`RUNNING` instead of
       `CANCELING`/`FAILED`, never own more than the pipeline's two fixed slots 
across the
       release/re-acquire pairs, consume rows after the recovery, and then 
cancel to `CANCELED` with
       the whole pool released.
     - `job.retry.times=2` with an unbounded failure budget: exactly three 
attempts, the client
       completion future resolves as `FAILED` with a terminal error, the job 
stays `FAILED` without a
       late redeployment, and every fixed slot is released.
   - The fixture sink is a deterministic failure injector only 
(`DeploymentFailureSink` +
     `DeploymentFailureProbe`, registered via `@AutoService`); every assertion 
is about the engine's
     deployment, retry accounting, job lifecycle and slot accounting, never 
about connector, transform
     or SQL semantics.
   
   ### Existing coverage gap
   
   - `JobClientJobProxyIT#testJobRetryTimes` only checks restore log lines for 
a source that throws
     while emitting rows, i.e. after a task group deployed successfully.
   - `ClusterFaultToleranceTwoPipelineIT`, `SaturatedSlotPoolRestoreIT`, the 
sibling-restore tests and
     the checkpoint timeout recovery test inject failures after the pipeline is 
already running.
   - `SeaTunnelSlotIT` covers a submission that never gets enough slots, and 
the cancel-during-deploy
     guard stops a deployment that is parked in writer creation. None of them 
fails the writer
     creation itself and observes how `job.retry.times` and the fixed-slot pool 
behave across the
     resulting redeployments.
   
   I searched open and closed PRs/issues for the same objective (`deployment 
failure retry`,
   `writer creation retry`, `sink init retry`, `retry budget slot`) before 
opening this PR; no
   same-purpose change exists. No engine defect was found: the contract holds 
on `dev`
   (`1e7e29a75b`), so no issue is filed with this change.
   
   ### Modules and compatibility
   
   New test-tree files only. No production code, public API, SPI, configuration 
option, default value,
   state or file format changes. No new dependencies; the test sink is not 
visible outside the test
   classpath.
   
   ### Verification
   
   ```
   export JAVA_HOME=<jdk17>
   mvn -pl seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base 
spotless:apply
   mvn -pl seatunnel-engine/seatunnel-engine-server -DskipTests install
   mvn -pl seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base \
       verify -DskipUT=true -DskipIT=false -Dit.test=DeploymentFailureRetryIT 
-DfailIfNoTests=false
     Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
   mvn -pl seatunnel-ci-tools test -Dtest=ImportClassCheckTest
     Tests run: 8, Failures: 0, Errors: 0, Skipped: 0
   ```
   
   Five consecutive green targeted runs on the pristine engine jar
   (`seatunnel-engine-server` sha256 
`e3687ea6c3c4ebc9caffa94e8ad57c5d7dc5df90dcfa93ed219d91ce1339137a`),
   15.9 s–16.8 s each; `spotless:check` is bound to `validate` and passed in 
every run.
   
   Observed evidence from a green run:
   
   ```
   Recovered from two deployment failures: attempts=3, assignedSlots=2, 
liveWriters=1, rows=200,
     failures=[injected sink writer creation failure, attempt 1 of 2,
               injected sink writer creation failure, attempt 2 of 2]
   Exhausted the retry budget: status=FAILED, attempts=3,
     error=org.apache.seatunnel.engine.server.checkpoint.CheckpointException: 
CheckpointCoordinator inside have error.
   ```
   
   Negative control: changing `SubPlan#canRestorePipeline` from `< 
pipelineMaxRestoreNum` to
   `<= pipelineMaxRestoreNum` (one extra restore) makes the new test fail in 
8.4 s with
   
   ```
   job.retry.times=2 must allow exactly three deployment attempts ==> expected: 
<3> but was: <4>
   ```
   
   The mutation was reverted, the pristine `seatunnel-engine-server` jar was 
reinstalled (sha256 above,
   matching the hash recorded for `dev` in previous rounds) and the green runs 
were repeated.
   
   ### Remaining risk
   
   The test measures the slot requirement of a parallel-1 streaming pipeline 
(two fixed slots:
   split enumerator plus source/sink task group) rather than assuming it from 
configuration, and it
   reads the pool from the live `ResourceManager`. If the engine legitimately 
changes that slot
   topology, the failure message names the observed count so the expectation 
can be updated
   deliberately.
   


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

Reply via email to