Search in sources :

Example 1 with HeapPriorityQueueSetFactory

use of org.apache.flink.runtime.state.heap.HeapPriorityQueueSetFactory in project flink by apache.

the class MemoryStateBackend method createKeyedStateBackend.

@Override
public <K> AbstractKeyedStateBackend<K> createKeyedStateBackend(Environment env, JobID jobID, String operatorIdentifier, TypeSerializer<K> keySerializer, int numberOfKeyGroups, KeyGroupRange keyGroupRange, TaskKvStateRegistry kvStateRegistry, TtlTimeProvider ttlTimeProvider, MetricGroup metricGroup, @Nonnull Collection<KeyedStateHandle> stateHandles, CloseableRegistry cancelStreamRegistry) throws BackendBuildingException {
    TaskStateManager taskStateManager = env.getTaskStateManager();
    HeapPriorityQueueSetFactory priorityQueueSetFactory = new HeapPriorityQueueSetFactory(keyGroupRange, numberOfKeyGroups, 128);
    LatencyTrackingStateConfig latencyTrackingStateConfig = latencyTrackingConfigBuilder.setMetricGroup(metricGroup).build();
    return new HeapKeyedStateBackendBuilder<>(kvStateRegistry, keySerializer, env.getUserCodeClassLoader().asClassLoader(), numberOfKeyGroups, keyGroupRange, env.getExecutionConfig(), ttlTimeProvider, latencyTrackingStateConfig, stateHandles, AbstractStateBackend.getCompressionDecorator(env.getExecutionConfig()), taskStateManager.createLocalRecoveryConfig(), priorityQueueSetFactory, isUsingAsynchronousSnapshots(), cancelStreamRegistry).build();
}
Also used : HeapPriorityQueueSetFactory(org.apache.flink.runtime.state.heap.HeapPriorityQueueSetFactory) LatencyTrackingStateConfig(org.apache.flink.runtime.state.metrics.LatencyTrackingStateConfig) TaskStateManager(org.apache.flink.runtime.state.TaskStateManager)

Example 2 with HeapPriorityQueueSetFactory

use of org.apache.flink.runtime.state.heap.HeapPriorityQueueSetFactory in project flink by apache.

the class KvStateRequestSerializerTest method getLongHeapKeyedStateBackend.

private HeapKeyedStateBackend<Long> getLongHeapKeyedStateBackend(final long key) throws BackendBuildingException {
    final KeyGroupRange keyGroupRange = new KeyGroupRange(0, 0);
    ExecutionConfig executionConfig = new ExecutionConfig();
    // objects for heap state list serialisation
    final HeapKeyedStateBackend<Long> longHeapKeyedStateBackend = new HeapKeyedStateBackendBuilder<>(mock(TaskKvStateRegistry.class), LongSerializer.INSTANCE, ClassLoader.getSystemClassLoader(), keyGroupRange.getNumberOfKeyGroups(), keyGroupRange, executionConfig, TtlTimeProvider.DEFAULT, LatencyTrackingStateConfig.disabled(), Collections.emptyList(), AbstractStateBackend.getCompressionDecorator(executionConfig), TestLocalRecoveryConfig.disabled(), new HeapPriorityQueueSetFactory(keyGroupRange, keyGroupRange.getNumberOfKeyGroups(), 128), async, new CloseableRegistry()).build();
    longHeapKeyedStateBackend.setCurrentKey(key);
    return longHeapKeyedStateBackend;
}
Also used : HeapPriorityQueueSetFactory(org.apache.flink.runtime.state.heap.HeapPriorityQueueSetFactory) KeyGroupRange(org.apache.flink.runtime.state.KeyGroupRange) ExecutionConfig(org.apache.flink.api.common.ExecutionConfig) CloseableRegistry(org.apache.flink.core.fs.CloseableRegistry)

Example 3 with HeapPriorityQueueSetFactory

use of org.apache.flink.runtime.state.heap.HeapPriorityQueueSetFactory in project flink by apache.

the class StateBackendBenchmarkUtils method createHeapKeyedStateBackend.

private static HeapKeyedStateBackend<Long> createHeapKeyedStateBackend(File rootDir) throws IOException {
    File recoveryBaseDir = prepareDirectory(recoveryDirName, rootDir);
    KeyGroupRange keyGroupRange = new KeyGroupRange(0, 1);
    int numberOfKeyGroups = keyGroupRange.getNumberOfKeyGroups();
    ExecutionConfig executionConfig = new ExecutionConfig();
    HeapPriorityQueueSetFactory priorityQueueSetFactory = new HeapPriorityQueueSetFactory(keyGroupRange, numberOfKeyGroups, 128);
    HeapKeyedStateBackendBuilder<Long> backendBuilder = new HeapKeyedStateBackendBuilder<>(null, new LongSerializer(), Thread.currentThread().getContextClassLoader(), numberOfKeyGroups, keyGroupRange, executionConfig, TtlTimeProvider.DEFAULT, LatencyTrackingStateConfig.disabled(), Collections.emptyList(), AbstractStateBackend.getCompressionDecorator(executionConfig), new LocalRecoveryConfig(null), priorityQueueSetFactory, false, new CloseableRegistry());
    return backendBuilder.build();
}
Also used : LongSerializer(org.apache.flink.api.common.typeutils.base.LongSerializer) HeapPriorityQueueSetFactory(org.apache.flink.runtime.state.heap.HeapPriorityQueueSetFactory) KeyGroupRange(org.apache.flink.runtime.state.KeyGroupRange) LocalRecoveryConfig(org.apache.flink.runtime.state.LocalRecoveryConfig) ExecutionConfig(org.apache.flink.api.common.ExecutionConfig) CloseableRegistry(org.apache.flink.core.fs.CloseableRegistry) File(java.io.File) HeapKeyedStateBackendBuilder(org.apache.flink.runtime.state.heap.HeapKeyedStateBackendBuilder)

