Github user uce commented on a diff in the pull request: https://github.com/apache/flink/pull/2584#discussion_r82213262 --- Diff: flink-tests/src/test/java/org/apache/flink/test/checkpointing/RescalingITCase.java --- @@ -663,28 +826,42 @@ public Integer snapshotState(long checkpointId, long checkpointTimestamp) throws public void restoreState(Integer state) throws Exception { counter = state; } + } + + private static class PartitionedStateSource extends StateSourceBase implements ListCheckpointed<Integer> { + + private static final long serialVersionUID = -359715965103593462L; + private static final int NUM_PARTITIONS = 7; + + private static int[] CHECK_CORRECT_SNAPSHOT; + private static int[] CHECK_CORRECT_RESTORE; @Override - public void run(SourceContext<Integer> ctx) throws Exception { - final Object lock = ctx.getCheckpointLock(); + public List<Integer> snapshotState(long checkpointId, long timestamp) throws Exception { - while (running) { - synchronized (lock) { - counter++; + CHECK_CORRECT_SNAPSHOT[getRuntimeContext().getIndexOfThisSubtask()] = counter; - ctx.collect(counter * getRuntimeContext().getIndexOfThisSubtask()); - } + int div = counter / NUM_PARTITIONS; + int mod = counter % NUM_PARTITIONS; - Thread.sleep(2); - if(counter == 10) { - workStartedLatch.countDown(); + List<Integer> split = new ArrayList<>(); + for (int i = 0; i < NUM_PARTITIONS; ++i) { + int partitionValue = div; + if (mod > 0) { + --mod; + ++partitionValue; } + split.add(partitionValue); } + return split; } @Override - public void cancel() { - running = false; + public void restoreState(List<Integer> state) throws Exception { + for(Integer v : state) { --- End diff -- Missing whitespace after `for`
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---