use of io.dingodb.store.row.cmd.store.RangeSplitRequest in project dingo by dingodb.
the class DefaultDingoRowStoreCliService method rangeSplit.
@Override
public Status rangeSplit(final String regionId, final String newRegionId, final String groupId, final Configuration conf) {
final PeerId leaderId = new PeerId();
final Status st = this.cliService.getLeader(groupId, conf, leaderId);
if (!st.isOk()) {
throw new IllegalStateException(st.getErrorMsg());
}
final RangeSplitRequest request = new RangeSplitRequest();
request.setRegionId(regionId);
request.setNewRegionId(newRegionId);
try {
final BaseResponse<?> response = (BaseResponse<?>) this.rpcClient.invokeSync(leaderId.getEndpoint(), request, this.opts.getTimeoutMs());
if (response.isSuccess()) {
return Status.OK();
}
return new Status(-1, "Fail to range split on region %d, error: %s", regionId, response);
} catch (final Exception e) {
LOG.error("Fail to range split on exception: {}.", StackTraceUtil.stackTrace(e));
return new Status(-1, "fail to range split on region %d", regionId);
}
}
Aggregations