corgy-w opened a new pull request, #11962:
URL: https://github.com/apache/seatunnel/pull/11962

   Closes #11961
   
   ### Purpose of this pull request
   
   Separate savepoint storage from checkpoint storage and introduce a versioned 
savepoint bundle format (`engine-wire-v1`) with manifest checksums and 
versioned readers, so that savepoints are never lost by checkpoint 
retention/terminal cleanup and the wire format has an explicit compatibility 
contract.
   
   See the linked issue for the full problem statement and design.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes, compared to `dev` (unreleased branch):
   
   - **Previous behavior**: savepoints are written into the checkpoint 
directory (`<namespace>/<job-id>/`) with the runtime serialization format, 
participate in `max-retained` rotation, and are deleted together with 
checkpoints when the job reaches `FINISHED`/`CANCELED` after a 
savepoint-restore cycle.
   - **New behavior**: savepoints are written as isolated bundles under 
`<namespace>/savepoint/<job-id>/<savepoint-id>/` (payloads staged first, 
`_metadata.ser` as the commit marker with `formatVersion=1` and per-file length 
+ SHA-256 checksums). They are excluded from checkpoint rotation and terminal 
cleanup, kept until explicitly deleted. Restore selects the newest completed 
bundle; savepoints written by earlier engines (still inside the checkpoint 
directory, no version marker) remain readable on a best-effort basis. Bundles 
written by a newer engine are rejected with an explicit error. 
`restore.mode`/`savepoint.path` env options remain **planned-not-implemented** 
(documented).
   
   The `CheckpointStorage` SPI, CLI/REST parameters and checkpoint storage 
layout are unchanged.
   
   ### How was this patch tested?
   
   Unit/integration tests (all green locally, JDK 11):
   
   - `CheckpointWireCompatibilityTest` (8): legacy-v0 fixture replay, byte 
stability, `isRestored` excluded from v1, enum name encoding, unknown-enum 
explicit error
   - `SavepointReaderRegistryTest` (3): v1 readable, below-window migration 
error, above-window rejection
   - `LocalSavepointStorageTest` (5) / `HdfsSavepointStorageTest` (2): 
commit/list/read/delete, staging invisibility before commit, abort, corruption 
detection, duplicate id rejection, checkpoint/savepoint isolation
   - `CheckpointStorageTest` (5), `SavePointTest` (6, 1 skipped on Windows), 
`CheckpointManagerTest` (6), `CheckpointCoordinatorTest` (14): 
savepoint-and-restore end-to-end with the new bundle path; updated 
`CheckpointStorageTest` asserts isolation
   - `SavepointRestoreSelectionTest` (1): two savepoints coexist as isolated 
bundles, restore picks the newest after deleting the older one
   
   Build commands used (local notes: JDK 21 breaks the bundled 
google-java-format, use JDK 11; build with `-pl` so shaded modules resolve from 
the local repo):
   
   ```bash
   JAVA_HOME=<jdk11> ./mvnw -pl seatunnel-engine/seatunnel-engine-server 
spotless:apply
   JAVA_HOME=<jdk11> ./mvnw -pl seatunnel-engine/seatunnel-engine-server 
-Dskip.spotless=true \
     
-Dtest='SavePointTest,CheckpointStorageTest,CheckpointCoordinatorTest,CheckpointManagerTest,CheckpointWireCompatibilityTest,SavepointReaderRegistryTest,SavepointRestoreSelectionTest'
 test
   JAVA_HOME=<jdk11> ./mvnw -pl 
seatunnel-engine/seatunnel-engine-storage/checkpoint-storage-plugins/checkpoint-storage-local-file,seatunnel-engine/seatunnel-engine-storage/checkpoint-storage-plugins/checkpoint-storage-hdfs
 -Dskip.spotless=true \
     
-Dtest='LocalFileStorageTest,LocalSavepointStorageTest,AbstractFileCheckPointTest,HdfsSavepointStorageTest'
 test
   ```
   
   ### Check list
   
   * [x] If necessary, please update the documentation to describe the new 
feature. https://github.com/apache/seatunnel/tree/dev/docs 
(`state-storage-and-recovery.md` en/zh, `rest-api-job-lifecycle.md` en/zh)
   * [x] If necessary, please update `incompatible-changes.md` to describe the 
incompatibility caused by this PR.
   * [x] No new Jar binary packages added (no License Notice needed).
   * [x] No connector code changes (plugin-mapping.properties / seatunnel-dist 
pom / label-scope-conf / e2e / plugin_config not applicable).
   


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