Class VeniceMultiKeyPath<K>
- java.lang.Object
-
- com.linkedin.venice.router.api.path.VenicePath
-
- com.linkedin.venice.router.api.path.VeniceMultiKeyPath<K>
-
- All Implemented Interfaces:
ResourcePath<RouterKey>
- Direct Known Subclasses:
VeniceComputePath
,VeniceMultiGetPath
public abstract class VeniceMultiKeyPath<K> extends VenicePath
-
-
Field Summary
Fields Modifier and Type Field Description protected int
keyNum
protected java.util.Map<RouterKey,K>
routerKeyMap
-
Fields inherited from class com.linkedin.venice.router.api.path.VenicePath
retryManager, storeName, versionNumber
-
-
Constructor Summary
Constructors Constructor Description VeniceMultiKeyPath(java.lang.String storeName, int versionNumber, java.lang.String resourceName, boolean smartLongTailRetryEnabled, int smartLongTailRetryAbortThresholdMs, int longTailRetryMaxRouteForMultiKeyReq, RetryManager retryManager)
VeniceMultiKeyPath(java.lang.String storeName, int versionNumber, java.lang.String resourceName, boolean smartLongTailRetryEnabled, int smartLongTailRetryAbortThresholdMs, java.util.Map<RouterKey,K> routerKeyMap, int longTailRetryMaxRouteForMultiKeyReq, RetryManager retryManager)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description org.apache.http.client.methods.HttpUriRequest
composeRouterRequestInternal(java.lang.String storageNodeUri)
protected abstract K
createRouterRequestKey(java.nio.ByteBuffer key, int keyIdx, int partitionId)
Create a router request key.protected abstract VenicePath
fixRetryRequestForSubPath(java.util.Map<RouterKey,K> routerKeyMap)
byte[]
getBody()
io.netty.handler.codec.http.HttpMethod
getHttpMethod()
int
getLongTailRetryMaxRouteForMultiKeyReq()
void
initialize(java.lang.String storeName, java.lang.String resourceName, java.util.List<java.nio.ByteBuffer> keys, VenicePartitionFinder partitionFinder, int maxKeyCount, RouterStats<AggRouterHttpRequestStats> stats)
Fill the router key map and the index2routerKey map.boolean
isLongTailRetryAllowedForNewRequest()
protected abstract byte[]
serializeRouterRequest()
For multi-get requests, simply serialize the set of RouterKey to bytes; for read compute requests, concatenate the compute request and the serialized keysprotected void
setupRetryRelatedInfo(VenicePath originalPath)
VenicePath
substitutePartitionKey(RouterKey s)
The following function is used to generate aVeniceMultiGetPath
or aVeniceComputePath
for a given key, and the generatedVenicePath
will be used to compose router request and forward to storage node; This function will be triggered by DDS router framework.VenicePath
substitutePartitionKey(java.util.Collection<RouterKey> s)
The following function is used to generate aVeniceMultiGetPath
or aVeniceComputePath
for a given key subset, and the generatedVenicePath
will be used to compose router request and forward to storage node; This function will be triggered by DDS router framework.-
Methods inherited from class com.linkedin.venice.router.api.path.VenicePath
canRequestStorageNode, composeRouterRequest, getChunkedResponse, getHelixGroupId, getLongTailRetryThresholdMs, getOriginalRequestStartTs, getPartitionKeys, getRequestId, getRequestSize, getRequestType, getResourceName, getResponseDecompressor, getResponseHeaders, getSmartLongTailRetryAbortThresholdMs, getStoreName, getStreamingRequestType, getVeniceApiVersionHeader, getVersionNumber, isLongTailRetryWithinBudget, isRetryRequest, isRetryRequestTooLate, isSmartLongTailRetryEnabled, isStreamingRequest, markStorageNodeAsFast, recordOriginalRequestStartTimestamp, recordRequest, requestStorageNode, setChunkedWriteHandler, setHelixGroupId, setLongTailRetryThresholdMs, setPartitionKeys, setResponseDecompressor, setResponseHeaders, setRetryRequest, setRetryRequest, setupVeniceHeaders
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.linkedin.alpini.router.api.ResourcePath
getLocation, getPartitionKey
-
-
-
-
Constructor Detail
-
VeniceMultiKeyPath
public VeniceMultiKeyPath(java.lang.String storeName, int versionNumber, java.lang.String resourceName, boolean smartLongTailRetryEnabled, int smartLongTailRetryAbortThresholdMs, int longTailRetryMaxRouteForMultiKeyReq, RetryManager retryManager)
-
VeniceMultiKeyPath
public VeniceMultiKeyPath(java.lang.String storeName, int versionNumber, java.lang.String resourceName, boolean smartLongTailRetryEnabled, int smartLongTailRetryAbortThresholdMs, java.util.Map<RouterKey,K> routerKeyMap, int longTailRetryMaxRouteForMultiKeyReq, RetryManager retryManager)
-
-
Method Detail
-
initialize
public void initialize(java.lang.String storeName, java.lang.String resourceName, java.util.List<java.nio.ByteBuffer> keys, VenicePartitionFinder partitionFinder, int maxKeyCount, RouterStats<AggRouterHttpRequestStats> stats) throws RouterException
Fill the router key map and the index2routerKey map.- Parameters:
storeName
-resourceName
-keys
- Multiple keys from client request; keys have been deserialized to ByteBufferpartitionFinder
-maxKeyCount
-- Throws:
RouterException
-
substitutePartitionKey
public VenicePath substitutePartitionKey(RouterKey s)
The following function is used to generate aVeniceMultiGetPath
or aVeniceComputePath
for a given key, and the generatedVenicePath
will be used to compose router request and forward to storage node; This function will be triggered by DDS router framework.- Specified by:
substitutePartitionKey
in classVenicePath
- Parameters:
s
-- Returns:
-
substitutePartitionKey
public VenicePath substitutePartitionKey(@Nonnull java.util.Collection<RouterKey> s)
The following function is used to generate aVeniceMultiGetPath
or aVeniceComputePath
for a given key subset, and the generatedVenicePath
will be used to compose router request and forward to storage node; This function will be triggered by DDS router framework.- Specified by:
substitutePartitionKey
in classVenicePath
- Parameters:
s
-- Returns:
-
composeRouterRequestInternal
public org.apache.http.client.methods.HttpUriRequest composeRouterRequestInternal(java.lang.String storageNodeUri)
- Specified by:
composeRouterRequestInternal
in classVenicePath
-
getHttpMethod
public io.netty.handler.codec.http.HttpMethod getHttpMethod()
- Specified by:
getHttpMethod
in classVenicePath
-
getBody
public byte[] getBody()
- Specified by:
getBody
in classVenicePath
-
getLongTailRetryMaxRouteForMultiKeyReq
public int getLongTailRetryMaxRouteForMultiKeyReq()
-
isLongTailRetryAllowedForNewRequest
public boolean isLongTailRetryAllowedForNewRequest()
- Overrides:
isLongTailRetryAllowedForNewRequest
in classVenicePath
-
setupRetryRelatedInfo
protected void setupRetryRelatedInfo(VenicePath originalPath)
- Overrides:
setupRetryRelatedInfo
in classVenicePath
-
createRouterRequestKey
protected abstract K createRouterRequestKey(java.nio.ByteBuffer key, int keyIdx, int partitionId)
Create a router request key.- Parameters:
key
-keyIdx
-partitionId
-- Returns:
- An instance of ComputeRouterRequestKeyV1 for compute request; return an instance of MultiGetRouterRequestKeyV1 for multi-get
-
fixRetryRequestForSubPath
protected abstract VenicePath fixRetryRequestForSubPath(java.util.Map<RouterKey,K> routerKeyMap)
- Parameters:
routerKeyMap
-- Returns:
- a sub-path with a new set of keys
-
serializeRouterRequest
protected abstract byte[] serializeRouterRequest()
For multi-get requests, simply serialize the set of RouterKey to bytes; for read compute requests, concatenate the compute request and the serialized keys- Returns:
-
-