Search in sources :

Example 11 with Determination

use of org.voltdb.probe.MeshProber.Determination in project voltdb by VoltDB.

the class TestHostMessenger method testProbedRejoinOnWholeCluster.

@Test
public void testProbedRejoinOnWholeCluster() throws Exception {
    VoltDB.ignoreCrash = true;
    NodeStateRef upNodesState = new NodeStateRef(NodeState.INITIALIZING);
    MeshProber.Builder jcb = MeshProber.builder().coordinators(coordinators(2)).hostCount(3).startAction(StartAction.PROBE).nodeStateSupplier(upNodesState).kfactor(1).paused(false).bare(true);
    HostMessenger hm1 = createHostMessenger(0, jcb.build(), false);
    HostMessenger hm2 = createHostMessenger(1, jcb.build(), false);
    HostMessenger hm3 = createHostMessenger(2, jcb.build(), false);
    final AtomicReference<Exception> exception = new AtomicReference<Exception>();
    HostMessengerThread hm1Start = new HostMessengerThread(hm1, exception);
    HostMessengerThread hm2Start = new HostMessengerThread(hm2, exception);
    HostMessengerThread hm3Start = new HostMessengerThread(hm3, exception);
    hm1Start.start();
    hm2Start.start();
    hm3Start.start();
    hm1Start.join();
    hm2Start.join();
    hm3Start.join();
    if (exception.get() != null) {
        fail(exception.get().toString());
    }
    Determination dtm = prober(hm1).waitForDetermination();
    assertEquals(StartAction.CREATE, dtm.startAction);
    assertEquals(3, dtm.hostCount);
    assertEquals(dtm, prober(hm2).waitForDetermination());
    assertEquals(dtm, prober(hm3).waitForDetermination());
    assertTrue(upNodesState.compareAndSet(NodeState.INITIALIZING, NodeState.UP));
    jcb.nodeState(NodeState.INITIALIZING).bare(true);
    HostMessenger hm4 = createHostMessenger(2, jcb.build(), false);
    try {
        hm4.start();
        fail("did not crash on whole cluster rejoin attempt");
    } catch (AssertionError pass) {
        assertTrue(VoltDB.wasCrashCalled);
    }
}
Also used : AtomicReference(java.util.concurrent.atomic.AtomicReference) MeshProber(org.voltdb.probe.MeshProber) Determination(org.voltdb.probe.MeshProber.Determination) Test(org.junit.Test)

Example 12 with Determination

use of org.voltdb.probe.MeshProber.Determination in project voltdb by VoltDB.

the class TestHostMessenger method testMultiHostProbedRecoverWithOneBare.

@Test
public void testMultiHostProbedRecoverWithOneBare() throws Exception {
    MeshProber.Builder jcb = MeshProber.builder().coordinators(coordinators(3)).startAction(StartAction.PROBE).nodeState(NodeState.INITIALIZING).kfactor(1);
    MeshProber bare = jcb.bare(true).build();
    MeshProber dressed = jcb.bare(false).build();
    HostMessenger hm1 = createHostMessenger(0, bare, true);
    HostMessenger hm2 = createHostMessenger(1, jcb.prober(dressed).build(), false);
    HostMessenger hm3 = createHostMessenger(2, jcb.prober(dressed).build(), false);
    final AtomicReference<Exception> exception = new AtomicReference<Exception>();
    HostMessengerThread hm2Start = new HostMessengerThread(hm2, exception);
    HostMessengerThread hm3Start = new HostMessengerThread(hm3, exception);
    hm2Start.start();
    hm3Start.start();
    hm2Start.join();
    hm3Start.join();
    if (exception.get() != null) {
        fail(exception.get().toString());
    }
    Determination dtm = prober(hm1).waitForDetermination();
    assertEquals(StartAction.RECOVER, dtm.startAction);
    assertEquals(3, dtm.hostCount);
    assertEquals(dtm, prober(hm2).waitForDetermination());
    assertEquals(dtm, prober(hm3).waitForDetermination());
    List<String> root1 = hm1.getZK().getChildren("/", false);
    List<String> root2 = hm2.getZK().getChildren("/", false);
    List<String> root3 = hm3.getZK().getChildren("/", false);
    assertTrue(root1.equals(root2));
    assertTrue(root2.equals(root3));
    List<String> hostids1 = hm1.getZK().getChildren(CoreZK.hostids, false);
    List<String> hostids2 = hm2.getZK().getChildren(CoreZK.hostids, false);
    List<String> hostids3 = hm3.getZK().getChildren(CoreZK.hostids, false);
    assertTrue(hostids1.equals(hostids2));
    assertTrue(hostids2.equals(hostids3));
}
Also used : AtomicReference(java.util.concurrent.atomic.AtomicReference) MeshProber(org.voltdb.probe.MeshProber) Determination(org.voltdb.probe.MeshProber.Determination) Test(org.junit.Test)

