Search in sources :

Example 1 with Cluster

use of io.dingodb.store.row.metadata.Cluster in project dingo by dingodb.

the class MetadataRpcClient method internalGetClusterInfo.

private void internalGetClusterInfo(final long clusterId, final CompletableFuture<Cluster> future, final int retriesLeft, final Errors lastCause) {
    final RetryRunner retryRunner = retryCause -> internalGetClusterInfo(clusterId, future, retriesLeft - 1, retryCause);
    final FailoverClosure<Cluster> closure = new FailoverClosureImpl<>(future, retriesLeft, retryRunner);
    final GetClusterInfoRequest request = new GetClusterInfoRequest();
    request.setClusterId(clusterId);
    this.pdRpcService.callPdServerWithRpc(request, closure, lastCause);
}
Also used : CreateRegionIdRequest(io.dingodb.store.row.cmd.pd.CreateRegionIdRequest) GetClusterInfoRequest(io.dingodb.store.row.cmd.pd.GetClusterInfoRequest) Errors(io.dingodb.store.row.errors.Errors) FailoverClosure(io.dingodb.store.row.client.failover.FailoverClosure) Store(io.dingodb.store.row.metadata.Store) CompletableFuture(java.util.concurrent.CompletableFuture) Cluster(io.dingodb.store.row.metadata.Cluster) SetStoreInfoRequest(io.dingodb.store.row.cmd.pd.SetStoreInfoRequest) RetryRunner(io.dingodb.store.row.client.failover.RetryRunner) FailoverClosureImpl(io.dingodb.store.row.client.failover.impl.FailoverClosureImpl) GetStoreInfoRequest(io.dingodb.store.row.cmd.pd.GetStoreInfoRequest) GetStoreIdRequest(io.dingodb.store.row.cmd.pd.GetStoreIdRequest) Endpoint(io.dingodb.raft.util.Endpoint) FutureHelper(io.dingodb.store.row.client.FutureHelper) GetClusterInfoRequest(io.dingodb.store.row.cmd.pd.GetClusterInfoRequest) FailoverClosureImpl(io.dingodb.store.row.client.failover.impl.FailoverClosureImpl) Cluster(io.dingodb.store.row.metadata.Cluster) RetryRunner(io.dingodb.store.row.client.failover.RetryRunner)

Example 2 with Cluster

use of io.dingodb.store.row.metadata.Cluster in project dingo by dingodb.

the class RemotePlacementDriverClient method refreshRouteTable.

@Override
protected void refreshRouteTable() {
    final Cluster cluster = this.metadataRpcClient.getClusterInfo(this.clusterId);
    if (cluster == null) {
        LOG.warn("Cluster info is empty: {}.", this.clusterId);
        return;
    }
    final List<Store> stores = cluster.getStores();
    if (stores == null || stores.isEmpty()) {
        LOG.error("Stores info is empty: {}.", this.clusterId);
        return;
    }
    for (final Store store : stores) {
        final List<Region> regions = store.getRegions();
        if (regions == null || regions.isEmpty()) {
            LOG.error("Regions info is empty: {} - {}.", this.clusterId, store.getId());
            continue;
        }
        for (final Region region : regions) {
            super.regionRouteTable.addOrUpdateRegion(region);
        }
    }
}
Also used : Cluster(io.dingodb.store.row.metadata.Cluster) Store(io.dingodb.store.row.metadata.Store) Region(io.dingodb.store.row.metadata.Region)

Example 3 with Cluster

use of io.dingodb.store.row.metadata.Cluster in project dingo by dingodb.

the class RowStoreMetaAdaptorImpl method cluster.

@Override
public Cluster cluster() {
    List<Store> stores = scheduleMetaAdaptor.namespaceView().resourceViews().values().stream().filter(ExecutorView.class::isInstance).map(ExecutorView.class::cast).map(this::mapping).collect(Collectors.toList());
    Cluster cluster = new Cluster(0, stores);
    log.debug("Get cluster, cluster: {}", cluster);
    return cluster;
}
Also used : ExecutorView(io.dingodb.server.coordinator.resource.impl.ExecutorView) Store(io.dingodb.store.row.metadata.Store) Cluster(io.dingodb.store.row.metadata.Cluster)

Example 4 with Cluster

use of io.dingodb.store.row.metadata.Cluster in project dingo by dingodb.

the class GetClusterInfoHandler method handleRequest.

@Override
public void handleRequest(RpcContext rpcCtx, GetClusterInfoRequest request) {
    GetClusterInfoResponse response = new GetClusterInfoResponse();
    if (rowStoreMetaAdaptor.available()) {
        Cluster cluster = rowStoreMetaAdaptor.cluster();
        response.setClusterId(cluster.getClusterId());
        response.setValue(cluster);
    } else {
        response.setError(Errors.NOT_LEADER);
    }
    rpcCtx.sendResponse(response);
}
Also used : GetClusterInfoResponse(io.dingodb.store.row.cmd.pd.GetClusterInfoResponse) Cluster(io.dingodb.store.row.metadata.Cluster)

Aggregations

Cluster (io.dingodb.store.row.metadata.Cluster)4 Store (io.dingodb.store.row.metadata.Store)3 Endpoint (io.dingodb.raft.util.Endpoint)1 ExecutorView (io.dingodb.server.coordinator.resource.impl.ExecutorView)1 FutureHelper (io.dingodb.store.row.client.FutureHelper)1 FailoverClosure (io.dingodb.store.row.client.failover.FailoverClosure)1 RetryRunner (io.dingodb.store.row.client.failover.RetryRunner)1 FailoverClosureImpl (io.dingodb.store.row.client.failover.impl.FailoverClosureImpl)1 CreateRegionIdRequest (io.dingodb.store.row.cmd.pd.CreateRegionIdRequest)1 GetClusterInfoRequest (io.dingodb.store.row.cmd.pd.GetClusterInfoRequest)1 GetClusterInfoResponse (io.dingodb.store.row.cmd.pd.GetClusterInfoResponse)1 GetStoreIdRequest (io.dingodb.store.row.cmd.pd.GetStoreIdRequest)1 GetStoreInfoRequest (io.dingodb.store.row.cmd.pd.GetStoreInfoRequest)1 SetStoreInfoRequest (io.dingodb.store.row.cmd.pd.SetStoreInfoRequest)1 Errors (io.dingodb.store.row.errors.Errors)1 Region (io.dingodb.store.row.metadata.Region)1 CompletableFuture (java.util.concurrent.CompletableFuture)1