use of org.rocksdb.ColumnFamilyOptions in project flink by apache.
the class RocksDBResourceContainerTest method testFreeMultipleColumnOptionsAfterClose.
@Test
public void testFreeMultipleColumnOptionsAfterClose() throws Exception {
RocksDBResourceContainer container = new RocksDBResourceContainer();
final int optionNumber = 20;
ArrayList<ColumnFamilyOptions> columnFamilyOptions = new ArrayList<>(optionNumber);
for (int i = 0; i < optionNumber; i++) {
columnFamilyOptions.add(container.getColumnOptions());
}
container.close();
for (ColumnFamilyOptions columnFamilyOption : columnFamilyOptions) {
assertThat(columnFamilyOption.isOwningHandle(), is(false));
}
}
use of org.rocksdb.ColumnFamilyOptions in project flink by apache.
the class RocksDBResourceContainerTest method testFreeColumnOptionsAfterClose.
@Test
public void testFreeColumnOptionsAfterClose() throws Exception {
RocksDBResourceContainer container = new RocksDBResourceContainer();
ColumnFamilyOptions columnFamilyOptions = container.getColumnOptions();
assertThat(columnFamilyOptions.isOwningHandle(), is(true));
container.close();
assertThat(columnFamilyOptions.isOwningHandle(), is(false));
}
use of org.rocksdb.ColumnFamilyOptions in project flink by apache.
the class RocksDBStateBackendConfigTest method testPredefinedAndOptionsFactory.
@Test
public void testPredefinedAndOptionsFactory() throws Exception {
final RocksDBOptionsFactory optionsFactory = new RocksDBOptionsFactory() {
@Override
public DBOptions createDBOptions(DBOptions currentOptions, Collection<AutoCloseable> handlesToClose) {
return currentOptions;
}
@Override
public ColumnFamilyOptions createColumnOptions(ColumnFamilyOptions currentOptions, Collection<AutoCloseable> handlesToClose) {
return currentOptions.setCompactionStyle(CompactionStyle.UNIVERSAL);
}
};
try (final RocksDBResourceContainer optionsContainer = new RocksDBResourceContainer(PredefinedOptions.SPINNING_DISK_OPTIMIZED, optionsFactory)) {
final ColumnFamilyOptions columnFamilyOptions = optionsContainer.getColumnOptions();
assertNotNull(columnFamilyOptions);
assertEquals(CompactionStyle.UNIVERSAL, columnFamilyOptions.compactionStyle());
}
}
use of org.rocksdb.ColumnFamilyOptions in project flink by apache.
the class RocksDBStateBackendConfigTest method testPredefinedAndConfigurableOptions.
@Test
public void testPredefinedAndConfigurableOptions() throws Exception {
Configuration configuration = new Configuration();
configuration.set(RocksDBConfigurableOptions.COMPACTION_STYLE, CompactionStyle.UNIVERSAL);
try (final RocksDBResourceContainer optionsContainer = new RocksDBResourceContainer(configuration, PredefinedOptions.SPINNING_DISK_OPTIMIZED, null, null)) {
final ColumnFamilyOptions columnFamilyOptions = optionsContainer.getColumnOptions();
assertNotNull(columnFamilyOptions);
assertEquals(CompactionStyle.UNIVERSAL, columnFamilyOptions.compactionStyle());
}
try (final RocksDBResourceContainer optionsContainer = new RocksDBResourceContainer(new Configuration(), PredefinedOptions.SPINNING_DISK_OPTIMIZED, null, null)) {
final ColumnFamilyOptions columnFamilyOptions = optionsContainer.getColumnOptions();
assertNotNull(columnFamilyOptions);
assertEquals(CompactionStyle.LEVEL, columnFamilyOptions.compactionStyle());
}
}
Aggregations