Search in sources :

Example 1 with RawBatchDeleteResponse

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

the class RegionStoreClient method rawBatchDelete.

public void rawBatchDelete(BackOffer backoffer, List<ByteString> keys, boolean atomicForCAS) {
    Long clusterId = pdClient.getClusterId();
    Histogram.Timer requestTimer = GRPC_RAW_REQUEST_LATENCY.labels("client_grpc_raw_batch_delete", clusterId.toString()).startTimer();
    try {
        if (keys.isEmpty()) {
            return;
        }
        Supplier<RawBatchDeleteRequest> factory = () -> RawBatchDeleteRequest.newBuilder().setContext(makeContext(storeType, backoffer.getSlowLog())).addAllKeys(keys).setForCas(atomicForCAS).build();
        RegionErrorHandler<RawBatchDeleteResponse> handler = new RegionErrorHandler<RawBatchDeleteResponse>(regionManager, this, resp -> resp.hasRegionError() ? resp.getRegionError() : null);
        RawBatchDeleteResponse resp = callWithRetry(backoffer, TikvGrpc.getRawBatchDeleteMethod(), factory, handler);
        handleRawBatchDelete(resp);
    } finally {
        requestTimer.observeDuration();
    }
}
Also used : RawBatchDeleteRequest(org.tikv.kvproto.Kvrpcpb.RawBatchDeleteRequest) Histogram(io.prometheus.client.Histogram) RawBatchDeleteResponse(org.tikv.kvproto.Kvrpcpb.RawBatchDeleteResponse) RegionErrorHandler(org.tikv.common.operation.RegionErrorHandler)

Example 2 with RawBatchDeleteResponse

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

the class RegionStoreClient method rawBatchDelete.

public void rawBatchDelete(BackOffer backoffer, List<ByteString> keys, boolean atomic) {
    if (keys.isEmpty()) {
        return;
    }
    Supplier<RawBatchDeleteRequest> factory = () -> RawBatchDeleteRequest.newBuilder().setContext(region.getContext()).addAllKeys(keys).setForCas(atomic).build();
    KVErrorHandler<RawBatchDeleteResponse> handler = new KVErrorHandler<>(regionManager, this, resp -> resp.hasRegionError() ? resp.getRegionError() : null);
    RawBatchDeleteResponse resp = callWithRetry(backoffer, TikvGrpc.getRawBatchDeleteMethod(), factory, handler);
    handleRawBatchDelete(resp);
}
Also used : RawBatchDeleteRequest(org.tikv.kvproto.Kvrpcpb.RawBatchDeleteRequest) RawBatchDeleteResponse(org.tikv.kvproto.Kvrpcpb.RawBatchDeleteResponse) KVErrorHandler(com.pingcap.tikv.operation.KVErrorHandler)

Aggregations

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