use of org.janusgraph.diskstorage.BackendException in project janusgraph by JanusGraph.
the class ConsistentKeyLockerTest method testWriteLockDiesOnPermanentStorageException.
/**
* Test that the first {@link org.janusgraph.diskstorage.PermanentBackendException} thrown by the
* locker's store causes it to attempt to delete outstanding lock writes and
* then emit the exception without retrying.
*
* @throws org.janusgraph.diskstorage.BackendException shouldn't happen
*/
@Test
public void testWriteLockDiesOnPermanentStorageException() throws BackendException {
PermanentBackendException errOnFire = new PermanentBackendException("Storage cluster is on fire");
expect(lockState.has(defaultTx, defaultLockID)).andReturn(false);
recordSuccessfulLocalLock();
StaticBuffer lockCol = recordExceptionLockWrite(errOnFire);
recordSuccessfulLockDelete(lockCol);
recordSuccessfulLocalUnlock();
ctrl.replay();
BackendException expected = null;
try {
// SUT
locker.writeLock(defaultLockID, defaultTx);
} catch (PermanentLockingException e) {
expected = e;
}
assertNotNull(expected);
assertEquals(errOnFire, expected.getCause());
}
use of org.janusgraph.diskstorage.BackendException in project janusgraph by JanusGraph.
the class KCVSCacheTest method loadStore.
public void loadStore(int numKeys, int numCols) {
StoreTransaction tx = getStoreTx();
try {
for (int i = 1; i <= numKeys; i++) {
final List<Entry> adds = new ArrayList<>(numCols);
for (int j = 1; j <= numCols; j++) adds.add(getEntry(j, j));
store.mutate(BufferUtil.getIntBuffer(i), adds, KeyColumnValueStore.NO_DELETIONS, tx);
}
tx.commit();
} catch (BackendException e) {
throw new RuntimeException(e);
}
}
Aggregations