spuru9 opened a new pull request, #28540:
URL: https://github.com/apache/flink/pull/28540
## What is the purpose of the change
Backport of #27936 ([FLINK-39061]) to `release-2.1`. The cherry-pick is
clean (`git cherry-pick -x 59b5196e105`); the diff is identical to the merged
master commit.
`StateMachineExample` was inadvertently changed to use the State V2 async
API (`state.v2.ValueState`, `enableAsyncState()`, `asyncValue()`,
`asyncUpdate()`, `asyncClear()`), which requires the ForSt backend. ForSt is
still under development and does not yet support `CANONICAL` savepoints —
triggering one causes an `IllegalStateException` that crashes the job.
This PR rolls the example back to the v1 synchronous State API, which is GA,
works with all standard backends, and supports all savepoint formats including
`CANONICAL`.
## Brief change log
- Replace `state.v2.ValueState` / `ValueStateDescriptor` imports with the
v1 equivalents
- Remove `.enableAsyncState()` from the `keyBy` chain in
`StateMachineMapper`
- Rewrite `flatMap` to use synchronous `currentState.value()`, `update()`,
and `clear()` instead of `asyncValue().thenAccept(...)`, `asyncUpdate()`, and
`asyncClear()`
## Verifying this change
This change is manually verified.
- Reproduction: Confirmed that the original implementation fails
savepoints with `java.lang.IllegalStateException: ForStStateBackend does not
support CANONICAL savepoints` when deployed via the K8s Operator.
- Validation: Verified that rolling back to the State V1 API allows
successful savepoints using production-ready backends (e.g., RocksDB).
- Local Build: Passed `./mvnw compile -pl
flink-examples/flink-examples-streaming`.
## Does this pull request potentially affect one of the following parts:
- Dependencies (does it add or upgrade a dependency): no
- The public API, i.e., is any changed class annotated with
`@Public(Evolving)`: no
- The serializers: no
- The runtime per-record code paths (performance sensitive): no
- Anything that affects deployment or recovery: JobManager (and its
components), Checkpointing, Kubernetes/Yarn, ZooKeeper: no
- The S3 file system connector: no
## Documentation
- Does this pull request introduce a new feature? no
- If yes, how is the feature documented? not applicable
---
##### Was generative AI tooling used to co-author this PR?
- [X] Yes (Claude Code)
--
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]