new RegisteredPriorityQueueStateBackendMetaInfo<>(stateName, byteOrderedElementSerializer); new RegisteredPriorityQueueStateBackendMetaInfo<>(stateName, byteOrderedElementSerializer);
/** * Returns a deep copy of the snapshot, where the serializer is changed to the given serializer. */ public HeapPriorityQueueSnapshotRestoreWrapper<T> forUpdatedSerializer( @Nonnull TypeSerializer<T> updatedSerializer) { RegisteredPriorityQueueStateBackendMetaInfo<T> updatedMetaInfo = new RegisteredPriorityQueueStateBackendMetaInfo<>(metaInfo.getName(), updatedSerializer); return new HeapPriorityQueueSnapshotRestoreWrapper<>( priorityQueue, updatedMetaInfo, keyExtractorFunction, localKeyGroupRange, totalKeyGroups); } }
/** * Returns a deep copy of the snapshot, where the serializer is changed to the given serializer. */ public HeapPriorityQueueSnapshotRestoreWrapper<T> forUpdatedSerializer( @Nonnull TypeSerializer<T> updatedSerializer) { RegisteredPriorityQueueStateBackendMetaInfo<T> updatedMetaInfo = new RegisteredPriorityQueueStateBackendMetaInfo<>(metaInfo.getName(), updatedSerializer); return new HeapPriorityQueueSnapshotRestoreWrapper<>( priorityQueue, updatedMetaInfo, keyExtractorFunction, localKeyGroupRange, totalKeyGroups); } }
public RegisteredPriorityQueueStateBackendMetaInfo deepCopy() { return new RegisteredPriorityQueueStateBackendMetaInfo<>(name, getElementSerializer().duplicate()); } }
public RegisteredPriorityQueueStateBackendMetaInfo deepCopy() { return new RegisteredPriorityQueueStateBackendMetaInfo<>(name, getElementSerializer().duplicate()); } }
public static RegisteredStateMetaInfoBase fromMetaInfoSnapshot(@Nonnull StateMetaInfoSnapshot snapshot) { final StateMetaInfoSnapshot.BackendStateType backendStateType = snapshot.getBackendStateType(); switch (backendStateType) { case KEY_VALUE: return new RegisteredKeyValueStateBackendMetaInfo<>(snapshot); case OPERATOR: return new RegisteredOperatorStateBackendMetaInfo<>(snapshot); case BROADCAST: return new RegisteredBroadcastStateBackendMetaInfo<>(snapshot); case PRIORITY_QUEUE: return new RegisteredPriorityQueueStateBackendMetaInfo<>(snapshot); default: throw new IllegalArgumentException("Unknown backend state type: " + backendStateType); } } }
public static RegisteredStateMetaInfoBase fromMetaInfoSnapshot(@Nonnull StateMetaInfoSnapshot snapshot) { final StateMetaInfoSnapshot.BackendStateType backendStateType = snapshot.getBackendStateType(); switch (backendStateType) { case KEY_VALUE: return new RegisteredKeyValueStateBackendMetaInfo<>(snapshot); case OPERATOR: return new RegisteredOperatorStateBackendMetaInfo<>(snapshot); case BROADCAST: return new RegisteredBroadcastStateBackendMetaInfo<>(snapshot); case PRIORITY_QUEUE: return new RegisteredPriorityQueueStateBackendMetaInfo<>(snapshot); default: throw new IllegalArgumentException("Unknown backend state type: " + backendStateType); } } }
registeredState = registeredPQStates.get(metaInfoSnapshot.getName()); if (registeredState == null) { createInternal(new RegisteredPriorityQueueStateBackendMetaInfo<>(metaInfoSnapshot));
registeredState = registeredPQStates.get(metaInfoSnapshot.getName()); if (registeredState == null) { createInternal(new RegisteredPriorityQueueStateBackendMetaInfo<>(metaInfoSnapshot));
new RegisteredPriorityQueueStateBackendMetaInfo<>(stateName, byteOrderedElementSerializer); new RegisteredPriorityQueueStateBackendMetaInfo<>(stateName, byteOrderedElementSerializer);
new RegisteredPriorityQueueStateBackendMetaInfo<>(stateName, byteOrderedElementSerializer); new RegisteredPriorityQueueStateBackendMetaInfo<>(stateName, byteOrderedElementSerializer);
@SuppressWarnings("unchecked") @Nonnull @Override public <T extends HeapPriorityQueueElement & PriorityComparable & Keyed> KeyGroupedInternalPriorityQueue<T> create( @Nonnull String stateName, @Nonnull TypeSerializer<T> byteOrderedElementSerializer) { final HeapPriorityQueueSnapshotRestoreWrapper existingState = registeredPQStates.get(stateName); if (existingState != null) { // TODO we implement the simple way of supporting the current functionality, mimicking keyed state // because this should be reworked in FLINK-9376 and then we should have a common algorithm over // StateMetaInfoSnapshot that avoids this code duplication. TypeSerializerSchemaCompatibility<T> compatibilityResult = existingState.getMetaInfo().updateElementSerializer(byteOrderedElementSerializer); if (compatibilityResult.isIncompatible()) { throw new FlinkRuntimeException(new StateMigrationException("For heap backends, the new priority queue serializer must not be incompatible.")); } else { registeredPQStates.put( stateName, existingState.forUpdatedSerializer(byteOrderedElementSerializer)); } return existingState.getPriorityQueue(); } else { final RegisteredPriorityQueueStateBackendMetaInfo<T> metaInfo = new RegisteredPriorityQueueStateBackendMetaInfo<>(stateName, byteOrderedElementSerializer); return createInternal(metaInfo); } }
@SuppressWarnings("unchecked") @Nonnull @Override public <T extends HeapPriorityQueueElement & PriorityComparable & Keyed> KeyGroupedInternalPriorityQueue<T> create( @Nonnull String stateName, @Nonnull TypeSerializer<T> byteOrderedElementSerializer) { final HeapPriorityQueueSnapshotRestoreWrapper existingState = registeredPQStates.get(stateName); if (existingState != null) { // TODO we implement the simple way of supporting the current functionality, mimicking keyed state // because this should be reworked in FLINK-9376 and then we should have a common algorithm over // StateMetaInfoSnapshot that avoids this code duplication. TypeSerializerSchemaCompatibility<T> compatibilityResult = existingState.getMetaInfo().updateElementSerializer(byteOrderedElementSerializer); if (compatibilityResult.isIncompatible()) { throw new FlinkRuntimeException(new StateMigrationException("For heap backends, the new priority queue serializer must not be incompatible.")); } else { registeredPQStates.put( stateName, existingState.forUpdatedSerializer(byteOrderedElementSerializer)); } return existingState.getPriorityQueue(); } else { final RegisteredPriorityQueueStateBackendMetaInfo<T> metaInfo = new RegisteredPriorityQueueStateBackendMetaInfo<>(stateName, byteOrderedElementSerializer); return createInternal(metaInfo); } }