Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup Unused Netty Code path as we are only using PipelineV2 #739

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ When updating the changelog, remember to be very clear about what behavior has c
and what APIs have changed, if applicable.

## [Unreleased]
- Cleanup the Technical debt by removing the unused code associated with Netty PipelineV1

## [29.22.15] - 2021-11-30
- Add mock response generator factory for BATCH_FINDER methods.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import com.linkedin.r2.message.stream.StreamResponse;
import com.linkedin.r2.transport.common.bridge.client.TransportClient;
import com.linkedin.r2.transport.common.bridge.common.TransportCallback;
import com.linkedin.r2.transport.http.client.common.ssl.SslSessionValidator;
import com.linkedin.r2.netty.common.ssl.SslSessionValidator;
import java.util.Map;
import java.util.concurrent.atomic.AtomicLong;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
package com.linkedin.d2.balancer.simple;

import com.linkedin.r2.transport.http.client.common.ssl.SslSessionValidator;
import com.linkedin.r2.netty.common.ssl.SslSessionValidator;
import java.util.List;


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import com.linkedin.common.callback.Callback;
import com.linkedin.common.util.None;
import com.linkedin.d2.balancer.clients.DegraderTrackerClient;
import com.linkedin.d2.balancer.clients.DegraderTrackerClientImpl;
import com.linkedin.d2.balancer.clients.RetryTrackerClient;
import com.linkedin.d2.balancer.clients.TrackerClient;
Expand All @@ -22,7 +21,6 @@

import java.net.URI;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,14 @@
import com.linkedin.r2.filter.R2Constants;
import com.linkedin.r2.message.RequestContext;
import com.linkedin.r2.message.rest.RestRequestBuilder;
import com.linkedin.r2.message.rest.RestResponse;
import com.linkedin.r2.message.stream.StreamRequestBuilder;
import com.linkedin.r2.message.stream.StreamResponse;
import com.linkedin.r2.message.stream.entitystream.EntityStreams;
import com.linkedin.r2.transport.common.TransportClientFactory;
import com.linkedin.r2.transport.common.bridge.client.TransportCallbackAdapter;
import com.linkedin.r2.transport.common.bridge.client.TransportClient;
import com.linkedin.r2.transport.http.client.HttpClientFactory;
import com.linkedin.r2.transport.http.client.common.ssl.SslSessionNotTrustedException;
import com.linkedin.r2.transport.http.client.common.ssl.SslSessionValidator;
import com.linkedin.r2.netty.common.ssl.SslSessionNotTrustedException;
import com.linkedin.r2.netty.common.ssl.SslSessionValidator;
import com.linkedin.test.util.ClockedExecutor;
import com.linkedin.util.clock.SystemClock;
import java.net.URI;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import com.linkedin.d2.discovery.event.SynchronousExecutorService;
import com.linkedin.d2.discovery.stores.mock.MockStore;
import com.linkedin.r2.transport.common.TransportClientFactory;
import com.linkedin.r2.transport.http.client.common.ssl.SslSessionNotTrustedException;
import com.linkedin.r2.netty.common.ssl.SslSessionNotTrustedException;
import java.net.URI;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,25 +121,18 @@ public void testClientMessageEcho() throws Exception

private boolean isAlpnFailureCombination()
{
return _clientProvider.getUsePipelineV2() &&
_clientProvider instanceof Https2ClientProvider &&
return _clientProvider instanceof Https2ClientProvider &&
_serverProvider instanceof Https1JettyServerProvider;
}

private boolean isClearTextUpgradeFailureCombination()
{
return _clientProvider.getUsePipelineV2() &&
_clientProvider instanceof Http2ClientProvider &&
return _clientProvider instanceof Http2ClientProvider &&
_serverProvider instanceof Http1JettyServerProvider;
}

