taowenjun opened a new issue, #13491:
URL: https://github.com/apache/seatunnel/issues/13491
### Search before asking
I searched open and closed issues/PRs for `PaimonSourceSplit`, `paimon
splitId`, and Paimon missing/duplicate reads. I did not find the same root
cause. Historical #6765/#6766 discuss enumerator/state changes, but are closed
without merging and do not establish a fix for this problem.
### What happened
Paimon source readers on Spark can miss some splits and read other splits
more than once when parallel tasks independently enumerate the same fixed
snapshot. Single-reader execution can hide the problem.
The issue is in the assignment key, even when the planned file set and order
are identical:
```java
// PaimonSourceSplit
public String splitId() {
return split.toString();
}
// AbstractSplitEnumerator
getSplitOwner(fileSourceSplit.splitId(), context.currentParallelism());
```
Paimon `DataSplit` inherits `Object.toString()`, which calls its overridden
`hashCode()`. The hash includes nested file metadata, including the
`FileSource` enum. Enum identity hashes are not guaranteed to agree across
JVMs. Consequently, the same split may produce a different string and reader
owner in different executors. The generated `id` already stored in
`PaimonSourceSplit` is not used by `splitId()`.
This matters for the Spark `ParallelSource` path: each task has its own
enumerator and keeps assignments for its own reader index. Different ownership
decisions can cause both omission and duplication, without a failed task.
### Released-version reproduction
Reproduced with the official Maven Central SeaTunnel **3.1.0** Paimon
connector and matching Spark 3 starter, Corretto **11.0.33**, Spark **3.4.3**,
and Paimon **1.1.1**. SHA1 checksums were verified before use.
The isolated diagnostic instantiated the actual Paimon source and batch
enumerator in 16 Spark tasks, each with only its own reader registered, as in
`ParallelEnumeratorContext`. It planned a fixed append-only snapshot containing
91 splits/files. It did **not** create a data reader, sink, or commit, so the
following row counts are metadata expectations, not measured exported rows.
A shared Paimon classloader per executor JVM isolated both classes and SPI
resources from an older Paimon JAR bundled with the test Spark distribution.
Code-source and SHA256 records confirmed that all Paimon classes came from the
official connector's bundled 1.1.1. No old SeaTunnel starter was loaded.
| Metric | Official 3.1.0 | Same runtime, only splitId fix |
|---|---:|---:|
| Tasks | 16 | 16 |
| Planned files per task | 91 | 91 |
| Files never assigned | 31 | 0 |
| Files assigned more than once | 22 | 0 |
| Extra assigned copies | 28 | 0 |
| Total assignment records | 88 | 91 |
| Expected rows in all source splits | 65,382,462 | 65,382,462 |
| Expected rows in assigned splits | 63,272,298 | 65,382,462 |
| Files with inconsistent splitId across tasks | 91 | 0 |
The fixed verification JAR was compared entry by entry with the release JAR:
only `PaimonSourceSplit.class` changed. The starter, dependencies, snapshot,
projection, task count and resource limits were unchanged.
Release artifact SHA256:
- Paimon connector:
`fa29aae18f305751a9f0e4c8043221dfd4ecdada832223e422005e97e55cc747`
- Spark 3 starter:
`9ac557b40808bbb1e422768c91f0c4c2c092e8cbacfe5c016730e9c330cc2181`
### Expected behavior
Every split of an identical fixed plan should be assigned to exactly one
reader, independently of executor JVM identity hashes.
### Proposed focused fix
Return the existing generated `id` from `PaimonSourceSplit.splitId()`. This
preserves the current generator and assignment algorithm. Independent
enumeration still requires consistent plan ordering; this change does not claim
to solve arbitrary ordering changes.
The same implementation remains on dev at
`39c74ce48b0fb5e0318326b8d57a42c7380c40c8`. I have a minimal patch with unit
regressions and an existing E2E assertion. Split ownership changes, so old/new
artifacts must not be mixed and stateful recovery/rescaling need separate
qualification. No production deployment or full business-data scan was
performed for this released-version diagnostic.
### Are you willing to submit a PR?
Yes, I am contributing this fix to Apache SeaTunnel.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]