use of org.voltcore.messaging.TransactionInfoBaseMessage in project voltdb by VoltDB.
the class TestReplaySequencer method testSentinelsAndFragsWithSameTxnId.
/**
* This tests multiple @LoadMultipartitionTable transactions with the same
* txnId as DR does.
*/
@Test
public void testSentinelsAndFragsWithSameTxnId() {
ReplaySequencer dut = new ReplaySequencer();
TransactionInfoBaseMessage sntl = makeSentinel(1L);
TransactionInfoBaseMessage frag = makeFragment(1L);
TransactionInfoBaseMessage frag2 = makeFragment(1L);
Assert.assertTrue(dut.offer(1L, sntl));
Assert.assertTrue(dut.offer(1L, frag));
Assert.assertEquals(frag, dut.poll());
Assert.assertEquals(null, dut.poll());
Assert.assertNull(dut.drain());
// subsequent fragments won't block the queue.
Assert.assertFalse(dut.offer(1L, frag2));
Assert.assertEquals(null, dut.poll());
Assert.assertNull(dut.drain());
// Dupe sentinels and fragments
Assert.assertTrue(dut.offer(1L, sntl));
Assert.assertFalse(dut.offer(1L, frag));
Assert.assertFalse(dut.offer(1L, frag2));
Assert.assertEquals(null, dut.poll());
Assert.assertNull(dut.drain());
}
use of org.voltcore.messaging.TransactionInfoBaseMessage in project voltdb by VoltDB.
the class TestReplaySequencer method testOfferSentinelThenFragments.
@Test
public void testOfferSentinelThenFragments() {
boolean result;
ReplaySequencer dut = new ReplaySequencer();
TransactionInfoBaseMessage sntl = makeSentinel(1L);
TransactionInfoBaseMessage frag = makeFragment(1L);
TransactionInfoBaseMessage frag2 = makeFragment(1L);
result = dut.offer(1L, sntl);
// toString should not throw
try {
dut.dump(1);
} catch (Exception e) {
fail(e.getMessage());
}
result = dut.offer(1L, frag);
Assert.assertEquals(true, result);
Assert.assertEquals(frag, dut.poll());
Assert.assertEquals(null, dut.poll());
// subsequent fragments won't block the queue.
result = dut.offer(1L, frag2);
Assert.assertEquals(false, result);
Assert.assertEquals(null, dut.poll());
Assert.assertNull(dut.drain());
}
use of org.voltcore.messaging.TransactionInfoBaseMessage in project voltdb by VoltDB.
the class TestReplaySequencer method testCompleteWithoutFirstFrag.
@Test
public void testCompleteWithoutFirstFrag() {
ReplaySequencer dut = new ReplaySequencer();
TransactionInfoBaseMessage sntl = makeSentinel(1L);
TransactionInfoBaseMessage frag = makeFragment(1L);
TransactionInfoBaseMessage cmpl = makeCompleteTxn(1L);
Assert.assertTrue(dut.offer(1L, sntl));
// a restart complete arrives before the first fragment
Assert.assertFalse(dut.offer(1L, cmpl));
Assert.assertTrue(dut.offer(1L, frag));
// CompleteTxn will not be queued, it always forwards to scheduler directly.
Assert.assertFalse(dut.offer(1L, cmpl));
Assert.assertEquals(frag, dut.poll());
Assert.assertNull(dut.poll());
}
use of org.voltcore.messaging.TransactionInfoBaseMessage in project voltdb by VoltDB.
the class TestReplaySequencer method testEarlyMPIEOL.
@Test
public void testEarlyMPIEOL() {
ReplaySequencer dut = new ReplaySequencer();
// need
// Fragment 1
// Fragment 2
// MPI EOL
// Sentinel 1
// Sentinel 2
TransactionInfoBaseMessage frag1 = makeFragment(1L);
TransactionInfoBaseMessage sentinel1 = makeSentinel(1L);
TransactionInfoBaseMessage complete1 = makeCompleteTxn(1L);
TransactionInfoBaseMessage frag2 = makeFragment(2L);
TransactionInfoBaseMessage sentinel2 = makeSentinel(2L);
TransactionInfoBaseMessage complete2 = makeCompleteTxn(2L);
Assert.assertTrue(dut.offer(1L, frag1));
Assert.assertFalse(dut.offer(1L, complete1));
Assert.assertTrue(dut.offer(2L, frag2));
Assert.assertFalse(dut.offer(2L, complete2));
// We get a really early MPI EOL before we have any of our partition's sentinels
Assert.assertTrue(dut.offer(0L, makeMPIEOL()));
Assert.assertTrue(dut.offer(1L, sentinel1));
Assert.assertEquals(frag1, dut.poll());
Assert.assertTrue(dut.offer(2L, sentinel2));
Assert.assertEquals(frag2, dut.poll());
Assert.assertNull(dut.poll());
Assert.assertNull(dut.drain());
}
use of org.voltcore.messaging.TransactionInfoBaseMessage in project voltdb by VoltDB.
the class TestReplaySequencer method testOfferSentinelThenFragment.
@Test
public void testOfferSentinelThenFragment() {
boolean result;
ReplaySequencer dut = new ReplaySequencer();
TransactionInfoBaseMessage sntl = makeSentinel(1L);
TransactionInfoBaseMessage frag = makeFragment(1L);
result = dut.offer(1L, sntl);
Assert.assertEquals(true, result);
Assert.assertEquals(null, dut.poll());
result = dut.offer(1L, frag);
Assert.assertEquals(true, result);
Assert.assertEquals(frag, dut.poll());
Assert.assertEquals(null, dut.poll());
Assert.assertNull(dut.drain());
}
Aggregations