Search in sources :

Example 6 with ColumnFamilyOptions

use of org.rocksdb.ColumnFamilyOptions in project flink by apache.

the class KVStateRequestSerializerRocksDBTest method testMapSerialization.

/**
	 * 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);
    ColumnFamilyOptions columnFamilyOptions = PredefinedOptions.DEFAULT.createColumnOptions();
    final RocksDBKeyedStateBackend<Long> longHeapKeyedStateBackend = new RocksDBKeyedStateBackend<>(new JobID(), "no-op", ClassLoader.getSystemClassLoader(), temporaryFolder.getRoot(), dbOptions, columnFamilyOptions, mock(TaskKvStateRegistry.class), LongSerializer.INSTANCE, 1, new KeyGroupRange(0, 0), new ExecutionConfig());
    longHeapKeyedStateBackend.setCurrentKey(key);
    final InternalMapState<VoidNamespace, Long, String> mapState = (InternalMapState<VoidNamespace, Long, String>) longHeapKeyedStateBackend.getPartitionedState(VoidNamespace.INSTANCE, VoidNamespaceSerializer.INSTANCE, new MapStateDescriptor<>("test", LongSerializer.INSTANCE, StringSerializer.INSTANCE));
    KvStateRequestSerializerTest.testMapSerialization(key, mapState);
}
Also used : MapStateDescriptor(org.apache.flink.api.common.state.MapStateDescriptor) KeyGroupRange(org.apache.flink.runtime.state.KeyGroupRange) TaskKvStateRegistry(org.apache.flink.runtime.query.TaskKvStateRegistry) ExecutionConfig(org.apache.flink.api.common.ExecutionConfig) RocksDBKeyedStateBackend(org.apache.flink.contrib.streaming.state.RocksDBKeyedStateBackend) ColumnFamilyOptions(org.rocksdb.ColumnFamilyOptions) InternalMapState(org.apache.flink.runtime.state.internal.InternalMapState) DBOptions(org.rocksdb.DBOptions) VoidNamespace(org.apache.flink.runtime.state.VoidNamespace) JobID(org.apache.flink.api.common.JobID) Test(org.junit.Test) KvStateRequestSerializerTest(org.apache.flink.runtime.query.netty.message.KvStateRequestSerializerTest)

Aggregations

ColumnFamilyOptions (org.rocksdb.ColumnFamilyOptions)6 DBOptions (org.rocksdb.DBOptions)6 Test (org.junit.Test)5 Mockito.anyString (org.mockito.Mockito.anyString)3 ExecutionConfig (org.apache.flink.api.common.ExecutionConfig)2 JobID (org.apache.flink.api.common.JobID)2 TaskKvStateRegistry (org.apache.flink.runtime.query.TaskKvStateRegistry)2 KvStateRequestSerializerTest (org.apache.flink.runtime.query.netty.message.KvStateRequestSerializerTest)2 KeyGroupRange (org.apache.flink.runtime.state.KeyGroupRange)2 VoidNamespace (org.apache.flink.runtime.state.VoidNamespace)2 File (java.io.File)1 ArrayList (java.util.ArrayList)1 Properties (java.util.Properties)1 MapStateDescriptor (org.apache.flink.api.common.state.MapStateDescriptor)1 RocksDBKeyedStateBackend (org.apache.flink.contrib.streaming.state.RocksDBKeyedStateBackend)1 InternalMapState (org.apache.flink.runtime.state.internal.InternalMapState)1 ColumnFamilyDescriptor (org.rocksdb.ColumnFamilyDescriptor)1 ColumnFamilyHandle (org.rocksdb.ColumnFamilyHandle)1 RocksDB (org.rocksdb.RocksDB)1 StorageInitializationException (voldemort.store.StorageInitializationException)1