Rangsh commented on PR #12218:
URL: https://github.com/apache/seatunnel/pull/12218#issuecomment-7150067996

   @DanielLeens @SEZ9 @zhangshenghang
   
   Thanks for the detailed review on `e778df2e24`. **Latest push:** 
`0b242a3271` on branch `fix/zeta-deploy-local-task-rollback-12164` — addressing 
the remaining **High** items from [Daniel’s 
review](https://github.com/apache/seatunnel/pull/12218#pullrequestreview-6038243309)
 and the checklist in [SEZ9’s 
comment](https://github.com/apache/seatunnel/pull/12218#issuecomment-7144951092).
   
   Contributing to **Seatunnel** / fixes **#12164**.
   
   ---
   
   ## Daniel — blocking items (review 6038243309)
   
   ### Issue 1 (High): rollback must survive cooperative `close()` failures
   
   **Ask:** Catch **`Throwable`** on the rollback close path, log/suppress, 
still remove context, release classloaders **where applicable**, complete 
**FAILED**; add a test where cooperative `close()` throws and we still redeploy 
cleanly.
   
   **Fixed on `0b242a3271`:**
   - `closeTaskAfterRollbackIfNeeded` catches **`Throwable`**, logs, adds 
suppressed to the deployment failure when present, and continues rollback 
bookkeeping (context removal, latch/dropped-task accounting, **classloader 
release where applicable** via the existing published-context cleanup path).
   - New test: `testRollbackSurvivesCooperativeCloseFailureAndAllowsRedeploy` — 
asserts **FAILED**, `assertFailedGenerationAccounting`, no stuck active 
context, and a subsequent redeploy runs.
   
   ### Issue 2 (High): cancel-before-start test must gate like partial-submit
   
   **Ask:** Do not reject the tail blocking submit until the **first blocking 
worker has entered `call()`**.
   
   **Fixed on `0b242a3271`:**
   - `testRollbackAccountsBlockingCancelledBeforeWorkerStarts` — rejecting 
`submit()` awaits `firstEnteredCall` (via `PartialSubmitProbeTask.armCallGate`) 
before throwing on the tail; post-deploy gate flags + 
`assertFailedGenerationAccounting(service, location, 3)`.
   
   ### Cross-cutting: direct dropped-task / generation accounting
   
   **Fixed on `e778df2e24` (extended on `0b242a3271`):**
   - `registerExpectedBlockingTasks` + `accountForTasksDroppedAfterRollback` on 
rollback paths.
   - **`assertFailedGenerationAccounting`** — `lastLocalDeployResultFuture` 
**FAILED** plus tracker `completionLatchRemainingForTests() == 0` and 
`tasksReportedDoneCountForTests() == expectedTaskCount` via 
`lastLocalDeployExecutionTrackerForTests`.
   - Used in partial-submit (4 tasks), cancel-before-start (3), and cooperative 
close-failure (1) tests on current HEAD.
   
   ---
   
   ## SEZ9 — Item 1: dropped paths table (full)
   
   Rows follow the drop-path order in your checklist (never submitted → 
cancelled before start → removed from cooperative queue).
   
   | Drop path | What happens | Direct tracker / ownership assertion? | Primary 
test(s) |
   
|-----------|----------------|----------------------------------------|-----------------|
   | **(1) Never submitted (blocking tail)** | `registerExpectedBlockingTasks` 
before submit loop; mid-batch `RejectedExecutionException` leaves a tail that 
never enters `call()` | **`assertFailedGenerationAccounting`** + 
`PartialSubmitProbeTask.enteredCall(4L)` false | 
`testDeployLocalTaskRollsBackAfterPartialBlockingSubmitRejection` |
   | **(2) Cancelled before worker starts** | Second blocking future cancelled 
while first blocking already in `call()`; later tail submit rejected | Gate 
flags after deploy + **`assertFailedGenerationAccounting(3)`** + 
`enteredCall(11L/12L)` false | 
`testRollbackAccountsBlockingCancelledBeforeWorkerStarts` |
   | **(3) Removed from cooperative queue** | Tracker removed from 
`threadShareTaskQueue`; `close()` before `taskDone` | Cooperative `close()` 
**Throwable** must not block rollback — 
**`assertFailedGenerationAccounting(1)`** + redeploy | 
`testRollbackSurvivesCooperativeCloseFailureAndAllowsRedeploy` |
   
   Redeploy-after-rollback paths still use **`deployTask(Data)`** + 
`ExecutionMarkerTask` in 
`testDeployLocalTaskRollsBackAfterPostPublishFailureAndAllowsRedeploy` and 
`testDeployLocalTaskRollsBackAfterPartialBlockingSubmitRejection`.
   
   **`TaskExecutionServiceTest`:** **29/29** Surefire executions on HEAD — 
**25** `@Test` methods, **one** `@ParameterizedTest` with **2** invocations 
(`@ValueSource(booleans = {false, true})`), and **one** `@RepeatedTest(2)`.
   
   ---
   
   ## SEZ9 — Items 2–5 (one line each)
   
   | # | Item | Status |
   |---|------|--------|
   | **2** | **`deployLocalTask` Javadoc** — post-publish vs pre-publication 
completion | **Fixed on `6d6a380a9b` (on HEAD `0b242a3271`).** After 
`contextPublished`, failure runs `rollbackPublishedDeployment` and completes 
**FAILED** (workers may finish the same future first). Before publication, 
still **`completeExceptionally(t)`** so severe-error log + master notification 
contract unchanged. |
   | **3** | **PR description** mentions `TaskGroupContext` changes | **Fixed 
on the PR body** for scope: lists `TaskGroupContext.java` and 
**`claimJarsForClassLoaderRelease()`** / once-only classloader release. On HEAD 
code (`6d6a380a9b`), **`classLoaders` and `jars` are `volatile`** with 
`@Setter(AccessLevel.NONE)` — happy to add an explicit **volatile** bullet to 
the PR description if you want it mirrored in prose there. |
   | **4** | **`TaskGroupContext`** — setters bypassing claim-once; `jars` 
visibility | **Fixed on `6d6a380a9b`.** `@Setter(AccessLevel.NONE)` on 
`classLoaders` and `jars`; both fields are **`volatile`**. |
   | **5a** | Callback-side rollback / **`deployTask(Data)` redeploy** tests: 
cleanup outside `finally`; `stop.set(true)` ineffective on deserialized tasks | 
**Fixed on `6d6a380a9b`.** `ExecutionMarkerTask` uses **static** `STOP` + 
`requestStop()` (not per-instance `stop` on serialized tasks). 
**`ExecutionMarkerTask.reset()`** runs before each redeploy marker use; 
**`finally`** calls `requestStop()` + `cancelTaskGroup` + executor/mode restore 
so static flags do not leak across tests. |
   | **5b** | Assertions inside overridden `submit()` swallowed by production 
`catch (Throwable)` | **Fixed on `66af82ec9d` / `6d6a380a9b`.** Custom 
`submit()` only updates gate latches/flags and throws 
`RejectedExecutionException`; assertions run **after** `deployTask` / 
`deployLocalTask` returns. |
   | **5c** | Partial-submit test installs rejecting executor and PART mode 
before `try`/`finally` | **Fixed on `6d6a380a9b` (retained on `0b242a3271`).** 
PART mode, rejecting executor, and jar setup are inside **`try`**; `finally` 
shuts down executor, clears overrides, restores thread-share mode, deletes temp 
jar. |
   | **5d** | Unused `callCount()`, inline FQ type, executor override “two 
ways” | **Fixed on `6d6a380a9b`; one nit deliberately left.** (1) **Removed** 
unused `ExecutionMarkerTask.callCount()`. (2) **Unified** blocking override on 
`setBlockingTaskExecutorOverride`; **intentionally** applied to **both** 
`realService` and the Mockito spy because the spy does not share the 
blocking-executor field with the delegate (commented in test). (3) 
**Deliberately left:** local `java.util.concurrent.CompletableFuture` in 
`assertFailedGenerationAccounting` — happy to switch to the engine import in a 
tiny follow-up to avoid unrelated import churn if you prefer zero FQ locals. |
   
   ---
   
   ## Verification
   
   - **HEAD:** `0b242a3271` · **Branch:** 
`fix/zeta-deploy-local-task-rollback-12164`
   - **Production on this push:** `TaskExecutionService.java` only (close 
**Throwable**, gates, accounting hooks, test hooks).
   - **Javadoc / `TaskGroupContext`:** on HEAD from `6d6a380a9b`, not 
re-touched in `0b242a3271`.
   - Local on HEAD: `spotless:apply`, module `verify`, 
**`TaskExecutionServiceTest` 29/29**.
   - Fork **Build** for `0b242a3271`: 
https://github.com/Rangsh/seatunnel/actions/runs/45525756694 (**queued** at 
post time; prior green on `e778df2e24`: 
[45305542167](https://github.com/Rangsh/seatunnel/actions/runs/45305542167)).
   
   Happy to adjust wording or split this into threaded replies if you prefer. 
Thanks again for the review.


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