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"));
}
}
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());
}
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));
}
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));
}
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));
}
Aggregations