@Override public OperatorStateBackend createOperatorStateBackend(Environment env, String operatorIdentifier) throws Exception { return backend.createOperatorStateBackend(env, operatorIdentifier); } }
@Override public void configure(int maxParallelism) { KeyGroupRangeAssignment.checkParallelismPreconditions(maxParallelism); this.maxParallelism = maxParallelism; } }
@Override public boolean hasNext() { if (null != currentStateHandle && currentOffsetsIterator.hasNext()) { return true; } closeCurrentStream(); while (stateHandleIterator.hasNext()) { currentStateHandle = stateHandleIterator.next(); if (currentStateHandle.getKeyGroupRange().getNumberOfKeyGroups() > 0) { currentOffsetsIterator = currentStateHandle.getGroupRangeOffsets().iterator(); return true; } } return false; }
private static int getKeyInKeyGroupRange(KeyGroupRange range, int maxParallelism) { Random rand = new Random(System.currentTimeMillis()); int result = rand.nextInt(); while (!range.contains(KeyGroupRangeAssignment.assignToKeyGroup(result, maxParallelism))) { result = rand.nextInt(); } return result; } }
private static <T extends StateObject> RunnableFuture<SnapshotResult<T>> createSnapshotResult(Class<T> clazz) { return DoneFuture.of(SnapshotResult.withLocalState(mock(clazz), mock(clazz))); } }
public InternalTimerServiceImplTest(int startKeyGroup, int endKeyGroup, int maxParallelism) { this.testKeyGroupRange = new KeyGroupRange(startKeyGroup, endKeyGroup); this.maxParallelism = maxParallelism; }
@Override public CompletedCheckpointStorageLocation resolveCheckpoint(String pointer) throws IOException { return checkpointStreamBackend.resolveCheckpoint(pointer); }
@Override public CheckpointStorage createCheckpointStorage(JobID jobId) throws IOException { return checkpointStreamBackend.createCheckpointStorage(jobId); }
private <N> KeyGroupedInternalPriorityQueue<TimerHeapInternalTimer<K, N>> createTimerPriorityQueue( String name, TimerSerializer<K, N> timerSerializer) { return priorityQueueSetFactory.create( name, timerSerializer); }
StateSnapshotTransformerWrapper(StateSnapshotTransformer<T> elementTransformer, TypeSerializer<T> elementSerializer) { this.elementTransformer = elementTransformer; this.elementSerializer = elementSerializer; this.transformStrategy = elementTransformer instanceof CollectionStateSnapshotTransformer ? ((CollectionStateSnapshotTransformer) elementTransformer).getFilterStrategy() : CollectionStateSnapshotTransformer.TransformStrategy.TRANSFORM_ALL; }
@Override public void notifyCheckpointComplete(long checkpointId) throws Exception { if (keyedStateBackend != null) { keyedStateBackend.notifyCheckpointComplete(checkpointId); } }
@Override public Optional<StateSnapshotTransformer<byte[]>> createForSerializedState() { return snapshotTransformFactory.createForSerializedState(); } }
@Override public void snapshotState(StateSnapshotContext context) throws Exception { OperatorStateCheckpointOutputStream outStream = context.getRawOperatorStateOutput(); IN_CHECKPOINT_LATCH.trigger(); // this should lock outStream.write(1); } }
@Override public void run() { super.run(); this.done = true; }
private static int getKeyInKeyGroupRange(KeyGroupRange range, int maxParallelism) { Random rand = new Random(System.currentTimeMillis()); int result = rand.nextInt(); while (!range.contains(KeyGroupRangeAssignment.assignToKeyGroup(result, maxParallelism))) { result = rand.nextInt(); } return result; }
@Override public CompletedCheckpointStorageLocation resolveCheckpoint(String externalPointer) throws IOException { return backend.resolveCheckpoint(externalPointer); }
@Override public CheckpointStorage createCheckpointStorage(JobID jobId) throws IOException { return backend.createCheckpointStorage(jobId); }
private static <K, N> KeyGroupedInternalPriorityQueue<TimerHeapInternalTimer<K, N>> createTimerQueue( String name, TimerSerializer<K, N> timerSerializer, PriorityQueueSetFactory priorityQueueSetFactory) { return priorityQueueSetFactory.create( name, timerSerializer); } }
@Override public Optional<StateSnapshotTransformer<byte[]>> createForSerializedState() { return snapshotTransformFactory.createForSerializedState() .map(RocksDBMapState.StateSnapshotTransformerWrapper::new); } }