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
-
Field Summary
Modifier and TypeFieldDescriptionprotected int
Fields inherited from class com.linkedin.venice.router.api.path.VenicePath
retryManager, storeName, versionNumber
-
Constructor Summary
ConstructorDescriptionVeniceMultiKeyPath
(String storeName, int versionNumber, String resourceName, boolean smartLongTailRetryEnabled, int smartLongTailRetryAbortThresholdMs, int longTailRetryMaxRouteForMultiKeyReq, RetryManager retryManager) VeniceMultiKeyPath
(String storeName, int versionNumber, String resourceName, boolean smartLongTailRetryEnabled, int smartLongTailRetryAbortThresholdMs, Map<RouterKey, K> routerKeyMap, int longTailRetryMaxRouteForMultiKeyReq, RetryManager retryManager) -
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()
io.netty.handler.codec.http.HttpMethod
int
void
initialize
(String storeName, String resourceName, List<ByteBuffer> keys, VenicePartitionFinder partitionFinder, int maxKeyCount, RouterStats<AggRouterHttpRequestStats> stats) Fill the router key map and the index2routerKey map.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 keysprotected 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, 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
-
Field Details
-
keyNum
protected int keyNum -
routerKeyMap
-
-
Constructor Details
-
VeniceMultiKeyPath
public VeniceMultiKeyPath(String storeName, int versionNumber, String resourceName, boolean smartLongTailRetryEnabled, int smartLongTailRetryAbortThresholdMs, int longTailRetryMaxRouteForMultiKeyReq, RetryManager retryManager) -
VeniceMultiKeyPath
-
-
Method Details
-
initialize
public void initialize(String storeName, String resourceName, List<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
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
-
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:
-