private boolean isValidClearTextOrAlpnCombination()
{
if (!_clientProvider.getUsePipelineV2())
{
return false;
}

if (_clientProvider instanceof Https2ClientProvider &&
_serverProvider instanceof Https2JettyServerProvider)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,21 @@

import com.linkedin.common.callback.FutureCallback;
import com.linkedin.common.util.None;
import com.linkedin.r2.filter.FilterChain;
import com.linkedin.r2.filter.FilterChains;
import com.linkedin.r2.filter.message.stream.StreamFilterAdapters;
import com.linkedin.r2.message.rest.RestRequestBuilder;
import com.linkedin.r2.message.rest.RestResponse;
import com.linkedin.r2.sample.Bootstrap;
import com.linkedin.r2.transport.common.Client;
import com.linkedin.r2.transport.common.TransportClientFactory;
import com.linkedin.r2.transport.common.bridge.client.TransportClientAdapter;
import com.linkedin.r2.transport.common.bridge.server.TransportDispatcher;
import com.linkedin.r2.transport.common.bridge.server.TransportDispatcherBuilder;
import com.linkedin.r2.transport.http.client.HttpClientFactory;
import com.linkedin.r2.transport.http.common.HttpProtocolVersion;
import com.linkedin.r2.transport.http.server.HttpJettyServer;
import com.linkedin.r2.transport.http.server.HttpServer;
import com.linkedin.r2.transport.http.server.HttpServerFactory;
import java.net.URI;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Factory;
import org.testng.annotations.Test;
import test.r2.integ.clientserver.providers.AbstractEchoServiceTest;
import test.r2.integ.clientserver.providers.AbstractServiceTest;
import test.r2.integ.clientserver.providers.ClientServerConfiguration;
import test.r2.integ.clientserver.providers.client.ClientProvider;
import test.r2.integ.clientserver.providers.server.ServerProvider;
import test.r2.integ.helper.CaptureWireAttributesFilter;
import test.r2.integ.helper.EchoHandler;
import test.r2.integ.helper.LogEntityLengthFilter;
import test.r2.integ.helper.SendWireAttributeFilter;


/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
import com.linkedin.r2.message.RequestContext;
import com.linkedin.r2.sample.Bootstrap;
import com.linkedin.r2.sample.echo.rest.RestEchoClient;
import com.linkedin.r2.transport.http.client.common.ssl.SslSessionNotTrustedException;
import com.linkedin.r2.transport.http.client.common.ssl.SslSessionValidator;
import com.linkedin.r2.netty.common.ssl.SslSessionNotTrustedException;
import com.linkedin.r2.netty.common.ssl.SslSessionValidator;
import com.linkedin.test.util.ExceptionTestUtil;
import java.util.concurrent.TimeUnit;
import javax.net.ssl.SSLSession;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
import com.linkedin.r2.netty.common.SslHandlerUtil;
import com.linkedin.r2.transport.http.client.AsyncPool;
import com.linkedin.r2.transport.http.client.HttpClientFactory;
import com.linkedin.r2.transport.http.client.common.ChannelPoolManager;
import com.linkedin.r2.transport.http.client.common.ChannelPoolManagerFactoryImpl;
import com.linkedin.r2.transport.http.client.common.ChannelPoolManagerKey;
import com.linkedin.r2.transport.http.client.common.ChannelPoolManagerKeyBuilder;
import com.linkedin.r2.netty.common.ChannelPoolManager;
import com.linkedin.r2.netty.common.ChannelPoolManagerFactoryImpl;
import com.linkedin.r2.netty.common.ChannelPoolManagerKey;
import com.linkedin.r2.netty.common.ChannelPoolManagerKeyBuilder;
import io.netty.channel.Channel;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
Expand Down Expand Up @@ -68,7 +68,7 @@ public void testHttpsEarlyHandshakeHttp1() throws Exception

ChannelPoolManagerFactoryImpl channelPoolManagerFactory =
new ChannelPoolManagerFactoryImpl(eventLoopGroup, scheduler, SSL_SESSION_RESUMPTION_ENABLED,
_clientProvider.getUsePipelineV2(), HttpClientFactory.DEFAULT_CHANNELPOOL_WAITER_TIMEOUT,
HttpClientFactory.DEFAULT_CHANNELPOOL_WAITER_TIMEOUT,
HttpClientFactory.DEFAULT_CONNECT_TIMEOUT, HttpClientFactory.DEFAULT_SSL_HANDSHAKE_TIMEOUT);
SSLContext context = SslContextUtil.getContext();

Expand All @@ -80,7 +80,7 @@ public void testHttpsEarlyHandshakeHttp1() throws Exception
.setSSLParameters(context.getDefaultSSLParameters())
.build();

ChannelPoolManager channelPoolManager = channelPoolManagerFactory.buildRest(key);
ChannelPoolManager channelPoolManager = channelPoolManagerFactory.buildHttp1Stream(key);

InetAddress inetAddress = InetAddress.getByName("localhost");
final SocketAddress address = new InetSocketAddress(inetAddress, _port);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import com.linkedin.r2.transport.common.bridge.server.TransportDispatcher;
import com.linkedin.r2.transport.common.bridge.server.TransportDispatcherBuilder;
import com.linkedin.r2.transport.http.client.HttpClientFactory;
import com.linkedin.test.util.retry.ThreeRetries;
import java.net.URI;
import java.nio.charset.Charset;
import java.util.Collections;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import com.linkedin.r2.transport.common.bridge.server.TransportDispatcher;
import com.linkedin.r2.transport.common.bridge.server.TransportDispatcherBuilder;
import com.linkedin.r2.transport.http.client.HttpClientFactory;
import com.linkedin.util.clock.SystemClock;
import java.net.URI;
import java.util.HashMap;
import java.util.Map;
Expand Down Expand Up @@ -72,7 +71,7 @@ public class TestStreamingTimeout extends AbstractServiceTest
private static final int HTTP_REQUEST_TIMEOUT = 30000;
private static RequestHandler _requestHandler;

@Factory(dataProvider = "allPipelineV2StreamCombinations", dataProviderClass = ClientServerConfiguration.class)
@Factory(dataProvider = "allStreamCombinations", dataProviderClass = ClientServerConfiguration.class)
public TestStreamingTimeout(ClientProvider clientProvider, ServerProvider serverProvider, int port)
{
super(clientProvider, serverProvider, port);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,7 @@ protected URI getHttpUri(URI relativeUri)
//Http2 Stream based channel is available on http2 new pipeline
protected boolean isHttp2StreamBasedChannel()
{
if(_clientProvider instanceof Http2ClientProvider || _clientProvider instanceof Https2ClientProvider)
{
return _clientProvider.getUsePipelineV2();
}

return false;
return _clientProvider instanceof Http2ClientProvider || _clientProvider instanceof Https2ClientProvider;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -56,31 +56,6 @@ public static Object[][] allStreamCombinations()
return ArrayUtils.addAll(allHttpStream(), allHttpsStream());
}

@DataProvider
public static Object[][] allPipelineV2StreamCombinations()
{
List<Object[]> streamCombinations = new ArrayList<>();
Object[][] allStreamCombinations = allStreamCombinations();
for (Object[] allStreamCombination : allStreamCombinations)
{
ClientProvider clientProvider = (ClientProvider) allStreamCombination[0];
if (clientProvider.getUsePipelineV2())
{
streamCombinations.add(allStreamCombination);
}
}

Object[][] filteredStreamCombinations = new Object[streamCombinations.size()][3];
for(int i=0; i<streamCombinations.size(); i++)
{
filteredStreamCombinations[i][0] = streamCombinations.get(i)[0];
filteredStreamCombinations[i][1] = streamCombinations.get(i)[1];
filteredStreamCombinations[i][2] = streamCombinations.get(i)[2];
}

return filteredStreamCombinations;
}

@DataProvider
public static Object[][] allRestCombinations()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,12 @@
public abstract class AbstractClientProvider implements ClientProvider
{
protected final boolean _clientROS;
protected boolean _usePipelineV2;
private List<HttpClientFactory> _httpClientFactoryList;
private final static NioEventLoopGroup _nioEventLoopGroup = new NioEventLoopGroup(5, new NamedThreadFactory("R2 Nio EventLoop Integration Test"));

protected AbstractClientProvider(boolean clientROS)
{
this(clientROS, false);
}

protected AbstractClientProvider(boolean clientROS, boolean usePipelineV2)
{
_clientROS = clientROS;
_usePipelineV2 = usePipelineV2;
_httpClientFactoryList = new ArrayList<>();
}

Expand All @@ -64,12 +57,6 @@ public Client createClient(FilterChain filters, Map<String, Object> clientProper
return createClient(createHttpClientFactory(filters), clientProperties);
}

@Override
public boolean getUsePipelineV2()
{
return _usePipelineV2;
}

@Override
public void tearDown()
{
Expand All @@ -91,15 +78,15 @@ public void onSuccess(None result) {
@Override
public String toString()
{
return "[" + getClass().getName() + ", stream=" + _clientROS +", _usePipelineV2=" + _usePipelineV2 + "]";
return "[" + getClass().getName() + ", stream=" + _clientROS + "]";
}

protected abstract Client createClient(HttpClientFactory httpClientFactory, Map<String, Object> clientProperties)
throws Exception;

private HttpClientFactory createHttpClientFactory(FilterChain filters)
{
HttpClientFactory httpClientFactory = Bootstrap.createHttpClientFactory(filters, _usePipelineV2, _nioEventLoopGroup);
HttpClientFactory httpClientFactory = Bootstrap.createHttpClientFactory(filters, _nioEventLoopGroup);
_httpClientFactoryList.add(httpClientFactory);
return httpClientFactory;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,5 @@ default URI createHttpURI(int port, URI relativeURI)
return Bootstrap.createHttpURI(port, relativeURI);
}

boolean getUsePipelineV2();

void tearDown();
}
Loading