Class VeniceMultiKeyPath<K>
java.lang.Object
com.linkedin.venice.router.api.path.VenicePath
com.linkedin.venice.router.api.path.VeniceMultiKeyPath<K>
- Type Parameters:
K
- the key wrapper to be sent to servers for the given type of query
- All Implemented Interfaces:
ResourcePath<RouterKey>
- Direct Known Subclasses:
VeniceComputePath
,VeniceMultiGetPath
Multi-key requests support many additional functionalities compared to single gets, including:
- Smart long-tail retry configurations
- Streaming responses
- Helix-assisted routing (HAR)
-
Field Summary
FieldsFields inherited from class com.linkedin.venice.router.api.path.VenicePath
retryConfig, retryManager, storeVersionName
-
Constructor Summary
ConstructorsConstructorDescriptionVeniceMultiKeyPath
(StoreVersionName storeVersionName, RouterRetryConfig retryConfig, RetryManager retryManager, VeniceResponseDecompressor responseDecompressor) VeniceMultiKeyPath
(StoreVersionName storeVersionName, Map<RouterKey, K> routerKeyMap, RouterRetryConfig retryConfig, RetryManager retryManager, VeniceResponseDecompressor responseDecompressor) -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.http.client.methods.HttpUriRequest
composeRouterRequestInternal
(String storageNodeUri) protected abstract K
createRouterRequestKey
(ByteBuffer key, int keyIdx, int partitionId) Create a router request key.protected abstract VenicePath
fixRetryRequestForSubPath
(Map<RouterKey, K> routerKeyMap) byte[]
getBody()
int
io.netty.handler.codec.http.HttpMethod
int
int
long
int
void
initialize
(String resourceName, List<ByteBuffer> keys, VenicePartitionFinder partitionFinder, int maxKeyCount, AggRouterHttpRequestStats stats) Fill the router key map and the index2routerKey map.boolean
boolean
protected abstract byte[]
For multi-get requests, simply serialize the set of RouterKey to bytes; for read compute requests, concatenate the compute request and the serialized keysvoid
setChunkedWriteHandler
(io.netty.channel.ChannelHandlerContext ctx, VeniceChunkedWriteHandler chunkedWriteHandler, RouterStats<AggRouterHttpRequestStats> routerStats) void
setHelixGroupId
(int helixGroupId) protected void
setupRetryRelatedInfo
(VenicePath originalPath) 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.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, getClientComputeHeader, getOriginalRequestStartTs, getPartitionKeys, getRequestSize, getRequestType, getResourceName, getResponseDecompressor, getStoreName, getStreamingRequestType, getTime, getVeniceApiVersionHeader, getVersionNumber, isLongTailRetryWithinBudget, isRetryRequest, isRetryRequestTooLate, isStreamingRequest, markStorageNodeAsFast, recordOriginalRequestStartTimestamp, recordRequest, requestStorageNode, setPartitionKeys, 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
-
Field Details
-
routerKeyMap
-
-
Constructor Details
-
VeniceMultiKeyPath
public VeniceMultiKeyPath(StoreVersionName storeVersionName, RouterRetryConfig retryConfig, RetryManager retryManager, VeniceResponseDecompressor responseDecompressor) -
VeniceMultiKeyPath
public VeniceMultiKeyPath(StoreVersionName storeVersionName, Map<RouterKey, K> routerKeyMap, RouterRetryConfig retryConfig, RetryManager retryManager, VeniceResponseDecompressor responseDecompressor)
-
-
Method Details
-
initialize
public void initialize(String resourceName, List<ByteBuffer> keys, VenicePartitionFinder partitionFinder, int maxKeyCount, AggRouterHttpRequestStats stats) throws RouterException Fill the router key map and the index2routerKey map.- Parameters:
resourceName
-keys
- Multiple keys from client request; keys have been deserialized to ByteBufferpartitionFinder
-maxKeyCount
-- Throws:
RouterException
-
substitutePartitionKey
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
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(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
- Overrides:
setupRetryRelatedInfo
in classVenicePath
-
isSmartLongTailRetryEnabled
public boolean isSmartLongTailRetryEnabled()- Overrides:
isSmartLongTailRetryEnabled
in classVenicePath
-
getSmartLongTailRetryAbortThresholdMs
public int getSmartLongTailRetryAbortThresholdMs()- Overrides:
getSmartLongTailRetryAbortThresholdMs
in classVenicePath
-
getLongTailRetryThresholdMs
public int getLongTailRetryThresholdMs()- Specified by:
getLongTailRetryThresholdMs
in classVenicePath
-
getRequestId
public long getRequestId()- Overrides:
getRequestId
in classVenicePath
-
getHelixGroupId
public int getHelixGroupId()- Overrides:
getHelixGroupId
in classVenicePath
-
setHelixGroupId
public void setHelixGroupId(int helixGroupId) - Overrides:
setHelixGroupId
in classVenicePath
-
setChunkedWriteHandler
public void setChunkedWriteHandler(io.netty.channel.ChannelHandlerContext ctx, VeniceChunkedWriteHandler chunkedWriteHandler, RouterStats<AggRouterHttpRequestStats> routerStats) - Overrides:
setChunkedWriteHandler
in classVenicePath
-
getChunkedResponse
- Overrides:
getChunkedResponse
in classVenicePath
-
createRouterRequestKey
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
- 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:
-