Search in sources :

Example 1 with CASEntry

use of com.alipay.sofa.jraft.rhea.storage.CASEntry in project sofa-jraft by sofastack.

the class RegionRouteTable method findRegionsByCASEntries.

/**
 * Returns the list of regions to which the keys belongs.
 */
public Map<Region, List<CASEntry>> findRegionsByCASEntries(final List<CASEntry> casEntries) {
    Requires.requireNonNull(casEntries, "casEntries");
    final Map<Region, List<CASEntry>> regionMap = Maps.newHashMap();
    final StampedLock stampedLock = this.stampedLock;
    final long stamp = stampedLock.readLock();
    try {
        for (final CASEntry casEntry : casEntries) {
            final Region region = findRegionByKeyWithoutLock(casEntry.getKey());
            regionMap.computeIfAbsent(region, k -> Lists.newArrayList()).add(casEntry);
        }
        return regionMap;
    } finally {
        stampedLock.unlockRead(stamp);
    }
}
Also used : Logger(org.slf4j.Logger) LoggerFactory(org.slf4j.LoggerFactory) RouteTableException(com.alipay.sofa.jraft.rhea.errors.RouteTableException) NavigableMap(java.util.NavigableMap) Region(com.alipay.sofa.jraft.rhea.metadata.Region) Lists(com.alipay.sofa.jraft.rhea.util.Lists) List(java.util.List) RegionEpoch(com.alipay.sofa.jraft.rhea.metadata.RegionEpoch) TreeMap(java.util.TreeMap) Maps(com.alipay.sofa.jraft.rhea.util.Maps) Map(java.util.Map) KVEntry(com.alipay.sofa.jraft.rhea.storage.KVEntry) Comparator(java.util.Comparator) StampedLock(java.util.concurrent.locks.StampedLock) Requires(com.alipay.sofa.jraft.util.Requires) CASEntry(com.alipay.sofa.jraft.rhea.storage.CASEntry) BytesUtil(com.alipay.sofa.jraft.util.BytesUtil) Region(com.alipay.sofa.jraft.rhea.metadata.Region) StampedLock(java.util.concurrent.locks.StampedLock) List(java.util.List) CASEntry(com.alipay.sofa.jraft.rhea.storage.CASEntry)

Example 2 with CASEntry

use of com.alipay.sofa.jraft.rhea.storage.CASEntry in project sofa-jraft by sofastack.

the class AbstractRheaKVStoreTest method compareAndPutAllTest.

/**
 * Test method: {@link RheaKVStore#compareAndPutAll(List)}
 */
public void compareAndPutAllTest(final RheaKVStore store) {
    final List<CASEntry> entries = new ArrayList<>();
    entries.add(new CASEntry(makeKey("k1"), null, makeValue("v1")));
    entries.add(new CASEntry(makeKey("k2"), null, makeValue("v2")));
    entries.add(new CASEntry(makeKey("k3"), null, makeValue("v3")));
    boolean ret = store.bCompareAndPutAll(entries);
    assertTrue(ret);
    entries.clear();
    entries.add(new CASEntry(makeKey("k1"), makeValue("v1"), makeValue("v11")));
    entries.add(new CASEntry(makeKey("k2"), makeValue("v2"), makeValue("v22")));
    ret = store.bCompareAndPutAll(entries);
    assertTrue(ret);
    entries.clear();
    entries.add(new CASEntry(makeKey("k1"), makeValue("v11"), makeValue("v111")));
    entries.add(new CASEntry(makeKey("k2"), makeValue("v22"), makeValue("v222")));
    entries.add(new CASEntry(makeKey("k3"), makeValue("v33"), makeValue("v333")));
    ret = store.bCompareAndPutAll(entries);
    assertTrue(!ret);
    final Map<ByteArray, byte[]> map = store.bMultiGet(Lists.newArrayList(makeKey("k1"), makeKey("k2"), makeKey("k3")));
    assertArrayEquals(makeValue("v11"), map.get(ByteArray.wrap(makeKey("k1"))));
    assertArrayEquals(makeValue("v22"), map.get(ByteArray.wrap(makeKey("k2"))));
    assertArrayEquals(makeValue("v3"), map.get(ByteArray.wrap(makeKey("k3"))));
}
Also used : ArrayList(java.util.ArrayList) ByteArray(com.alipay.sofa.jraft.rhea.util.ByteArray) CASEntry(com.alipay.sofa.jraft.rhea.storage.CASEntry)