Example 4 with HeapPriorityQueueSetFactory

use of org.apache.flink.runtime.state.heap.HeapPriorityQueueSetFactory in project flink by apache.

the class FsStateBackend method createKeyedStateBackend.

// ------------------------------------------------------------------------
// state holding structures
// ------------------------------------------------------------------------
@Override
public <K> AbstractKeyedStateBackend<K> createKeyedStateBackend(Environment env, JobID jobID, String operatorIdentifier, TypeSerializer<K> keySerializer, int numberOfKeyGroups, KeyGroupRange keyGroupRange, TaskKvStateRegistry kvStateRegistry, TtlTimeProvider ttlTimeProvider, MetricGroup metricGroup, @Nonnull Collection<KeyedStateHandle> stateHandles, CloseableRegistry cancelStreamRegistry) throws BackendBuildingException {
    TaskStateManager taskStateManager = env.getTaskStateManager();
    LocalRecoveryConfig localRecoveryConfig = taskStateManager.createLocalRecoveryConfig();
    HeapPriorityQueueSetFactory priorityQueueSetFactory = new HeapPriorityQueueSetFactory(keyGroupRange, numberOfKeyGroups, 128);
    LatencyTrackingStateConfig latencyTrackingStateConfig = latencyTrackingConfigBuilder.setMetricGroup(metricGroup).build();
    return new HeapKeyedStateBackendBuilder<>(kvStateRegistry, keySerializer, env.getUserCodeClassLoader().asClassLoader(), numberOfKeyGroups, keyGroupRange, env.getExecutionConfig(), ttlTimeProvider, latencyTrackingStateConfig, stateHandles, AbstractStateBackend.getCompressionDecorator(env.getExecutionConfig()), localRecoveryConfig, priorityQueueSetFactory, isUsingAsynchronousSnapshots(), cancelStreamRegistry).build();
}
Also used : HeapPriorityQueueSetFactory(org.apache.flink.runtime.state.heap.HeapPriorityQueueSetFactory) LatencyTrackingStateConfig(org.apache.flink.runtime.state.metrics.LatencyTrackingStateConfig) LocalRecoveryConfig(org.apache.flink.runtime.state.LocalRecoveryConfig) TaskStateManager(org.apache.flink.runtime.state.TaskStateManager)

Example 5 with HeapPriorityQueueSetFactory

use of org.apache.flink.runtime.state.heap.HeapPriorityQueueSetFactory in project flink by apache.

the class HashMapStateBackend method createKeyedStateBackend.

@Override
public <K> AbstractKeyedStateBackend<K> createKeyedStateBackend(Environment env, JobID jobID, String operatorIdentifier, TypeSerializer<K> keySerializer, int numberOfKeyGroups, KeyGroupRange keyGroupRange, TaskKvStateRegistry kvStateRegistry, TtlTimeProvider ttlTimeProvider, MetricGroup metricGroup, @Nonnull Collection<KeyedStateHandle> stateHandles, CloseableRegistry cancelStreamRegistry) throws IOException {
    TaskStateManager taskStateManager = env.getTaskStateManager();
    LocalRecoveryConfig localRecoveryConfig = taskStateManager.createLocalRecoveryConfig();
    HeapPriorityQueueSetFactory priorityQueueSetFactory = new HeapPriorityQueueSetFactory(keyGroupRange, numberOfKeyGroups, 128);
    LatencyTrackingStateConfig latencyTrackingStateConfig = latencyTrackingConfigBuilder.setMetricGroup(metricGroup).build();
    return new HeapKeyedStateBackendBuilder<>(kvStateRegistry, keySerializer, env.getUserCodeClassLoader().asClassLoader(), numberOfKeyGroups, keyGroupRange, env.getExecutionConfig(), ttlTimeProvider, latencyTrackingStateConfig, stateHandles, getCompressionDecorator(env.getExecutionConfig()), localRecoveryConfig, priorityQueueSetFactory, true, cancelStreamRegistry).build();
}
Also used : HeapPriorityQueueSetFactory(org.apache.flink.runtime.state.heap.HeapPriorityQueueSetFactory) LatencyTrackingStateConfig(org.apache.flink.runtime.state.metrics.LatencyTrackingStateConfig) LocalRecoveryConfig(org.apache.flink.runtime.state.LocalRecoveryConfig) TaskStateManager(org.apache.flink.runtime.state.TaskStateManager)

Aggregations

HeapPriorityQueueSetFactory (org.apache.flink.runtime.state.heap.HeapPriorityQueueSetFactory)6 LocalRecoveryConfig (org.apache.flink.runtime.state.LocalRecoveryConfig)3 TaskStateManager (org.apache.flink.runtime.state.TaskStateManager)3 LatencyTrackingStateConfig (org.apache.flink.runtime.state.metrics.LatencyTrackingStateConfig)3 ExecutionConfig (org.apache.flink.api.common.ExecutionConfig)2 CloseableRegistry (org.apache.flink.core.fs.CloseableRegistry)2 KeyGroupRange (org.apache.flink.runtime.state.KeyGroupRange)2 File (java.io.File)1 LongSerializer (org.apache.flink.api.common.typeutils.base.LongSerializer)1 PriorityQueueSetFactory (org.apache.flink.runtime.state.PriorityQueueSetFactory)1 HeapKeyedStateBackendBuilder (org.apache.flink.runtime.state.heap.HeapKeyedStateBackendBuilder)1 TestProcessingTimeService (org.apache.flink.streaming.runtime.tasks.TestProcessingTimeService)1 Test (org.junit.Test)1