use of com.yahoo.jrt.slobrok.server.Slobrok in project vespa by vespa-engine.
the class MasterElectionTest method setUpFleetController.
protected void setUpFleetController(int count, boolean useFakeTimer, FleetControllerOptions options) throws Exception {
if (zooKeeperServer == null) {
zooKeeperServer = new ZooKeeperTestServer();
}
slobrok = new Slobrok();
usingFakeTimer = useFakeTimer;
this.options = options;
this.options.zooKeeperSessionTimeout = 10 * timeoutMS;
this.options.zooKeeperServerAddress = zooKeeperServer.getAddress();
this.options.slobrokConnectionSpecs = new String[1];
this.options.slobrokConnectionSpecs[0] = "tcp/localhost:" + slobrok.port();
this.options.fleetControllerCount = count;
for (int i = 0; i < count; ++i) {
FleetControllerOptions nodeOptions = options.clone();
nodeOptions.fleetControllerIndex = i;
fleetControllers.add(createFleetController(usingFakeTimer, nodeOptions, true, null));
}
}
use of com.yahoo.jrt.slobrok.server.Slobrok in project vespa by vespa-engine.
the class FleetControllerTest method setUpSystem.
protected void setUpSystem(boolean useFakeTimer, FleetControllerOptions options) throws Exception {
log.log(LogLevel.DEBUG, "Setting up system");
slobrok = new Slobrok();
this.options = options;
if (options.zooKeeperServerAddress != null) {
zooKeeperServer = new ZooKeeperTestServer();
this.options.zooKeeperServerAddress = zooKeeperServer.getAddress();
log.log(LogLevel.DEBUG, "Set up new zookeeper server at " + this.options.zooKeeperServerAddress);
}
this.options.slobrokConnectionSpecs = new String[1];
this.options.slobrokConnectionSpecs[0] = "tcp/localhost:" + slobrok.port();
this.usingFakeTimer = useFakeTimer;
}
use of com.yahoo.jrt.slobrok.server.Slobrok in project vespa by vespa-engine.
the class RpcServerTest method testRebinding.
@Test
public void testRebinding() throws Exception {
startingTest("RpcServerTest::testRebinding");
Slobrok slobrok = new Slobrok();
String[] slobrokConnectionSpecs = new String[1];
slobrokConnectionSpecs[0] = "tcp/localhost:" + slobrok.port();
RpcServer server = new RpcServer(timer, new Object(), "mycluster", 0, new BackOff());
server.setSlobrokConnectionSpecs(slobrokConnectionSpecs, 0);
int portUsed = server.getPort();
server.setSlobrokConnectionSpecs(slobrokConnectionSpecs, portUsed);
server.disconnect();
server.disconnect();
server.connect();
server.connect();
server.disconnect();
server.connect();
server.shutdown();
slobrok.stop();
}
use of com.yahoo.jrt.slobrok.server.Slobrok in project vespa by vespa-engine.
the class SlobrokTest method testSingleSlobrokRestart.
@Test
public void testSingleSlobrokRestart() throws Exception {
startingTest("SlobrokTest::testSingleSlobrokRestart");
FleetControllerOptions options = new FleetControllerOptions("mycluster");
options.nodeStateRequestTimeoutMS = 60 * 60 * 1000;
options.maxSlobrokDisconnectGracePeriod = 60 * 60 * 1000;
setUpFleetController(true, options);
setUpVdsNodes(true, new DummyVdsNodeOptions());
waitForStableSystem();
int version = fleetController.getSystemState().getVersion();
int slobrokPort = slobrok.port();
// Test that we survive some slobrok instability without changing system state.
for (int j = 0; j < 4; ++j) {
log.log(LogLevel.INFO, "Mirror updateForDistributor count is " + fleetController.getSlobrokMirrorUpdates());
log.log(LogLevel.INFO, "STOPPING SLOBROK SERVER (" + (j + 1) + "/4)");
slobrok.stop();
for (int i = 0; i < 10; ++i) {
// Force one node to at least notice that the slobrok server is gone
if (i == 5) {
log.log(LogLevel.INFO, "Forcing one node to initate a resend: " + nodes.get(3));
nodes.get(3).replyToPendingNodeStateRequests();
}
waitForCompleteCycle();
timer.advanceTime(100);
}
log.log(LogLevel.INFO, "STARTING SLOBROK SERVER AGAIN (" + (j + 1) + "/4)");
slobrok = new Slobrok(slobrokPort);
// May take up to 30 seconds for slobrok clients to re-register. Trigger retry.
for (DummyVdsNode node : nodes) {
node.disconnectSlobrok();
node.registerSlobrok();
}
// fleetController.setFreshSlobrokMirror();
waitForCompleteCycle();
fleetController.waitForNodesInSlobrok(10, 10, timeoutMS);
log.log(LogLevel.INFO, "Waiting for cluster to be up and available again");
for (int i = 0; i < timeoutMS; i += 10) {
if (clusterAvailable())
break;
timer.advanceTime(1000);
waitForCompleteCycle();
try {
Thread.sleep(10);
} catch (InterruptedException e) {
}
}
assertClusterAvailable();
}
assertEquals("Cluster state was affected, although it should not have been.", version, fleetController.getSystemState().getVersion());
}
use of com.yahoo.jrt.slobrok.server.Slobrok in project vespa by vespa-engine.
the class RoutingContextTestCase method setUp.
@Override
public void setUp() throws ListenFailedException, UnknownHostException {
slobrok = new Slobrok();
dstServer = new TestServer(new MessageBusParams().addProtocol(new SimpleProtocol()), new RPCNetworkParams().setIdentity(new Identity("dst")).setSlobrokConfigId(TestServer.getSlobrokConfig(slobrok)));
dstSession = dstServer.mb.createDestinationSession(new DestinationSessionParams().setName("session").setMessageHandler(new Receptor()));
srcServer = new TestServer(new MessageBusParams().setRetryPolicy(new RetryTransientErrorsPolicy().setBaseDelay(0)).addProtocol(new SimpleProtocol()), new RPCNetworkParams().setSlobrokConfigId(TestServer.getSlobrokConfig(slobrok)));
srcSession = srcServer.mb.createSourceSession(new SourceSessionParams().setTimeout(600.0).setReplyHandler(new Receptor()));
assertTrue(srcServer.waitSlobrok("dst/session", 1));
}
Aggregations