Search in sources :

Example 11 with MeshProber

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

the class TestHostMessenger method testProbedEditionMismatchCrash.

@Test
public void testProbedEditionMismatchCrash() throws Exception {
    VoltDB.ignoreCrash = true;
    MeshProber.Builder jcb = MeshProber.builder().coordinators(coordinators(2)).hostCount(3).startAction(StartAction.PROBE).nodeState(NodeState.INITIALIZING).kfactor(1).paused(false).enterprise(true).bare(true);
    MeshProber jc1 = jcb.build();
    MeshProber jc2 = jcb.enterprise(false).build();
    assertNotSame(jc1.isEnterprise(), jc2.isEnterprise());
    HostMessenger hm1 = createHostMessenger(0, jcb.prober(jc1).build(), false);
    HostMessenger hm2 = createHostMessenger(1, jcb.prober(jc1).build(), false);
    HostMessenger hm3 = createHostMessenger(2, jcb.prober(jc2).build(), false);
    final AtomicReference<Exception> exception = new AtomicReference<Exception>();
    HostMessengerThread hm1Start = new HostMessengerThread(hm1, exception);
    HostMessengerThread hm2Start = new HostMessengerThread(hm2, exception);
    hm1Start.start();
    hm2Start.start();
    hm1Start.join();
    hm2Start.join();
    if (exception.get() != null) {
        fail(exception.get().toString());
    }
    try {
        hm3.start();
        fail("did not crash on whole cluster rejoin attempt");
    } catch (AssertionError pass) {
        assertTrue(VoltDB.wasCrashCalled);
        assertTrue(VoltDB.crashMessage.contains("cannot contain both enterprise and community editions"));
    }
}
Also used : AtomicReference(java.util.concurrent.atomic.AtomicReference) MeshProber(org.voltdb.probe.MeshProber) Test(org.junit.Test)

Example 12 with MeshProber

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

the class TestHostMessenger method testSingleProbedRecoverHost.

@Test
public void testSingleProbedRecoverHost() throws Exception {
    MeshProber jc = MeshProber.builder().coordinators(coordinators(1)).startAction(StartAction.PROBE).nodeState(NodeState.INITIALIZING).bare(false).build();
    HostMessenger hm = createHostMessenger(0, jc, true);
    Determination dtm = prober(hm).waitForDetermination();
    assertEquals(StartAction.RECOVER, dtm.startAction);
    assertEquals(1, dtm.hostCount);
    Mailbox m1 = hm.createMailbox();
    SiteMailbox sm = new SiteMailbox(hm, (-2L << 32));
    hm.createMailbox(sm.getHSId(), sm);
    sm.send(m1.getHSId(), new LocalObjectMessage(null));
    m1.send(sm.getHSId(), new LocalObjectMessage(null));
    LocalObjectMessage lom = (LocalObjectMessage) m1.recv();
    assertEquals(lom.m_sourceHSId, sm.getHSId());
    lom = (LocalObjectMessage) sm.recv();
    assertEquals(lom.m_sourceHSId, m1.getHSId());
}
Also used : MeshProber(org.voltdb.probe.MeshProber) Determination(org.voltdb.probe.MeshProber.Determination) Test(org.junit.Test)

Example 13 with MeshProber

use of org.voltdb.probe.MeshProber 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 14 with MeshProber

use of org.voltdb.probe.MeshProber 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 15 with MeshProber

use of org.voltdb.probe.MeshProber 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)

Aggregations

MeshProber (org.voltdb.probe.MeshProber)16 Test (org.junit.Test)15 AtomicReference (java.util.concurrent.atomic.AtomicReference)13 Determination (org.voltdb.probe.MeshProber.Determination)7 UUID (java.util.UUID)2 Supplier (com.google_voltpatches.common.base.Supplier)1 HostAndPort (com.google_voltpatches.common.net.HostAndPort)1 IOException (java.io.IOException)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 SocketException (java.net.SocketException)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 Set (java.util.Set)1 ExecutionException (java.util.concurrent.ExecutionException)1 KeeperException (org.apache.zookeeper_voltpatches.KeeperException)1 JSONException (org.json_voltpatches.JSONException)1 JSONObject (org.json_voltpatches.JSONObject)1 HostMessenger (org.voltcore.messaging.HostMessenger)1 ClusterType (org.voltdb.compiler.deploymentfile.ClusterType)1 VoltDbMessageFactory (org.voltdb.messaging.VoltDbMessageFactory)1