Example 13 with Determination

use of org.voltdb.probe.MeshProber.Determination in project voltdb by VoltDB.

the class TestHostMessenger method testSafeModePropagation.

@Test
public void testSafeModePropagation() throws Exception {
    MeshProber.Builder jcb = MeshProber.builder().coordinators(coordinators(3)).startAction(StartAction.PROBE).nodeState(NodeState.INITIALIZING).bare(false).kfactor(1);
    MeshProber safe = jcb.safeMode(true).build();
    MeshProber unsafe = jcb.safeMode(false).build();
    HostMessenger hm1 = createHostMessenger(0, jcb.prober(unsafe).build(), true);
    HostMessenger hm2 = createHostMessenger(1, safe, false);
    HostMessenger hm3 = createHostMessenger(2, jcb.prober(unsafe).build(), false);
    final AtomicReference<Exception> exception = new AtomicReference<Exception>();
    HostMessengerThread hm2Start = new HostMessengerThread(hm2, exception);
    HostMessengerThread hm3Start = new HostMessengerThread(hm3, exception);
    hm2Start.start();
    hm3Start.start();
    hm2Start.join();
    hm3Start.join();
    if (exception.get() != null) {
        fail(exception.get().toString());
    }
    Determination dtm = prober(hm1).waitForDetermination();
    assertEquals(StartAction.SAFE_RECOVER, dtm.startAction);
    assertEquals(3, dtm.hostCount);
    assertEquals(dtm, prober(hm2).waitForDetermination());
    assertEquals(dtm, prober(hm3).waitForDetermination());
    List<String> root1 = hm1.getZK().getChildren("/", false);
    List<String> root2 = hm2.getZK().getChildren("/", false);
    List<String> root3 = hm3.getZK().getChildren("/", false);
    assertTrue(root1.equals(root2));
    assertTrue(root2.equals(root3));
    List<String> hostids1 = hm1.getZK().getChildren(CoreZK.hostids, false);
    List<String> hostids2 = hm2.getZK().getChildren(CoreZK.hostids, false);
    List<String> hostids3 = hm3.getZK().getChildren(CoreZK.hostids, false);
    assertTrue(hostids1.equals(hostids2));
    assertTrue(hostids2.equals(hostids3));
}
Also used : AtomicReference(java.util.concurrent.atomic.AtomicReference) MeshProber(org.voltdb.probe.MeshProber) Determination(org.voltdb.probe.MeshProber.Determination) Test(org.junit.Test)

Example 14 with Determination

use of org.voltdb.probe.MeshProber.Determination in project voltdb by VoltDB.

the class TestHostMessenger method testPauseModePropagation.

