Interface ClickHouseNodeManager

    • Method Detail

      • getNodes

        List<ClickHouseNode> getNodes()
        Gets a copy of nodes, which in most cases are in healthy status. However, this really depends on how ClickHouseLoadBalancingPolicy manages node status. In first-alive policy, it's acutally a full list regardless node status.
        Returns:
        non-null nodes
      • getNodes

        List<ClickHouseNode> getNodes​(ClickHouseNodeSelector selector,
                                      int groupSize)
        Gets a copy of filtered nodes.
        Parameters:
        selector - node selector for filtering out nodes, null means no filter
        groupSize - maximum number of nodes to get, zero or negative value means all
        Returns:
        non-null nodes
      • getFaultyNodes

        List<ClickHouseNode> getFaultyNodes()
        Gets a copy of faulty nodes.
        Returns:
        non-null faulty nodes
      • getFaultyNodes

        List<ClickHouseNode> getFaultyNodes​(ClickHouseNodeSelector selector,
                                            int groupSize)
        Gets a copy of filtered faulty nodes.
        Parameters:
        selector - node selector for filtering out nodes, null means no filter
        groupSize - maximum number of nodes to get, zero or negative value means all
        Returns:
        non-null faulty nodes
      • getNodeSelector

        ClickHouseNodeSelector getNodeSelector()
        Gets node selector for filtering out nodes.
        Returns:
        non-null node selector
      • scheduleDiscovery

        Optional<ScheduledFuture<?>> scheduleDiscovery()
        Schedule node discovery task immediately. Nothing will happen when task scheduler does not exist(e.g. getPolicy().getScheduler() returns null) or there's a task running for node discovery.
        Returns:
        optional future for retrieving the running task
      • scheduleHealthCheck

        Optional<ScheduledFuture<?>> scheduleHealthCheck()
        Schedule node discovery task immediately. Nothing will happen when task scheduler does not exist(e.g. getPolicy().getScheduler() returns null) or there's a task running for health check.
        Returns:
        optional future for retrieving the running task
      • suggestNode

        ClickHouseNode suggestNode​(ClickHouseNode server,
                                   Throwable failure)
        Suggests a different node in order to recover from a failure, which is usually a connection error.
        Parameters:
        server - node related to the failure(e.g. the node couldn't be connected)
        failure - recoverable failure
        Returns:
        non-null node which may or may not be same as the given one
      • update

        void update​(ClickHouseNode node,
                    ClickHouseNode.Status status)
        Updates node status to one of ClickHouseNode.Status. It simply delegates the call to getPolicy().update(node, status) in a thread-safe manner.
        Parameters:
        node - non-null node to update
        status - non-null status of the node