use of org.voltdb.probe.MeshProber in project voltdb by VoltDB.
the class TestHostMessenger method testProbedMeshMismatchCrash.
@Test
public void testProbedMeshMismatchCrash() 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).bare(true);
MeshProber jc1 = jcb.build();
MeshProber jc2 = jcb.coordinators(coordinators(3)).build();
assertNotSame(jc1.getMeshHash(), jc2.getMeshHash());
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("Mismatched list of hosts"));
}
}
use of org.voltdb.probe.MeshProber in project voltdb by VoltDB.
the class TestHostMessenger method testProbedJoinerAcceptorMismatchCrash.
@Test
public void testProbedJoinerAcceptorMismatchCrash() 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).bare(true);
MeshProber jc1 = jcb.build();
JoinAcceptor jc2 = new JoinAcceptor() {
@Override
public void detract(Set<Integer> hostIds) {
}
@Override
public void detract(int hostId) {
}
@Override
public void accrue(Map<Integer, JSONObject> jos) {
}
@Override
public void accrue(int hostId, JSONObject jo) {
}
};
HostMessenger hm1 = createHostMessenger(0, jcb.prober(jc1).build(), false);
HostMessenger hm2 = createHostMessenger(1, jcb.prober(jc1).build(), false);
HostMessenger hm3 = createHostMessenger(2, jc2, 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("is incompatible with this node verion"));
}
}
use of org.voltdb.probe.MeshProber in project voltdb by VoltDB.
the class TestHostMessenger method testNotEnoughTerminusPropagation.
@Test
public void testNotEnoughTerminusPropagation() 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, jcb.prober(without).build(), 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();
assertNull(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));
}
use of org.voltdb.probe.MeshProber in project voltdb by VoltDB.
the class TestHostMessenger method testProbedHostCountMismatchCrash.
@Test
public void testProbedHostCountMismatchCrash() 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).bare(true);
MeshProber jc1 = jcb.build();
MeshProber jc2 = jcb.hostCount(4).build();
assertNotSame(jc1.getHostCount(), jc2.getHostCount());
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("Mismatched host count"));
}
}
use of org.voltdb.probe.MeshProber in project voltdb by VoltDB.
the class TestHostMessenger method testStartActionMismatchCrash.
@Test
public void testStartActionMismatchCrash() 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).bare(true);
MeshProber jc1 = jcb.build();
MeshProber jc2 = jcb.startAction(StartAction.CREATE).build();
assertNotSame(jc1.getStartAction(), jc2.getStartAction());
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("Start action CREATE does not match PROBE"));
}
}
Aggregations