Github user zentol commented on a diff in the pull request:
https://github.com/apache/flink/pull/2939#discussion_r91730804
--- Diff:
flink-tests/src/test/java/org/apache/flink/test/classloading/jar/CheckpointedStreamingProgram.java
---
@@ -72,34 +74,27 @@ public void run(SourceContext<String> ctx) throws
Exception {
public void cancel() {
running = false;
}
-
- @Override
- public Integer snapshotState(long checkpointId, long
checkpointTimestamp) throws Exception {
- return null;
- }
-
- @Override
- public void restoreState(Integer state) {
-
- }
}
- public static class StatefulMapper implements MapFunction<String,
String>, Checkpointed<StatefulMapper>, CheckpointListener {
+ public static class StatefulMapper implements MapFunction<String,
String>, ListCheckpointed<StatefulMapper>, CheckpointListener {
private String someState;
private boolean atLeastOneSnapshotComplete = false;
private boolean restored = false;
@Override
- public StatefulMapper snapshotState(long checkpointId, long
checkpointTimestamp) throws Exception {
- return this;
+ public List<StatefulMapper> snapshotState(long checkpointId,
long timestamp) throws Exception {
+ return Collections.singletonList(this);
}
@Override
- public void restoreState(StatefulMapper state) {
- restored = true;
- this.someState = state.someState;
- this.atLeastOneSnapshotComplete =
state.atLeastOneSnapshotComplete;
+ public void restoreState(List<StatefulMapper> state) throws
Exception {
+ if (!state.isEmpty()) {
--- End diff --
Alright, i figured out why we can't fail here immediately. It still seems
odd though that do not explicitly differentiate between a call to restore
before any state was snapshotted and a broken snapshotting that doesn't return
a state, although this applies to all other tests as well.
If the test is successful f that we are getting the state that we
snapshotted we should also have failure condition in case this does not happen;
currently we simply enter undefined territory.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---