Search in sources :

Example 1 with Slobrok

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));
    }
}
Also used : Slobrok(com.yahoo.jrt.slobrok.server.Slobrok)

Example 2 with Slobrok

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;
}
Also used : Slobrok(com.yahoo.jrt.slobrok.server.Slobrok)

Example 3 with Slobrok

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();
}
Also used : RpcServer(com.yahoo.vespa.clustercontroller.core.rpc.RpcServer) Slobrok(com.yahoo.jrt.slobrok.server.Slobrok) Test(org.junit.Test)

Example 4 with Slobrok

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());
}
Also used : Slobrok(com.yahoo.jrt.slobrok.server.Slobrok) Test(org.junit.Test)

Example 5 with Slobrok

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));
}
Also used : SimpleProtocol(com.yahoo.messagebus.test.SimpleProtocol) Receptor(com.yahoo.messagebus.test.Receptor) RPCNetworkParams(com.yahoo.messagebus.network.rpc.RPCNetworkParams) Slobrok(com.yahoo.jrt.slobrok.server.Slobrok) Identity(com.yahoo.messagebus.network.Identity) TestServer(com.yahoo.messagebus.network.rpc.test.TestServer)

Aggregations

Slobrok (com.yahoo.jrt.slobrok.server.Slobrok)43 TestServer (com.yahoo.messagebus.network.rpc.test.TestServer)23 Test (org.junit.Test)20 Receptor (com.yahoo.messagebus.test.Receptor)17 RPCNetworkParams (com.yahoo.messagebus.network.rpc.RPCNetworkParams)15 Identity (com.yahoo.messagebus.network.Identity)12 SimpleProtocol (com.yahoo.messagebus.test.SimpleProtocol)11 SimpleMessage (com.yahoo.messagebus.test.SimpleMessage)6 RoutingTableSpec (com.yahoo.messagebus.routing.RoutingTableSpec)4 Before (org.junit.Before)4 ListenFailedException (com.yahoo.jrt.ListenFailedException)3 Spec (com.yahoo.jrt.Spec)3 DocumentTypeManager (com.yahoo.document.DocumentTypeManager)2 DocumentProtocol (com.yahoo.documentapi.messagebus.protocol.DocumentProtocol)2 MessageBusParams (com.yahoo.messagebus.MessageBusParams)2 SourceSessionParams (com.yahoo.messagebus.SourceSessionParams)2 SimpleReply (com.yahoo.messagebus.test.SimpleReply)2 MessageBusDocumentAccess (com.yahoo.documentapi.messagebus.MessageBusDocumentAccess)1 MessageBusParams (com.yahoo.documentapi.messagebus.MessageBusParams)1 NonWorkingRequestHandler (com.yahoo.jdisc.test.NonWorkingRequestHandler)1