You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@paimon.apache.org by Andreas Bube via dev <de...@paimon.apache.org> on 2026/09/03 08:38:23 UTC
[DISCUSS] The operator-uid.suffix options do not cover every operator
Hi all,
#4424 [1] added sink.operator-uid.suffix and source.operator-uid.suffix to
improve state compatibility when the job graph changes. #4543 [2] is still
open on a related failure, and the last question there was whether #4424
already solves it, or whether we should just recommend the suffix options
to users. I think the answer is neither, because neither option reaches
every operator it needs to.
We hit this in production. A streaming job writing to an append-only
table, with the suffix set. We deployed our job with one extra operator in
front of the sink. The Kubernetes operator tried a savepoint upgrade, the
savepoint failed, it fell back to last-state recovery, and the new
JobManager restored from the checkpoint store:
JobInitializationException: Could not start the JobMaster.
Caused by: IllegalStateException: There is no operator for the state
1312a02de57ecb55f9f6d4dfc28aad32
The id belonged to "Compact Worker: <table>". The job then stayed globally
terminal and refused the same job id, so we recovered by hand.
FlinkSinkBuilder adds its two row conversion operators without a uid, and
AppendTableSink adds the compaction coordinator and worker without one.
Writer, Global Committer and dynamic-bucket-assigner are covered. Other
shapes leave more uncovered (local merge, Collect Statistics, the
changelog compaction operators, INDEX_BOOTSTRAP,
cross-partition-bucket-assigner).
The source side has a smaller version of the same gap. toDataStream
applies the uid to the source itself, then buildForRow adds a Row
conversion operator after it without one. The table path calls build() and
adds nothing, so this only affects DataStream readers.
Two tests, both expected to fail, and the ITCase fails the same way on
Flink 1.20 and 2.x:
- https://github.com/bube/paimon/actions/runs/33540653767
-
https://github.com/bube/paimon/blob/flink-operator-uid-suffix-restore-itcase/paimon-flink/paimon-flink-common/src/test/java/org/apache/paimon/flink/sink/OperatorUidSuffixRestoreITCase.java
-
https://github.com/bube/paimon/blob/flink-operator-uid-suffix-coverage/paimon-flink/paimon-flink-common/src/test/java/org/apache/paimon/flink/sink/OperatorUidSuffixTest.java
Where I would like input is compatibility. Assigning uids changes those
ids, so the fix orphans the entries in existing checkpoints and throws the
same error once for anyone who already sets the suffix.
I first assumed a savepoint upgrade would absorb that, since
loadAndValidateCheckpoint skips unmatched operators whose state is empty.
I no longer think that holds in general. Collect Statistics has a
coordinator that completes its checkpoint with an empty byte[], and
OperatorCoordinatorCheckpoints wraps that in a handle unconditionally, so
coordinatorState is non-null and the check rejects it before it looks at
emptiness. I have not audited the rest, so I do not know how many
operators are in that position.
So I do not have a migration path I trust. An opt-in option would let
users choose when to take the one time break, but I would rather hear what
you would prefer. Happy to write the patch once there is a direction.
Best,
Andreas
[1] https://github.com/apache/paimon/issues/4424
[2] https://github.com/apache/paimon/issues/4543
Re: [DISCUSS] The operator-uid.suffix options do not cover every operator
Posted by Andreas Bube via dev <de...@paimon.apache.org>.
It took a while to test on all the various table types, but now the PR
is ready for review: https://github.com/apache/paimon/pull/10109
On Tue, 8 Sept 2026 at 12:07, Jingsong Li <ji...@gmail.com> wrote:
>
> Hi Andreas,
>
> 3.0 Yes, we can change some options.
>
> Best,
> Jingsong
>
> On Tue, Sep 8, 2026 at 3:34 PM Andreas Bube <ab...@toogoodtogo.com> wrote:
> >
> > Hi Jingsong,
> >
> > Thanks for the feedback. That sounds like a solid approach for the
> > initial bug fix. I'll start working on this later this week.
> >
> > Looking ahead to a future major release like Paimon 3.0, could we
> > consider enabling stable UIDs by default? Speaking from experience, we
> > initially missed the operator-uid.suffix settings and had to migrate
> > state across several jobs. Enabling this by default would help prevent
> > new users from running into similar issues with misconfigured Flink
> > jobs.
> >
> > Best regards,
> > Andreas
> >
> >
> > On Tue, 8 Sept 2026 at 05:30, Jingsong Li <ji...@gmail.com> wrote:
> > >
> > > Hi Andreas,
> > >
> > > Thanks for the investigation and the reproducer. I would prefer an
> > > opt-in option, with the current behavior preserved by default.
> > >
> > > I checked the current master and confirmed the missing UIDs. I also
> > > ran minimal checks against Flink 1.20.4 and 2.2.0: restoring through
> > > an explicit snapshot path skips unmatched empty operator entries,
> > > while HA checkpoint recovery rejects them. An empty byte[] coordinator
> > > snapshot still produces a non-null state handle, so Collect Statistics
> > > is rejected by the former path as well.
> > >
> > > For the patch, I suggest:
> > > - Keep all existing explicit UIDs unchanged.
> > > - When the new option and the corresponding suffix are set, assign
> > > stable UIDs to the remaining Paimon operators, including the
> > > DataStream row conversions.
> > > - Add coverage for UID stability after upstream topology changes,
> > > recovery from a retained checkpoint store, and migration from the old
> > > UID layout, including PARTITION_DYNAMIC.
> > >
> > > The option lets existing jobs choose when to migrate, but enabling it
> > > still needs a documented migration procedure. Release notes alone
> > > would leave users exposed to an unexpected recovery failure on
> > > upgrade. For cases requiring allowNonRestoredState, we should first
> > > verify exactly which entries are being dropped and that the source,
> > > writer and committer state remains mapped; we should not recommend
> > > ignoring unmatched state unconditionally.
> > >
> > > The current FlinkJobRecoveryITCase restores through
> > > execution.state-recovery.path, which explains why its coverage does
> > > not catch the last-state failure you reported.
> > >
> > > A patch along these lines would be welcome.
> > >
> > > Best,
> > > Jingsong
Re: [DISCUSS] The operator-uid.suffix options do not cover every operator
Posted by Jingsong Li <ji...@gmail.com>.
Hi Andreas,
Thanks for the investigation and the reproducer. I would prefer an
opt-in option, with the current behavior preserved by default.
I checked the current master and confirmed the missing UIDs. I also
ran minimal checks against Flink 1.20.4 and 2.2.0: restoring through
an explicit snapshot path skips unmatched empty operator entries,
while HA checkpoint recovery rejects them. An empty byte[] coordinator
snapshot still produces a non-null state handle, so Collect Statistics
is rejected by the former path as well.
For the patch, I suggest:
- Keep all existing explicit UIDs unchanged.
- When the new option and the corresponding suffix are set, assign
stable UIDs to the remaining Paimon operators, including the
DataStream row conversions.
- Add coverage for UID stability after upstream topology changes,
recovery from a retained checkpoint store, and migration from the old
UID layout, including PARTITION_DYNAMIC.
The option lets existing jobs choose when to migrate, but enabling it
still needs a documented migration procedure. Release notes alone
would leave users exposed to an unexpected recovery failure on
upgrade. For cases requiring allowNonRestoredState, we should first
verify exactly which entries are being dropped and that the source,
writer and committer state remains mapped; we should not recommend
ignoring unmatched state unconditionally.
The current FlinkJobRecoveryITCase restores through
execution.state-recovery.path, which explains why its coverage does
not catch the last-state failure you reported.
A patch along these lines would be welcome.
Best,
Jingsong
Re: [DISCUSS] The operator-uid.suffix options do not cover every operator
Posted by Andreas Bube via dev <de...@paimon.apache.org>.
Hi again,
Following up on the compatibility question. What a restore does with the
orphaned entries splits the uncovered operators in two.
A savepoint upgrade skips an unmatched operator if its entry holds
nothing, and rejects it otherwise. Compact Worker holds nothing: I gave it
a uid, savepointed without it and restored with it, and that worked. The
other uncovered operators are plain factories with no declared state, so I
assume the same.
The one exception I found is Collect Statistics, which shows up under
partition.sink-strategy=PARTITION_DYNAMIC. It is a
CoordinatedOperatorFactory, so its entry is never empty, and uid'ing it
does break state compatibility. I tested that one.
Last-state recovery is different again. It rejects any unmatched id
without looking at the entry at all, which is what we hit in production.
So: release notes, or an opt-in option so people can pick their moment?
Happy to write the patch either way.
Best,
Andreas
On Thu, 3 Sept 2026 at 10:38, Andreas Bube <ab...@toogoodtogo.com> wrote:
> Hi all,
>
> #4424 [1] added sink.operator-uid.suffix and source.operator-uid.suffix to
> improve state compatibility when the job graph changes. #4543 [2] is still
> open on a related failure, and the last question there was whether #4424
> already solves it, or whether we should just recommend the suffix options
> to users. I think the answer is neither, because neither option reaches
> every operator it needs to.
>
> We hit this in production. A streaming job writing to an append-only
> table, with the suffix set. We deployed our job with one extra operator in
> front of the sink. The Kubernetes operator tried a savepoint upgrade, the
> savepoint failed, it fell back to last-state recovery, and the new
> JobManager restored from the checkpoint store:
>
> JobInitializationException: Could not start the JobMaster.
> Caused by: IllegalStateException: There is no operator for the state
> 1312a02de57ecb55f9f6d4dfc28aad32
>
> The id belonged to "Compact Worker: <table>". The job then stayed globally
> terminal and refused the same job id, so we recovered by hand.
>
> FlinkSinkBuilder adds its two row conversion operators without a uid, and
> AppendTableSink adds the compaction coordinator and worker without one.
> Writer, Global Committer and dynamic-bucket-assigner are covered. Other
> shapes leave more uncovered (local merge, Collect Statistics, the
> changelog compaction operators, INDEX_BOOTSTRAP,
> cross-partition-bucket-assigner).
>
> The source side has a smaller version of the same gap. toDataStream
> applies the uid to the source itself, then buildForRow adds a Row
> conversion operator after it without one. The table path calls build() and
> adds nothing, so this only affects DataStream readers.
>
> Two tests, both expected to fail, and the ITCase fails the same way on
> Flink 1.20 and 2.x:
>
> - https://github.com/bube/paimon/actions/runs/33540653767
> -
> https://github.com/bube/paimon/blob/flink-operator-uid-suffix-restore-itcase/paimon-flink/paimon-flink-common/src/test/java/org/apache/paimon/flink/sink/OperatorUidSuffixRestoreITCase.java
> -
> https://github.com/bube/paimon/blob/flink-operator-uid-suffix-coverage/paimon-flink/paimon-flink-common/src/test/java/org/apache/paimon/flink/sink/OperatorUidSuffixTest.java
>
> Where I would like input is compatibility. Assigning uids changes those
> ids, so the fix orphans the entries in existing checkpoints and throws the
> same error once for anyone who already sets the suffix.
>
> I first assumed a savepoint upgrade would absorb that, since
> loadAndValidateCheckpoint skips unmatched operators whose state is empty.
> I no longer think that holds in general. Collect Statistics has a
> coordinator that completes its checkpoint with an empty byte[], and
> OperatorCoordinatorCheckpoints wraps that in a handle unconditionally, so
> coordinatorState is non-null and the check rejects it before it looks at
> emptiness. I have not audited the rest, so I do not know how many
> operators are in that position.
>
> So I do not have a migration path I trust. An opt-in option would let
> users choose when to take the one time break, but I would rather hear what
> you would prefer. Happy to write the patch once there is a direction.
>
> Best,
> Andreas
>
> [1] https://github.com/apache/paimon/issues/4424
> [2] https://github.com/apache/paimon/issues/4543
>