use of org.rocksdb.RocksObject in project flink by apache.
the class RocksDBStateBackendTest method testRunningSnapshotAfterBackendClosed.
@Test
public void testRunningSnapshotAfterBackendClosed() throws Exception {
setupRocksKeyedStateBackend();
RunnableFuture<KeyGroupsStateHandle> snapshot = keyedStateBackend.snapshot(0L, 0L, testStreamFactory, CheckpointOptions.forFullCheckpoint());
RocksDB spyDB = keyedStateBackend.db;
verify(spyDB, times(1)).getSnapshot();
verify(spyDB, times(0)).releaseSnapshot(any(Snapshot.class));
this.keyedStateBackend.dispose();
verify(spyDB, times(1)).close();
assertEquals(null, keyedStateBackend.db);
//Ensure every RocksObjects not closed yet
for (RocksObject rocksCloseable : allCreatedCloseables) {
verify(rocksCloseable, times(0)).close();
}
Thread asyncSnapshotThread = new Thread(snapshot);
asyncSnapshotThread.start();
try {
snapshot.get();
fail();
} catch (Exception ignored) {
}
asyncSnapshotThread.join();
//Ensure every RocksObject was closed exactly once
for (RocksObject rocksCloseable : allCreatedCloseables) {
verify(rocksCloseable, times(1)).close();
}
}
use of org.rocksdb.RocksObject in project flink by apache.
the class RocksDBStateBackendTest method verifyRocksObjectsReleased.
private void verifyRocksObjectsReleased() {
//Ensure every RocksObject was closed exactly once
for (RocksObject rocksCloseable : allCreatedCloseables) {
verify(rocksCloseable, times(1)).close();
}
assertNotNull(null, keyedStateBackend.db);
RocksDB spyDB = keyedStateBackend.db;
verify(spyDB, times(1)).getSnapshot();
verify(spyDB, times(1)).releaseSnapshot(any(Snapshot.class));
keyedStateBackend.dispose();
verify(spyDB, times(1)).close();
assertEquals(null, keyedStateBackend.db);
}
use of org.rocksdb.RocksObject in project flink by apache.
the class RocksDBStateBackendTest method testReleasingSnapshotAfterBackendClosed.
@Test
public void testReleasingSnapshotAfterBackendClosed() throws Exception {
setupRocksKeyedStateBackend();
RunnableFuture<KeyGroupsStateHandle> snapshot = keyedStateBackend.snapshot(0L, 0L, testStreamFactory, CheckpointOptions.forFullCheckpoint());
RocksDB spyDB = keyedStateBackend.db;
verify(spyDB, times(1)).getSnapshot();
verify(spyDB, times(0)).releaseSnapshot(any(Snapshot.class));
this.keyedStateBackend.dispose();
verify(spyDB, times(1)).close();
assertEquals(null, keyedStateBackend.db);
//Ensure every RocksObjects not closed yet
for (RocksObject rocksCloseable : allCreatedCloseables) {
verify(rocksCloseable, times(0)).close();
}
snapshot.cancel(true);
//Ensure every RocksObjects was closed exactly once
for (RocksObject rocksCloseable : allCreatedCloseables) {
verify(rocksCloseable, times(1)).close();
}
}
Aggregations