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.HttpUriRequestcomposeRouterRequestInternal(String storageNodeUri) protected abstract KcreateRouterRequestKey(ByteBuffer key, int keyIdx, int partitionId) Create a router request key.protected abstract VenicePathfixRetryRequestForSubPath(Map<RouterKey, K> routerKeyMap) byte[]getBody()intio.netty.handler.codec.http.HttpMethodintintlongintvoidinitialize(String resourceName, List<ByteBuffer> keys, VenicePartitionFinder partitionFinder, int maxKeyCount, AggRouterHttpRequestStats stats) Fill the router key map and the index2routerKey map.booleanbooleanprotected 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 keysvoidsetChunkedWriteHandler(io.netty.channel.ChannelHandlerContext ctx, VeniceChunkedWriteHandler chunkedWriteHandler, RouterStats<AggRouterHttpRequestStats> routerStats) voidsetHelixGroupId(int helixGroupId) protected voidsetupRetryRelatedInfo(VenicePath originalPath) The following function is used to generate aVeniceMultiGetPathor aVeniceComputePathfor a given key, and the generatedVenicePathwill 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 aVeniceMultiGetPathor aVeniceComputePathfor a given key subset, and the generatedVenicePathwill 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, setupVeniceHeadersMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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 aVeniceMultiGetPathor aVeniceComputePathfor a given key, and the generatedVenicePathwill be used to compose router request and forward to storage node; This function will be triggered by DDS router framework.- Specified by:
substitutePartitionKeyin classVenicePath- Parameters:
s-- Returns:
-
substitutePartitionKey
The following function is used to generate aVeniceMultiGetPathor aVeniceComputePathfor a given key subset, and the generatedVenicePathwill be used to compose router request and forward to storage node; This function will be triggered by DDS router framework.- Specified by:
substitutePartitionKeyin classVenicePath- Parameters:
s-- Returns:
-
composeRouterRequestInternal
public org.apache.http.client.methods.HttpUriRequest composeRouterRequestInternal(String storageNodeUri) - Specified by:
composeRouterRequestInternalin classVenicePath
-
getHttpMethod
public io.netty.handler.codec.http.HttpMethod getHttpMethod()- Specified by:
getHttpMethodin classVenicePath
-
getBody
public byte[] getBody()- Specified by:
getBodyin classVenicePath
-
getLongTailRetryMaxRouteForMultiKeyReq
public int getLongTailRetryMaxRouteForMultiKeyReq() -
isLongTailRetryAllowedForNewRequest
public boolean isLongTailRetryAllowedForNewRequest()- Overrides:
isLongTailRetryAllowedForNewRequestin classVenicePath
-
setupRetryRelatedInfo
- Overrides:
setupRetryRelatedInfoin classVenicePath
-
isSmartLongTailRetryEnabled
public boolean isSmartLongTailRetryEnabled()- Overrides:
isSmartLongTailRetryEnabledin classVenicePath
-
getSmartLongTailRetryAbortThresholdMs
public int getSmartLongTailRetryAbortThresholdMs()- Overrides:
getSmartLongTailRetryAbortThresholdMsin classVenicePath
-
getLongTailRetryThresholdMs
public int getLongTailRetryThresholdMs()- Specified by:
getLongTailRetryThresholdMsin classVenicePath
-
getRequestId
public long getRequestId()- Overrides:
getRequestIdin classVenicePath
-
getHelixGroupId
public int getHelixGroupId()- Overrides:
getHelixGroupIdin classVenicePath
-
setHelixGroupId
public void setHelixGroupId(int helixGroupId) - Overrides:
setHelixGroupIdin classVenicePath
-
setChunkedWriteHandler
public void setChunkedWriteHandler(io.netty.channel.ChannelHandlerContext ctx, VeniceChunkedWriteHandler chunkedWriteHandler, RouterStats<AggRouterHttpRequestStats> routerStats) - Overrides:
setChunkedWriteHandlerin classVenicePath
-
getChunkedResponse
- Overrides:
getChunkedResponsein 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:
-