You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "letaoj (via GitHub)" <gi...@apache.org> on 2025/09/18 02:36:28 UTC
Re: [PR] [api] feat: Introduce per action state consistency API [flink-agents]
letaoj commented on code in PR #138:
URL: https://github.com/apache/flink-agents/pull/138#discussion_r2357363345
##########
runtime/src/main/java/org/apache/flink/agents/runtime/operator/ActionExecutionOperator.java:
##########
@@ -392,6 +447,71 @@ public void close() throws Exception {
super.close();
}
+ @Override
+ public void initializeState(StateInitializationContext context) throws Exception {
+ super.initializeState(context);
+
+ if (actionStateStore != null) {
+ Object recoveryMarker = null;
+ ListState<Object> recoveryMarkerOpState =
+ getOperatorStateBackend()
+ .getListState(
+ new ListStateDescriptor<>(
+ "recoveryMarker", TypeInformation.of(Object.class)));
+ Iterable<Object> recoveryMarkers = recoveryMarkerOpState.get();
+ if (recoveryMarkers != null) {
+ for (Object marker : recoveryMarkers) {
+ // there should be only one recovery marker
+ recoveryMarker = marker;
+ break;
+ }
+ }
+ actionStateStore.rebuildState(recoveryMarker);
+ }
+ ListState<Long> msgSequenceNumberOpState =
Review Comment:
Yeah, I think I was having trouble to get the keyed state work when I used ValueState and then I switched to ListState. However, the issue isn't because the ValueState vs ListState, it is because I was calling the value() on the ValueState out of a keyed context. Updated the logic.
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org