Package com.linkedin.venice.fastclient
Class RetriableAvroGenericStoreClient<K,V>
- java.lang.Object
-
- com.linkedin.venice.fastclient.InternalAvroStoreClient<K,V>
-
- com.linkedin.venice.fastclient.DelegatingAvroStoreClient<K,V>
-
- com.linkedin.venice.fastclient.RetriableAvroGenericStoreClient<K,V>
-
- All Implemented Interfaces:
AvroGenericReadComputeStoreClient<K,V>
,AvroGenericStoreClient<K,V>
,java.io.Closeable
,java.lang.AutoCloseable
- Direct Known Subclasses:
RetriableAvroSpecificStoreClient
public class RetriableAvroGenericStoreClient<K,V> extends DelegatingAvroStoreClient<K,V>
This class is mostly used to trigger retry in the following scenarios: 1. The original request latency exceeds the retry threshold. 2. The original request fails. TODO: 1. Limit the retry volume. 2. Leverage some smart logic to avoid useless retry, such as retry triggered by heavy GC.
-
-
Constructor Summary
Constructors Constructor Description RetriableAvroGenericStoreClient(InternalAvroStoreClient<K,V> delegate, ClientConfig clientConfig, TimeoutProcessor timeoutProcessor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Release the internal resources.void
compute(ComputeRequestContext<K,V> requestContext, ComputeRequestWrapper computeRequestWrapper, java.util.Set<K> keys, org.apache.avro.Schema resultSchema, StreamingCallback<K,ComputeGenericRecord> callback, long preRequestTimeInNS)
protected java.util.concurrent.CompletableFuture<V>
get(GetRequestContext requestContext, K key)
TODO: Limit the retry volume: Even though retry for a single request is being scheduled at max twice (once via scheduler (LONG_TAIL_RETRY) and once instant (ERROR_RETRY) if originalRequestFuture fails), there is no way to control the total allowed retry per node.void
streamingBatchGet(BatchGetRequestContext<K,V> requestContext, java.util.Set<K> keys, StreamingCallback<K,V> callback)
-
Methods inherited from class com.linkedin.venice.fastclient.DelegatingAvroStoreClient
compute, getClientConfig, getKeySchema, getLatestValueSchema, getSchemaReader, getStoreName, start
-
Methods inherited from class com.linkedin.venice.fastclient.InternalAvroStoreClient
batchGet, batchGet, compute, computeWithKeyPrefixFilter, get, isProjectionFieldValidationEnabled, streamingBatchGet, streamingBatchGet, streamingBatchGet
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.linkedin.venice.client.store.AvroGenericReadComputeStoreClient
compute, compute, compute
-
Methods inherited from interface com.linkedin.venice.client.store.AvroGenericStoreClient
get
-
-
-
-
Constructor Detail
-
RetriableAvroGenericStoreClient
public RetriableAvroGenericStoreClient(InternalAvroStoreClient<K,V> delegate, ClientConfig clientConfig, TimeoutProcessor timeoutProcessor)
-
-
Method Detail
-
get
protected java.util.concurrent.CompletableFuture<V> get(GetRequestContext requestContext, K key) throws VeniceClientException
TODO: Limit the retry volume: Even though retry for a single request is being scheduled at max twice (once via scheduler (LONG_TAIL_RETRY) and once instant (ERROR_RETRY) if originalRequestFuture fails), there is no way to control the total allowed retry per node. It would be good to design some mechanism to make it configurable, such as retry at most the slowest 5% of traffic, otherwise, too many retry requests could cause cascading failure.- Overrides:
get
in classDelegatingAvroStoreClient<K,V>
- Throws:
VeniceClientException
-
streamingBatchGet
public void streamingBatchGet(BatchGetRequestContext<K,V> requestContext, java.util.Set<K> keys, StreamingCallback<K,V> callback) throws VeniceClientException
- Overrides:
streamingBatchGet
in classDelegatingAvroStoreClient<K,V>
- Throws:
VeniceClientException
-
compute
public void compute(ComputeRequestContext<K,V> requestContext, ComputeRequestWrapper computeRequestWrapper, java.util.Set<K> keys, org.apache.avro.Schema resultSchema, StreamingCallback<K,ComputeGenericRecord> callback, long preRequestTimeInNS) throws VeniceClientException
- Overrides:
compute
in classDelegatingAvroStoreClient<K,V>
- Throws:
VeniceClientException
-
close
public void close()
Description copied from interface:AvroGenericStoreClient
Release the internal resources.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfaceAvroGenericStoreClient<K,V>
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classDelegatingAvroStoreClient<K,V>
-
-