Search in sources :

Example 6 with Cache

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

the class RocksDBResourceContainerTest method getBlockCache.

private Cache getBlockCache(ColumnFamilyOptions columnOptions) {
    BlockBasedTableConfig blockBasedTableConfig = null;
    try {
        blockBasedTableConfig = (BlockBasedTableConfig) columnOptions.tableFormatConfig();
    } catch (ClassCastException e) {
        fail("Table config got from ColumnFamilyOptions is not BlockBasedTableConfig");
    }
    Field cacheField = null;
    try {
        cacheField = BlockBasedTableConfig.class.getDeclaredField("blockCache");
    } catch (NoSuchFieldException e) {
        fail("blockCache is not defined");
    }
    cacheField.setAccessible(true);
    try {
        return (Cache) cacheField.get(blockBasedTableConfig);
    } catch (IllegalAccessException e) {
        fail("Cannot access blockCache field.");
        return null;
    }
}
Also used : Field(java.lang.reflect.Field) BlockBasedTableConfig(org.rocksdb.BlockBasedTableConfig) LRUCache(org.rocksdb.LRUCache) Cache(org.rocksdb.Cache)

Aggregations

Cache (org.rocksdb.Cache)6 LRUCache (org.rocksdb.LRUCache)5 BlockBasedTableConfig (org.rocksdb.BlockBasedTableConfig)4 Test (org.junit.Test)2 ColumnFamilyOptions (org.rocksdb.ColumnFamilyOptions)2 TableFormatConfig (org.rocksdb.TableFormatConfig)2 Field (java.lang.reflect.Field)1 HashSet (java.util.HashSet)1 ProcessorStateException (org.apache.kafka.streams.errors.ProcessorStateException)1 Statistics (org.rocksdb.Statistics)1 WriteBufferManager (org.rocksdb.WriteBufferManager)1