use of com.alipay.sofa.jraft.rhea.client.pd.PlacementDriverClient in project sofa-jraft by sofastack.
the class ChaosTestCluster method removePeer.
public synchronized void removePeer(final PeerId peerId) {
for (int i = this.stores.size() - 1; i >= 0; i--) {
final RheaKVStore store = this.stores.get(i);
if (peerId.getEndpoint().equals(getSelfEndpoint(store))) {
final PlacementDriverClient pdClient = store.getPlacementDriverClient();
if (!pdClient.removeReplica(Constants.DEFAULT_REGION_ID, JRaftHelper.toPeer(peerId), true)) {
throw new RuntimeException("fail to remove peer: " + peerId);
}
store.shutdown();
this.stores.remove(i);
this.peerIds.remove(i);
LOG.info("Shutdown and remove peer: {}", peerId);
return;
}
}
LOG.info("Could not find peer: {}", peerId);
}
use of com.alipay.sofa.jraft.rhea.client.pd.PlacementDriverClient in project sofa-jraft by sofastack.
the class PlacementDriverServer method awaitReady.
public boolean awaitReady(final long timeoutMillis) {
final PlacementDriverClient pdClient = this.rheaKVStore.getPlacementDriverClient();
final Endpoint endpoint = pdClient.getLeader(this.regionEngine.getRegion().getId(), true, timeoutMillis);
return endpoint != null;
}
Aggregations