Example 3 with CASEntry

use of com.alipay.sofa.jraft.rhea.storage.CASEntry in project sofa-jraft by sofastack.

the class DefaultRheaKVStore method internalCompareAndPutAll.

private FutureGroup<Boolean> internalCompareAndPutAll(final List<CASEntry> entries, final int retriesLeft, final Throwable lastCause) {
    final Map<Region, List<CASEntry>> regionMap = this.pdClient.findRegionsByCASEntries(entries, ApiExceptionHelper.isInvalidEpoch(lastCause));
    final List<CompletableFuture<Boolean>> futures = Lists.newArrayListWithCapacity(regionMap.size());
    final Errors lastError = lastCause == null ? null : Errors.forException(lastCause);
    for (final Map.Entry<Region, List<CASEntry>> entry : regionMap.entrySet()) {
        final Region region = entry.getKey();
        final List<CASEntry> subEntries = entry.getValue();
        final RetryCallable<Boolean> retryCallable = retryCause -> internalCompareAndPutAll(subEntries, retriesLeft - 1, retryCause);
        final BoolFailoverFuture future = new BoolFailoverFuture(retriesLeft, retryCallable);
        internalRegionCompareAndPutAll(region, subEntries, future, retriesLeft, lastError);
        futures.add(future);
    }
    return new FutureGroup<>(futures);
}
Also used : NamedThreadFactory(com.alipay.sofa.jraft.rhea.util.concurrent.NamedThreadFactory) PlacementDriverClient(com.alipay.sofa.jraft.rhea.client.pd.PlacementDriverClient) BatchingOptions(com.alipay.sofa.jraft.rhea.options.BatchingOptions) LoggerFactory(org.slf4j.LoggerFactory) FailoverClosure(com.alipay.sofa.jraft.rhea.client.failover.FailoverClosure) ExtSerializerSupports(com.alipay.sofa.jraft.rhea.rpc.ExtSerializerSupports) Region(com.alipay.sofa.jraft.rhea.metadata.Region) Lists(com.alipay.sofa.jraft.rhea.util.Lists) ListFailoverFuture(com.alipay.sofa.jraft.rhea.client.failover.impl.ListFailoverFuture) DescriberManager(com.alipay.sofa.jraft.rhea.DescriberManager) Map(java.util.Map) Constants(com.alipay.sofa.jraft.rhea.util.Constants) ApiExceptionHelper(com.alipay.sofa.jraft.rhea.errors.ApiExceptionHelper) ScanRequest(com.alipay.sofa.jraft.rhea.cmd.store.ScanRequest) Endpoint(com.alipay.sofa.jraft.util.Endpoint) MergeRequest(com.alipay.sofa.jraft.rhea.cmd.store.MergeRequest) ThreadFactory(java.util.concurrent.ThreadFactory) DeleteRequest(com.alipay.sofa.jraft.rhea.cmd.store.DeleteRequest) WaitStrategyType(com.alipay.sofa.jraft.rhea.util.concurrent.disruptor.WaitStrategyType) CASEntry(com.alipay.sofa.jraft.rhea.storage.CASEntry) DistributedLock(com.alipay.sofa.jraft.rhea.util.concurrent.DistributedLock) LogExceptionHandler(com.alipay.sofa.jraft.util.LogExceptionHandler) CASAllRequest(com.alipay.sofa.jraft.rhea.cmd.store.CASAllRequest) TaskDispatcher(com.alipay.sofa.jraft.rhea.util.concurrent.disruptor.TaskDispatcher) PeerId(com.alipay.sofa.jraft.entity.PeerId) RouteTable(com.alipay.sofa.jraft.RouteTable) PlacementDriverOptions(com.alipay.sofa.jraft.rhea.options.PlacementDriverOptions) KVStoreClosure(com.alipay.sofa.jraft.rhea.storage.KVStoreClosure) KVMetrics(com.alipay.sofa.jraft.rhea.metrics.KVMetrics) CompareAndPutRequest(com.alipay.sofa.jraft.rhea.cmd.store.CompareAndPutRequest) PutRequest(com.alipay.sofa.jraft.rhea.cmd.store.PutRequest) FakePlacementDriverClient(com.alipay.sofa.jraft.rhea.client.pd.FakePlacementDriverClient) ContainsKeyRequest(com.alipay.sofa.jraft.rhea.cmd.store.ContainsKeyRequest) RawKVStore(com.alipay.sofa.jraft.rhea.storage.RawKVStore) DeleteRangeRequest(com.alipay.sofa.jraft.rhea.cmd.store.DeleteRangeRequest) Strings(com.alipay.sofa.jraft.rhea.util.Strings) List(java.util.List) ResetSequenceRequest(com.alipay.sofa.jraft.rhea.cmd.store.ResetSequenceRequest) RegionEngine(com.alipay.sofa.jraft.rhea.RegionEngine) BoolFailoverFuture(com.alipay.sofa.jraft.rhea.client.failover.impl.BoolFailoverFuture) JRaftHelper(com.alipay.sofa.jraft.rhea.JRaftHelper) ZipStrategyManager(com.alipay.sofa.jraft.rhea.storage.zip.ZipStrategyManager) RemotePlacementDriverClient(com.alipay.sofa.jraft.rhea.client.pd.RemotePlacementDriverClient) FailoverClosureImpl(com.alipay.sofa.jraft.rhea.client.failover.impl.FailoverClosureImpl) RheaKVStoreOptions(com.alipay.sofa.jraft.rhea.options.RheaKVStoreOptions) Requires(com.alipay.sofa.jraft.util.Requires) Histogram(com.codahale.metrics.Histogram) RheaRuntimeException(com.alipay.sofa.jraft.rhea.errors.RheaRuntimeException) BatchPutRequest(com.alipay.sofa.jraft.rhea.cmd.store.BatchPutRequest) StackTraceUtil(com.alipay.sofa.jraft.rhea.util.StackTraceUtil) CompletableFuture(java.util.concurrent.CompletableFuture) FollowerStateListener(com.alipay.sofa.jraft.rhea.FollowerStateListener) Utils(com.alipay.sofa.jraft.util.Utils) ErrorsHelper(com.alipay.sofa.jraft.rhea.errors.ErrorsHelper) BatchDeleteRequest(com.alipay.sofa.jraft.rhea.cmd.store.BatchDeleteRequest) StateListenerContainer(com.alipay.sofa.jraft.rhea.StateListenerContainer) RetryCallable(com.alipay.sofa.jraft.rhea.client.failover.RetryCallable) GetRequest(com.alipay.sofa.jraft.rhea.cmd.store.GetRequest) Errors(com.alipay.sofa.jraft.rhea.errors.Errors) StateListener(com.alipay.sofa.jraft.rhea.StateListener) GetAndPutRequest(com.alipay.sofa.jraft.rhea.cmd.store.GetAndPutRequest) KeyLockRequest(com.alipay.sofa.jraft.rhea.cmd.store.KeyLockRequest) KeyUnlockRequest(com.alipay.sofa.jraft.rhea.cmd.store.KeyUnlockRequest) MapFailoverFuture(com.alipay.sofa.jraft.rhea.client.failover.impl.MapFailoverFuture) KVMetricNames(com.alipay.sofa.jraft.rhea.metrics.KVMetricNames) KVIterator(com.alipay.sofa.jraft.rhea.storage.KVIterator) NodeExecutor(com.alipay.sofa.jraft.rhea.storage.NodeExecutor) Dispatcher(com.alipay.sofa.jraft.rhea.util.concurrent.disruptor.Dispatcher) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) StoreEngine(com.alipay.sofa.jraft.rhea.StoreEngine) MultiGetRequest(com.alipay.sofa.jraft.rhea.cmd.store.MultiGetRequest) EventHandler(com.lmax.disruptor.EventHandler) PutIfAbsentRequest(com.alipay.sofa.jraft.rhea.cmd.store.PutIfAbsentRequest) Logger(org.slf4j.Logger) RetryRunner(com.alipay.sofa.jraft.rhea.client.failover.RetryRunner) GetSequenceRequest(com.alipay.sofa.jraft.rhea.cmd.store.GetSequenceRequest) RingBuffer(com.lmax.disruptor.RingBuffer) AffinityNamedThreadFactory(com.alipay.sofa.jraft.rhea.util.concurrent.AffinityNamedThreadFactory) ListRetryCallable(com.alipay.sofa.jraft.rhea.client.failover.ListRetryCallable) Status(com.alipay.sofa.jraft.Status) ByteArray(com.alipay.sofa.jraft.rhea.util.ByteArray) NodeExecuteRequest(com.alipay.sofa.jraft.rhea.cmd.store.NodeExecuteRequest) TimeUnit(java.util.concurrent.TimeUnit) StoreEngineOptions(com.alipay.sofa.jraft.rhea.options.StoreEngineOptions) Sequence(com.alipay.sofa.jraft.rhea.storage.Sequence) RpcOptions(com.alipay.sofa.jraft.rhea.options.RpcOptions) KVEntry(com.alipay.sofa.jraft.rhea.storage.KVEntry) Collections(java.util.Collections) LeaderStateListener(com.alipay.sofa.jraft.rhea.LeaderStateListener) EventFactory(com.lmax.disruptor.EventFactory) Disruptor(com.lmax.disruptor.dsl.Disruptor) BytesUtil(com.alipay.sofa.jraft.util.BytesUtil) BoolFailoverFuture(com.alipay.sofa.jraft.rhea.client.failover.impl.BoolFailoverFuture) Errors(com.alipay.sofa.jraft.rhea.errors.Errors) CompletableFuture(java.util.concurrent.CompletableFuture) Region(com.alipay.sofa.jraft.rhea.metadata.Region) List(java.util.List) CASEntry(com.alipay.sofa.jraft.rhea.storage.CASEntry) Map(java.util.Map)

