Search in sources :

Example 1 with DatabaseHandler

use of com.yahoo.vespa.clustercontroller.core.database.DatabaseHandler in project vespa by vespa-engine.

the class FleetController method create.

private static FleetController create(FleetControllerOptions options, Timer timer, StatusPageServerInterface statusPageServer, RpcServer rpcServer, MetricReporter metricReporter) throws Exception {
    MetricUpdater metricUpdater = new MetricUpdater(metricReporter, options.fleetControllerIndex);
    EventLog log = new EventLog(timer, metricUpdater);
    ContentCluster cluster = new ContentCluster(options.clusterName, options.nodes, options.storageDistribution, options.minStorageNodesUp, options.minRatioOfStorageNodesUp);
    NodeStateGatherer stateGatherer = new NodeStateGatherer(timer, timer, log);
    Communicator communicator = new RPCCommunicator(RPCCommunicator.createRealSupervisor(), timer, options.fleetControllerIndex, options.nodeStateRequestTimeoutMS, options.nodeStateRequestTimeoutEarliestPercentage, options.nodeStateRequestTimeoutLatestPercentage, options.nodeStateRequestRoundTripTimeMaxSeconds);
    DatabaseHandler database = new DatabaseHandler(timer, options.zooKeeperServerAddress, options.fleetControllerIndex, timer);
    NodeLookup lookUp = new SlobrokClient(timer);
    StateChangeHandler stateGenerator = new StateChangeHandler(timer, log, metricUpdater);
    SystemStateBroadcaster stateBroadcaster = new SystemStateBroadcaster(timer, timer);
    MasterElectionHandler masterElectionHandler = new MasterElectionHandler(options.fleetControllerIndex, options.fleetControllerCount, timer, timer);
    FleetController controller = new FleetController(timer, log, cluster, stateGatherer, communicator, statusPageServer, rpcServer, lookUp, database, stateGenerator, stateBroadcaster, masterElectionHandler, metricUpdater, options);
    controller.start();
    return controller;
}
Also used : RPCCommunicator(com.yahoo.vespa.clustercontroller.core.rpc.RPCCommunicator) RPCCommunicator(com.yahoo.vespa.clustercontroller.core.rpc.RPCCommunicator) SlobrokClient(com.yahoo.vespa.clustercontroller.core.rpc.SlobrokClient) DatabaseHandler(com.yahoo.vespa.clustercontroller.core.database.DatabaseHandler)

Example 2 with DatabaseHandler

use of com.yahoo.vespa.clustercontroller.core.database.DatabaseHandler in project vespa by vespa-engine.

the class GroupAutoTakedownTest method previously_cleared_start_timestamps_are_not_reintroduced_on_up_edge.

@Test
public void previously_cleared_start_timestamps_are_not_reintroduced_on_up_edge() throws Exception {
    ClusterFixture fixture = createFixtureForAllUpHierarchicCluster(DistributionBuilder.withGroups(3).eachWithNodeCount(2), 0.51);
    final NodeState newState = new NodeState(NodeType.STORAGE, State.UP);
    newState.setStartTimestamp(123456);
    fixture.reportStorageNodeState(4, newState);
    assertEquals("distributor:6 storage:6 .4.t:123456", fixture.generatedClusterState());
    DatabaseHandler handler = mock(DatabaseHandler.class);
    DatabaseHandler.Context context = mock(DatabaseHandler.Context.class);
    when(context.getCluster()).thenReturn(fixture.cluster);
    Set<ConfiguredNode> nodes = new HashSet<>(fixture.cluster.clusterInfo().getConfiguredNodes().values());
    fixture.nodeStateChangeHandler.handleAllDistributorsInSync(fixture.annotatedGeneratedClusterState().getClusterState(), nodes, handler, context);
    // Timestamp should now be cleared from state
    assertEquals("distributor:6 storage:6", fixture.generatedClusterState());
    // Trigger a group down+up edge. Timestamp should _not_ be reintroduced since it was previously cleared.
    assertEquals("distributor:6 storage:4", stateAfterStorageTransition(fixture, 5, State.DOWN));
    assertEquals("distributor:6 storage:6", stateAfterStorageTransition(fixture, 5, State.UP));
}
Also used : NodeState(com.yahoo.vdslib.state.NodeState) DatabaseHandler(com.yahoo.vespa.clustercontroller.core.database.DatabaseHandler) ConfiguredNode(com.yahoo.vdslib.distribution.ConfiguredNode) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 3 with DatabaseHandler

use of com.yahoo.vespa.clustercontroller.core.database.DatabaseHandler in project vespa by vespa-engine.

the class FleetControllerTest method createFleetController.

