Search in sources :

Example 6 with DataOutrankedException

use of org.corfudb.runtime.exceptions.DataOutrankedException in project CorfuDB by CorfuDB.

the class StreamLogWithRankedAddressSpaceTest method testLowerRank.

@Test
public void testLowerRank() {
    StreamLogFiles log = new StreamLogFiles(getContext(), false);
    long address = 0;
    writeToLog(log, address, DataType.DATA, "v-1", 2);
    LogData value1 = log.read(address);
    assertTrue(new String(value1.getData()).contains("v-1"));
    try {
        writeToLog(log, address, DataType.DATA, "v-2", 1);
        fail();
    } catch (DataOutrankedException e) {
    // expected
    }
    LogData value2 = log.read(address);
    assertTrue(new String(value2.getData()).contains("v-1"));
    log.close();
}
Also used : LogData(org.corfudb.protocols.wireprotocol.LogData) DataOutrankedException(org.corfudb.runtime.exceptions.DataOutrankedException) Test(org.junit.Test) AbstractCorfuTest(org.corfudb.AbstractCorfuTest)

Aggregations

LogData (org.corfudb.protocols.wireprotocol.LogData)6 DataOutrankedException (org.corfudb.runtime.exceptions.DataOutrankedException)6 AbstractCorfuTest (org.corfudb.AbstractCorfuTest)4 Test (org.junit.Test)4 ReadResponse (org.corfudb.protocols.wireprotocol.ReadResponse)2 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 ILogData (org.corfudb.protocols.wireprotocol.ILogData)1 IMetadata (org.corfudb.protocols.wireprotocol.IMetadata)1 HoleFillRequiredException (org.corfudb.runtime.exceptions.HoleFillRequiredException)1 LogUnitException (org.corfudb.runtime.exceptions.LogUnitException)1 OverwriteException (org.corfudb.runtime.exceptions.OverwriteException)1 QuorumUnreachableException (org.corfudb.runtime.exceptions.QuorumUnreachableException)1 ValueAdoptedException (org.corfudb.runtime.exceptions.ValueAdoptedException)1 QuorumFuturesFactory (org.corfudb.runtime.view.QuorumFuturesFactory)1 Holder (org.corfudb.util.Holder)1 RetryNeededException (org.corfudb.util.retry.RetryNeededException)1