Search in sources :

Example 1 with StorageMetadataWritesFencedOutException

use of io.pravega.segmentstore.storage.metadata.StorageMetadataWritesFencedOutException in project pravega by pravega.

the class WriteOperation method handleException.

private Object handleException(Throwable e) {
    log.debug("{} write - exception op={}, segment={}, offset={}, length={}.", chunkedSegmentStorage.getLogPrefix(), System.identityHashCode(this), handle.getSegmentName(), offset, length);
    val ex = Exceptions.unwrap(e);
    if (ex instanceof StorageMetadataWritesFencedOutException) {
        throw new CompletionException(new StorageNotPrimaryException(handle.getSegmentName(), ex));
    }
    if (ex instanceof ChunkStorageFullException) {
        throw new CompletionException(new StorageFullException(handle.getSegmentName(), ex));
    }
    throw new CompletionException(ex);
}
Also used : lombok.val(lombok.val) CompletionException(java.util.concurrent.CompletionException) StorageFullException(io.pravega.segmentstore.storage.StorageFullException) StorageNotPrimaryException(io.pravega.segmentstore.storage.StorageNotPrimaryException) StorageMetadataWritesFencedOutException(io.pravega.segmentstore.storage.metadata.StorageMetadataWritesFencedOutException)

Example 2 with StorageMetadataWritesFencedOutException

use of io.pravega.segmentstore.storage.metadata.StorageMetadataWritesFencedOutException in project pravega by pravega.

the class ConcatOperation method handleException.

private Void handleException(Throwable e) {
    log.debug("{} concat - exception op={}, target={}, source={}, offset={}.", chunkedSegmentStorage.getLogPrefix(), System.identityHashCode(this), targetHandle.getSegmentName(), sourceSegment, offset);
    val ex = Exceptions.unwrap(e);
    if (ex instanceof StorageMetadataWritesFencedOutException) {
        throw new CompletionException(new StorageNotPrimaryException(targetHandle.getSegmentName(), ex));
    }
    if (ex instanceof ChunkStorageFullException) {
        throw new CompletionException(new StorageFullException(targetHandle.getSegmentName(), ex));
    }
    throw new CompletionException(ex);
}
Also used : lombok.val(lombok.val) CompletionException(java.util.concurrent.CompletionException) StorageFullException(io.pravega.segmentstore.storage.StorageFullException) StorageNotPrimaryException(io.pravega.segmentstore.storage.StorageNotPrimaryException) StorageMetadataWritesFencedOutException(io.pravega.segmentstore.storage.metadata.StorageMetadataWritesFencedOutException)

Example 3 with StorageMetadataWritesFencedOutException

use of io.pravega.segmentstore.storage.metadata.StorageMetadataWritesFencedOutException in project pravega by pravega.

the class ChunkedSegmentStorageMockTests method testStorageMetadataWritesFencedOutExceptionDuringCommit.

@Test
public void testStorageMetadataWritesFencedOutExceptionDuringCommit() throws Exception {
    Exception exceptionToThrow = new StorageMetadataWritesFencedOutException("Test Exception");
    val clazz = StorageNotPrimaryException.class;
    testExceptionDuringCommit(exceptionToThrow, clazz);
}
Also used : lombok.val(lombok.val) StorageNotPrimaryException(io.pravega.segmentstore.storage.StorageNotPrimaryException) StorageFullException(io.pravega.segmentstore.storage.StorageFullException) StorageMetadataWritesFencedOutException(io.pravega.segmentstore.storage.metadata.StorageMetadataWritesFencedOutException) IntentionalException(io.pravega.test.common.IntentionalException) IOException(java.io.IOException) CompletionException(java.util.concurrent.CompletionException) StorageMetadataException(io.pravega.segmentstore.storage.metadata.StorageMetadataException) StorageMetadataVersionMismatchException(io.pravega.segmentstore.storage.metadata.StorageMetadataVersionMismatchException) StorageNotPrimaryException(io.pravega.segmentstore.storage.StorageNotPrimaryException) StorageMetadataWritesFencedOutException(io.pravega.segmentstore.storage.metadata.StorageMetadataWritesFencedOutException) Test(org.junit.Test)

Example 4 with StorageMetadataWritesFencedOutException

use of io.pravega.segmentstore.storage.metadata.StorageMetadataWritesFencedOutException in project pravega by pravega.

the class TruncateOperation method handleException.

private Void handleException(Void value, Throwable e) {
    if (null != e) {
        log.debug("{} truncate - exception op={}, segment={}, offset={}.", chunkedSegmentStorage.getLogPrefix(), System.identityHashCode(this), handle.getSegmentName(), offset);
        val ex = Exceptions.unwrap(e);
        if (ex instanceof StorageMetadataWritesFencedOutException) {
            throw new CompletionException(new StorageNotPrimaryException(handle.getSegmentName(), ex));
        }
        throw new CompletionException(ex);
    }
    return value;
}
Also used : lombok.val(lombok.val) CompletionException(java.util.concurrent.CompletionException) StorageNotPrimaryException(io.pravega.segmentstore.storage.StorageNotPrimaryException) StorageMetadataWritesFencedOutException(io.pravega.segmentstore.storage.metadata.StorageMetadataWritesFencedOutException)

Aggregations

StorageNotPrimaryException (io.pravega.segmentstore.storage.StorageNotPrimaryException)4 StorageMetadataWritesFencedOutException (io.pravega.segmentstore.storage.metadata.StorageMetadataWritesFencedOutException)4 CompletionException (java.util.concurrent.CompletionException)4 lombok.val (lombok.val)4 StorageFullException (io.pravega.segmentstore.storage.StorageFullException)3 StorageMetadataException (io.pravega.segmentstore.storage.metadata.StorageMetadataException)1 StorageMetadataVersionMismatchException (io.pravega.segmentstore.storage.metadata.StorageMetadataVersionMismatchException)1 IntentionalException (io.pravega.test.common.IntentionalException)1 IOException (java.io.IOException)1 Test (org.junit.Test)1