Repository navigation
[Fix][Zeta] Restore legacy job status WAL entries - #11781
Conversation
The Build check has been queued since the PR was opened; the fork's ubuntu-latest runners are saturated by other queued jobs. Re-triggering the workflow to give this PR another chance to pick up a runner. No code changes; only the Build status is the goal.
Previous Build run has been queued since the PR was opened; the fork runner pool is saturated. Cancelling and re-triggering the workflow to give this PR another chance to pick up a runner. No code changes.
DanielLeens
left a comment
There was a problem hiding this comment.
What Problem Does This PR Solve?
- User pain point: After the job-status model classes (
JobResult,JobStatus,JobStatusData) were relocated fromengine-coretoengine-commonin #9689, clusters running the file-backed IMap storage (imap-storage-file) that persist job state via WAL can no longer restart. On startup, Hazelcast'sMapStoreWrapper.loadAll()reads pre-existing WAL records that still carry the old fully-qualified class name (org.apache.seatunnel.engine.core.job.JobStatus, etc.),Class.forName()throwsClassNotFoundException, and job-state recovery fails (reported in #9928, reproduced going 2.3.10 -> 2.3.12). - Fix approach:
WALReader.deserializeData()now resolves the class name recorded in the WAL through a small staticLEGACY_CLASS_NAME_MAPPINGSlookup table before callingClassUtils.getClass(), transparently remapping the three moved classes to their currentengine-commonpackage while leaving every other class name untouched. - One-sentence summary: A minimal, backward-compatible class-name-resolution shim in
WALReaderthat lets a newer SeaTunnel version keep reading job-status WAL entries written by pre-#9689 versions.
1. Code Change Review
1.1 Core Logic Analysis
Changed file: seatunnel-engine/seatunnel-engine-storage/imap-storage-plugins/imap-storage-file/src/main/java/.../common/WALReader.java
Before:
private Object deserializeData(byte[] data, String className) {
try {
Class<?> clazz = ClassUtils.getClass(className);
...After:
private Object deserializeData(byte[] data, String className) {
try {
Class<?> clazz = ClassUtils.getClass(resolveClassName(className));
...
private static String resolveClassName(String className) {
return LEGACY_CLASS_NAME_MAPPINGS.getOrDefault(className, className);
}Key findings
- I verified against the actual move commit (
e7de54e4e7, PR #9689): git reportsJobResult.java,JobStatus.java,JobStatusData.javaas purerenamedfiles (1 addition / 1 deletion each — only thepackageline changed). Field layout is byte-for-byte identical between the oldengine-coreand newengine-commonversions, so re-deserializing old WAL bytes with the new class via ProtoStuff is safe — no field-shift/schema-mismatch risk. - The mapping table exactly matches the three classes that actually moved (confirmed via
previous_filenameon the rename diff) — nothing missing, nothing extra.seatunnel-engine-storagecurrently has only one IMap storage plugin (imap-storage-file), so there's no sibling implementation with the same bug that was left unfixed. deserializeData()is shared by bothloadAllKeys()andloadAllData(), and is used for both key and value class-name resolution, so this fix also covers the (less likely but possible) case where a legacy job-status object was ever used as a map key.- Nice design choice: the main code only manipulates class names as
Strings (no compile-time reference toengine-common'sJobResult/JobStatus/JobStatusData), soimap-storage-file's production classpath doesn't gain a new dependency — theengine-commondependency added inpom.xmlis correctly scoped totestonly, used exclusively by the new regression test. - This only fixes the read path. The write path (
IMapFileStorage.parseToIMapFileData) already usesvalue.getClass().getName(), so any record written (or rewritten via archive/compaction) by a post-fix JVM will naturally carry the newengine-commonclass name going forward — no double-mapping or write-side change was needed, and none was made.
Runtime path traced (from the actual production crash in #9928, confirmed against current dev):
Master node restart
-> Hazelcast BasicRecordStoreLoader.loadAndGet()
-> MapStoreWrapper.loadAll()
-> FileMapStore.loadAll() [seatunnel-engine-server/.../persistence/FileMapStore.java]
-> IMapFileStorage.loadAll() [IMapFileStorage.java:238]
-> new WALReader(...).loadAllData(businessRootPath, ...) [WALReader.java]
-> deserializeData(data.getValue(), data.getValueClassName()) [WALReader.java:~130]
-> resolveClassName("org.apache.seatunnel.engine.core.job.JobStatus")
-> LEGACY_CLASS_NAME_MAPPINGS hit -> "org.apache.seatunnel.engine.common.job.JobStatus"
-> ClassUtils.getClass(...) succeeds (previously threw ClassNotFoundException here)
-> serializer.deserialize(data, JobStatus.class) -> JobStatus.RUNNING
-> job status IMap successfully rehydrated, cluster startup proceeds
This is squarely on the normal/primary startup-recovery path for any cluster that persists job state to file-backed IMap storage and is being upgraded across the #9689 boundary — not an edge case. Before this fix it throws unconditionally for every legacy job-status record; after this fix it resolves transparently and falls through to the unchanged (and already-correct) code path for every other class name.
1.2 Compatibility Impact
Fully compatible. New/foward-format WAL entries are unaffected (map lookup misses -> className returned unchanged). Old-format entries written by any pre-#9689 SeaTunnel version now deserialize correctly instead of crashing. No public API, Option, or config surface is touched.
1.3 Performance / Side-Effect Analysis
Negligible: one extra HashMap.getOrDefault lookup per record read, against an immutable 3-entry map built once in a static initializer. No new I/O, no new locks, no change to the write path, no additional objects retained across calls. No retry/idempotency implications — deserialization is a pure function of the WAL bytes.
1.4 Error Handling and Logging
No new error paths introduced; the existing ClassNotFoundException -> IMapStorageException wrapping is preserved unchanged for genuinely unknown class names, which is correct — the fix intentionally narrows to the 3 known-moved classes rather than silently swallowing all ClassNotFoundExceptions.
- Location:
WALReader.java:43(theLEGACY_CLASS_NAME_MAPPINGSstatic field / static initializer block)
Problem description: The field itself has no accompanying comment; only theresolveClassName()method below it is documented. A reader skimming the class won't immediately see why this table exists (i.e., that it's tied to the #9689engine-core->engine-commonmove and issue #9928) without reading the method doc further down.
Potential risk: Low today, but this is exactly the kind of "one-time migration shim" that tends to get deleted by a future well-meaning cleanup once nobody remembers why it's there, silently reintroducing #9928 for anyone still upgrading from a pre-#9689 version.
Best improvement: Add a short comment directly above the field (or the static block), e.g. "Legacy class names written by SeaTunnel versions before #9689 moved the job-status model to engine-common; keep in sync with any future job-model package moves. See #9928.0"
Severity: Medium
Raised by another reviewer: No
2. Code Quality Assessment
2.1 Coding Standards
Formatting and style are consistent with the surrounding file (AOSP/Google format). The one gap is the missing field-level comment on LEGACY_CLASS_NAME_MAPPINGS covered as Issue 1 above; resolveClassName() itself is properly documented with a Javadoc explaining purpose, parameter, and return value.
2.2 Test Coverage and Test Stability
The new test testReaderLoadsJobStatusWrittenWithLegacyClassName directly reproduces the #9928 scenario: it writes a WAL record with the hardcoded legacy value-class-name string (org.apache.seatunnel.engine.core.job.JobStatus) and asserts the reader returns a real engine-common JobStatus.RUNNING instance. This is exactly the right regression test — it fails on dev pre-fix (ClassNotFoundException) and passes post-fix.
Stability rating: Stable.
Evidence (WALReaderAndWriterTest.java):
- Uses the same deterministic local-filesystem harness (
FS,@BeforeAll/@AfterAll) as the pre-existing tests in this class — noThread.sleep, no timing-dependent assertions, no shared mutable static state beyond the already-establishedFS/SERIALIZERfields reused across tests. - Uses its own dedicated path (
LEGACY_JOB_STATUS_PATH = /tmp/imap-wal-legacy-job-status/) that doesn't collide withPARENT_PATHorSAME_TIMESTAMP_TOMBSTONE_PATHused by other tests in the same class, avoiding cross-test interference. - Resource is released in
@AfterAll(FS.delete(LEGACY_JOB_STATUS_PATH, true)), matching the cleanup pattern of the other two paths. - Assertions are exact-value (
assertEquals(JobStatus.class, ...),assertEquals(JobStatus.RUNNING.name(), ...)), not weak existence checks.
2.3 Documentation Updates
Not required — this is an internal bugfix in the WAL deserialization path with no user-facing config, CLI, or connector behavior change, so no docs/en/docs/zh update is expected.
3. Architectural Soundness
3.1 Elegance of the Solution
Precise fix. It targets exactly the three classes that actually moved, verified against the real rename commit, and does so without adding any new compile-time coupling to engine-common in production code.
3.2 Maintainability
Good — the mapping table is small, centralized, and trivially extensible if another job-model class is relocated in the future. The only maintainability gap is the missing "why does this exist / when is it safe to remove" context noted in Issue 1, which would help whoever eventually has to decide whether this mapping can ever be dropped.
3.3 Extensibility
Adding a future legacy mapping is a one-line addition to the static block; no structural changes needed elsewhere.
3.4 Historical-Version Compatibility
This is the core value of the PR: it restores the ability to read WAL entries written by any SeaTunnel version prior to the #9689 engine-core -> engine-common move (confirmed to include at least 2.3.10, per #9928), without requiring operators to manually migrate or discard persisted job state during upgrade. I did not find any other job-model classes that moved in that same commit and were left unmapped.
4. Issue Summary
| Number | Issue | Location | Severity |
|---|---|---|---|
| 1 | LEGACY_CLASS_NAME_MAPPINGS static field lacks its own explanatory comment (why it exists / which issue it fixes) |
WALReader.java:43 |
Medium |
5. Merge Recommendation
Conclusion: Ready to merge after fixes
- Blockers — must be fixed
- Recommended fixes — non-blocking
- None beyond the above; the fix itself, the runtime-path tracing, and the regression test all check out.
Overall this is a well-scoped, low-risk fix for a real production upgrade-breaking bug, backed by a solid regression test and verified (by me, independently) against the actual rename commit to confirm the mapping is both complete and safe at the field-serialization level. Nice work — thank you for tracking this down to the exact three classes instead of a broader (and riskier) catch-all approach.
Note for visibility: at the time of this review the fork's CI run for this head commit was still queued and hadn't produced results yet, so I can't yet confirm a green CI run — will be worth a final check once it completes.
Explain why LEGACY_CLASS_NAME_MAPPINGS exists (the engine-core -> engine-common job model move in apache#9689) and why removing it would break upgrades that still have old WAL entries (apache#9928).
DanielLeens
left a comment
There was a problem hiding this comment.
What Problem Does This PR Solve?
Re-verified from scratch against the current head (20d56e95). Unchanged from my last review: after PR #9689 relocated the job-status model classes (JobResult, JobStatus, JobStatusData) from seatunnel-engine-core to seatunnel-engine-common, any cluster using the file-backed IMap storage (imap-storage-file) to persist job state fails to restart, because WALReader.deserializeData() calls ClassUtils.getClass() with the class name literally recorded in old WAL entries (org.apache.seatunnel.engine.core.job.JobStatus), which no longer exists on the classpath. This is a real, reported production issue (#9928), reproduced going from 2.3.10 to 2.3.12, and I independently confirmed the exact reported stack trace (WALReader.deserializeData -> ClassNotFoundException: org.apache.seatunnel.engine.core.job.JobStatus) matches this code path on dev.
The fix adds a small static LEGACY_CLASS_NAME_MAPPINGS table and a resolveClassName() helper in WALReader.java so the three moved class names are transparently remapped to their current engine-common package before class resolution, leaving every other class name untouched.
What changed since my last review
My prior review (commit 18e347bea) flagged one Medium issue: LEGACY_CLASS_NAME_MAPPINGS had no field-level comment explaining why it exists, which risked a future well-meaning cleanup silently reintroducing #9928. The single new commit on this PR, 20d56e95 ("[Fix][Zeta] Document legacy WAL class name mappings"), adds exactly that — a Javadoc block directly above the field (WALReader.java:46-54) explaining the #9689 move, the #9928 crash it prevents, and explicitly warning that removing an entry breaks upgrades from releases that still wrote the old class name. That is precisely the fix I asked for, correctly scoped, and no other lines changed. I re-diffed dev...review-pr-11781 in full (not just the incremental commit) rather than trusting the delta alone, and the rest of the PR — resolveClassName(), the mapping table contents, the test-scoped engine-common pom.xml dependency, and the new regression test — is byte-for-byte what I reviewed before.
1. Code Change Review
1.1 Core Logic Analysis
WALReader.java:141-144:
private Object deserializeData(byte[] data, String className) {
try {
Class<?> clazz = ClassUtils.getClass(resolveClassName(className));WALReader.java:160-166:
private static String resolveClassName(String className) {
return LEGACY_CLASS_NAME_MAPPINGS.getOrDefault(className, className);
}I re-verified the completeness/safety claims independently rather than re-using my prior conclusions verbatim:
- Re-ran
git show --stat e7de54e4e7(the actual #9689 move commit): exactly 3 files arerenamed withsimilarity index95-98%, and the per-file diff (git show e7de54e4e7 -- '*JobStatus.java' '*JobResult.java' '*JobStatusData.java') shows only thepackagedeclaration line changed in each — field layout is byte-identical between old and new location, so re-deserializing legacy WAL bytes against the new class via the existing serializer is safe. - Re-ran
git log --all --diff-filter=R -M --name-status -- 'seatunnel-engine/**'looking for any othercore -> commonjob-model rename across the whole history, not just #9689: found none. The 3-entry mapping table is complete, not just for the reported bug but for every class that has ever moved. - Confirmed
JobInfo(used byrunningJobInfoIMap) never moved packages (git log --all --follow -- '**/JobInfo.java'shows no rename), so it's correctly out of scope for this table. - Confirmed the write path (
IMapFileStorage.java:289-300,key.getClass().getName()/value.getClass().getName()) always serializes the current runtime class name, so records written by a post-fix JVM naturally carry theengine-commonname going forward — no write-side change needed, and none was made.
Runtime path (re-traced against current dev, unchanged from before):
Master node restart
-> Hazelcast BasicRecordStoreLoader.loadAndGet()
-> MapStoreWrapper.loadAll()
-> FileMapStore.loadAll()
-> IMapFileStorage.loadAll() [IMapFileStorage.java:238]
-> WALReader.loadAllData()
-> deserializeData(data, "org.apache.seatunnel.engine.core.job.JobStatus")
-> resolveClassName(...) hits LEGACY_CLASS_NAME_MAPPINGS -> engine-common name
-> ClassUtils.getClass(...) succeeds (previously threw ClassNotFoundException)
-> job status IMap successfully rehydrated
This is the primary/normal startup-recovery path for any cluster upgrading across the #9689 boundary while persisting job state via file-backed IMap storage — not a rare edge case, and it fires unconditionally (100% of legacy job-status records) before the fix.
One clarification worth stating explicitly since it wasn't in my last review: before this fix, the ClassNotFoundException is wrapped as IMapStorageException and propagates up to Hazelcast's BasicRecordStoreLoader, which catches it and only logs a WARN ("Could not load keys from map store") rather than crashing cluster startup outright — visible in the #9928 report itself. That means the pre-fix failure mode is silent loss of persisted job state on restart, not a startup crash; the PR's practical effect is preventing that silent state loss. This is pre-existing Hazelcast-level exception handling, unrelated to and untouched by this diff — noted for completeness, not as an issue.
1.2 Compatibility Impact
Fully compatible, re-confirmed. New-format WAL entries are unaffected (map lookup misses, class name returned unchanged). Old-format entries from any pre-#9689 SeaTunnel version now deserialize correctly instead of crashing/silently dropping. No public API, Option, or config surface is touched. No incompatible-changes doc entry needed since this restores previously-broken backward compatibility rather than introducing a break.
1.3 Performance / Side-Effect Analysis
Unchanged from prior review: one HashMap.getOrDefault lookup per record read against an immutable 3-entry map built once in a static initializer. No new I/O, locks, or write-path change. No retry/idempotency concerns — deserialization is a pure function of the WAL bytes and class name.
1.4 Error Handling and Logging
The ClassNotFoundException -> IMapStorageException wrapping for genuinely unknown class names is preserved unchanged, which is correct — the fix intentionally narrows to the 3 known-moved classes rather than broadly swallowing all ClassNotFoundExceptions. No issues here in this or the prior round.
2. Code Quality Assessment
2.1 Coding Standards
Consistent with the surrounding file's style. The only gap noted last round (missing field-level rationale comment on LEGACY_CLASS_NAME_MAPPINGS) is now fixed at WALReader.java:45-54 with a proper multi-line Javadoc block covering purpose, the triggering issue, and the risk of removal. resolveClassName() retains its own Javadoc as before.
2.2 Test Coverage and Test Stability
Unchanged and still solid: testReaderLoadsJobStatusWrittenWithLegacyClassName (WALReaderAndWriterTest.java:155-176) writes a WAL record using the hardcoded legacy value-class-name string and asserts the reader returns a real engine-common JobStatus.RUNNING instance — this fails on pre-fix code with the exact reported ClassNotFoundException and passes post-fix.
Stability rating: Stable.
- Same deterministic local-filesystem harness as the rest of the class (
FS,@BeforeAll/@AfterAll), noThread.sleep, no timing-dependent assertions. - Dedicated path
LEGACY_JOB_STATUS_PATH = /tmp/imap-wal-legacy-job-status/(WALReaderAndWriterTest.java:54) doesn't collide withPARENT_PATHorSAME_TIMESTAMP_TOMBSTONE_PATHused elsewhere in the class. - Cleaned up in
@AfterAll(FS.delete(LEGACY_JOB_STATUS_PATH, true),WALReaderAndWriterTest.java:184), matching the existing cleanup pattern. - Assertions are exact-value (
assertEquals(JobStatus.class, ...),assertEquals(JobStatus.RUNNING.name(), ...)), not weak existence checks.
2.3 Documentation Updates
Not required — internal WAL-deserialization bugfix with no user-facing config/CLI/connector surface change.
3. Architectural Soundness
3.1 Elegance of the Solution
Precisely targeted fix, re-verified independently against the actual rename commit rather than taking the PR description's claim at face value. No new compile-time coupling to engine-common from production code — only String manipulation, with the engine-common pom.xml dependency correctly scoped to test.
3.2 Maintainability
Improved by this round's change: the mapping table now carries its own explanation of why it exists and what breaks if it's removed, directly addressing the "silent future cleanup risk" I flagged last time.
3.3 Extensibility
Adding a future legacy mapping remains a one-line addition to the static block; the new Javadoc explicitly documents this expectation ("extend it whenever a persisted job model class is moved again").
3.4 Historical-Version Compatibility
This is the core value of the PR. It restores the ability to read job-status WAL entries written by any SeaTunnel version prior to the #9689 engine-core -> engine-common move (confirmed affecting at least 2.3.10, per #9928) without operator-driven manual migration or state discard during upgrade. I re-confirmed via full-history search that no other job-model classes moved packages and were left unmapped.
4. Issue Summary
| # | Issue | Location | Severity |
|---|---|---|---|
| — | None outstanding. The single Medium issue from my prior review (missing rationale comment on LEGACY_CLASS_NAME_MAPPINGS) is resolved by commit 20d56e95. |
WALReader.java:45-54 |
Resolved |
5. Merge Recommendation
Conclusion: Ready to merge
- Blockers — must be fixed
- None.
- Recommended fixes — non-blocking
- None.
Nice follow-up — the added Javadoc is exactly the kind of "why this exists, don't delete it" context that prevents this class of regression from recurring after a future refactor. Combined with the from-scratch re-verification I did this round (independent confirmation of the #9689 rename completeness, the write-path class-name behavior, and the pre-existing Hazelcast-level exception handling around the recovery path), I don't see any remaining non-CI blocker. The fork's Build check is still queued at the time of this re-review (same status as last round); worth a final glance once it completes, but there is no code-side reason to hold this PR.
DanielLeens
left a comment
There was a problem hiding this comment.
What Problem Does This PR Solve?
After PR #9689 relocated the job-status model classes (JobResult, JobStatus, JobStatusData) from seatunnel-engine-core to seatunnel-engine-common, any cluster using the file-backed IMap storage (imap-storage-file) to persist job state fails to restart, because WALReader.deserializeData() calls ClassUtils.getClass() with the class name literally recorded in old WAL entries (org.apache.seatunnel.engine.core.job.JobStatus), which no longer exists on the classpath — a real, reported production issue (#9928). The fix adds a small static LEGACY_CLASS_NAME_MAPPINGS table and a resolveClassName() helper in WALReader.java so the three moved class names are transparently remapped to their current engine-common package before class resolution. One-sentence summary: this is the same fix I approved on 2026-08-14, now re-verified against a fresh head that only carries a clean, no-conflict sync with dev.
What changed since my last review (APPROVED, 2026-08-14, head 20d56e95)
Exactly one new commit landed: 835b264f3 ("[Fix][Zeta] Sync legacy job status fix with latest dev", merge commit, first parent 20d56e954, second parent 4ba289595 = dev). I did not just trust the commit message — I diffed the pre-merge and post-merge heads directly for every file this PR touches:
git diff 20d56e954 835b264f3 -- .../imap-storage-file/pom.xml
git diff 20d56e954 835b264f3 -- .../common/WALReader.java
git diff 20d56e954 835b264f3 -- .../common/WALReaderAndWriterTest.java
WALReader.java and WALReaderAndWriterTest.java come back byte-identical before and after the merge — the actual fix logic I reviewed and approved is completely untouched. The only real delta is in pom.xml:
- <artifactId>seatunnel-hadoop3-3.1.4-uber</artifactId>
- <version>${project.version}</version>
- <classifier>optional</classifier>
+ <artifactId>seatunnel-shade-hadoop3-uber</artifactId>
<scope>provided</scope>
...
- <artifactId>seatunnel-commons-lang3</artifactId>
- <version>${project.version}</version>
- <classifier>optional</classifier>
+ <artifactId>seatunnel-shade-commons-lang3</artifactId>This is dev's independent shaded-dependency renaming (the seatunnel-shade/* reactor modules were removed/externalized on dev and replaced with externally-versioned seatunnel-shade-* artifacts resolved via the parent POM's dependencyManagement) landing cleanly through the merge — not a manual conflict resolution. I confirmed this is the correct, current convention by grepping dev's tree: dozens of other modules (seatunnel-benchmarks/pom.xml, connector-file-base/pom.xml, connector-file-ftp/pom.xml, etc.) reference seatunnel-shade-hadoop3-uber/seatunnel-shade-commons-lang3 the exact same way — no explicit <version>/<classifier>, inherited from the parent POM. This is the opposite of the situation I flagged on PR #11712 this same round, where a merge-conflict resolution silently broke compilation — here there was no textual conflict at all on these lines (the PR's own diff never touched them), so git's merge picked up dev's change automatically and correctly.
I re-confirmed the merge-base (4ba289595) is a genuine ancestor of the live, freshly-fetched dev, so this sync is current, not stale.
1. Code Change Review
1.1 Core Logic Analysis
Unchanged from my 08-14 review (re-pulled and re-read the raw blob at the current head to confirm, not just trusting the zero-diff result above):
WALReader.java:
private static final Map<String, String> LEGACY_CLASS_NAME_MAPPINGS;
// ... Javadoc covering #9689/#9928, warning against removal, still present at lines 44-54
static { ... }
private Object deserializeData(byte[] data, String className) {
try {
Class<?> clazz = ClassUtils.getClass(resolveClassName(className));
...
private static String resolveClassName(String className) {
return LEGACY_CLASS_NAME_MAPPINGS.getOrDefault(className, className);
}Runtime path (re-traced, unchanged from prior rounds):
Master node restart
-> Hazelcast BasicRecordStoreLoader.loadAndGet()
-> MapStoreWrapper.loadAll()
-> FileMapStore.loadAll()
-> IMapFileStorage.loadAll()
-> WALReader.loadAllData()
-> deserializeData(data, "org.apache.seatunnel.engine.core.job.JobStatus")
-> resolveClassName(...) hits LEGACY_CLASS_NAME_MAPPINGS -> engine-common name
-> ClassUtils.getClass(...) succeeds (previously threw ClassNotFoundException)
-> job status IMap successfully rehydrated
This is the primary/normal startup-recovery path for any cluster upgrading across the #9689 boundary while persisting job state via file-backed IMap storage. Field layout between old (engine-core) and new (engine-common) classes is byte-identical (pure package rename, verified against the actual move commit in my 08-09 review), so re-deserializing legacy WAL bytes against the new class is safe.
Key findings this round:
- Zero functional change since my approval — the merge only touched a build-dependency coordinate, not application logic.
- The
imap-storage-filemodule's production classpath still gains no new compile-time coupling toengine-common's job-model classes — the fix operates purely onStringclass names.
1.2 Compatibility Impact
Fully compatible, unchanged from my prior review. New-format WAL entries are unaffected; old-format entries from any pre-#9689 SeaTunnel version now deserialize correctly instead of crashing/silently dropping (the underlying ClassNotFoundException was previously caught and only WARN-logged by Hazelcast's BasicRecordStoreLoader, so the real pre-fix failure mode is silent loss of persisted job state on restart, not a startup crash). No public API, Option, or config surface touched. No incompatible-changes doc entry needed since this restores previously-broken backward compatibility.
1.3 Performance / Side-Effect Analysis
Unchanged: one HashMap.getOrDefault lookup per record read against an immutable 3-entry map built once in a static initializer. No new I/O, locks, or write-path change.
1.4 Error Handling and Logging
Unchanged: the ClassNotFoundException -> IMapStorageException wrapping for genuinely unknown class names is preserved, correctly narrowed to only the 3 known-moved classes.
No new issues found this round.
2. Code Quality Assessment
2.1 Coding Standards
Unchanged and still good — the LEGACY_CLASS_NAME_MAPPINGS field now carries the explanatory Javadoc I asked for in my first-round review, added and verified in the second round, and still present, untouched, at the current head.
2.2 Test Coverage and Test Stability
Unchanged: testReaderLoadsJobStatusWrittenWithLegacyClassName (WALReaderAndWriterTest.java) directly reproduces #9928 and is byte-identical to what I approved.
Stability rating: Stable. Deterministic local-filesystem harness, no Thread.sleep, dedicated non-colliding path (LEGACY_JOB_STATUS_PATH), proper @AfterAll cleanup, exact-value assertions. Same conclusion as both prior rounds; the file is unchanged so there's nothing new to re-evaluate.
2.3 Documentation Updates
Not required — internal WAL-deserialization bugfix with no user-facing config/CLI/connector surface change, unchanged from prior rounds.
3. Architectural Soundness
3.1 Elegance of the Solution
Precise fix, re-confirmed unchanged.
3.2 Maintainability / 3.3 Extensibility
Unchanged from my 08-14 review — good, self-documenting, one-line-to-extend mapping table.
3.4 Historical-Version Compatibility
This remains the core value of the PR: restoring the ability to read job-status WAL entries written by any SeaTunnel version prior to the #9689 move, without operator-driven manual migration or state discard during upgrade.
4. Issue Summary
| # | Issue | Location | Severity |
|---|---|---|---|
| — | None outstanding. The single new commit since my last review is a clean, no-conflict dev sync touching only an external shaded-dependency coordinate in pom.xml; the fix logic itself is byte-identical to what I already approved. |
— | — |
5. Merge Recommendation
Conclusion: Ready to merge
This confirms my 08-14 "Ready to merge" conclusion rather than reversing it — I re-verified from scratch rather than assuming the sync commit was safe just because it's a merge from dev. I checked both possible failure modes explicitly: (1) whether the merge silently altered the reviewed logic — it didn't, WALReader.java/WALReaderAndWriterTest.java are byte-identical before and after; and (2) whether the pom.xml change is a genuine, correct pickup of dev's dependency rename rather than a broken manual conflict resolution (the failure mode I found on PR #11712 this same session) — it is a clean, correctly-patterned change with no textual conflict at all. CI is now genuinely green on the fork for this exact head (Build workflow SUCCESS, including unit-test and the broader all-connectors-it/jdbc-connectors-it/etc. jobs), resolving the "still queued" caveat from my first-round review. mergeable: MERGEABLE, no conflicts.
- Blockers — must be fixed
- None.
- Recommended fixes — non-blocking
- None.
No remaining concerns from me. Thanks for keeping the branch in sync with dev promptly — this is ready to merge as far as I can tell.
|
Thanks for the extra |
|
Thanks for the |
SEZ9
left a comment
There was a problem hiding this comment.
Thanks for working on this. I reviewed the latest head 835b264f3beb.
What this PR fixes
- User pain: restarting a Zeta cluster that persists IMap state through the file-backed storage fails with
ClassNotFoundExceptionfororg.apache.seatunnel.engine.core.job.JobStatus(and siblings) because #9689 moved those classes toseatunnel-engine-commonwhile existing WAL frames still carry the old FQCNs (#9928). - Fix approach:
WALReadernow consults a static, unmodifiableLEGACY_CLASS_NAME_MAPPINGStable (WALReader.java:56-70) and rewrites the recorded name beforeClassUtils.getClass(resolveClassName(className))(WALReader.java:144), coveringJobResult,JobStatusandJobStatusData; all three targets exist underseatunnel-engine-common/.../common/job/. A test-scopedseatunnel-engine-commondependency is added to the plugin pom so the regression test can reference the relocatedJobStatus. - Assessment: a minimal, correctly scoped shim on the one choke point that both
loadAllKeysandloadAllDatafunnel through; the mapping targets are right and non-legacy names pass through unchanged viagetOrDefault. What should be tightened before merge: the regression test covers only theJobStatusentry with a writer-produced fixture and compares viatoString(), theClassNotFoundExceptionmessage still reports only the raw WAL name rather than the resolved one, and the upgrade/downgrade behaviour is not documented for users. None of it is blocking.
Runtime chain I rechecked
Hazelcast MapStore replay on cluster restart
FileMapStore.loadAll(keys) -> mapStorage.loadAll() FileMapStore.java:109
FileMapStore.loadAllKeys() -> mapStorage.loadAllKeys() FileMapStore.java:118
IMapFileStorage.loadAll() -> new WALReader(fs, fileConfiguration, serializer).loadAllData(new Path(businessRootPath), new HashSet<>()) IMapFileStorage.java:237-238
IMapFileStorage.loadAllKeys() -> new WALReader(...).loadAllKeys(new Path(businessRootPath)) IMapFileStorage.java:247-248
WALReader.loadAllKeys() -> deserializeData(data.getKey(), data.getKeyClassName()) WALReader.java:95
WALReader.loadAllData() -> deserializeData(data.getKey(), data.getKeyClassName()) WALReader.java:122
-> deserializeData(data.getValue(), data.getValueClassName()) WALReader.java:136
WALReader.deserializeData() -> ClassUtils.getClass(resolveClassName(className)) [CHANGED] WALReader.java:144
WALReader.resolveClassName() -> LEGACY_CLASS_NAME_MAPPINGS.getOrDefault(className, className) [NEW] WALReader.java:167-168
LEGACY_CLASS_NAME_MAPPINGS static init: core.job.{JobResult,JobStatus,JobStatusData} -> common.job.* [NEW] WALReader.java:58-70
-> serializer.deserialize(data, clazz) WALReader.java:146
ProtoStuffSerializer.deserialize: clz not in WRAPPERS -> getSchema(clz).newMessage() + mergeFrom ProtoStuffSerializer.java:115-119
catch ClassNotFoundException -> IMapStorageException("... class name is {}", className) (raw WAL name only) WALReader.java:153-156
Write side (unchanged, shows where the recorded FQCN originates):
IMapFileStorage.parseToIMapFileData(...) -> .keyClassName(key.getClass().getName()) / .valueClassName(value.getClass().getName()) IMapFileStorage.java:289-291
Regression test:
WALReaderAndWriterTest.testReaderLoadsJobStatusWrittenWithLegacyClassName() WALReaderAndWriterTest.java:155-176
WALWriter.write(IMapFileData{value=SERIALIZER.serialize(JobStatus.RUNNING), valueClassName="org.apache.seatunnel.engine.core.job.JobStatus"}) :160-168
WALReader.loadAllData(LEGACY_JOB_STATUS_PATH, new HashSet<>()) :171-172
assertEquals(JobStatus.class, ...getClass()); assertEquals(JobStatus.RUNNING.name(), ...toString()) :174-175
Findings
Issue 1: Regression test asserts only getClass()/toString() on the replayed enum and covers just 1 of the 3 legacy mappings
- Location:
seatunnel-engine/seatunnel-engine-storage/imap-storage-plugins/imap-storage-file/src/test/java/org/apache/seatunnel/engine/imap/storage/file/common/WALReaderAndWriterTest.java:175 - Why it matters: - Root cause: the new test compares
data.get(key).getClass()withJobStatus.classanddata.get(key).toString()withJobStatus.RUNNING.name()(WALReaderAndWriterTest.java:174-175) instead of assertingAssertions.assertEquals(JobStatus.RUNNING, data.get(key)).JobStatusis not inProtoStuffSerializer.WRAPPERS, sodeserializegoes throughgetSchema(clz).newMessage()followed byProtostuffIOUtil.mergeFrom(ProtoStuffSerializer.java:115-119), i.e. aRuntimeSchemabuilt for the enum class itself. If that path ever hands back an instance that is not the canonicalJobStatus.RUNNINGconstant, both current assertions still pass while==/equalscomparisons andswitchstatements in the engine would misbehave. - Coverage gap: only the
org.apache.seatunnel.engine.core.job.JobStatusentry ofLEGACY_CLASS_NAME_MAPPINGSis exercised; theJobResultandJobStatusDatamappings (WALReader.java:60-62,66-68) are never written under their legacy names or replayed.loadAllKeysis also not exercised for the legacy record. - Fix: assert equality (and ideally
assertSame) againstJobStatus.RUNNING, and turn the test into a@ParameterizedTestover the three legacy names with a sample object each, plus aloadAllKeys(...).contains(key)check. - Evidence:
seatunnel-engine/seatunnel-engine-storage/imap-storage-plugins/imap-storage-file/src/test/java/org/apache/seatunnel/engine/imap/storage/file/common/WALReaderAndWriterTest.java:175 Assertions.assertEquals(JobStatus.RUNNING.name(), data.get(key).toString());;seatunnel-engine/seatunnel-engine-storage/imap-storage-plugins/imap-storage-file/src/main/java/org/apache/seatunnel/engine/imap/storage/file/common/WALReader.java:60 legacyClassNameMappings.put("org.apache.seatunnel.engine.core.job.JobResult", "org.apache.seatunnel.engine.common.job.JobResult");;seatunnel-engine/seatunnel-engine-storage/imap-storage-plugins/imap-storage-file/src/main/java/org/apache/seatunnel/engine/imap/storage/file/common/WALReader.java:66 legacyClassNameMappings.put("org.apache.seatunnel.engine.core.job.JobStatusData", "org.apache.seatunnel.engine.common.job.JobStatusData"); - Suggested fix: These two assertions are weaker than the contract the engine needs.
JobStatusis not inProtoStuffSerializer.WRAPPERS, so it is materialised viagetSchema(JobStatus.class).newMessage()+mergeFrom; checkinggetClass()andtoString()would still pass if the reader handed back a non-canonical enum instance. Please assertAssertions.assertEquals(JobStatus.RUNNING, data.get(key))(and ideallyassertSame). Also, only theJobStatusentry ofLEGACY_CLASS_NAME_MAPPINGSis exercised --JobResultandJobStatusDataare mapped but never replayed. A@ParameterizedTestover the three legacy names with a sample object each, plus aloadAllKeys(...).contains(key)check, would cover the whole table. - Severity: Medium
Issue 2: ClassNotFoundException after legacy-name rewrite still reports only the original WAL class name; a wrong or stale mapping target is undiagnosable and still aborts the whole cluster restart
- Location:
seatunnel-engine/seatunnel-engine-storage/imap-storage-plugins/imap-storage-file/src/main/java/org/apache/seatunnel/engine/imap/storage/file/common/WALReader.java:144 - Why it matters: - Root cause:
deserializeData()now callsClassUtils.getClass(resolveClassName(className))(WALReader.java:144), but thecatch (ClassNotFoundException e)block below (WALReader.java:153-156) still formats the message with the originalclassNameread from the WAL record. The resolved name is never stored or logged. - Impact: if a mapping target is wrong or the target class is relocated again, the failure surfaces as
deserialize data error, class name is org.apache.seatunnel.engine.core.job.JobResult-- exactly the #9928 symptom -- which makes it look as though the mapping was never applied. Because this exception propagates out ofloadAllData/loadAllKeysintoFileMapStore.loadAll, it still aborts the whole MapStore replay on restart, so the operator has nothing to work with but a misleading message. - Fix: hold the resolved name in a local, include both the recorded and the resolved name in the
IMapStorageExceptionmessage, and emit a WARN (once per legacy name) when a rewrite is applied so upgrades that depend on this table are visible in the master log. - Evidence:
seatunnel-engine/seatunnel-engine-storage/imap-storage-plugins/imap-storage-file/src/main/java/org/apache/seatunnel/engine/imap/storage/file/common/WALReader.java:168 return LEGACY_CLASS_NAME_MAPPINGS.getOrDefault(className, className); - Suggested fix: When the resolved class cannot be loaded, the
catch (ClassNotFoundException)below still reports the originalclassName, so a wrong/stale mapping target would surface asclass name is org.apache.seatunnel.engine.core.job.JobResultand look like the mapping was never applied. Please hold the resolved name in a local, include both names in theIMapStorageExceptionmessage, and log a WARN (once per legacy name) when a rewrite is applied so upgrades that depend on this table are visible in the master log. This exception aborts the whole MapStoreloadAll, so the diagnostics matter. - Severity: Medium
Issue 3: Only the JobStatus mapping is exercised; the JobResult and JobStatusData target names are unverified string literals that the compiler cannot check
- Location:
seatunnel-engine/seatunnel-engine-storage/imap-storage-plugins/imap-storage-file/src/main/java/org/apache/seatunnel/engine/imap/storage/file/common/WALReader.java:61 - Why it matters: - Root cause:
imap-storage-filedoes not compile againstseatunnel-engine-common-- the pom adds it at<scope>test</scope>only (pom.xml:50) -- so the three target names inLEGACY_CLASS_NAME_MAPPINGS(WALReader.java:60-68) are plain strings with no compile-time check. The new test writes a record with the legacyJobStatusname only; nothing verifies thatorg.apache.seatunnel.engine.common.job.JobResultandorg.apache.seatunnel.engine.common.job.JobStatusDataresolve. - Impact: a typo in either target, or a future relocation of either class, would not fail the build or any unit test and would only be discovered as a
ClassNotFoundExceptionduring a production cluster restart -- the exact failure mode this PR is fixing. - Fix: add a test that iterates every entry of the table and asserts
Class.forName(target)succeeds (the test scope dependency already makes the classes available), and ideally round-trip aJobResultand aJobStatusDatawritten under their legacy names. - Evidence:
seatunnel-engine/seatunnel-engine-storage/imap-storage-plugins/imap-storage-file/src/main/java/org/apache/seatunnel/engine/imap/storage/file/common/WALReader.java:67 "org.apache.seatunnel.engine.core.job.JobStatusData",;seatunnel-engine/seatunnel-engine-storage/imap-storage-plugins/imap-storage-file/pom.xml:50 <scope>test</scope>;seatunnel-engine/seatunnel-engine-storage/imap-storage-plugins/imap-storage-file/src/test/java/org/apache/seatunnel/engine/imap/storage/file/common/WALReaderAndWriterTest.java:165 .valueClassName("org.apache.seatunnel.engine.core.job.JobStatus") - Suggested fix: Because this module only sees
seatunnel-engine-commonat test scope, these target names are unchecked strings. The new test only coversJobStatus; theJobResultandJobStatusDatatargets are never resolved anywhere. Please add a test that iterates all entries and assertsClass.forName(target)succeeds (and ideally round-trips aJobResult/JobStatusDatawritten under the legacy name), otherwise a typo or another relocation would only be caught by a failed production restart. - Severity: Medium
Issue 4: Compatibility restoration is only documented in Javadoc; no user-facing upgrade note for clusters using file-based IMap storage
- Location:
seatunnel-engine/seatunnel-engine-storage/imap-storage-plugins/imap-storage-file/src/main/java/org/apache/seatunnel/engine/imap/storage/file/common/WALReader.java:56 - Why it matters: - The PR fixes an upgrade break for every cluster that persists job state through
imap-storage-file: WAL records written before #9689 carryorg.apache.seatunnel.engine.core.job.JobStatusand friends, and the newLEGACY_CLASS_NAME_MAPPINGStable (WALReader.java:56-70) is what makes a restart succeed. - Today the only place this contract is written down is the private-field Javadoc (
WALReader.java:45-55).docs/en/introduction/concepts/incompatible-changes.mdcontains only a## devheading with no entry for #9689,engine-common, orengine.common.job, so operators have no user-facing statement that upgrading with an existingimap-storagedirectory is supported and that no manual WAL cleanup is needed. - Fix: add a one-line bullet under
## devindocs/en/introduction/concepts/incompatible-changes.md(and thedocs/zhmirror) stating that the job-status classes moved toseatunnel-engine-commonand that the WAL reader resolves the legacy names transparently. - Evidence:
seatunnel-engine/seatunnel-engine-storage/imap-storage-plugins/imap-storage-file/src/main/java/org/apache/seatunnel/engine/imap/storage/file/common/WALReader.java:52 * see #9928. Removing an entry from this table breaks upgrades from any release that still - Suggested fix: The Javadoc here is clear and explains the forever-compatibility contract well. Since this is what makes upgrades from pre-#9689 releases work for anyone running the file-based IMap storage, could we also surface it to users? A one-line bullet under
## devindocs/en/introduction/concepts/incompatible-changes.md(and thedocs/zhmirror) saying the job-status classes moved toseatunnel-engine-commonand that the WAL reader now resolves the legacy names transparently would let operators know no manual WAL cleanup is needed. The #9689 move itself was never recorded there, so this would close that gap too. - Severity: Low
Issue 5: The #9689 class relocation and this shim's upgrade/downgrade semantics are not recorded in incompatible-changes.md
- Location:
seatunnel-engine/seatunnel-engine-storage/imap-storage-plugins/imap-storage-file/src/main/java/org/apache/seatunnel/engine/imap/storage/file/common/WALReader.java:65 - Why it matters: - Root cause: the mapping added here (
WALReader.java:58-70) exists because #9689 movedJobResult/JobStatus/JobStatusDatafromseatunnel-engine-coretoseatunnel-engine-common, which changed the class names thatIMapFileStorage.parseToIMapFileDatarecords in the WAL viavalue.getClass().getName().docs/en/introduction/concepts/incompatible-changes.mdhas no entry for this (no mention of #9689,engine-commonorengine.common.job). - Impact: with this PR the upgrade direction (old WAL -> new reader) works, but the reverse does not: once a post-#9689 master has written
org.apache.seatunnel.engine.common.job.JobStatusinto the persisted IMap WAL, rolling back to an older release fails with the sameClassNotFoundExceptionas #9928. Operators have no documented warning about this one-way door or how to prepare for a rollback. - Fix: add a short note (en + zh) describing the WAL class-name change, stating that this release can replay pre-#9689 WALs, and that downgrading requires finishing/cancelling jobs or clearing the
imap-storagedirectory first. - Evidence:
seatunnel-engine/seatunnel-engine-storage/imap-storage-plugins/imap-storage-file/src/main/java/org/apache/seatunnel/engine/imap/storage/file/common/WALReader.java:65 "org.apache.seatunnel.engine.common.job.JobStatus"); - Suggested fix: This restores the upgrade path, but the relocation in #9689 remains a one-way door: once a post-#9689 master has written
engine.common.job.JobStatusinto the persisted IMap WAL, rolling back to an older release hits the sameClassNotFoundExceptionas #9928. I don't see an entry for #9689 indocs/en/introduction/concepts/incompatible-changes.md. Could you add a short note there (en + zh) describing the WAL class-name change, that this release can replay pre-#9689 WALs, and that downgrading requires finishing/cancelling jobs or clearing theimap-storagedirectory first? - Severity: Low
Issue 6: New test-scoped seatunnel-engine-common dependency has no comment explaining why production code deliberately references the class names as strings
- Location:
seatunnel-engine/seatunnel-engine-storage/imap-storage-plugins/imap-storage-file/pom.xml:50 - Why it matters: - The pom adds
seatunnel-engine-commonat<scope>test</scope>(pom.xml:46-51) purely so the test can importorg.apache.seatunnel.engine.common.job.JobStatus. Production code inWALReader.java:60-68keeps the target names as string literals so the storage plugin does not gain a compile-time dependency on the engine module. - Without a comment, a future contributor is likely to either promote the scope to compile or replace the literals with
JobStatus.class.getName(), quietly introducing a dependency from the storage plugin ontoseatunnel-engine-common. - Fix: add a short XML comment on the dependency (and optionally a sentence in the
LEGACY_CLASS_NAME_MAPPINGSJavadoc) stating that the test scope is intentional and that the table must stay string-based. - Evidence:
seatunnel-engine/seatunnel-engine-storage/imap-storage-plugins/imap-storage-file/pom.xml:50 <scope>test</scope>;seatunnel-engine/seatunnel-engine-storage/imap-storage-plugins/imap-storage-file/src/main/java/org/apache/seatunnel/engine/imap/storage/file/common/WALReader.java:62 "org.apache.seatunnel.engine.common.job.JobResult"); - Suggested fix: Keeping this test-scoped is the right call, since
WALReaderdeliberately refers to the relocated classes by string so the storage plugin stays free of a compile dependency onseatunnel-engine-common. Could you add a short XML comment saying so? Otherwise the next person is likely to promote the scope or replace the literals inLEGACY_CLASS_NAME_MAPPINGSwithJobStatus.class.getName(), which would quietly introduce that dependency. - Severity: Low
Issue 7: Legacy fixture is produced by the current WALWriter, so the test never reads a WAL frame actually written by a pre-#9689 release
- Location:
seatunnel-engine/seatunnel-engine-storage/imap-storage-plugins/imap-storage-file/src/test/java/org/apache/seatunnel/engine/imap/storage/file/common/WALReaderAndWriterTest.java:165 - Why it matters: - The test builds the 'legacy' record with today's
IMapFileData.builder()andWALWriter(WALReaderAndWriterTest.java:158-168), only overridingvalueClassNameto the old FQCN (:165). That provesresolveClassNameis applied, but it does not prove that a WAL file produced by an older SeaTunnel release (olderIMapFileDataprotostuff layout, olderJobStatusenum constants/ordinals) replays end-to-end, which is the scenario #9928 reports. - If the
IMapFileDataframe format or the protostuff encoding of the moved classes ever diverges from what old releases wrote, this test would keep passing while real upgrades fail. - Fix: check in a small real WAL fixture produced by a pre-#9689 release under
src/test/resources/and replay it in this test. - Evidence:
seatunnel-engine/seatunnel-engine-storage/imap-storage-plugins/imap-storage-file/src/test/java/org/apache/seatunnel/engine/imap/storage/file/common/WALReaderAndWriterTest.java:165 .valueClassName("org.apache.seatunnel.engine.core.job.JobStatus") - Suggested fix: This record is written with the current
WALWriter/IMapFileDatalayout and only the class-name string is 'legacy'. That validatesresolveClassName, but not that a WAL file actually produced by a pre-#9689 release replays. Consider checking in a small real WAL fixture from such a release undersrc/test/resources/and replaying it here; that is the scenario #9928 reports. - Severity: Low
Issue 8: Single-hop getOrDefault lookup means a future relocation requires rewriting every existing target, contrary to the 'extend it' guidance in the Javadoc
- Location:
seatunnel-engine/seatunnel-engine-storage/imap-storage-plugins/imap-storage-file/src/main/java/org/apache/seatunnel/engine/imap/storage/file/common/WALReader.java:168 - Why it matters: - Root cause:
resolveClassNameperforms onegetOrDefaultlookup (WALReader.java:168). The Javadoc (WALReader.java:52-54) instructs maintainers to 'extend it whenever a persisted job model class is moved again', but adding a newcommon -> newpkgentry would not fix records that still carry thecorename, because thecore -> commonresult is not re-resolved. - Impact: a future move would silently reintroduce the #9928 restart failure for clusters upgrading directly from a pre-#9689 release unless the maintainer also remembers to rewrite the three existing targets -- which nothing in the code or tests enforces.
- Fix: either document that every target must always be the current class name (backed by a test that resolves every target, see the coverage gap above), or resolve iteratively with a hop limit so chained entries work.
- Evidence:
seatunnel-engine/seatunnel-engine-storage/imap-storage-plugins/imap-storage-file/src/main/java/org/apache/seatunnel/engine/imap/storage/file/common/WALReader.java:168 return LEGACY_CLASS_NAME_MAPPINGS.getOrDefault(className, className); - Suggested fix: This is a single-hop lookup, so if a class moves again, adding a new
common -> Xentry as the Javadoc suggests would not fix records still carrying thecorename. Please either document that targets must always be the current class name (backed by a test that resolves every target), or resolve iteratively with a hop limit so chained entries work. - Severity: Low
Review conclusion
Conclusion: final approval remains pending on the previous comments
2. Remaining follow-ups
- Issue 1: Regression test asserts only getClass()/toString() on the replayed enum and covers just 1 of the 3 legacy mappings
- Issue 2: ClassNotFoundException after legacy-name rewrite still reports only the original WAL class name; a wrong or stale mapping target is undiagnosable and still aborts the whole cluster restart
- Issue 3: Only the JobStatus mapping is exercised; the JobResult and JobStatusData target names are unverified string literals that the compiler cannot check
- Issue 4: Compatibility restoration is only documented in Javadoc; no user-facing upgrade note for clusters using file-based IMap storage
- Issue 5: The #9689 class relocation and this shim's upgrade/downgrade semantics are not recorded in incompatible-changes.md
- Issue 6: New test-scoped
seatunnel-engine-commondependency has no comment explaining why production code deliberately references the class names as strings - Issue 7: Legacy fixture is produced by the current WALWriter, so the test never reads a WAL frame actually written by a pre-#9689 release
- Issue 8: Single-hop getOrDefault lookup means a future relocation requires rewriting every existing target, contrary to the 'extend it' guidance in the Javadoc
Thanks for the updates so far. Happy to discuss the remaining points.
|
Thanks @nzw921rx and @dybyte for the approvals. Before I merge, I'd like to close out the open points from my earlier review — as far as I can tell from the thread, none of them have been addressed on Remaining asks, in priority order:
Items 1 and 2 are what I'd like to see before merging; 3 and 4 can be follow-ups if you prefer, just let me know. Thanks for the patience on this. |
…est and report rewritten class name on lookup failure
446ae12
DanielLeens
left a comment
There was a problem hiding this comment.
Thanks @zhangshenghang for the quick follow-up commit, and thanks @SEZ9 for the careful checklist. I re-read the whole PR at the new head (446ae12) from scratch, not just the delta since my earlier approval on 835b264. The new commit addresses the main asks from SEZ9's review. +1 to @SEZ9's points on test coverage, error reporting and docs; I verified each against the new head below.
What Problem Does This PR Solve?
- User pain point: The job status model classes (
JobResult,JobStatus,JobStatusData) moved fromseatunnel-engine-coretoseatunnel-engine-commonin #9689. File-backed IMap WAL records persist the class name viavalue.getClass().getName(), so WAL files written by older releases still carryorg.apache.seatunnel.engine.core.job.*. After upgrading and restarting,ClassUtils.getClass(...)throwsClassNotFoundExceptionand job-state recovery aborts (#9928). - Fix approach:
WALReaderrewrites the recorded class name through a small immutable lookup table before loading the class. - Summary: A minimal, string-based shim at the single choke point used by both key and value deserialization, so pre-#9689 WAL files replay on current versions.
- Example: A WAL record with valueClassName
org.apache.seatunnel.engine.core.job.JobStatusis now loaded asorg.apache.seatunnel.engine.common.job.JobStatusinstead of failing the whole restart.
1. Code Change Review
1.1 Core Logic Analysis
Files changed: WALReader.java, its test, the module pom (test-scoped dependency), and incompatible-changes.md (en and zh).
Runtime path (PR head):
Master restart
Hazelcast MapStore replay -> FileMapStore.loadAll / loadAllKeys
-> IMapFileStorage.loadAll / loadAllKeys
-> WALReader.loadAllData / loadAllKeys
-> deserializeData(bytes, recordedClassName)
-> resolveClassName(recordedClassName) [NEW: table lookup, getOrDefault]
-> ClassUtils.getClass(resolvedName)
-> serializer.deserialize(bytes, clazz) [unchanged]
catch ClassNotFoundException
-> IMapStorageException(recorded name + resolved name) [UPDATED]
Write side (unchanged): IMapFileStorage.parseToIMapFileData records the current class name.
This is on the normal startup-recovery path for any cluster with file-backed IMap persistence that upgrades across the #9689 boundary, not an edge path. Names that are not in the table pass through unchanged, so nothing else is affected. The three mapped classes exist under seatunnel-engine-common/.../common/job/, and #9689 was a package-only move, so the serialized field layout is unchanged.
Status of previously raised items at the new head:
- Test only covered JobStatus and used weak assertions (SEZ9 Issue 1/3): FIXED.
WALReaderAndWriterTestnow hastestReaderLoadsAllLegacyJobModelClassNames, which writes all three legacy names and asserts real field values (status name, error text, job id/name/status/times) on the replayed objects. The enum comparison usesname()with a comment explaining why identity is not used; that is an acceptable explanation for a ProtoStuff enum. - Exception only reports the original name (SEZ9 Issue 2): FIXED. The catch block now includes both the recorded and the resolved class name.
- Docs / upgrade-downgrade note (SEZ9 Issue 4/5): FIXED. Both
docs/enanddocs/zhincompatible-changes.mdhave a matching entry that states the rewrite is one-way and that downgrading after new WAL entries are written needs WAL cleanup. - pom comment (SEZ9 Issue 6), chained-relocation wording (Issue 8), real pre-#9689 fixture (Issue 7): not addressed; all are non-blocking (see Low issues).
1.2 Compatibility Impact
Fully compatible. Reading pre-#9689 WAL files now works; current-format WAL files are read exactly as before. No config option, API, default or serialization format changes. The downgrade limitation (a WAL written by a newer version cannot be read by an older one) is a pre-existing consequence of #9689 and is now documented.
1.3 Performance / Side-Effect Analysis
One HashMap lookup per deserialized key or value against a 3-entry immutable map built once. No new I/O, locks, threads or retained state, no change to write path, so no concern at large WAL volumes. Note that resolveClassName is computed a second time only inside the failure path, which is irrelevant for performance.
1.4 Error Handling and Logging
No blocking issues found.
Issue 1: Test-scoped seatunnel-engine-common dependency has no explanatory comment
- Location:
imap-storage-file/pom.xml:46-51 - Problem: Production code keeps the target names as strings on purpose, but nothing says so. A future cleanup could promote the scope or swap in
JobStatus.class.getName(). - Potential risk: Silent new compile dependency from the storage plugin onto the engine module.
- Best improvement: One short XML comment on the dependency (raised by @SEZ9 as item 4).
- Severity: Low
- Raised by another reviewer: Yes @SEZ9
Issue 2: Javadoc says to "extend" the table, but lookup is single-hop
- Location:
WALReader.javaJavadoc onLEGACY_CLASS_NAME_MAPPINGSandresolveClassName - Problem: If a class moves again, adding
common -> newpkgwould not fix records that still carry thecorename; the existing targets must be rewritten too. - Potential risk: A future move could reintroduce #9928 for direct upgrades from old releases.
- Best improvement: Reword the Javadoc to say every target must always be the current class name. The new all-names test helps here, since it resolves every target.
- Severity: Low
- Raised by another reviewer: Yes @SEZ9
Issue 3: Legacy fixture is produced by the current WALWriter
- Location:
WALReaderAndWriterTest.java, legacy tests - Problem: Only the class-name string is legacy; the frame bytes are written by the current writer. A real pre-#9689 WAL file would be stronger evidence.
- Potential risk: Low, because #9689 only changed the package line. This is optional.
- Best improvement: Optionally check in a small captured WAL file as a test resource.
- Severity: Low
- Raised by another reviewer: Yes @SEZ9 (explicitly non-blocking)
2. Code Quality Assessment
2.1 Coding Standards
Consistent with the file. The static table and resolveClassName both carry useful Javadoc explaining why the shim exists and the contract for maintaining it. The pre-existing commented-out log line in the catch block was lightly updated; harmless.
2.2 Test Coverage and Test Stability
Coverage now spans all three mapped names with value-level assertions. Stability: Stable. Both new tests use the local filesystem harness already used by the class, have no sleeps or timing assertions, and use a dedicated directory that is cleaned up in @AfterAll. The two new tests share one directory; the writer creates a fixed-name file so the second test may overwrite the first's file, but each test reads back only keys it wrote itself, so ordering does not matter.
2.3 Documentation Updates
en and zh incompatible-changes.md entries are present, consistent with each other and with the code (three classes, old to new package, one-way rewrite, downgrade caveat).
3. Architectural Soundness
3.1 Elegance of the Solution
Precise fix. It is placed at the one deserialization choke point and keeps the storage plugin free of a compile dependency on the engine module.
3.2 Maintainability
Good: immutable table, documented contract, all-names regression test.
3.3 Extensibility
New relocations can be added to the table (keeping targets current, see Issue 2).
3.4 Historical-Version Compatibility
Restores upgrades from pre-#9689 releases; does not change behaviour for newer WAL data.
4. Issue Summary
| # | Issue | Location | Severity |
|---|---|---|---|
| 1 | No comment on the test-scoped dependency | imap-storage-file/pom.xml:46-51 |
Low |
| 2 | Javadoc guidance vs single-hop lookup | WALReader.java (table Javadoc) |
Low |
| 3 | Fixture not captured from a real old release | WALReaderAndWriterTest.java |
Low |
5. Merge Recommendation
Conclusion: Ready to merge
- Blockers - must be fixed: none.
- Recommended fixes - non-blocking: Issues 1 to 3 above, all optional and reasonable as a follow-up.
Overall assessment: the fix is correct, scoped to the one path that failed, and the author has now covered the test, diagnostics and documentation asks. My earlier approval stands for the new head. On SEZ9's request that items 1 and 2 be seen before merge: both are now in the code at this head; item 3 is also done, and item 4 was explicitly allowed as a follow-up. @SEZ9 please re-check when you have a moment.
CI/sync status: the apache-side Build check for this head is still in progress and the lightweight checks are green; I saw no PR-caused failure. The branch has no reported conflicts. Next step: let the fork CI run finish, then a committer can merge.
|
Thanks for the follow-up commit. I haven't been able to verify the new head (446ae12) myself yet, so rather than guess at what changed since 835b264, could you confirm the status of the earlier points? Error reporting (F2): Does the Docs (F4, F5): If Test coverage (F1, F3): Does the regression test now cover all three legacy names ( Legacy fixture (F7): Is the fixture still produced by the current Multi-hop lookup (F8): If the lookup is still a single-hop Pom comment (F6): A one-line comment on the test-scoped None of these change the approach; the shim at the single |
Resolve the merge conflicts with dev: keep both sides' documentation entries. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
DanielLeens
left a comment
There was a problem hiding this comment.
Thanks @zhangshenghang for keeping this branch in sync with dev, and sorry to be the bearer of bad news on a PR I had approved: after the latest dev merge (head 9adcc9341f) I re-read the whole diff from scratch, and the branch no longer compiles. My earlier approval was given on 446ae12807, and I am withdrawing it for this head until the one-line fix below lands. The author-side change is otherwise identical to what I approved (see the unchanged-code check below), so this should be quick.
What Problem Does This PR Solve?
- User pain point: Job status model classes (
JobResult,JobStatus,JobStatusData) moved fromseatunnel-engine-coretoseatunnel-engine-commonin #9689. WAL files written by older releases still recordorg.apache.seatunnel.engine.core.job.*, so a restart on a current build fails withClassNotFoundException(#9928). - Fix approach:
WALReaderrewrites those three recorded names through an immutable lookup table right beforeClassUtils.getClass(...). - Summary: A small string-based shim at the single deserialization choke point so pre-#9689 WAL files replay again.
1. Code Change Review
1.1 Core Logic Analysis
Unchanged-code check: I diffed the PR's own added/removed lines at 446ae12807 (the head I approved) against 9adcc9341f. They are identical (same 5 files, +151/-3 against each merge base), so the shim, the two tests, the pom scope and the en/zh docs are exactly as reviewed before.
What changed underneath it: dev now contains #11494 (WAL recovery memory optimization), which rewrote WALReader and dropped import java.util.Collections; (and List) from that file. The PR's static initializer still calls Collections.unmodifiableMap(...), so the auto-merge succeeds textually but the result does not compile.
Runtime path at this head (the shim itself is still on the normal restart-recovery path):
Master restart
-> FileMapStore.loadAll / loadAllKeys
-> IMapFileStorage.loadAll / loadAllKeys
-> WALReader.loadAllData / loadAllKeys (dev: streaming LatestMutationAccumulator, #11494)
-> deserializeData(bytes, recordedClassName)
-> resolveClassName(recordedClassName) (this PR: table lookup)
-> ClassUtils.getClass(resolvedName)
-> serializer.deserialize(bytes, clazz)
The new dev flow still funnels every key and value through deserializeData, so the shim placement remains correct once it compiles.
1.2 Compatibility Impact
Fully compatible (unchanged from my previous review): pre-#9689 WAL files become readable, current-format WAL data is read exactly as before, and the downgrade caveat is documented in both incompatible-changes.md files.
1.3 Performance / Side-Effect Analysis
Unchanged: one lookup in a 3-entry immutable map per deserialized key/value, no new I/O, locks or retained state.
1.4 Error Handling and Logging
Issue 1: Merged head does not compile because java.util.Collections is no longer imported
- Location:
seatunnel-engine/seatunnel-engine-storage/imap-storage-plugins/imap-storage-file/src/main/java/org/apache/seatunnel/engine/imap/storage/file/common/WALReader.java:69(Collections.unmodifiableMap(...)), imports at lines 36-40 - Problem description: #11494 removed the
Collectionsimport from this file when it rewrote the read path. This PR's static initializer relies on it. The fork Build for this head fails inimap-storage-filewithcannot find symbol: variable CollectionsatWALReader.java:[69,37], which in turn fails Install, unit tests and every integration shard that depends on the module. - Potential risk: Nothing can merge or be verified until the module compiles, and the failing shards are all downstream of this single error.
- Best improvement: Re-add
import java.util.Collections;toWALReader.java(beforejava.util.HashMap), run./mvnw spotless:apply -pl seatunnel-engine/seatunnel-engine-storage/imap-storage-plugins/imap-storage-file, and push. Option B, if you prefer not to touch imports: build the map with an unmodifiable view another way, but re-adding the import is the smaller change. - Severity: High (build break)
- Raised by another reviewer: No
I have no other blocking findings; the earlier non-blocking Low items (pom comment, single-hop Javadoc wording, fixture produced by the current writer) from my previous review still stand as optional follow-ups and are not repeated as issues here.
2. Code Quality Assessment
2.1 Coding Standards
Unchanged and consistent with the file. The new tests were already rated Stable (no sleeps, dedicated directory, cleaned in @AfterAll). They also still compile against dev's loadAllData(Path, Set) signature, which did not change.
2.2 Test Coverage and Test Stability
Unchanged: all three legacy names are covered with value-level assertions. Stability: Stable. The tests could not run on this head only because of the compile error.
2.3 Documentation Updates
docs/en and docs/zh entries are present and consistent; no change needed.
3. Architectural Soundness
Precise fix, placed at the one choke point, no new dependencies in production code. Historical-version compatibility is as described in 1.2.
4. Issue Summary
| # | Issue | Location | Severity |
|---|---|---|---|
| 1 | Missing java.util.Collections import after the dev merge |
WALReader.java:69 |
High |
5. Merge Recommendation
Conclusion: Ready to merge after fixes
- Blockers - must be fixed
- Issue 1: add the missing import so the module compiles.
- Recommended fixes - non-blocking
- The three Low items from my previous review (optional).
Other reviewers: @nzw921rx and @dybyte approved earlier, and @SEZ9's open asks (test coverage, both class names in the error, docs) were verified as addressed in my previous review; I do not see new activity from them after that, and the fix above does not change that conclusion.
CI / sync facts for this head: fork Build run 37391629994 failed, and the failures I traced (Install, unit tests, the integration shards) all stem from the compile error above, so I would not treat them as unrelated flakes. The branch has no reported merge conflicts (mergeable=true, state blocked only by the pending review/CI gates), and it is 43 commits behind dev, which is metadata only. Once the import is restored and CI is green, I am happy to move this back to approved. Thanks again for the patience and for the quick turnarounds so far!
IMapStorageException formats its message with String.format, so the {}
placeholders used in WALReader.deserializeData never rendered the
recorded or resolved class name, leaving the restart failure without
the context needed to diagnose a stale legacy mapping. Switch both
throw sites to %s placeholders (also fixing the inverted 's%' pair in
the IOException branch) and add a regression test that replays a WAL
entry with an unknown class name and asserts both names surface in the
exception message.
DanielLeens
left a comment
There was a problem hiding this comment.
Thanks @zhangshenghang, this is exactly the fix I asked for in my last round, and it was quick! I re-read the whole diff of the latest head 9658666be8 from scratch, including the delta since 998271775d.
What Problem Does This PR Solve?
- User pain point: #9689 moved
JobResult,JobStatusandJobStatusDatafromseatunnel-engine-coretoseatunnel-engine-common. WAL files written by older releases still recordorg.apache.seatunnel.engine.core.job.*, so restarting a current build that persists job state through file-backed IMap storage fails withClassNotFoundException(#9928). - Fix approach:
WALReaderrewrites those three recorded names through an immutable lookup table right beforeClassUtils.getClass(...). - One-sentence summary: A small string-based shim at the single deserialization choke point so pre-#9689 WAL files replay again.
1. Code Change Review
1.1 Core Logic Analysis
I compared the PR's own added/removed lines (against each merge base with dev) for the previous head 998271775d and the current head. The shim, the table, the pom scope and the docs are unchanged; the new content is exactly the error-message fix:
WALReader.java(deserializeData, around:129-:158): theClassNotFoundExceptionbranch now uses%splaceholders ("class name is %s, resolved class name is %s"), and theIOExceptionbranch's previouss%typo is now%s, with comments explaining thatIMapStorageException(Throwable, String, Object...)goes throughString.format.WALReaderAndWriterTest.java: newtestUnknownClassNameSurfacesInExceptionMessagewrites a record whose value class name isorg.apache.seatunnel.engine.core.job.NeverExistedJobStatus, replays it withloadAllData, and asserts the message containsclass name is <name>, resolved class name is <name>; the new path is deleted in@AfterAll.- The branch also contains a merge of
dev(ce88ee9d7d); the branch is now fully up to date (behind_by=0,ahead_by=11, status ahead, no conflicts).
Runtime path (normal restart-recovery route, unchanged):
Master restart -> Hazelcast MapStore replay
-> FileMapStore.loadAll / loadAllKeys
-> IMapFileStorage.loadAll / loadAllKeys
-> WALReader.loadAllData / loadAllKeys
-> deserializeData(bytes, recordedClassName)
-> resolveClassName(recordedClassName) 3-entry immutable map, getOrDefault
-> ClassUtils.getClass(resolvedName)
-> serializer.deserialize(bytes, clazz)
-> ClassNotFoundException -> IMapStorageException("... %s ... %s") now renders both names
This closes my previous Issue 1 (and @SEZ9's F2): with %s the recorded and resolved names now appear in the restart failure. I verified the formatting mechanism in IMapStorageException(Throwable, String, Object...), which calls String.format(message, data). The new test would have failed on the previous head, because {} is not a String.format specifier, so it protects exactly this regression. I also want to acknowledge that the earlier gap was mine to catch in two rounds, and thank you for turning it around so quickly.
1.2 Compatibility Impact
Fully compatible. Current-format WAL entries resolve unchanged, pre-#9689 entries become readable again, and there is no config, API or serialization-format change. The one-way downgrade caveat is documented in both incompatible-changes.md files.
1.3 Performance / Side-Effect Analysis
One hash lookup per deserialized key/value. No new I/O, lock, thread or retained state.
1.4 Error Handling and Logging
Resolved. Both failure branches now render their arguments. One tiny remark, not a request: the IOException branch prints data (a byte[]) with %s, which shows an array identity such as [B@..., not the bytes; that is a pre-existing choice and the class name next to it is the useful part, so I would leave it.
2. Code Quality Assessment
2.1 Coding Standards
Consistent with the file; the new comments explain why %s is required.
2.2 Test Coverage and Test Stability
All three legacy names are replayed with value-level assertions, the targets are bound to the live classes, and the error message is now asserted. Stability rating: Stable (no sleeps, deterministic data, local file system, cleanup in @AfterAll). I reviewed the tests statically and did not run them.
2.3 Documentation Updates
docs/en and docs/zh incompatible-changes.md entries are present and consistent.
3. Architectural Soundness
Precise fix at the one choke point, no new production dependency, a single table to extend (single-level resolution is documented in the Javadoc).
4. Issue Summary
| # | Issue | Location | Severity |
|---|---|---|---|
| 1 | (carryover, previous round) Message renders no class names | WALReader.java deserializeData |
Resolved on this head |
| 2 | (carryover, previous round, optional) testLegacyMappingsTargetCurrentClassNames reads a private field by reflection, with fully-qualified java.lang.reflect.Field / java.util.Map and an unchecked cast (WALReaderAndWriterTest.java:253-257) |
WALReaderAndWriterTest.java |
Low, non-blocking |
5. Merge Recommendation
Conclusion: Ready to merge
- Blockers - must be fixed: No source-side blockers.
- Recommended fixes - non-blocking: Issue 2 is only a style/robustness suggestion (make
resolveClassNamepackage-private and assert on it directly, or importField/Map); it is fine to leave it or do it as a follow-up.
CI status: pending, not failing. For head 9658666be8 the apache-side Build is in_progress; labeler and Notify test workflow are success. The fork's Build run for this head is still queued (https://github.com/zhangshenghang/seatunnel/actions/runs/38363095354). Nothing is needed from you except letting it finish; if a lane fails I will check whether it relates to this diff (the previous head's only failures were two unrelated connector ITs).
Review gate: I only have read-level review controls here, so the formal approval has to come from a maintainer with write access. @SEZ9, from my side every item you listed (F1/F2/F3/F4/F5/F6/F8) is now satisfied in the code of this head; F7 (a real pre-#9689 fixture) is a reasonable follow-up.
Thanks again for sticking with this - it is a real upgrade-path fix!
|
Hi @SEZ9, yes — exactly: my F5 was referring to your F7, i.e. replaying a WAL frame actually written by a pre-#9689 release rather than one produced by the current WALWriter. Producing a genuine old-format fixture needs a build from the pre-relocation release line, so I'd prefer to keep it as a follow-up once this shim lands. Thanks for the careful review! |
|
Hi @zhangshenghang, thanks for clarifying — that lines up, your F5 and my F7 are the same point: replaying a frame actually written by a pre-#9689 release, not one produced by the current WALWriter. Agreed on deferring that. Producing a genuine old-format fixture does need a build from the pre-relocation release line, and that's not something I'd block this shim on. Two small asks so it doesn't get lost:
On the rest of the earlier review, could you confirm where things stand so I can do a final pass:
If any of these were addressed in a later push, just point me at it and I'll re-review. |
Co-authored-by: multica-agent <github@multica.ai>
|
Hi @SEZ9, both asks are done:
On the earlier items, where things stand on the current head:
These landed across |
DanielLeens
left a comment
There was a problem hiding this comment.
Thanks @zhangshenghang for the quick turnaround, and thanks @SEZ9 for the careful follow-ups. I re-read the whole PR from scratch on the latest head f6869ab098, including everything that landed after my last review on 9658666be8. Sorry for one small thing I should have flagged in my earlier rounds: the test fixture directory handling (Issue 1 below). It is a carryover from the previous version, not something newly introduced.
What Problem Does This PR Solve?
- User pain point: #9689 moved
JobResult,JobStatusandJobStatusDatafromorg.apache.seatunnel.engine.core.jobtoorg.apache.seatunnel.engine.common.job. WAL files written by older releases still record the old class names, so a restart that replays file-backed IMap storage fails withClassNotFoundException(#9928). - Fix approach:
WALReaderrewrites those three recorded names through an immutable lookup table right beforeClassUtils.getClass(...). - One-sentence summary: A small string-based shim at the single deserialization choke point so pre-#9689 WAL files replay again.
1. Code Change Review
1.1 Core Logic Analysis
PR-owned files on this head (5): WALReader.java (+56/-4), WALReaderAndWriterTest.java (+160), imap-storage-file/pom.xml (+9), and the en/zh incompatible-changes.md entries (+5 each).
Delta since my last review: the only PR-owned change is a 3-line TODO comment on LEGACY_JOB_STATUS_PATH in WALReaderAndWriterTest.java (fixture provenance, which is what @SEZ9 asked for). The other commits (ce88ee9, 6c771bd, a59cd95) are dev merges; the unrelated Lance, Flink e2e and Spark files that show up in a raw compare are dev content, not part of this PR (gh api pulls/11781/files lists exactly the 5 files above). The branch is ahead_by=14, behind_by=0, no conflicts.
Key code (after the change):
private static final Map<String, String> LEGACY_CLASS_NAME_MAPPINGS; // 3 entries, unmodifiable
private Object deserializeData(byte[] data, String className) {
try {
Class<?> clazz = ClassUtils.getClass(resolveClassName(className));
... serializer.deserialize(data, clazz) ...
} catch (ClassNotFoundException e) {
throw new IMapStorageException(e,
"deserialize data error, class name is %s, resolved class name is %s",
className, resolveClassName(className));
}
}
private static String resolveClassName(String className) {
return LEGACY_CLASS_NAME_MAPPINGS.getOrDefault(className, className);
}Complete runtime path (normal restart-recovery route, which does reach the changed code):
Master restart -> Hazelcast MapStore replay
-> FileMapStore.loadAll / loadAllKeys
-> IMapFileStorage.loadAll / loadAllKeys
-> WALReader.loadAllData / loadAllKeys
-> readLatestMutations -> IMapFileData{key, keyClassName, value, valueClassName}
-> deserializeData(bytes, recordedClassName)
-> resolveClassName: core.job.{JobStatus,JobResult,JobStatusData} -> common.job.*
-> ClassUtils.getClass(resolved) -> ProtoStuffSerializer.deserialize(bytes, clazz)
-> ClassNotFoundException -> IMapStorageException (both names rendered via %s)
Write side (unchanged): WALWriter records value.getClass().getName(), i.e. the current common.job.* names.
Why the shim is sufficient (I verified this against the sources, not only the PR text): ProtoStuffSerializer uses RuntimeSchema keyed by the target Class handed in by WALReader; the serialized bytes of JobStatusData (Long, String, enum JobStatus, longs), JobResult (enum + String) and JobStatus carry field numbers and enum ordinals, not embedded class names. So rewriting only the recorded className is enough, and the wire format of the three classes did not change in #9689 (the PR for #9689 renames exactly these three files and nothing else that is persisted through this storage).
Key findings:
- The normal restart path reaches the changed logic; this is not only a boundary path.
- Precise, minimal fix at the single choke point; a single table to extend; no change to the write path.
- Single-hop resolution is documented in the Javadoc (agreed with @SEZ9 in the thread).
- Current-format entries resolve unchanged (
getOrDefault), so there is no behavior change for clusters that never wrote legacy names.
1.2 Compatibility Impact
Fully compatible. No API, option, default, protocol or serialization-format change. Pre-#9689 WAL entries become readable again; current entries are untouched. The one-directional downgrade caveat (a WAL written by the new version cannot be resolved by an old release) is documented in both docs/en and docs/zh incompatible-changes.md. ProtoStuffSerializer is not touched.
1.3 Performance / Side-Effect Analysis
One immutable HashMap lookup per deserialized key/value on replay only (startup/recovery path). No new I/O, lock, thread, cache or retained state. The %s formatting happens only on the failure path. No concern at high data volume: the cost is O(1) per record and is dwarfed by the existing file read and protostuff decode.
1.4 Error Handling and Logging
Good. The failure message now renders both the recorded and the resolved class name, which closes @SEZ9's F2. The old commented-out log.error lines are still present in deserializeData; harmless, but dead comments, see Issue 2.
2. Code Quality Assessment
2.1 Coding Standards
The new table and resolveClassName carry Javadoc explaining why (#9689/#9928, never remove entries, single-level resolution). The test-scoped seatunnel-engine-common dependency in the pom has the explanatory comment @SEZ9 asked for.
2.2 Test Coverage and Test Stability
Coverage: all three legacy names are replayed with value-level assertions (JobStatus by name, JobResult by status and error, JobStatusData by all six fields), the mapping targets are bound to live classes, and the unknown-class message is asserted. A real pre-#9689 frame fixture is intentionally deferred and now documented by the TODO (non-blocking, agreed with @SEZ9; I would still like the follow-up issue linked once this merges).
Test stability rating: Risk present (non-blocking), evidence:
WALReaderAndWriterTest.java:65, 276-359:testReaderLoadsJobStatusWrittenWithLegacyClassNameandtestReaderLoadsAllLegacyJobModelClassNamesboth write into the sameLEGACY_JOB_STATUS_PATH, and@BeforeEachonly cleansPARENT_PATH(:79-81). The directory is deleted only in@AfterAll(:405). The assertions usedata.get(key)so they pass today regardless of order, but each test replays whatever the other left behind (and anything a crashed earlier run left in/tmp). That is hidden inter-test state; it will not fail now but can start failing if someone adds a size or key-set assertion. Suggested fix: deleteLEGACY_JOB_STATUS_PATH(andUNKNOWN_CLASS_NAME_PATH) incleanWalDirectory(), or use a per-test sub-directory such asnew Path(PARENT_PATH, "legacy-" + name)as the unsorted/selective tests already do.- No
Thread.sleep, no ports, no clock dependence, deterministic data; the class is@EnabledOnOs({LINUX, MAC})like before. I reviewed the tests statically and did not run them.
2.3 Documentation Updates
incompatible-changes.md has the entry in both docs/en and docs/zh, consistent with each other and with the code (three classes, one-way downgrade).
3. Architectural Soundness
3.1 Elegance of the Solution
Precise fix.
3.2 Maintainability
Clear boundary: one table, one resolve method, one call site. Rules for extending it are in the Javadoc.
3.3 Extensibility
Adequate for the stated need; a future relocation just adds entries (including intermediate names), as documented.
3.4 Historical-Version Compatibility
Reads pre-#9689 WAL files again; does not alter how current versions write. Downgrade after new writes is the documented limitation.
4. Issue Summary
| # | Issue | Location | Severity | Raised by another reviewer |
|---|---|---|---|---|
| 1 | Two tests share LEGACY_JOB_STATUS_PATH; it is not cleaned per test (carryover from earlier versions) |
WALReaderAndWriterTest.java:65, 79-81, 276-359 |
Low (stability risk, non-blocking) | No |
| 2 | testLegacyMappingsTargetCurrentClassNames reads a private static field via reflection with fully-qualified java.lang.reflect.Field / java.util.Map and an unchecked cast; the commented-out log.error lines remain in deserializeData |
WALReaderAndWriterTest.java:259-263, WALReader.java:148-149, 156-157 |
Low (style, non-blocking) | No |
Issue 2 detail: a package-private resolveClassName (or a package-private accessor for the table) would let the test assert directly without reflection, and importing Field/Map removes the inline qualified names. Both are optional.
5. Merge Recommendation
Conclusion: Ready to merge
- Blockers - must be fixed: none on the source side.
- Recommended fixes - non-blocking: Issue 1 (test isolation) and Issue 2 (style). Neither affects production behavior; both can be done now or in the follow-up that adds the real pre-#9689 fixture.
On the existing review state: I agree with @SEZ9's last comment that the remaining items are satisfied in the code (F1/F2/F3/F4/F5/F6/F8 verified by me on this head; F7 deferred with a TODO), and I see no reason to hold the PR on them. @nzw921rx and @dybyte had approved earlier on older heads (those reviews show as dismissed), so a fresh approval from a committer with write access is still needed.
CI status (head f6869ab098): the apache-side Build is in_progress; labeler and Notify test workflow are success. The fork Build run for this head (https://github.com/zhangshenghang/seatunnel/actions/runs/38504983404) is still queued. The previous head 6c771bdd was fully green (Build, labeler, Notify test workflow all success), and the delta from that head to this one in this PR's own files is a comment-only change, so I do not expect a new failure; please just let it finish. If a lane fails I will check whether it relates to this diff. Nothing is needed from you right now.
Upstream sync: behind_by=0, ahead_by=14, mergeable=true; mergeable_state is blocked only because the required approving review is missing.
Review gate: I only have read-level review controls here, so the formal approval has to come from a maintainer with write access. @SEZ9, from my side this is ready.
Thanks again for sticking with this; it is a real upgrade-path fix!
DanielLeens
left a comment
There was a problem hiding this comment.
Quick follow-up on head f6869ab09850 (no new commits or replies since my last review).
The CI fact I cited previously has changed. In my last review the apache-side Build was in_progress and the fork run was queued; both have now finished.
Update: CI was previously the only remaining gate on my side, and I had no code, test, docs or compatibility blockers. CI is now passing on this exact head: the apache-side Build check is success, and the real fork run (https://github.com/zhangshenghang/seatunnel/actions/runs/38504983404) completed success on f6869ab09850. So my conclusion is updated to approve.
The two non-blocking test/style notes from my last review (shared fixture directory, reflection and dead comments) are unchanged and still optional.
Remaining gate: the required committer approval. If GitHub does not register this as an approval, my account only has read-level review controls, so a maintainer with write access needs to approve. Thanks again for the work!
|
The CI fact cited in my previous review has changed: Build for the current unchanged head is now passing. CI was previously the only remaining blocker; CI is now passing, so my technical conclusion changes to approve. I do not see a new source-side blocker from Daniel's review. This branch is behind the latest dev base, which I have recorded as merge metadata only; because the current head CI is green, that fact alone does not call for an additional source change. I have read-only review controls, so this COMMENT does not change GitHub's displayed review decision; a write-capable maintainer must perform any final approval or dismissal action. |
|
Thanks for the update. With CI reported passing on My earlier review points are still open, though. Here is what I'd still like to see before approval: Tests (
Robustness (
Docs
Style (
If you've decided against any of these, a short reply is fine and we can close them out. Happy to re-review once a new push lands. |
|
Thanks @SEZ9 for the thorough checklist. I re-read it against the current head Already addressed on this head
Still open, and my read on each
On CI: the |
|
Thanks for the detailed mapping of the checklist against One small correction on the mapping-target test: a comparison of string literals against On the fixture point (the TODO acknowledging the frames are produced by the current
Your last comment looks cut off partway through item 1 of the "still open" list. If there were further open items, could you post them so I can review everything in one pass? |
|
Thanks @SEZ9, and sorry about the confusion. My previous comment was not cut off. It listed exactly three items under "Still open", and nothing else was pending:
If the comment rendered truncated on your side, those three are the complete list. Correction accepted on the mapping-target test. "Fails the build" should have said "fails the unit-test job". On the fixture, here is the evidence for your second option (justify the gap explicitly). I compared the three relocated types before and after the move, using the parent of
None of the three types has an So I would suggest @zhangshenghang replaces the TODO in Nothing else has changed on my side: the head is still |
…9689 capture The relocated JobStatus, JobResult and JobStatusData kept identical field layout and enum ordinals across apache#9689, and ProtoStuff's RuntimeSchema skips the static serialVersionUID added later by apache#11257, so a frame written by a pre-relocation release differs from the current WALWriter output only in the IMapFileData valueClassName string, which the legacy fixtures already set to the old names explicitly. Replace the TODO with that argument.
|
Done in 5dbf76a: the TODO in |
DanielLeens
left a comment
There was a problem hiding this comment.
Quick follow-up on the new head 5dbf76a83f89. Thanks @zhangshenghang for turning the fixture TODO into an explicit justification so quickly, and thanks @SEZ9 for the careful checklist.
What Problem Does This PR Solve?
Pain point: after the job model classes were relocated (#9689), file-based IMap WAL files written by older releases still record the old class names, so replay on restart fails with ClassNotFoundException and the cluster cannot recover job status.
Fix approach: WALReader remaps the three legacy job model class names (JobStatus, JobResult, JobStatusData) to their current locations before deserializing, with clearer error messages and an upgrade note in incompatible-changes.md (en and zh).
One-sentence summary: a narrow, read-side compatibility shim that lets restarted clusters replay pre-relocation WAL entries.
1. Code Change Review
1.1 Core Logic Analysis
The only change since my last review (f6869ab09850) is commit 5dbf76a83f, which touches a single file, WALReaderAndWriterTest.java (+6/-3). It replaces the TODO above LEGACY_JOB_STATUS_PATH with a comment explaining why a captured pre-#9689 WAL file is not required.
Before:
// TODO: the legacy fixtures ... are generated by the current WALWriter ... planned as a follow-up.
After:
// A real pre-#9689 WAL file is not required to exercise the legacy path: the relocated types ... kept identical field layout and enum ordinals ... the only wire difference is the valueClassName string ...
Key findings: the diff is comment-only, with no production, test-logic, pom or docs change, so the production runtime path (WAL replay -> WALReader.deserializeData -> legacy name remap -> ProtoStuff RuntimeSchema) is exactly what I reviewed and approved on the previous head. The justification matches the evidence I gathered earlier from the source: identical enum constants and ordinals, identical field order and types, and the later static serialVersionUID being skipped by RuntimeSchema. This also satisfies the second option SEZ9 offered for the fixture point (justify the gap explicitly). The same argument is reported to be in the PR description.
1.2 Compatibility Impact
Fully compatible. The shim is read-side only and is a no-op for names not in the mapping; new-format WALs are unchanged. The one-way semantics (a WAL written by a current build cannot be read by an older release) are documented in incompatible-changes.md.
1.3 Performance/Side-Effect
No change from the previously reviewed head; the map lookup is O(1) per frame and this commit adds nothing at runtime.
1.4 Error Handling and Logging
No new issues. The earlier error-message improvements (recorded plus resolved class name) remain in place.
2. Code Quality Assessment
2.1 Coding Standards
The new comment explains why (not what) and is accurate. No issues.
2.2 Test Coverage and Test Stability
Rating: Stable. No test logic changed in this commit. The existing tests (all three legacy names with value assertions, mapping targets resolved against the current classes, unknown-class message) are unchanged. Optional, non-blocking, carried over from before: the shared fixture directory and the reflection or fully qualified names in testLegacyMappingsTargetCurrentClassNames. A captured byte fixture remains a welcome follow-up, not a merge gate.
2.3 Documentation Updates
incompatible-changes.md en and zh are present. No further docs needed.
3. Architectural Soundness
3.1 Precise fix / temporary workaround / long-term solution
Precise fix at the right place (the reader, where the stale name is consumed), with a bounded and documented mapping table.
3.2 Extensibility
Single-level mapping is documented in the Javadoc; future relocations need an entry per intermediate name.
3.3 Side effects on other modules
None; confined to the imap-storage-file plugin.
3.4 Historical-version compatibility
Old WALs replay correctly via the shim; downgrade of a WAL written by a current build is unsupported and documented.
4. Issue Summary
| Number | Issue | Location | Severity |
|---|---|---|---|
| - | No new issues found in the incremental commit | WALReaderAndWriterTest.java | None |
5. Merge Recommendation
Conclusion: Ready to merge
Blockers: none on the source side. The only outstanding gates are that CI for the new head is still queued (the fork run for 5dbf76a83f has not started, and the apache-side Build is a pointer to it), and that the branch is behind dev, which I record as merge metadata only. Please re-check that CI turns green on 5dbf76a83f; since this commit is comment-only, the previously green run on f6869ab09850 is strong supporting evidence but not a substitute.
Overall assessment: a clean, well-justified closing touch on a carefully built compatibility fix. Thank you for the patience through several review rounds. Final approval needs a write-capable committer.
DanielLeens
left a comment
There was a problem hiding this comment.
Thanks again @zhangshenghang for the quick turnaround and for the careful write-up of why the legacy WAL fixtures need no pre-#9689 capture.
I re-checked the current head 5dbf76a83f89. The only delta since the head I approved (f6869ab09850) is one commit that adds explanatory documentation to WALReaderAndWriterTest; production code and test logic are unchanged. My earlier source-level conclusion therefore still holds: I see no code-side blocker, and the restore path for legacy job status WAL entries behaves as intended.
Approving from my side. The remaining gate is the Build check on this head, which had not reported yet when I looked, plus the final committer approval and merge. Great work, and thank you for the patience through the review rounds!
|
Change is controllable and there is a dev CI on it. It has been determined to have failed and will be bypassed. |
Purpose
Fixes #9928.
Job status classes were moved from
engine-coretoengine-common, but file-backed IMap WAL records preserve their original class names. Restarting a newer SeaTunnel version therefore failed to load persisted job state from older versions.Changes
engine-commonlocations before WAL deserialization.JobResult,JobStatus, andJobStatusData, which moved together.JobStatusclass name.Verification
./mvnw -pl seatunnel-engine/seatunnel-engine-storage/imap-storage-plugins/imap-storage-file -am -Dtest=WALReaderAndWriterTest -Dsurefire.failIfNoSpecifiedTests=false package./mvnw -q -DskipTests verifyWhy the legacy WAL fixtures need no pre-#9689 capture
The relocated types kept identical field layout and enum ordinals before and after #9689 (
JobStatus: the same 13 constants in the same order;JobResult:status,error;JobStatusData:jobId,jobName,jobStatus,submitTime,startTime,finishTime— same order and types). The only structural difference is theprivate static final long serialVersionUIDadded later by #11257, whichProtoStuffSerializer'sRuntimeSchemaskips as a static field, so it does not change the bytes. None of the three types has anObject-typed or abstract field, so no other class name is embedded in the value bytes; a frame written by a pre-#9689 release differs from the frame the currentWALWriterproduces only in thevalueClassNamestring ofIMapFileData, which the legacy tests set to the old names explicitly. A captured byte fixture would still be a welcome follow-up, but is not required to exercise the legacy path.