Package org.voltcore.messaging

Examples of org.voltcore.messaging.TransactionInfoBaseMessage


    @Test
    public void testMPIEOLWithSentinels()
    {
        ReplaySequencer dut = new ReplaySequencer();

        TransactionInfoBaseMessage init1 = makeIv2InitTask(101L);
        TransactionInfoBaseMessage sentinel1 = makeSentinel(1L);
        TransactionInfoBaseMessage init2 = makeIv2InitTask(102L);
        TransactionInfoBaseMessage init3 = makeIv2InitTask(103L);

        Assert.assertFalse(dut.offer(101L, init1));
        Assert.assertNull(dut.poll());

        Assert.assertTrue(dut.offer(1L, sentinel1));
        Assert.assertNull(dut.poll());

        // SPs blocked by the sentinel
        Assert.assertTrue(dut.offer(102L, init2));
        Assert.assertTrue(dut.offer(103L, init3));
        Assert.assertNull(dut.poll());
        Assert.assertNull(dut.drain());

        // The outstanding sentinel and the MP EOL should
        // move us to the draining state
        Assert.assertTrue(dut.offer(0L, makeMPIEOL()));

        // poll() should shut up and drain should start just
        // giving us everything
        Assert.assertNull(dut.poll());
        Assert.assertEquals(init2, dut.drain());
        Assert.assertEquals(init3, dut.drain());

        TransactionInfoBaseMessage init4 = makeIv2InitTask(104L);
        TransactionInfoBaseMessage sentinel2 = makeSentinel(2L);
        TransactionInfoBaseMessage init5 = makeIv2InitTask(105L);

        // These SPIs should be offered after sentinel1
        Assert.assertTrue(dut.offer(104L, init4));
        Assert.assertTrue(dut.offer(2L, sentinel2));
        Assert.assertTrue(dut.offer(105L, init5));
View Full Code Here


    @Test
    public void testMPIEOLWithoutSentinels()
    {
        ReplaySequencer dut = new ReplaySequencer();

        TransactionInfoBaseMessage init1 = makeIv2InitTask(101L);
        TransactionInfoBaseMessage init2 = makeIv2InitTask(102L);
        TransactionInfoBaseMessage init3 = makeIv2InitTask(103L);

        Assert.assertFalse(dut.offer(101L, init1));
        Assert.assertFalse(dut.offer(102L, init2));
        Assert.assertFalse(dut.offer(103L, init3));
        Assert.assertNull(dut.poll());
        Assert.assertNull(dut.drain());

        Assert.assertTrue(dut.offer(0L, makeMPIEOL()));

        TransactionInfoBaseMessage init4 = makeIv2InitTask(104L);
        TransactionInfoBaseMessage sentinel2 = makeSentinel(2L);
        TransactionInfoBaseMessage init5 = makeIv2InitTask(105L);

        Assert.assertFalse(dut.offer(104L, init4));
        // This will re-block us and should induce drain()
        Assert.assertTrue(dut.offer(2L, sentinel2));
        Assert.assertTrue(dut.offer(105L, init5));
View Full Code Here

    @Test
    public void testMPIEOL()
    {
        ReplaySequencer dut = new ReplaySequencer();

        TransactionInfoBaseMessage init1 = makeIv2InitTask(101L);
        TransactionInfoBaseMessage sentinel1 = makeSentinel(1L);
        TransactionInfoBaseMessage init2 = makeIv2InitTask(102L);
        TransactionInfoBaseMessage init3 = makeIv2InitTask(103L);
        TransactionInfoBaseMessage sentinel2 = makeSentinel(2L);
        TransactionInfoBaseMessage init4 = makeIv2InitTask(104L);
        TransactionInfoBaseMessage init5 = makeIv2InitTask(105L);

        Assert.assertFalse(dut.offer(101L, init1));
        Assert.assertNull(dut.poll());

        Assert.assertTrue(dut.offer(1L, sentinel1));
        Assert.assertNull(dut.poll());

        // SPs blocked by the sentinel
        Assert.assertTrue(dut.offer(102L, init2));
        Assert.assertTrue(dut.offer(103L, init3));
        Assert.assertNull(dut.poll());

        // SPs blocked by second sentinel
        Assert.assertTrue(dut.offer(2L, sentinel2));
        Assert.assertTrue(dut.offer(104L, init4));
        Assert.assertTrue(dut.offer(105L, init5));
        Assert.assertNull(dut.poll());
        Assert.assertNull(dut.drain());

        TransactionInfoBaseMessage frag1 = makeFragment(1L);
        TransactionInfoBaseMessage complete1 = makeCompleteTxn(1L);

        // Offering the fragment and the complete releases init2 and init3
        Assert.assertTrue(dut.offer(1L, frag1));
        Assert.assertEquals(frag1, dut.poll());
        Assert.assertNull(dut.poll());
View Full Code Here

    @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());
View Full Code Here

        // mp2
        // sp3
        // mp3
        // sp4

        TransactionInfoBaseMessage init1 = makeIv2InitTask(101L);
        TransactionInfoBaseMessage sentinel1 = makeSentinel(1L);
        TransactionInfoBaseMessage init2 = makeIv2InitTask(102L);
        TransactionInfoBaseMessage sentinel2 = makeSentinel(2L);
        TransactionInfoBaseMessage init3 = makeIv2InitTask(103L);
        TransactionInfoBaseMessage sentinel3 = makeSentinel(3L);
        TransactionInfoBaseMessage init4 = makeIv2InitTask(104L);

        Assert.assertFalse(dut.offer(101L, init1));
        Assert.assertTrue(dut.offer(1L, sentinel1));
        Assert.assertTrue(dut.offer(102L, init2));
        Assert.assertTrue(dut.offer(2L, sentinel2));
View Full Code Here

        // sp1
        // sp2
        // sp3
        // sp4

        TransactionInfoBaseMessage init1 = makeIv2InitTask(101L);
        TransactionInfoBaseMessage sentinel1 = makeSentinel(1L);
        TransactionInfoBaseMessage init2 = makeIv2InitTask(102L);
        TransactionInfoBaseMessage sentinel2 = makeSentinel(2L);
        TransactionInfoBaseMessage init3 = makeIv2InitTask(103L);
        TransactionInfoBaseMessage sentinel3 = makeSentinel(3L);
        TransactionInfoBaseMessage init4 = makeIv2InitTask(104L);

        Assert.assertTrue(dut.offer(1L, sentinel1));
        Assert.assertTrue(dut.offer(2L, sentinel2));
        Assert.assertTrue(dut.offer(3L, sentinel3));
        Assert.assertTrue(dut.offer(101L, init1));
View Full Code Here

        // 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.assertTrue(dut.offer(1L, complete1));
        Assert.assertTrue(dut.offer(2L, frag2));
        Assert.assertTrue(dut.offer(2L, complete2));
View Full Code Here

    public void testDupInitMsg()
    {
        ReplaySequencer dut = new ReplaySequencer();

        // simple deduping
        TransactionInfoBaseMessage init1 = makeIv2InitTask(1L);

        Assert.assertFalse(dut.offer(1L, init1));
        Assert.assertNotNull(dut.dedupe(1L, init1));
        Assert.assertTrue(dut.offer(1L, init1));
        Assert.assertNull(dut.poll());

        // dedupe with sentinels mixed
        TransactionInfoBaseMessage sntl1 = makeSentinel(2L);
        TransactionInfoBaseMessage init2 = makeIv2InitTask(3L);

        Assert.assertTrue(dut.offer(2L, sntl1));
        Assert.assertTrue(dut.offer(3L, init2));
        Assert.assertNotNull(dut.dedupe(3L, init2));
        Assert.assertTrue(dut.offer(3L, init2));
        Assert.assertNull(dut.poll());

        TransactionInfoBaseMessage frag1 = makeFragment(2L);
        TransactionInfoBaseMessage cmpl1 = makeCompleteTxn(2L);

        Assert.assertTrue(dut.offer(2L, frag1));
        Assert.assertEquals(frag1, dut.poll());
        Assert.assertFalse(dut.offer(2L,cmpl1));
        Assert.assertEquals(init2, dut.poll());
View Full Code Here

    @Test
    public void testDupSentinels()
    {
        ReplaySequencer dut = new ReplaySequencer();

        TransactionInfoBaseMessage sntl1 = makeSentinel(1L);
        TransactionInfoBaseMessage frag1 = makeFragment(1L);
        TransactionInfoBaseMessage cmpl1 = makeCompleteTxn(1L);
        TransactionInfoBaseMessage init1 = makeIv2InitTask(2L);
        TransactionInfoBaseMessage init2 = makeIv2InitTask(3L);

        Assert.assertTrue(dut.offer(1L, sntl1));
        Assert.assertTrue(dut.offer(1L, frag1));
        Assert.assertTrue(dut.offer(2L, init1));
        Assert.assertEquals(frag1, dut.poll());
View Full Code Here

    @Test
    public void testAllowLoadTableWithSameTxnId()
    {
        ReplaySequencer dut = new ReplaySequencer();

        TransactionInfoBaseMessage init1 = makeIv2InitTask(1L, "@LoadSinglepartitionTable");
        TransactionInfoBaseMessage init2 = makeIv2InitTask(2L, "@LoadMultipartitionTable");

        Assert.assertFalse(dut.offer(1L, init1));
        Assert.assertNull(dut.dedupe(1L, init1));
        Assert.assertFalse(dut.offer(1L, init1));
        Assert.assertNull(dut.poll());
View Full Code Here

TOP

Related Classes of org.voltcore.messaging.TransactionInfoBaseMessage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.