diff --git a/pom.xml b/pom.xml index dd2378a652763..64cbc2332417b 100644 --- a/pom.xml +++ b/pom.xml @@ -84,8 +84,8 @@ 1.27.1 4.30.2 12.0.29 - 4.1.130.Final - 1.2.8 + 4.2.10.Final + 1.3.3 2.5 2.12.1 3.18.0 @@ -1649,6 +1649,12 @@ ${dep.reactor-netty.version} + + io.projectreactor + reactor-core + 3.8.3 + + org.apache.thrift libthrift diff --git a/presto-function-namespace-managers/pom.xml b/presto-function-namespace-managers/pom.xml index 2bc7e2c752283..1329c0554f9fb 100644 --- a/presto-function-namespace-managers/pom.xml +++ b/presto-function-namespace-managers/pom.xml @@ -189,6 +189,11 @@ drift-transport-netty + + io.netty + netty-buffer + + com.facebook.presto diff --git a/presto-function-namespace-managers/src/main/java/com/facebook/presto/functionNamespace/mysql/MySqlFunctionNamespaceManagerFactory.java b/presto-function-namespace-managers/src/main/java/com/facebook/presto/functionNamespace/mysql/MySqlFunctionNamespaceManagerFactory.java index 666d47ce13f7c..ab37fcd3d844f 100644 --- a/presto-function-namespace-managers/src/main/java/com/facebook/presto/functionNamespace/mysql/MySqlFunctionNamespaceManagerFactory.java +++ b/presto-function-namespace-managers/src/main/java/com/facebook/presto/functionNamespace/mysql/MySqlFunctionNamespaceManagerFactory.java @@ -22,6 +22,7 @@ import com.facebook.presto.spi.function.FunctionNamespaceManagerFactory; import com.facebook.presto.spi.function.SqlFunctionHandle; import com.google.inject.Injector; +import io.netty.buffer.PooledByteBufAllocator; import java.util.Map; @@ -51,7 +52,7 @@ public FunctionNamespaceManager create(String catalogName, Map com.facebook.presto:presto-ui + + io.netty:* true diff --git a/presto-main-base/src/main/java/com/facebook/presto/execution/SafeEventLoopGroup.java b/presto-main-base/src/main/java/com/facebook/presto/execution/SafeEventLoopGroup.java index bca2888c6b395..1bb157db5910e 100644 --- a/presto-main-base/src/main/java/com/facebook/presto/execution/SafeEventLoopGroup.java +++ b/presto-main-base/src/main/java/com/facebook/presto/execution/SafeEventLoopGroup.java @@ -52,6 +52,7 @@ public SafeEventLoopGroup(int nThreads, ThreadFactory threadFactory, long slowMe @Override protected EventLoop newChild(Executor executor, Object... args) + throws Exception { return new SafeEventLoop(this, executor); } @@ -71,7 +72,7 @@ protected void run() Runnable task = takeTask(); if (task != null) { try { - runTask(task); + task.run(); } catch (Throwable t) { log.error(t, "Error executing task on event loop"); diff --git a/presto-main/pom.xml b/presto-main/pom.xml index f8a9f3c4ecdac..f4d43c061dc65 100644 --- a/presto-main/pom.xml +++ b/presto-main/pom.xml @@ -311,7 +311,6 @@ io.projectreactor reactor-core - 3.8.0-M2 diff --git a/presto-main/src/main/java/com/facebook/presto/server/PrestoServer.java b/presto-main/src/main/java/com/facebook/presto/server/PrestoServer.java index 14c66a6a95483..bf64294640107 100644 --- a/presto-main/src/main/java/com/facebook/presto/server/PrestoServer.java +++ b/presto-main/src/main/java/com/facebook/presto/server/PrestoServer.java @@ -120,6 +120,13 @@ public void run() verifyJvmRequirements(); verifySystemTimeIsReasonable(); + // Netty 4.2 enables SSL endpoint verification by default. The Drift Netty transport + // does not pass hostnames to the SSL engine, causing SSLHandshakeException. Disable + // the default endpoint verification until Drift is updated to support it. + if (System.getProperty("io.netty.handler.ssl.defaultEndpointVerificationAlgorithm") == null) { + System.setProperty("io.netty.handler.ssl.defaultEndpointVerificationAlgorithm", "NONE"); + } + Logger log = Logger.get(PrestoServer.class); ImmutableList.Builder modules = ImmutableList.builder(); diff --git a/presto-main/src/main/java/com/facebook/presto/server/ServerMainModule.java b/presto-main/src/main/java/com/facebook/presto/server/ServerMainModule.java index f54a113c0a917..67f98fb3f57bc 100644 --- a/presto-main/src/main/java/com/facebook/presto/server/ServerMainModule.java +++ b/presto-main/src/main/java/com/facebook/presto/server/ServerMainModule.java @@ -265,6 +265,7 @@ import com.google.inject.TypeLiteral; import com.google.inject.multibindings.MapBinder; import io.airlift.slice.Slice; +import io.netty.buffer.PooledByteBufAllocator; import jakarta.annotation.PreDestroy; import jakarta.inject.Singleton; import jakarta.servlet.Filter; @@ -628,7 +629,7 @@ public ListeningExecutorService createResourceManagerExecutor(ResourceManagerCon config.setMaxContentLength(new DataSize(32, MEGABYTE)); }); - binder.install(new DriftNettyClientModule()); + binder.install(new DriftNettyClientModule(PooledByteBufAllocator.DEFAULT)); driftClientBinder(binder).bindDriftClient(ThriftTaskClient.class, ForExchange.class) .withAddressSelector(((addressSelectorBinder, annotation, prefix) -> addressSelectorBinder.bind(AddressSelector.class).annotatedWith(annotation).to(FixedAddressSelector.class))); diff --git a/presto-main/src/main/java/com/facebook/presto/server/remotetask/HttpRemoteTaskFactory.java b/presto-main/src/main/java/com/facebook/presto/server/remotetask/HttpRemoteTaskFactory.java index 294f8d27cf068..b3facd515a963 100644 --- a/presto-main/src/main/java/com/facebook/presto/server/remotetask/HttpRemoteTaskFactory.java +++ b/presto-main/src/main/java/com/facebook/presto/server/remotetask/HttpRemoteTaskFactory.java @@ -50,7 +50,6 @@ import com.facebook.presto.sql.planner.PlanFragment; import com.google.common.collect.Multimap; import com.google.common.util.concurrent.ThreadFactoryBuilder; -import io.netty.channel.EventLoop; import io.netty.util.concurrent.AbstractEventExecutorGroup; import jakarta.annotation.PreDestroy; import jakarta.inject.Inject; @@ -205,14 +204,7 @@ else if (binaryTransportEnabled) { this.taskUpdateSizeTrackingEnabled = taskConfig.isTaskUpdateSizeTrackingEnabled(); this.eventLoopGroup = Optional.of(new SafeEventLoopGroup(config.getRemoteTaskMaxCallbackThreads(), - new ThreadFactoryBuilder().setNameFormat("task-event-loop-%s").setDaemon(true).build(), taskConfig.getSlowMethodThresholdOnEventLoop()) - { - @Override - protected EventLoop newChild(Executor executor, Object... args) - { - return new SafeEventLoop(this, executor); - } - }); + new ThreadFactoryBuilder().setNameFormat("task-event-loop-%s").setDaemon(true).build(), taskConfig.getSlowMethodThresholdOnEventLoop())); } @Managed diff --git a/presto-tests/pom.xml b/presto-tests/pom.xml index e907fa0868449..f1b49251de559 100644 --- a/presto-tests/pom.xml +++ b/presto-tests/pom.xml @@ -264,6 +264,11 @@ drift-transport-netty + + io.netty + netty-buffer + + jakarta.servlet jakarta.servlet-api diff --git a/presto-tests/src/main/java/com/facebook/presto/tests/H2FunctionNamespaceManagerFactory.java b/presto-tests/src/main/java/com/facebook/presto/tests/H2FunctionNamespaceManagerFactory.java index 420044f21ca41..b8a1c227f01ae 100644 --- a/presto-tests/src/main/java/com/facebook/presto/tests/H2FunctionNamespaceManagerFactory.java +++ b/presto-tests/src/main/java/com/facebook/presto/tests/H2FunctionNamespaceManagerFactory.java @@ -24,6 +24,7 @@ import com.facebook.presto.spi.function.FunctionNamespaceManagerFactory; import com.facebook.presto.spi.function.SqlFunctionHandle; import com.google.inject.Injector; +import io.netty.buffer.PooledByteBufAllocator; import java.util.Map; @@ -53,7 +54,7 @@ public FunctionNamespaceManager create(String catalogName, Mapdrift-transport-netty + + io.netty + netty-buffer + + com.google.guava guava diff --git a/presto-thrift-connector/src/main/java/com/facebook/presto/connector/thrift/ThriftConnectorFactory.java b/presto-thrift-connector/src/main/java/com/facebook/presto/connector/thrift/ThriftConnectorFactory.java index 8b582274d6250..bb8b36becd16a 100644 --- a/presto-thrift-connector/src/main/java/com/facebook/presto/connector/thrift/ThriftConnectorFactory.java +++ b/presto-thrift-connector/src/main/java/com/facebook/presto/connector/thrift/ThriftConnectorFactory.java @@ -25,6 +25,7 @@ import com.facebook.presto.spi.relation.RowExpressionService; import com.google.inject.Injector; import com.google.inject.Module; +import io.netty.buffer.PooledByteBufAllocator; import org.weakref.jmx.guice.MBeanModule; import javax.management.MBeanServer; @@ -65,7 +66,7 @@ public Connector create(String catalogName, Map config, Connecto try { Bootstrap app = new Bootstrap( new MBeanModule(), - new DriftNettyClientModule(), + new DriftNettyClientModule(PooledByteBufAllocator.DEFAULT), binder -> { binder.bind(MBeanServer.class).toInstance(new RebindSafeMBeanServer(getPlatformMBeanServer())); binder.bind(TypeManager.class).toInstance(context.getTypeManager());