Search in sources :

Example 1 with AllNodes

use of com.facebook.presto.metadata.AllNodes in project presto by prestodb.

the class TestDistributedResourceGroupInfoResource method waitUntilCoordinatorsDiscoveredHealthyInRM.

private void waitUntilCoordinatorsDiscoveredHealthyInRM(long timeoutInMillis) throws TimeoutException, InterruptedException {
    long deadline = System.currentTimeMillis() + timeoutInMillis;
    while (System.currentTimeMillis() < deadline) {
        AllNodes allNodes = this.resourceManager.refreshNodes();
        if (allNodes.getActiveCoordinators().size() == COORDINATOR_COUNT) {
            return;
        }
        sleep(100);
    }
    throw new TimeoutException(format("one of the nodes is still missing after: %s ms", timeoutInMillis));
}
Also used : AllNodes(com.facebook.presto.metadata.AllNodes) TimeoutException(java.util.concurrent.TimeoutException)

Example 2 with AllNodes

use of com.facebook.presto.metadata.AllNodes in project presto by prestodb.

the class TestDistributedClusterStatsResource method waitUntilCoordinatorsDiscoveredHealthyInRM.

private void waitUntilCoordinatorsDiscoveredHealthyInRM(long timeoutInMillis) throws TimeoutException, InterruptedException {
    long deadline = System.currentTimeMillis() + timeoutInMillis;
    while (System.currentTimeMillis() < deadline) {
        AllNodes allNodes = this.resourceManager.refreshNodes();
        if (allNodes.getActiveCoordinators().size() == COORDINATOR_COUNT) {
            return;
        }
        sleep(100);
    }
    throw new TimeoutException(format("one of the nodes is still missing after: %s ms", timeoutInMillis));
}
Also used : AllNodes(com.facebook.presto.metadata.AllNodes) TimeoutException(java.util.concurrent.TimeoutException)

Example 3 with AllNodes

use of com.facebook.presto.metadata.AllNodes in project presto by prestodb.

the class ConfidenceBasedNodeTtlFetcherManager method refreshTtlInfo.

@VisibleForTesting
public synchronized void refreshTtlInfo() {
    AllNodes allNodes = nodeManager.getAllNodes();
    refreshTtlInfo(allNodes);
}
Also used : AllNodes(com.facebook.presto.metadata.AllNodes) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Example 4 with AllNodes

use of com.facebook.presto.metadata.AllNodes in project presto by prestodb.

the class TestHiveRecoverableExecution method waitUntilAllNodesAreHealthy.

private static void waitUntilAllNodesAreHealthy(DistributedQueryRunner queryRunner, Duration timeout) throws TimeoutException, InterruptedException {
    TestingPrestoServer coordinator = queryRunner.getCoordinator();
    long deadline = System.currentTimeMillis() + timeout.toMillis();
    while (System.currentTimeMillis() < deadline) {
        AllNodes allNodes = coordinator.refreshNodes();
        if (allNodes.getActiveNodes().size() == queryRunner.getNodeCount()) {
            return;
        }
        sleep(1000);
    }
    throw new TimeoutException(format("one of the nodes is still missing after: %s", timeout));
}
Also used : AllNodes(com.facebook.presto.metadata.AllNodes) TestingPrestoServer(com.facebook.presto.server.testing.TestingPrestoServer) TimeoutException(java.util.concurrent.TimeoutException)

Example 5 with AllNodes

use of com.facebook.presto.metadata.AllNodes in project presto by prestodb.

the class NodeSystemTable method cursor.

@Override
public RecordCursor cursor(ConnectorTransactionHandle transactionHandle, ConnectorSession session, TupleDomain<Integer> constraint) {
    Builder table = InMemoryRecordSet.builder(NODES_TABLE);
    AllNodes allNodes = nodeManager.getAllNodes();
    addRows(table, allNodes.getActiveNodes(), ACTIVE);
    addRows(table, allNodes.getInactiveNodes(), INACTIVE);
    addRows(table, allNodes.getShuttingDownNodes(), SHUTTING_DOWN);
    return table.build().cursor();
}
Also used : TableMetadataBuilder.tableMetadataBuilder(com.facebook.presto.metadata.MetadataUtil.TableMetadataBuilder.tableMetadataBuilder) Builder(com.facebook.presto.spi.InMemoryRecordSet.Builder) AllNodes(com.facebook.presto.metadata.AllNodes)

Aggregations

AllNodes (com.facebook.presto.metadata.AllNodes)6 TimeoutException (java.util.concurrent.TimeoutException)4 TableMetadataBuilder.tableMetadataBuilder (com.facebook.presto.metadata.MetadataUtil.TableMetadataBuilder.tableMetadataBuilder)1 TestingPrestoServer (com.facebook.presto.server.testing.TestingPrestoServer)1 Builder (com.facebook.presto.spi.InMemoryRecordSet.Builder)1 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1