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 Details

    • keyNum

      protected int keyNum
    • routerKeyMap

      protected final Map<RouterKey,K> routerKeyMap
  • Constructor Details

    • VeniceMultiKeyPath

      public VeniceMultiKeyPath(String storeName, int versionNumber, String resourceName, boolean smartLongTailRetryEnabled, int smartLongTailRetryAbortThresholdMs, int longTailRetryMaxRouteForMultiKeyReq, RetryManager retryManager)
    • VeniceMultiKeyPath

      public VeniceMultiKeyPath(String storeName, int versionNumber, String resourceName, boolean smartLongTailRetryEnabled, int smartLongTailRetryAbortThresholdMs, Map<RouterKey,K> routerKeyMap, int longTailRetryMaxRouteForMultiKeyReq, RetryManager retryManager)
  • 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 ByteBuffer
      partitionFinder -
      maxKeyCount -
      Throws:
      RouterException
    • substitutePartitionKey

      public VenicePath substitutePartitionKey(RouterKey s)
      The following function is used to generate a VeniceMultiGetPath or a VeniceComputePath for a given key, and the generated VenicePath 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 class VenicePath
      Parameters:
      s -
      Returns:
    • substitutePartitionKey

      public VenicePath substitutePartitionKey(@Nonnull Collection<RouterKey> s)
      The following function is used to generate a VeniceMultiGetPath or a VeniceComputePath for a given key subset, and the generated VenicePath 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 class VenicePath
      Parameters:
      s -
      Returns:
    • composeRouterRequestInternal

      public org.apache.http.client.methods.HttpUriRequest composeRouterRequestInternal(String storageNodeUri)
      Specified by:
      composeRouterRequestInternal in class VenicePath
    • getHttpMethod

      public io.netty.handler.codec.http.HttpMethod getHttpMethod()
      Specified by:
      getHttpMethod in class VenicePath
    • getBody

      public byte[] getBody()
      Specified by:
      getBody in class VenicePath
    • getLongTailRetryMaxRouteForMultiKeyReq

      public int getLongTailRetryMaxRouteForMultiKeyReq()
    • isLongTailRetryAllowedForNewRequest

      public boolean isLongTailRetryAllowedForNewRequest()
      Overrides:
      isLongTailRetryAllowedForNewRequest in class VenicePath
    • setupRetryRelatedInfo

      protected void setupRetryRelatedInfo(VenicePath originalPath)
      Overrides:
      setupRetryRelatedInfo in class VenicePath
    • createRouterRequestKey

      protected abstract K createRouterRequestKey(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(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: