use of org.rocksdb.WriteBufferManager in project flink by apache.
the class RocksDBResourceContainerTest method getWriteBufferManager.
private WriteBufferManager getWriteBufferManager(DBOptions dbOptions) {
Field writeBufferManagerField = null;
try {
writeBufferManagerField = DBOptions.class.getDeclaredField("writeBufferManager_");
} catch (NoSuchFieldException e) {
fail("writeBufferManager_ is not defined.");
}
writeBufferManagerField.setAccessible(true);
try {
return (WriteBufferManager) writeBufferManagerField.get(dbOptions);
} catch (IllegalAccessException e) {
fail("Cannot access writeBufferManager_ field.");
return null;
}
}
use of org.rocksdb.WriteBufferManager in project flink by apache.
the class RocksDBResourceContainerTest method testGetDbOptionsWithSharedResources.
/**
* Guard that {@link RocksDBResourceContainer#getDbOptions()} shares the same {@link
* WriteBufferManager} instance if the {@link RocksDBResourceContainer} instance is initiated
* with {@link OpaqueMemoryResource}.
*
* @throws Exception if unexpected error happened.
*/
@Test
public void testGetDbOptionsWithSharedResources() throws Exception {
final int optionNumber = 20;
OpaqueMemoryResource<RocksDBSharedResources> sharedResources = getSharedResources();
RocksDBResourceContainer container = new RocksDBResourceContainer(PredefinedOptions.DEFAULT, null, sharedResources);
HashSet<WriteBufferManager> writeBufferManagers = new HashSet<>();
for (int i = 0; i < optionNumber; i++) {
DBOptions dbOptions = container.getDbOptions();
WriteBufferManager writeBufferManager = getWriteBufferManager(dbOptions);
writeBufferManagers.add(writeBufferManager);
}
assertThat(writeBufferManagers.size(), is(1));
assertThat(writeBufferManagers.iterator().next(), is(sharedResources.getResourceHandle().getWriteBufferManager()));
container.close();
}
Aggregations