use of org.rocksdb.WriteOptions in project beam by apache.
the class SamzaTimerInternalsFactoryTest method createStore.
private KeyValueStore<ByteArray, StateValue<?>> createStore() {
final Options options = new Options();
options.setCreateIfMissing(true);
RocksDbKeyValueStore rocksStore = new RocksDbKeyValueStore(temporaryFolder.getRoot(), options, new MapConfig(), false, "beamStore", new WriteOptions(), new FlushOptions(), new KeyValueStoreMetrics("beamStore", new MetricsRegistryMap()));
return new SerializedKeyValueStore<>(rocksStore, new ByteArraySerdeFactory.ByteArraySerde(), new StateValueSerdeFactory.StateValueSerde(), new SerializedKeyValueStoreMetrics("beamStore", new MetricsRegistryMap()));
}
use of org.rocksdb.WriteOptions in project flink by apache.
the class RocksDBWriteBatchWrapperTest method testWriteBatchWrapperFlushAfterCountExceed.
/**
* Tests that {@link RocksDBWriteBatchWrapper} flushes after the kv count exceeds the
* preconfigured value.
*/
@Test
public void testWriteBatchWrapperFlushAfterCountExceed() throws Exception {
try (RocksDB db = RocksDB.open(folder.newFolder().getAbsolutePath());
WriteOptions options = new WriteOptions().setDisableWAL(true);
ColumnFamilyHandle handle = db.createColumnFamily(new ColumnFamilyDescriptor("test".getBytes()));
RocksDBWriteBatchWrapper writeBatchWrapper = new RocksDBWriteBatchWrapper(db, options, 100, 50000)) {
long initBatchSize = writeBatchWrapper.getDataSize();
byte[] dummy = new byte[2];
ThreadLocalRandom.current().nextBytes(dummy);
for (int i = 1; i < 100; ++i) {
writeBatchWrapper.put(handle, dummy, dummy);
// each kv consumes 8 bytes
assertEquals(initBatchSize + 8 * i, writeBatchWrapper.getDataSize());
}
writeBatchWrapper.put(handle, dummy, dummy);
assertEquals(initBatchSize, writeBatchWrapper.getDataSize());
}
}
use of org.rocksdb.WriteOptions in project flink by apache.
the class RocksDBResourceContainerTest method testFreeWriteReadOptionsAfterClose.
@Test
public void testFreeWriteReadOptionsAfterClose() throws Exception {
RocksDBResourceContainer container = new RocksDBResourceContainer();
WriteOptions writeOptions = container.getWriteOptions();
ReadOptions readOptions = container.getReadOptions();
assertThat(writeOptions.isOwningHandle(), is(true));
assertThat(readOptions.isOwningHandle(), is(true));
container.close();
assertThat(writeOptions.isOwningHandle(), is(false));
assertThat(readOptions.isOwningHandle(), is(false));
}
Aggregations