Example 4 with CASEntry

use of com.alipay.sofa.jraft.rhea.storage.CASEntry in project sofa-jraft by sofastack.

the class DefaultRheaKVStore method internalRegionCompareAndPutAll.

private void internalRegionCompareAndPutAll(final Region region, final List<CASEntry> subEntries, final CompletableFuture<Boolean> future, final int retriesLeft, final Errors lastCause) {
    final RegionEngine regionEngine = getRegionEngine(region.getId(), true);
    final RetryRunner retryRunner = retryCause -> internalRegionCompareAndPutAll(region, subEntries, future, retriesLeft - 1, retryCause);
    final FailoverClosure<Boolean> closure = new FailoverClosureImpl<>(future, false, retriesLeft, retryRunner);
    if (regionEngine != null) {
        if (ensureOnValidEpoch(region, regionEngine, closure)) {
            final RawKVStore rawKVStore = getRawKVStore(regionEngine);
            if (this.kvDispatcher == null) {
                rawKVStore.compareAndPutAll(subEntries, closure);
            } else {
                this.kvDispatcher.execute(() -> rawKVStore.compareAndPutAll(subEntries, closure));
            }
        }
    } else {
        final CASAllRequest request = new CASAllRequest();
        request.setCasEntries(subEntries);
        request.setRegionId(region.getId());
        request.setRegionEpoch(region.getRegionEpoch());
        this.rheaKVRpcService.callAsyncWithRpc(request, closure, lastCause);
    }
}
Also used : NamedThreadFactory(com.alipay.sofa.jraft.rhea.util.concurrent.NamedThreadFactory) PlacementDriverClient(com.alipay.sofa.jraft.rhea.client.pd.PlacementDriverClient) BatchingOptions(com.alipay.sofa.jraft.rhea.options.BatchingOptions) LoggerFactory(org.slf4j.LoggerFactory) FailoverClosure(com.alipay.sofa.jraft.rhea.client.failover.FailoverClosure) ExtSerializerSupports(com.alipay.sofa.jraft.rhea.rpc.ExtSerializerSupports) Region(com.alipay.sofa.jraft.rhea.metadata.Region) Lists(com.alipay.sofa.jraft.rhea.util.Lists) ListFailoverFuture(com.alipay.sofa.jraft.rhea.client.failover.impl.ListFailoverFuture) DescriberManager(com.alipay.sofa.jraft.rhea.DescriberManager) Map(java.util.Map) Constants(com.alipay.sofa.jraft.rhea.util.Constants) ApiExceptionHelper(com.alipay.sofa.jraft.rhea.errors.ApiExceptionHelper) ScanRequest(com.alipay.sofa.jraft.rhea.cmd.store.ScanRequest) Endpoint(com.alipay.sofa.jraft.util.Endpoint) MergeRequest(com.alipay.sofa.jraft.rhea.cmd.store.MergeRequest) ThreadFactory(java.util.concurrent.ThreadFactory) DeleteRequest(com.alipay.sofa.jraft.rhea.cmd.store.DeleteRequest) WaitStrategyType(com.alipay.sofa.jraft.rhea.util.concurrent.disruptor.WaitStrategyType) CASEntry(com.alipay.sofa.jraft.rhea.storage.CASEntry) DistributedLock(com.alipay.sofa.jraft.rhea.util.concurrent.DistributedLock) LogExceptionHandler(com.alipay.sofa.jraft.util.LogExceptionHandler) CASAllRequest(com.alipay.sofa.jraft.rhea.cmd.store.CASAllRequest) TaskDispatcher(com.alipay.sofa.jraft.rhea.util.concurrent.disruptor.TaskDispatcher) PeerId(com.alipay.sofa.jraft.entity.PeerId) RouteTable(com.alipay.sofa.jraft.RouteTable) PlacementDriverOptions(com.alipay.sofa.jraft.rhea.options.PlacementDriverOptions) KVStoreClosure(com.alipay.sofa.jraft.rhea.storage.KVStoreClosure) KVMetrics(com.alipay.sofa.jraft.rhea.metrics.KVMetrics) CompareAndPutRequest(com.alipay.sofa.jraft.rhea.cmd.store.CompareAndPutRequest) PutRequest(com.alipay.sofa.jraft.rhea.cmd.store.PutRequest) FakePlacementDriverClient(com.alipay.sofa.jraft.rhea.client.pd.FakePlacementDriverClient) ContainsKeyRequest(com.alipay.sofa.jraft.rhea.cmd.store.ContainsKeyRequest) RawKVStore(com.alipay.sofa.jraft.rhea.storage.RawKVStore) DeleteRangeRequest(com.alipay.sofa.jraft.rhea.cmd.store.DeleteRangeRequest) Strings(com.alipay.sofa.jraft.rhea.util.Strings) List(java.util.List) ResetSequenceRequest(com.alipay.sofa.jraft.rhea.cmd.store.ResetSequenceRequest) RegionEngine(com.alipay.sofa.jraft.rhea.RegionEngine) BoolFailoverFuture(com.alipay.sofa.jraft.rhea.client.failover.impl.BoolFailoverFuture) JRaftHelper(com.alipay.sofa.jraft.rhea.JRaftHelper) ZipStrategyManager(com.alipay.sofa.jraft.rhea.storage.zip.ZipStrategyManager) RemotePlacementDriverClient(com.alipay.sofa.jraft.rhea.client.pd.RemotePlacementDriverClient) FailoverClosureImpl(com.alipay.sofa.jraft.rhea.client.failover.impl.FailoverClosureImpl) RheaKVStoreOptions(com.alipay.sofa.jraft.rhea.options.RheaKVStoreOptions) Requires(com.alipay.sofa.jraft.util.Requires) Histogram(com.codahale.metrics.Histogram) RheaRuntimeException(com.alipay.sofa.jraft.rhea.errors.RheaRuntimeException) BatchPutRequest(com.alipay.sofa.jraft.rhea.cmd.store.BatchPutRequest) StackTraceUtil(com.alipay.sofa.jraft.rhea.util.StackTraceUtil) CompletableFuture(java.util.concurrent.CompletableFuture) FollowerStateListener(com.alipay.sofa.jraft.rhea.FollowerStateListener) Utils(com.alipay.sofa.jraft.util.Utils) ErrorsHelper(com.alipay.sofa.jraft.rhea.errors.ErrorsHelper) BatchDeleteRequest(com.alipay.sofa.jraft.rhea.cmd.store.BatchDeleteRequest) StateListenerContainer(com.alipay.sofa.jraft.rhea.StateListenerContainer) RetryCallable(com.alipay.sofa.jraft.rhea.client.failover.RetryCallable) GetRequest(com.alipay.sofa.jraft.rhea.cmd.store.GetRequest) Errors(com.alipay.sofa.jraft.rhea.errors.Errors) StateListener(com.alipay.sofa.jraft.rhea.StateListener) GetAndPutRequest(com.alipay.sofa.jraft.rhea.cmd.store.GetAndPutRequest) KeyLockRequest(com.alipay.sofa.jraft.rhea.cmd.store.KeyLockRequest) KeyUnlockRequest(com.alipay.sofa.jraft.rhea.cmd.store.KeyUnlockRequest) MapFailoverFuture(com.alipay.sofa.jraft.rhea.client.failover.impl.MapFailoverFuture) KVMetricNames(com.alipay.sofa.jraft.rhea.metrics.KVMetricNames) KVIterator(com.alipay.sofa.jraft.rhea.storage.KVIterator) NodeExecutor(com.alipay.sofa.jraft.rhea.storage.NodeExecutor) Dispatcher(com.alipay.sofa.jraft.rhea.util.concurrent.disruptor.Dispatcher) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) StoreEngine(com.alipay.sofa.jraft.rhea.StoreEngine) MultiGetRequest(com.alipay.sofa.jraft.rhea.cmd.store.MultiGetRequest) EventHandler(com.lmax.disruptor.EventHandler) PutIfAbsentRequest(com.alipay.sofa.jraft.rhea.cmd.store.PutIfAbsentRequest) Logger(org.slf4j.Logger) RetryRunner(com.alipay.sofa.jraft.rhea.client.failover.RetryRunner) GetSequenceRequest(com.alipay.sofa.jraft.rhea.cmd.store.GetSequenceRequest) RingBuffer(com.lmax.disruptor.RingBuffer) AffinityNamedThreadFactory(com.alipay.sofa.jraft.rhea.util.concurrent.AffinityNamedThreadFactory) ListRetryCallable(com.alipay.sofa.jraft.rhea.client.failover.ListRetryCallable) Status(com.alipay.sofa.jraft.Status) ByteArray(com.alipay.sofa.jraft.rhea.util.ByteArray) NodeExecuteRequest(com.alipay.sofa.jraft.rhea.cmd.store.NodeExecuteRequest) TimeUnit(java.util.concurrent.TimeUnit) StoreEngineOptions(com.alipay.sofa.jraft.rhea.options.StoreEngineOptions) Sequence(com.alipay.sofa.jraft.rhea.storage.Sequence) RpcOptions(com.alipay.sofa.jraft.rhea.options.RpcOptions) KVEntry(com.alipay.sofa.jraft.rhea.storage.KVEntry) Collections(java.util.Collections) LeaderStateListener(com.alipay.sofa.jraft.rhea.LeaderStateListener) EventFactory(com.lmax.disruptor.EventFactory) Disruptor(com.lmax.disruptor.dsl.Disruptor) BytesUtil(com.alipay.sofa.jraft.util.BytesUtil) FailoverClosureImpl(com.alipay.sofa.jraft.rhea.client.failover.impl.FailoverClosureImpl) RawKVStore(com.alipay.sofa.jraft.rhea.storage.RawKVStore) CASAllRequest(com.alipay.sofa.jraft.rhea.cmd.store.CASAllRequest) RegionEngine(com.alipay.sofa.jraft.rhea.RegionEngine) RetryRunner(com.alipay.sofa.jraft.rhea.client.failover.RetryRunner)

