Search in sources :

Example 1 with RawDeleteRangeRequest

use of org.tikv.kvproto.Kvrpcpb.RawDeleteRangeRequest in project tispark by pingcap.

the class RegionStoreClient method rawDeleteRange.

/**
 * Delete raw keys in the range of [startKey, endKey)
 *
 * @param backOffer BackOffer
 * @param startKey startKey
 * @param endKey endKey
 */
public void rawDeleteRange(BackOffer backOffer, ByteString startKey, ByteString endKey) {
    Supplier<RawDeleteRangeRequest> factory = () -> RawDeleteRangeRequest.newBuilder().setContext(region.getContext()).setStartKey(startKey).setEndKey(endKey).build();
    KVErrorHandler<RawDeleteRangeResponse> handler = new KVErrorHandler<>(regionManager, this, resp -> resp.hasRegionError() ? resp.getRegionError() : null);
    RawDeleteRangeResponse resp = callWithRetry(backOffer, TikvGrpc.getRawDeleteRangeMethod(), factory, handler);
    rawDeleteRangeHelper(resp);
}
Also used : RawDeleteRangeResponse(org.tikv.kvproto.Kvrpcpb.RawDeleteRangeResponse) KVErrorHandler(com.pingcap.tikv.operation.KVErrorHandler) RawDeleteRangeRequest(org.tikv.kvproto.Kvrpcpb.RawDeleteRangeRequest)

Example 2 with RawDeleteRangeRequest

use of org.tikv.kvproto.Kvrpcpb.RawDeleteRangeRequest in project client-java by tikv.

the class RegionStoreClient method rawDeleteRange.

/**
 * Delete raw keys in the range of [startKey, endKey)
 *
 * @param backOffer BackOffer
 * @param startKey startKey
 * @param endKey endKey
 */
public void rawDeleteRange(BackOffer backOffer, ByteString startKey, ByteString endKey) {
    Long clusterId = pdClient.getClusterId();
    Histogram.Timer requestTimer = GRPC_RAW_REQUEST_LATENCY.labels("client_grpc_raw_delete_range", clusterId.toString()).startTimer();
    try {
        Supplier<RawDeleteRangeRequest> factory = () -> RawDeleteRangeRequest.newBuilder().setContext(makeContext(storeType, backOffer.getSlowLog())).setStartKey(startKey).setEndKey(endKey).build();
        RegionErrorHandler<RawDeleteRangeResponse> handler = new RegionErrorHandler<RawDeleteRangeResponse>(regionManager, this, resp -> resp.hasRegionError() ? resp.getRegionError() : null);
        RawDeleteRangeResponse resp = callWithRetry(backOffer, TikvGrpc.getRawDeleteRangeMethod(), factory, handler);
        rawDeleteRangeHelper(resp);
    } finally {
        requestTimer.observeDuration();
    }
}
Also used : Histogram(io.prometheus.client.Histogram) RawDeleteRangeResponse(org.tikv.kvproto.Kvrpcpb.RawDeleteRangeResponse) RawDeleteRangeRequest(org.tikv.kvproto.Kvrpcpb.RawDeleteRangeRequest) RegionErrorHandler(org.tikv.common.operation.RegionErrorHandler)

Aggregations

RawDeleteRangeRequest (org.tikv.kvproto.Kvrpcpb.RawDeleteRangeRequest)2 RawDeleteRangeResponse (org.tikv.kvproto.Kvrpcpb.RawDeleteRangeResponse)2 KVErrorHandler (com.pingcap.tikv.operation.KVErrorHandler)1 Histogram (io.prometheus.client.Histogram)1 RegionErrorHandler (org.tikv.common.operation.RegionErrorHandler)1