Package com.linkedin.venice.fastclient
Class DualReadAvroGenericStoreClient<K,V>
- java.lang.Object
-
- com.linkedin.venice.fastclient.InternalAvroStoreClient<K,V>
-
- com.linkedin.venice.fastclient.DelegatingAvroStoreClient<K,V>
-
- com.linkedin.venice.fastclient.DualReadAvroGenericStoreClient<K,V>
-
- All Implemented Interfaces:
AvroGenericReadComputeStoreClient<K,V>
,AvroGenericStoreClient<K,V>
,java.io.Closeable
,java.lang.AutoCloseable
- Direct Known Subclasses:
DualReadAvroSpecificStoreClient
public class DualReadAvroGenericStoreClient<K,V> extends DelegatingAvroStoreClient<K,V>
The following class has capability to send dual read requests via Fast-client and Thin-client. 1. If both of them succeed, return the faster one. 2. If one of them fails, return the succeeded one. 3. If both of them fail, throw exception. Currently, this implementation only supports dual-read for single-get and batch-get requests. Compute requests have not been implemented for two reasons: 1. We prefer to do a gradual ramp of the feature as dual reads can lead to extra load on the storage nodes 2. The complexity of implementing dual reads for compute is higher and needs extra work to convert aStreamingCallback
into aFuture
.
-
-
Constructor Summary
Constructors Modifier Constructor Description DualReadAvroGenericStoreClient(InternalAvroStoreClient<K,V> delegate, ClientConfig config)
protected
DualReadAvroGenericStoreClient(InternalAvroStoreClient<K,V> delegate, ClientConfig config, AvroGenericStoreClient<K,V> thinClient)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.concurrent.CompletableFuture<java.util.Map<K,V>>
batchGet(BatchGetRequestContext<K,V> requestContext, java.util.Set<K> keys)
protected java.util.concurrent.CompletableFuture<V>
get(GetRequestContext requestContext, K key)
TODO both super.get(key) and super.get(ctx,key) fetches non map for vsonClient for the first request.-
Methods inherited from class com.linkedin.venice.fastclient.DelegatingAvroStoreClient
close, compute, compute, getClientConfig, getKeySchema, getLatestValueSchema, getSchemaReader, getStoreName, start, streamingBatchGet
-
Methods inherited from class com.linkedin.venice.fastclient.InternalAvroStoreClient
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
-
DualReadAvroGenericStoreClient
public DualReadAvroGenericStoreClient(InternalAvroStoreClient<K,V> delegate, ClientConfig config)
-
DualReadAvroGenericStoreClient
protected DualReadAvroGenericStoreClient(InternalAvroStoreClient<K,V> delegate, ClientConfig config, AvroGenericStoreClient<K,V> thinClient)
-
-
Method Detail
-
get
protected java.util.concurrent.CompletableFuture<V> get(GetRequestContext requestContext, K key) throws VeniceClientException
TODO both super.get(key) and super.get(ctx,key) fetches non map for vsonClient for the first request. Needs to be investigated- Overrides:
get
in classDelegatingAvroStoreClient<K,V>
- Throws:
VeniceClientException
-
batchGet
public java.util.concurrent.CompletableFuture<java.util.Map<K,V>> batchGet(BatchGetRequestContext<K,V> requestContext, java.util.Set<K> keys) throws VeniceClientException
- Overrides:
batchGet
in classInternalAvroStoreClient<K,V>
- Throws:
VeniceClientException
-
-