use of org.janusgraph.diskstorage.TemporaryBackendException in project janusgraph by JanusGraph.
the class ConsistentKeyLockerTest method testCheckLocksThrowsExceptionAfterMaxTemporaryStorageExceptions.
/**
* The checker will throw a TemporaryStorageException if getSlice() throws
* fails with a TemporaryStorageException as many times as there are
* configured lock retries.
*
* @throws InterruptedException shouldn't happen
* @throws org.janusgraph.diskstorage.BackendException shouldn't happen
*/
@Test
public void testCheckLocksThrowsExceptionAfterMaxTemporaryStorageExceptions() throws InterruptedException, BackendException {
// Setup a LockStatus for defaultLockID
ConsistentKeyLockStatus lockStatus = makeStatusNow();
currentTimeNS = currentTimeNS.plusNanos(1);
expect(lockState.getLocksForTx(defaultTx)).andReturn(ImmutableMap.of(defaultLockID, lockStatus));
expectSleepAfterWritingLock(lockStatus);
// Three successive getSlice calls, each throwing a distinct TSE
recordExceptionalLockGetSlice(new TemporaryBackendException("Storage cluster is having me-time"));
recordExceptionalLockGetSlice(new TemporaryBackendException("Storage cluster is in a dissociative fugue state"));
recordExceptionalLockGetSlice(new TemporaryBackendException("Storage cluster has gone to Prague to find itself"));
ctrl.replay();
TemporaryBackendException tse = null;
try {
locker.checkLocks(defaultTx);
} catch (TemporaryBackendException e) {
tse = e;
}
assertNotNull(tse);
}
use of org.janusgraph.diskstorage.TemporaryBackendException in project janusgraph by JanusGraph.
the class ConsistentKeyLockerTest method testWriteLockRetriesOnTemporaryStorageException.
/**
* Test the locker retries a lock write after the initial store mutation
* fails with a {@link org.janusgraph.diskstorage.TemporaryBackendException}. The retry should both
* attempt to write the and delete the failed mutation column.
*
* @throws org.janusgraph.diskstorage.BackendException shouldn't happen
*/
@Test
public void testWriteLockRetriesOnTemporaryStorageException() throws BackendException {
TemporaryBackendException tse = new TemporaryBackendException("Storage cluster is waking up");
expect(lockState.has(defaultTx, defaultLockID)).andReturn(false);
recordSuccessfulLocalLock();
StaticBuffer firstCol = recordExceptionLockWrite(tse);
LockInfo secondLI = recordSuccessfulLockWrite(1, ChronoUnit.NANOS, firstCol);
recordSuccessfulLocalLock(secondLI.tsNS);
lockState.take(eq(defaultTx), eq(defaultLockID), eq(secondLI.stat));
ctrl.replay();
// SUT
locker.writeLock(defaultLockID, defaultTx);
}
Aggregations