zhangshenghang opened a new issue, #13485: URL: https://github.com/apache/seatunnel/issues/13485
### Search before asking - [x] I searched existing issues and pull requests and found no report of this specific savepoint retry after a master switch. ### What happened I ran a streaming job (`FakeSource -> a test sink`, checkpointing enabled, one pipeline) on a Zeta cluster with two master nodes and two worker nodes. The test held the savepoint barrier in the sink writer, issued `SeaTunnelClient#savePointJob(jobId)`, and shut the active master down while the savepoint checkpoint was still unacknowledged. With the current `dev` code: 1. The job is `DOING_SAVEPOINT` and savepoint checkpoint `1` is pending on master `5801`. 2. Master `5801` is shut down. 3. The surviving master `5802` restores the job: `DOING_SAVEPOINT -> PENDING -> SCHEDULED -> RUNNING` in about a second. 4. About one second later the new master logs `Begin do save point for Job ...` even though no user call was made on it, and the job goes `RUNNING -> DOING_SAVEPOINT` again. This is the Hazelcast client retrying the original invocation on the new master. 5. The retried savepoint checkpoint (`3`) is never acknowledged, expires after `checkpoint.timeout`, the pipeline is cancelled and the job ends `FAILED`. After the terminal cleanup the job status even becomes `UNKNOWABLE`: ``` [1178514641060364290] 09:56:26,819 ... job turned from state RUNNING to DOING_SAVEPOINT. [1178514641060364290] 09:56:26,820 ... start save point for job id: 1178514641060364290. ... [1178514641060364290] 09:56:27,974 ... begin restore job (1178514641060364290) from master active switch [1178514641060364290] 09:56:27,996 ... job turned from state DOING_SAVEPOINT to PENDING. [1178514641060364290] 09:56:28,000 ... job turned from state SCHEDULED to RUNNING. [1178514641060364290] 09:56:28,100 ... Begin do save point for Job test... <-- retried request on the new master [1178514641060364290] 09:56:28,101 ... job turned from state RUNNING to DOING_SAVEPOINT. ... [1178514641060364290] 09:58:16,636 ... timeout checkpoint: ... SAVEPOINT_TYPE [1178514641060364290] 09:58:16,678 ... job turned from state FAILING to FAILED. ``` In another run the job was `UNKNOWABLE` by the time the client polled it, because the failed job had already been cleaned up. ### Expected behavior A savepoint request is not idempotent. When the master that owns the request dies, the client call should fail deterministically and the new active master should only restore the job: - the restored job stays `RUNNING` (it must not be pushed back into `DOING_SAVEPOINT` by a request the user did not issue on it); - the operator can retry the savepoint themselves; - the job remains cancellable and keeps its slots only for real work. ### Root cause `seatunnel-engine/seatunnel-engine-core/src/main/resources/client-protocol-definition/SeaTunnelEngine.yaml` declares `savePointJob` with `retryable: true`, and the generated `SeaTunnelSavePointJobCodec#encodeRequest` sets `clientMessage.setRetryable(true)`. Hazelcast therefore re-sends the invocation to the newly active master after the member failure, re-executing a non-idempotent operation on a job that was just restored. ### Fix Mark the savepoint request non-retryable (`retryable: false` in the protocol definition and `setRetryable(false)` in the generated codec). An E2E test (`SavepointInFlightMasterFailoverIT`) pins the behavior: with the fix the savepoint call fails, the job is restored to `RUNNING`, stays `RUNNING`, and can be cancelled; without it, the retried request fails the job. -- 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]
