use of org.tikv.kvproto.Kvrpcpb.CommitRequest in project tispark by pingcap.
the class RegionStoreClient method commit.
/**
* Commit batch keys
*
* @param backOffer backOffer
* @param keys keys to commit
* @param startTs start version
* @param commitTs commit version
*/
public void commit(BackOffer backOffer, Iterable<ByteString> keys, long startTs, long commitTs) throws KeyException {
boolean forWrite = true;
Supplier<CommitRequest> factory = () -> CommitRequest.newBuilder().setStartVersion(startTs).setCommitVersion(commitTs).addAllKeys(keys).setContext(region.getContext()).build();
KVErrorHandler<CommitResponse> handler = new KVErrorHandler<>(regionManager, this, lockResolverClient, resp -> resp.hasRegionError() ? resp.getRegionError() : null, resp -> resp.hasError() ? resp.getError() : null, resolveLockResult -> null, startTs, forWrite);
CommitResponse resp = callWithRetry(backOffer, TikvGrpc.getKvCommitMethod(), factory, handler);
handleCommitResponse(resp);
}
use of org.tikv.kvproto.Kvrpcpb.CommitRequest in project client-java by tikv.
the class RegionStoreClient method commit.
/**
* Commit batch keys
*
* @param backOffer backOffer
* @param keys keys to commit
* @param startTs start version
* @param commitTs commit version
*/
public void commit(BackOffer backOffer, Iterable<ByteString> keys, long startTs, long commitTs) throws KeyException {
boolean forWrite = true;
Supplier<CommitRequest> factory = () -> CommitRequest.newBuilder().setStartVersion(startTs).setCommitVersion(commitTs).addAllKeys(keys).setContext(makeContext(storeType, backOffer.getSlowLog())).build();
KVErrorHandler<CommitResponse> handler = new KVErrorHandler<>(regionManager, this, lockResolverClient, resp -> resp.hasRegionError() ? resp.getRegionError() : null, resp -> resp.hasError() ? resp.getError() : null, resolveLockResult -> null, startTs, forWrite);
CommitResponse resp = callWithRetry(backOffer, TikvGrpc.getKvCommitMethod(), factory, handler);
handleCommitResponse(resp);
}
Aggregations