Java Code Examples for org.apache.flink.contrib.streaming.state.RocksDBKeyedStateBackend#dispose()
The following examples show how to use
org.apache.flink.contrib.streaming.state.RocksDBKeyedStateBackend#dispose() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: KVStateRequestSerializerRocksDBTest.java From flink with Apache License 2.0 | 6 votes |
/** * Tests list serialization and deserialization match. * * @see KvStateRequestSerializerTest#testListSerialization() * KvStateRequestSerializerTest#testListSerialization() using the heap state back-end * test */ @Test public void testListSerialization() throws Exception { final long key = 0L; final RocksDBKeyedStateBackend<Long> longHeapKeyedStateBackend = RocksDBTestUtils .builderForTestDefaults(temporaryFolder.getRoot(), LongSerializer.INSTANCE) .build(); longHeapKeyedStateBackend.setCurrentKey(key); final InternalListState<Long, VoidNamespace, Long> listState = longHeapKeyedStateBackend.createInternalState(VoidNamespaceSerializer.INSTANCE, new ListStateDescriptor<>("test", LongSerializer.INSTANCE)); KvStateRequestSerializerTest.testListSerialization(key, listState); longHeapKeyedStateBackend.dispose(); }
Example 2
Source File: KVStateRequestSerializerRocksDBTest.java From flink with Apache License 2.0 | 6 votes |
/** * Tests map serialization and deserialization match. * * @see KvStateRequestSerializerTest#testMapSerialization() * KvStateRequestSerializerTest#testMapSerialization() using the heap state back-end * test */ @Test public void testMapSerialization() throws Exception { final long key = 0L; // objects for RocksDB state list serialisation final RocksDBKeyedStateBackend<Long> longHeapKeyedStateBackend = RocksDBTestUtils .builderForTestDefaults(temporaryFolder.getRoot(), LongSerializer.INSTANCE) .build(); longHeapKeyedStateBackend.setCurrentKey(key); final InternalMapState<Long, VoidNamespace, Long, String> mapState = (InternalMapState<Long, VoidNamespace, Long, String>) longHeapKeyedStateBackend.getPartitionedState( VoidNamespace.INSTANCE, VoidNamespaceSerializer.INSTANCE, new MapStateDescriptor<>("test", LongSerializer.INSTANCE, StringSerializer.INSTANCE)); KvStateRequestSerializerTest.testMapSerialization(key, mapState); longHeapKeyedStateBackend.dispose(); }
Example 3
Source File: KVStateRequestSerializerRocksDBTest.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
/** * Tests list serialization and deserialization match. * * @see KvStateRequestSerializerTest#testListSerialization() * KvStateRequestSerializerTest#testListSerialization() using the heap state back-end * test */ @Test public void testListSerialization() throws Exception { final long key = 0L; // objects for RocksDB state list serialisation DBOptions dbOptions = PredefinedOptions.DEFAULT.createDBOptions(); dbOptions.setCreateIfMissing(true); ExecutionConfig executionConfig = new ExecutionConfig(); final RocksDBKeyedStateBackend<Long> longHeapKeyedStateBackend = new RocksDBKeyedStateBackendBuilder<>( "no-op", ClassLoader.getSystemClassLoader(), temporaryFolder.getRoot(), dbOptions, stateName -> PredefinedOptions.DEFAULT.createColumnOptions(), mock(TaskKvStateRegistry.class), LongSerializer.INSTANCE, 1, new KeyGroupRange(0, 0), executionConfig, TestLocalRecoveryConfig.disabled(), RocksDBStateBackend.PriorityQueueStateType.HEAP, TtlTimeProvider.DEFAULT, new UnregisteredMetricsGroup(), Collections.emptyList(), AbstractStateBackend.getCompressionDecorator(executionConfig), new CloseableRegistry() ).build(); longHeapKeyedStateBackend.setCurrentKey(key); final InternalListState<Long, VoidNamespace, Long> listState = longHeapKeyedStateBackend.createInternalState(VoidNamespaceSerializer.INSTANCE, new ListStateDescriptor<>("test", LongSerializer.INSTANCE)); KvStateRequestSerializerTest.testListSerialization(key, listState); longHeapKeyedStateBackend.dispose(); }
Example 4
Source File: KVStateRequestSerializerRocksDBTest.java From flink with Apache License 2.0 | 5 votes |
/** * Tests list serialization and deserialization match. * * @see KvStateRequestSerializerTest#testListSerialization() * KvStateRequestSerializerTest#testListSerialization() using the heap state back-end * test */ @Test public void testListSerialization() throws Exception { final long key = 0L; // objects for RocksDB state list serialisation DBOptions dbOptions = PredefinedOptions.DEFAULT.createDBOptions(); dbOptions.setCreateIfMissing(true); ExecutionConfig executionConfig = new ExecutionConfig(); final RocksDBKeyedStateBackend<Long> longHeapKeyedStateBackend = new RocksDBKeyedStateBackendBuilder<>( "no-op", ClassLoader.getSystemClassLoader(), temporaryFolder.getRoot(), dbOptions, stateName -> PredefinedOptions.DEFAULT.createColumnOptions(), mock(TaskKvStateRegistry.class), LongSerializer.INSTANCE, 1, new KeyGroupRange(0, 0), executionConfig, TestLocalRecoveryConfig.disabled(), RocksDBStateBackend.PriorityQueueStateType.HEAP, TtlTimeProvider.DEFAULT, new UnregisteredMetricsGroup(), Collections.emptyList(), AbstractStateBackend.getCompressionDecorator(executionConfig), new CloseableRegistry() ).build(); longHeapKeyedStateBackend.setCurrentKey(key); final InternalListState<Long, VoidNamespace, Long> listState = longHeapKeyedStateBackend.createInternalState(VoidNamespaceSerializer.INSTANCE, new ListStateDescriptor<>("test", LongSerializer.INSTANCE)); KvStateRequestSerializerTest.testListSerialization(key, listState); longHeapKeyedStateBackend.dispose(); }
Example 5
Source File: KVStateRequestSerializerRocksDBTest.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
/** * Tests map serialization and deserialization match. * * @see KvStateRequestSerializerTest#testMapSerialization() * KvStateRequestSerializerTest#testMapSerialization() using the heap state back-end * test */ @Test public void testMapSerialization() throws Exception { final long key = 0L; // objects for RocksDB state list serialisation DBOptions dbOptions = PredefinedOptions.DEFAULT.createDBOptions(); dbOptions.setCreateIfMissing(true); ExecutionConfig executionConfig = new ExecutionConfig(); final RocksDBKeyedStateBackend<Long> longHeapKeyedStateBackend = new RocksDBKeyedStateBackendBuilder<>( "no-op", ClassLoader.getSystemClassLoader(), temporaryFolder.getRoot(), dbOptions, stateName -> PredefinedOptions.DEFAULT.createColumnOptions(), mock(TaskKvStateRegistry.class), LongSerializer.INSTANCE, 1, new KeyGroupRange(0, 0), executionConfig, TestLocalRecoveryConfig.disabled(), RocksDBStateBackend.PriorityQueueStateType.HEAP, TtlTimeProvider.DEFAULT, new UnregisteredMetricsGroup(), Collections.emptyList(), AbstractStateBackend.getCompressionDecorator(executionConfig), new CloseableRegistry() ).build(); longHeapKeyedStateBackend.setCurrentKey(key); final InternalMapState<Long, VoidNamespace, Long, String> mapState = (InternalMapState<Long, VoidNamespace, Long, String>) longHeapKeyedStateBackend.getPartitionedState( VoidNamespace.INSTANCE, VoidNamespaceSerializer.INSTANCE, new MapStateDescriptor<>("test", LongSerializer.INSTANCE, StringSerializer.INSTANCE)); KvStateRequestSerializerTest.testMapSerialization(key, mapState); longHeapKeyedStateBackend.dispose(); }
Example 6
Source File: KVStateRequestSerializerRocksDBTest.java From flink with Apache License 2.0 | 4 votes |
/** * Tests map serialization and deserialization match. * * @see KvStateRequestSerializerTest#testMapSerialization() * KvStateRequestSerializerTest#testMapSerialization() using the heap state back-end * test */ @Test public void testMapSerialization() throws Exception { final long key = 0L; // objects for RocksDB state list serialisation DBOptions dbOptions = PredefinedOptions.DEFAULT.createDBOptions(); dbOptions.setCreateIfMissing(true); ExecutionConfig executionConfig = new ExecutionConfig(); final RocksDBKeyedStateBackend<Long> longHeapKeyedStateBackend = new RocksDBKeyedStateBackendBuilder<>( "no-op", ClassLoader.getSystemClassLoader(), temporaryFolder.getRoot(), dbOptions, stateName -> PredefinedOptions.DEFAULT.createColumnOptions(), mock(TaskKvStateRegistry.class), LongSerializer.INSTANCE, 1, new KeyGroupRange(0, 0), executionConfig, TestLocalRecoveryConfig.disabled(), RocksDBStateBackend.PriorityQueueStateType.HEAP, TtlTimeProvider.DEFAULT, new UnregisteredMetricsGroup(), Collections.emptyList(), AbstractStateBackend.getCompressionDecorator(executionConfig), new CloseableRegistry() ).build(); longHeapKeyedStateBackend.setCurrentKey(key); final InternalMapState<Long, VoidNamespace, Long, String> mapState = (InternalMapState<Long, VoidNamespace, Long, String>) longHeapKeyedStateBackend.getPartitionedState( VoidNamespace.INSTANCE, VoidNamespaceSerializer.INSTANCE, new MapStateDescriptor<>("test", LongSerializer.INSTANCE, StringSerializer.INSTANCE)); KvStateRequestSerializerTest.testMapSerialization(key, mapState); longHeapKeyedStateBackend.dispose(); }