@Test
public void testPauseModePropagation() throws Exception {
    MeshProber.Builder jcb = MeshProber.builder().coordinators(coordinators(3)).startAction(StartAction.PROBE).nodeState(NodeState.INITIALIZING).bare(true).kfactor(1);
    MeshProber paused = jcb.paused(true).build();
    MeshProber unpaused = jcb.paused(false).build();
    HostMessenger hm1 = createHostMessenger(0, jcb.prober(unpaused).build(), true);
    HostMessenger hm2 = createHostMessenger(1, paused, false);
    HostMessenger hm3 = createHostMessenger(2, jcb.prober(unpaused).build(), false);
    final AtomicReference<Exception> exception = new AtomicReference<Exception>();
    HostMessengerThread hm2Start = new HostMessengerThread(hm2, exception);
    HostMessengerThread hm3Start = new HostMessengerThread(hm3, exception);
    hm2Start.start();
    hm3Start.start();
    hm2Start.join();
    hm3Start.join();
    if (exception.get() != null) {
        fail(exception.get().toString());
    }
    Determination dtm = prober(hm1).waitForDetermination();
    assertEquals(StartAction.CREATE, dtm.startAction);
    assertEquals(3, dtm.hostCount);
    assertEquals(dtm, prober(hm2).waitForDetermination());
    assertEquals(dtm, prober(hm3).waitForDetermination());
    assertTrue(dtm.paused);
    List<String> root1 = hm1.getZK().getChildren("/", false);
    List<String> root2 = hm2.getZK().getChildren("/", false);
    List<String> root3 = hm3.getZK().getChildren("/", false);
    assertTrue(root1.equals(root2));
    assertTrue(root2.equals(root3));
    List<String> hostids1 = hm1.getZK().getChildren(CoreZK.hostids, false);
    List<String> hostids2 = hm2.getZK().getChildren(CoreZK.hostids, false);
    List<String> hostids3 = hm3.getZK().getChildren(CoreZK.hostids, false);
    assertTrue(hostids1.equals(hostids2));
    assertTrue(hostids2.equals(hostids3));
}
Also used : AtomicReference(java.util.concurrent.atomic.AtomicReference) MeshProber(org.voltdb.probe.MeshProber) Determination(org.voltdb.probe.MeshProber.Determination) Test(org.junit.Test)

Example 15 with Determination

use of org.voltdb.probe.MeshProber.Determination in project voltdb by VoltDB.

the class TestHostMessenger method testTerminusPropagation.

@Test
public void testTerminusPropagation() throws Exception {
    MeshProber.Builder jcb = MeshProber.builder().coordinators(coordinators(3)).startAction(StartAction.PROBE).nodeState(NodeState.INITIALIZING).bare(true).kfactor(1);
    MeshProber without = jcb.build();
    MeshProber with = jcb.terminusNonce("nonce-uno").build();
    HostMessenger hm1 = createHostMessenger(0, with, true);
    HostMessenger hm2 = createHostMessenger(1, with, false);
    HostMessenger hm3 = createHostMessenger(2, jcb.prober(without).build(), false);
    final AtomicReference<Exception> exception = new AtomicReference<Exception>();
    HostMessengerThread hm2Start = new HostMessengerThread(hm2, exception);
    HostMessengerThread hm3Start = new HostMessengerThread(hm3, exception);
    hm2Start.start();
    hm3Start.start();
    hm2Start.join();
    hm3Start.join();
    if (exception.get() != null) {
        fail(exception.get().toString());
    }
    Determination dtm = prober(hm1).waitForDetermination();
    assertEquals("nonce-uno", dtm.terminusNonce);
    assertEquals(3, dtm.hostCount);
    assertEquals(dtm, prober(hm2).waitForDetermination());
    assertEquals(dtm, prober(hm3).waitForDetermination());
    List<String> root1 = hm1.getZK().getChildren("/", false);
    List<String> root2 = hm2.getZK().getChildren("/", false);
    List<String> root3 = hm3.getZK().getChildren("/", false);
    assertTrue(root1.equals(root2));
    assertTrue(root2.equals(root3));
    List<String> hostids1 = hm1.getZK().getChildren(CoreZK.hostids, false);
    List<String> hostids2 = hm2.getZK().getChildren(CoreZK.hostids, false);
    List<String> hostids3 = hm3.getZK().getChildren(CoreZK.hostids, false);
    assertTrue(hostids1.equals(hostids2));
    assertTrue(hostids2.equals(hostids3));
}
Also used : AtomicReference(java.util.concurrent.atomic.AtomicReference) MeshProber(org.voltdb.probe.MeshProber) Determination(org.voltdb.probe.MeshProber.Determination) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)16 MeshProber (org.voltdb.probe.MeshProber)16 Determination (org.voltdb.probe.MeshProber.Determination)16 AtomicReference (java.util.concurrent.atomic.AtomicReference)14