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);
}
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);
}
}
}
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;
}
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);
}
Aggregations