Package com.linkedin.venice.router.api
Class VeniceDelegateMode
- java.lang.Object
-
- com.linkedin.alpini.router.api.ScatterGatherMode
-
- com.linkedin.venice.router.api.VeniceDelegateMode
-
public class VeniceDelegateMode extends ScatterGatherMode
This class contains all theScatterGatherMode
being used in Venice Router. IMPORTANT!!! Inscatter(com.linkedin.alpini.router.api.Scatter<H, P, K>, java.lang.String, java.lang.String, com.linkedin.alpini.router.api.PartitionFinder<K>, com.linkedin.alpini.router.api.HostFinder<H, R>, com.linkedin.alpini.router.api.HostHealthMonitor<H>, R)
function, onlyRouterException
is expected, otherwise, the netty buffer leaking issue will happen. This vulnerability is related to Alpini sinceScatterGatherMode.scatter(com.linkedin.alpini.router.api.Scatter<H, P, K>, java.lang.String, java.lang.String, com.linkedin.alpini.router.api.PartitionFinder<K>, com.linkedin.alpini.router.api.HostFinder<H, R>, com.linkedin.alpini.router.api.HostHealthMonitor<H>, R)
only catchesRouterException
to return the exceptional future, otherwise, that function will throw exception to miss the release operation inScatterGatherRequestHandlerImpl.prepareRetry(com.linkedin.alpini.base.concurrency.AsyncFuture<H>, P, BHS, R, com.linkedin.alpini.base.concurrency.AsyncPromise<java.util.List<HR>>, com.linkedin.alpini.base.concurrency.AsyncFuture<java.lang.Void>, java.util.concurrent.Executor, com.linkedin.alpini.router.api.HostHealthMonitor<H>, com.linkedin.alpini.router.monitoring.ScatterGatherStats.Delta, com.linkedin.alpini.base.misc.Metrics)
. Here are the details: 1. If the current implementation ofscatter(com.linkedin.alpini.router.api.Scatter<H, P, K>, java.lang.String, java.lang.String, com.linkedin.alpini.router.api.PartitionFinder<K>, com.linkedin.alpini.router.api.HostFinder<H, R>, com.linkedin.alpini.router.api.HostHealthMonitor<H>, R)
throws other exceptions thanRouterException
,ScatterGatherMode.scatter(com.linkedin.alpini.router.api.Scatter<H, P, K>, java.lang.String, java.lang.String, com.linkedin.alpini.router.api.PartitionFinder<K>, com.linkedin.alpini.router.api.HostFinder<H, R>, com.linkedin.alpini.router.api.HostHealthMonitor<H>, R)
will rethrow the exception instead of returning an exceptional future. 2. For long-tail retry,ScatterGatherRequestHandlerImpl.prepareRetry(com.linkedin.alpini.base.concurrency.AsyncFuture<H>, P, BHS, R, com.linkedin.alpini.base.concurrency.AsyncPromise<java.util.List<HR>>, com.linkedin.alpini.base.concurrency.AsyncFuture<java.lang.Void>, java.util.concurrent.Executor, com.linkedin.alpini.router.api.HostHealthMonitor<H>, com.linkedin.alpini.router.monitoring.ScatterGatherStats.Delta, com.linkedin.alpini.base.misc.Metrics)
will retain the request every time, and it will try to release the request in the handling function of "_scatterGatherHelper.scatter" inScatterGatherRequestHandlerImpl.prepareRetry(com.linkedin.alpini.base.concurrency.AsyncFuture<H>, P, BHS, R, com.linkedin.alpini.base.concurrency.AsyncPromise<java.util.List<HR>>, com.linkedin.alpini.base.concurrency.AsyncFuture<java.lang.Void>, java.util.concurrent.Executor, com.linkedin.alpini.router.api.HostHealthMonitor<H>, com.linkedin.alpini.router.monitoring.ScatterGatherStats.Delta, com.linkedin.alpini.base.misc.Metrics)
. 3. If #1 happens, the handling function mentioned in #2 won't be invoked, which means the release won't happen, and this is causing the request leaking. TODO: maybe we should improve DDS lib to catch all kinds of exception inScatterGatherMode.scatter(com.linkedin.alpini.router.api.Scatter<H, P, K>, java.lang.String, java.lang.String, com.linkedin.alpini.router.api.PartitionFinder<K>, com.linkedin.alpini.router.api.HostFinder<H, R>, com.linkedin.alpini.router.api.HostHealthMonitor<H>, R)
to avoid this potential leaking issue.
-
-
Field Summary
-
Fields inherited from class com.linkedin.alpini.router.api.ScatterGatherMode
BROADCAST_BY_PARTITION, BROADCAST_BY_PRIMARY_HOST, GROUP_BY_GREEDY_HOST, GROUP_BY_PARTITION, GROUP_BY_PRIMARY_HOST
-
-
Constructor Summary
Constructors Constructor Description VeniceDelegateMode(VeniceRouterConfig config, RouterStats<AggRouterHttpRequestStats> routerStats, RouteHttpRequestStats routeHttpRequestStats)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
initHelixGroupSelector(HelixGroupSelector helixGroupSelector)
void
initReadRequestThrottler(RouterThrottler requestThrottler)
<H,P extends ResourcePath<K>,K,R>
Scatter<H,P,K>scatter(Scatter<H,P,K> scatter, java.lang.String requestMethod, java.lang.String resourceName, PartitionFinder<K> partitionFinder, HostFinder<H,R> hostFinder, HostHealthMonitor<H> hostHealthMonitor, R roles)
Deprecated method is compatible to old method signature.-
Methods inherited from class com.linkedin.alpini.router.api.ScatterGatherMode
asBroadcast, asScatter, equals, hashCode, scatter, toString
-
-
-
-
Constructor Detail
-
VeniceDelegateMode
public VeniceDelegateMode(VeniceRouterConfig config, RouterStats<AggRouterHttpRequestStats> routerStats, RouteHttpRequestStats routeHttpRequestStats)
-
-
Method Detail
-
initReadRequestThrottler
public void initReadRequestThrottler(RouterThrottler requestThrottler)
-
initHelixGroupSelector
public void initHelixGroupSelector(HelixGroupSelector helixGroupSelector)
-
scatter
@Nonnull public <H,P extends ResourcePath<K>,K,R> Scatter<H,P,K> scatter(@Nonnull Scatter<H,P,K> scatter, @Nonnull java.lang.String requestMethod, @Nonnull java.lang.String resourceName, @Nonnull PartitionFinder<K> partitionFinder, @Nonnull HostFinder<H,R> hostFinder, @Nonnull HostHealthMonitor<H> hostHealthMonitor, @Nonnull R roles) throws RouterException
Description copied from class:ScatterGatherMode
Deprecated method is compatible to old method signature.- Overrides:
scatter
in classScatterGatherMode
- Throws:
RouterException
-
-