Example 5 with CASEntry

use of com.alipay.sofa.jraft.rhea.storage.CASEntry in project sofa-jraft by sofastack.

the class DefaultRegionKVService method handleCompareAndPutAll.

@Override
public void handleCompareAndPutAll(final CASAllRequest request, final RequestProcessClosure<BaseRequest, BaseResponse<?>> closure) {
    final CASAllResponse response = new CASAllResponse();
    response.setRegionId(getRegionId());
    response.setRegionEpoch(getRegionEpoch());
    try {
        KVParameterRequires.requireSameEpoch(request, getRegionEpoch());
        final List<CASEntry> casEntries = KVParameterRequires.requireNonEmpty(request.getCasEntries(), "casAll.casEntries");
        this.rawKVStore.compareAndPutAll(casEntries, new BaseKVStoreClosure() {

            @Override
            public void run(final Status status) {
                if (status.isOk()) {
                    response.setValue((Boolean) getData());
                } else {
                    setFailure(request, response, status, getError());
                }
                closure.sendResponse(response);
            }
        });
    } catch (final Throwable t) {
        LOG.error("Failed to handle: {}, {}.", request, StackTraceUtil.stackTrace(t));
        response.setError(Errors.forException(t));
        closure.sendResponse(response);
    }
}
Also used : Status(com.alipay.sofa.jraft.Status) BaseKVStoreClosure(com.alipay.sofa.jraft.rhea.storage.BaseKVStoreClosure) CASAllResponse(com.alipay.sofa.jraft.rhea.cmd.store.CASAllResponse) CASEntry(com.alipay.sofa.jraft.rhea.storage.CASEntry)