protected FleetController createFleetController(boolean useFakeTimer, FleetControllerOptions options, boolean startThread, StatusPageServerInterface status) throws Exception {
    Timer timer = useFakeTimer ? this.timer : new RealTimer();
    MetricUpdater metricUpdater = new MetricUpdater(new NoMetricReporter(), options.fleetControllerIndex);
    EventLog log = new EventLog(timer, metricUpdater);
    ContentCluster cluster = new ContentCluster(options.clusterName, options.nodes, options.storageDistribution, options.minStorageNodesUp, options.minRatioOfStorageNodesUp);
    NodeStateGatherer stateGatherer = new NodeStateGatherer(timer, timer, log);
    Communicator communicator = new RPCCommunicator(RPCCommunicator.createRealSupervisor(), timer, options.fleetControllerIndex, options.nodeStateRequestTimeoutMS, options.nodeStateRequestTimeoutEarliestPercentage, options.nodeStateRequestTimeoutLatestPercentage, options.nodeStateRequestRoundTripTimeMaxSeconds);
    SlobrokClient lookUp = new SlobrokClient(timer);
    lookUp.setSlobrokConnectionSpecs(new String[0]);
    if (status == null) {
        status = new StatusPageServer(timer, timer, options.httpPort);
    }
    RpcServer rpcServer = new RpcServer(timer, timer, options.clusterName, options.fleetControllerIndex, options.slobrokBackOffPolicy);
    DatabaseHandler database = new DatabaseHandler(timer, options.zooKeeperServerAddress, options.fleetControllerIndex, timer);
    StateChangeHandler stateGenerator = new StateChangeHandler(timer, log, metricUpdater);
    SystemStateBroadcaster stateBroadcaster = new SystemStateBroadcaster(timer, timer);
    MasterElectionHandler masterElectionHandler = new MasterElectionHandler(options.fleetControllerIndex, options.fleetControllerCount, timer, timer);
    FleetController controller = new FleetController(timer, log, cluster, stateGatherer, communicator, status, rpcServer, lookUp, database, stateGenerator, stateBroadcaster, masterElectionHandler, metricUpdater, options);
    if (startThread) {
        controller.start();
    }
    return controller;
}
Also used : RPCCommunicator(com.yahoo.vespa.clustercontroller.core.rpc.RPCCommunicator) StatusPageServer(com.yahoo.vespa.clustercontroller.core.status.statuspage.StatusPageServer) RPCCommunicator(com.yahoo.vespa.clustercontroller.core.rpc.RPCCommunicator) SlobrokClient(com.yahoo.vespa.clustercontroller.core.rpc.SlobrokClient) DatabaseHandler(com.yahoo.vespa.clustercontroller.core.database.DatabaseHandler) RpcServer(com.yahoo.vespa.clustercontroller.core.rpc.RpcServer) NoMetricReporter(com.yahoo.vespa.clustercontroller.utils.util.NoMetricReporter)

Example 4 with DatabaseHandler

use of com.yahoo.vespa.clustercontroller.core.database.DatabaseHandler in project vespa by vespa-engine.

the class StateChangeTest method initialize.

private void initialize(FleetControllerOptions options) throws Exception {
    List<Node> nodes = new ArrayList<>();
    for (int i = 0; i < options.nodes.size(); ++i) {
        nodes.add(new Node(NodeType.STORAGE, i));
        nodes.add(new Node(NodeType.DISTRIBUTOR, i));
    }
    communicator = new DummyCommunicator(nodes, timer);
    MetricUpdater metricUpdater = new MetricUpdater(new NoMetricReporter(), options.fleetControllerIndex);
    eventLog = new EventLog(timer, metricUpdater);
    ContentCluster cluster = new ContentCluster(options.clusterName, options.nodes, options.storageDistribution, options.minStorageNodesUp, options.minRatioOfStorageNodesUp);
    NodeStateGatherer stateGatherer = new NodeStateGatherer(timer, timer, eventLog);
    DatabaseHandler database = new DatabaseHandler(timer, options.zooKeeperServerAddress, options.fleetControllerIndex, timer);
    StateChangeHandler stateGenerator = new StateChangeHandler(timer, eventLog, metricUpdater);
    SystemStateBroadcaster stateBroadcaster = new SystemStateBroadcaster(timer, timer);
    MasterElectionHandler masterElectionHandler = new MasterElectionHandler(options.fleetControllerIndex, options.fleetControllerCount, timer, timer);
    ctrl = new FleetController(timer, eventLog, cluster, stateGatherer, communicator, null, null, communicator, database, stateGenerator, stateBroadcaster, masterElectionHandler, metricUpdater, options);
    ctrl.tick();
    if (options.fleetControllerCount == 1) {
        markAllNodesAsUp(options);
    }
}
Also used : ConfiguredNode(com.yahoo.vdslib.distribution.ConfiguredNode) DatabaseHandler(com.yahoo.vespa.clustercontroller.core.database.DatabaseHandler) NoMetricReporter(com.yahoo.vespa.clustercontroller.utils.util.NoMetricReporter)

Aggregations

DatabaseHandler (com.yahoo.vespa.clustercontroller.core.database.DatabaseHandler)4 ConfiguredNode (com.yahoo.vdslib.distribution.ConfiguredNode)2 RPCCommunicator (com.yahoo.vespa.clustercontroller.core.rpc.RPCCommunicator)2 SlobrokClient (com.yahoo.vespa.clustercontroller.core.rpc.SlobrokClient)2 NoMetricReporter (com.yahoo.vespa.clustercontroller.utils.util.NoMetricReporter)2 NodeState (com.yahoo.vdslib.state.NodeState)1 RpcServer (com.yahoo.vespa.clustercontroller.core.rpc.RpcServer)1 StatusPageServer (com.yahoo.vespa.clustercontroller.core.status.statuspage.StatusPageServer)1 HashSet (java.util.HashSet)1 Test (org.junit.Test)1