Aggregations

CASEntry (com.alipay.sofa.jraft.rhea.storage.CASEntry)5 Status (com.alipay.sofa.jraft.Status)3 ByteArray (com.alipay.sofa.jraft.rhea.util.ByteArray)3 RouteTable (com.alipay.sofa.jraft.RouteTable)2 PeerId (com.alipay.sofa.jraft.entity.PeerId)2 DescriberManager (com.alipay.sofa.jraft.rhea.DescriberManager)2 FollowerStateListener (com.alipay.sofa.jraft.rhea.FollowerStateListener)2 JRaftHelper (com.alipay.sofa.jraft.rhea.JRaftHelper)2 LeaderStateListener (com.alipay.sofa.jraft.rhea.LeaderStateListener)2 RegionEngine (com.alipay.sofa.jraft.rhea.RegionEngine)2 StateListener (com.alipay.sofa.jraft.rhea.StateListener)2 StateListenerContainer (com.alipay.sofa.jraft.rhea.StateListenerContainer)2 StoreEngine (com.alipay.sofa.jraft.rhea.StoreEngine)2 FailoverClosure (com.alipay.sofa.jraft.rhea.client.failover.FailoverClosure)2 ListRetryCallable (com.alipay.sofa.jraft.rhea.client.failover.ListRetryCallable)2 RetryCallable (com.alipay.sofa.jraft.rhea.client.failover.RetryCallable)2 RetryRunner (com.alipay.sofa.jraft.rhea.client.failover.RetryRunner)2 BoolFailoverFuture (com.alipay.sofa.jraft.rhea.client.failover.impl.BoolFailoverFuture)2 FailoverClosureImpl (com.alipay.sofa.jraft.rhea.client.failover.impl.FailoverClosureImpl)2 ListFailoverFuture (com.alipay.sofa.jraft.rhea.client.failover.impl.ListFailoverFuture)2