You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by ja...@apache.org on 2019/07/22 19:04:43 UTC

[incubator-pinot] 01/01: Bump up guava version to 27.1-jre

This is an automated email from the ASF dual-hosted git repository.

jackie pushed a commit to branch fix_guava
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git

commit e1b1d0785b637d4e5b3543fb2f2434e28f3178c0
Author: Jackie (Xiaotian) Jiang <xa...@linkedin.com>
AuthorDate: Mon Jul 22 12:01:58 2019 -0700

    Bump up guava version to 27.1-jre
    
    WARNING: there are some backward-imcompatibility from guava 20.0 to 27.1-jre
    We need to bump up the guava version because some other services we depend on need newer guava version
---
 .../apache/pinot/transport/netty/NettyServer.java  |  3 ++-
 .../transport/perf/ScatterGatherPerfClient.java    |  5 ++---
 .../pool/AsyncPoolResourceManagerAdapterTest.java  | 14 ++++++------
 .../pinot/transport/pool/KeyedPoolImplTest.java    | 25 +++++++++-------------
 pom.xml                                            | 14 ++++++------
 5 files changed, 29 insertions(+), 32 deletions(-)

diff --git a/pinot-transport/src/main/java/org/apache/pinot/transport/netty/NettyServer.java b/pinot-transport/src/main/java/org/apache/pinot/transport/netty/NettyServer.java
index 16f00a8..b2fdcad 100644
--- a/pinot-transport/src/main/java/org/apache/pinot/transport/netty/NettyServer.java
+++ b/pinot-transport/src/main/java/org/apache/pinot/transport/netty/NettyServer.java
@@ -22,6 +22,7 @@ import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.MoreExecutors;
 import io.netty.bootstrap.ServerBootstrap;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
@@ -290,7 +291,7 @@ public abstract class NettyServer implements Runnable {
           LOGGER.error("Request processing returned unhandled exception, error: ", t);
           sendResponse(new byte[0]);
         }
-      });
+      }, MoreExecutors.directExecutor());
     }
 
     @Override
diff --git a/pinot-transport/src/test/java/org/apache/pinot/transport/perf/ScatterGatherPerfClient.java b/pinot-transport/src/test/java/org/apache/pinot/transport/perf/ScatterGatherPerfClient.java
index 0783d03..bf4422c 100644
--- a/pinot-transport/src/test/java/org/apache/pinot/transport/perf/ScatterGatherPerfClient.java
+++ b/pinot-transport/src/test/java/org/apache/pinot/transport/perf/ScatterGatherPerfClient.java
@@ -152,9 +152,8 @@ public class ScatterGatherPerfClient implements Runnable {
 
     NettyClientMetrics clientMetrics = new NettyClientMetrics(registry, "client_");
     PooledNettyClientResourceManager rm = new PooledNettyClientResourceManager(_eventLoopGroup, _timer, clientMetrics);
-    _pool =
-        new KeyedPoolImpl<PooledNettyClientResourceManager.PooledClientConnection>(1, _maxActiveConnections, 300000, 10,
-            rm, _timedExecutor, MoreExecutors.sameThreadExecutor(), registry);
+    _pool = new KeyedPoolImpl<>(1, _maxActiveConnections, 300000, 10, rm, _timedExecutor,
+        MoreExecutors.newDirectExecutorService(), registry);
     rm.setPool(_pool);
     _scatterGather = new ScatterGatherImpl(_pool, _service);
     for (AsyncReader r : _readerThreads) {
diff --git a/pinot-transport/src/test/java/org/apache/pinot/transport/pool/AsyncPoolResourceManagerAdapterTest.java b/pinot-transport/src/test/java/org/apache/pinot/transport/pool/AsyncPoolResourceManagerAdapterTest.java
index 1d2feaa..a7c0bf8 100644
--- a/pinot-transport/src/test/java/org/apache/pinot/transport/pool/AsyncPoolResourceManagerAdapterTest.java
+++ b/pinot-transport/src/test/java/org/apache/pinot/transport/pool/AsyncPoolResourceManagerAdapterTest.java
@@ -19,6 +19,7 @@
 package org.apache.pinot.transport.pool;
 
 import com.google.common.util.concurrent.MoreExecutors;
+import java.util.concurrent.ExecutorService;
 import org.apache.pinot.common.response.ServerInstance;
 import org.apache.pinot.transport.common.Callback;
 import org.testng.Assert;
@@ -26,6 +27,7 @@ import org.testng.annotations.Test;
 
 
 public class AsyncPoolResourceManagerAdapterTest {
+  private static final ExecutorService EXECUTOR_SERVICE = MoreExecutors.newDirectExecutorService();
 
   @Test
   public void testCreate() {
@@ -36,7 +38,7 @@ public class AsyncPoolResourceManagerAdapterTest {
       String value = "dummy";
       MyPooledResourceManager rm = new MyPooledResourceManager(true, value);
       AsyncPoolResourceManagerAdapter<String> adapter =
-          new AsyncPoolResourceManagerAdapter<>(key, rm, MoreExecutors.sameThreadExecutor(), null);
+          new AsyncPoolResourceManagerAdapter<>(key, rm, EXECUTOR_SERVICE, null);
       MyCallback callback = new MyCallback();
 
       adapter.create(callback);
@@ -52,7 +54,7 @@ public class AsyncPoolResourceManagerAdapterTest {
       ServerInstance key = new ServerInstance("localhost:8080");
       MyPooledResourceManager rm = new MyPooledResourceManager(true, null);
       AsyncPoolResourceManagerAdapter<String> adapter =
-          new AsyncPoolResourceManagerAdapter<String>(key, rm, MoreExecutors.sameThreadExecutor(), null);
+          new AsyncPoolResourceManagerAdapter<String>(key, rm, EXECUTOR_SERVICE, null);
       MyCallback callback = new MyCallback();
 
       adapter.create(callback);
@@ -72,7 +74,7 @@ public class AsyncPoolResourceManagerAdapterTest {
       String value = "dummy";
       MyPooledResourceManager rm = new MyPooledResourceManager(true, null);
       AsyncPoolResourceManagerAdapter<String> adapter =
-          new AsyncPoolResourceManagerAdapter<>(key, rm, MoreExecutors.sameThreadExecutor(), null);
+          new AsyncPoolResourceManagerAdapter<>(key, rm, EXECUTOR_SERVICE, null);
 
       boolean ret = adapter.validateGet(value);
       Assert.assertTrue(ret, "Validate Return");
@@ -93,7 +95,7 @@ public class AsyncPoolResourceManagerAdapterTest {
       String value = "dummy";
       MyPooledResourceManager rm = new MyPooledResourceManager(false, null);
       AsyncPoolResourceManagerAdapter<String> adapter =
-          new AsyncPoolResourceManagerAdapter<>(key, rm, MoreExecutors.sameThreadExecutor(), null);
+          new AsyncPoolResourceManagerAdapter<>(key, rm, EXECUTOR_SERVICE, null);
 
       boolean ret = adapter.validateGet(value);
       Assert.assertFalse(ret, "Validate Return");
@@ -119,7 +121,7 @@ public class AsyncPoolResourceManagerAdapterTest {
       String value = "dummy";
       MyPooledResourceManager rm = new MyPooledResourceManager(true, null);
       AsyncPoolResourceManagerAdapter<String> adapter =
-          new AsyncPoolResourceManagerAdapter<>(key, rm, MoreExecutors.sameThreadExecutor(), null);
+          new AsyncPoolResourceManagerAdapter<>(key, rm, EXECUTOR_SERVICE, null);
       MyCallback callback = new MyCallback();
 
       adapter.destroy(value, true, callback);
@@ -137,7 +139,7 @@ public class AsyncPoolResourceManagerAdapterTest {
       String value = "dummy";
       MyPooledResourceManager rm = new MyPooledResourceManager(false, null);
       AsyncPoolResourceManagerAdapter<String> adapter =
-          new AsyncPoolResourceManagerAdapter<>(key, rm, MoreExecutors.sameThreadExecutor(), null);
+          new AsyncPoolResourceManagerAdapter<>(key, rm, EXECUTOR_SERVICE, null);
       MyCallback callback = new MyCallback();
 
       adapter.destroy(value, true, callback);
diff --git a/pinot-transport/src/test/java/org/apache/pinot/transport/pool/KeyedPoolImplTest.java b/pinot-transport/src/test/java/org/apache/pinot/transport/pool/KeyedPoolImplTest.java
index 6756090..7c847b8 100644
--- a/pinot-transport/src/test/java/org/apache/pinot/transport/pool/KeyedPoolImplTest.java
+++ b/pinot-transport/src/test/java/org/apache/pinot/transport/pool/KeyedPoolImplTest.java
@@ -38,15 +38,12 @@ import org.apache.pinot.transport.common.AsyncResponseFuture;
 import org.apache.pinot.transport.common.NoneType;
 import org.apache.pinot.transport.common.ServerResponseFuture;
 import org.apache.pinot.transport.metrics.AggregatedPoolStats;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
 
 public class KeyedPoolImplTest {
-
-  protected static Logger LOGGER = LoggerFactory.getLogger(KeyedPoolImplTest.class);
+  private static final ExecutorService EXECUTOR_SERVICE = MoreExecutors.newDirectExecutorService();
 
   @Test
   public void testCancelAfterCheckingOut()
@@ -152,14 +149,14 @@ public class KeyedPoolImplTest {
   public void testCreateError()
       throws Exception {
     ScheduledExecutorService timedExecutor = new ScheduledThreadPoolExecutor(1);
-    ExecutorService service = MoreExecutors.sameThreadExecutor();
     int numKeys = 1;
     int numResourcesPerKey = 1;
     Map<ServerInstance, List<String>> resources = buildCreateMap(numKeys, numResourcesPerKey);
 
     TestResourceManager rm = new TestResourceManager(resources, resources, null, null);
 
-    KeyedPool<String> kPool = new KeyedPoolImpl<>(0, 1, 1000L, 1000 * 60 * 60, rm, timedExecutor, service, null);
+    KeyedPool<String> kPool =
+        new KeyedPoolImpl<>(0, 1, 1000L, 1000 * 60 * 60, rm, timedExecutor, EXECUTOR_SERVICE, null);
     AsyncResponseFuture<String> f = (AsyncResponseFuture<String>) kPool.checkoutObject(getKey(0), "none");
     Assert.assertTrue(f.isDone());
     Assert.assertNull(f.get());
@@ -175,14 +172,14 @@ public class KeyedPoolImplTest {
   public void testDestroyError()
       throws Exception {
     ScheduledExecutorService timedExecutor = new ScheduledThreadPoolExecutor(1);
-    ExecutorService service = MoreExecutors.sameThreadExecutor();
     int numKeys = 1;
     int numResourcesPerKey = 1;
     Map<ServerInstance, List<String>> resources = buildCreateMap(numKeys, numResourcesPerKey);
 
     TestResourceManager rm = new TestResourceManager(resources, null, resources, null);
 
-    KeyedPool<String> kPool = new KeyedPoolImpl<>(0, 5, 1000L, 1000 * 60 * 60, rm, timedExecutor, service, null);
+    KeyedPool<String> kPool =
+        new KeyedPoolImpl<>(0, 5, 1000L, 1000 * 60 * 60, rm, timedExecutor, EXECUTOR_SERVICE, null);
     AsyncResponseFuture<String> f = (AsyncResponseFuture<String>) kPool.checkoutObject(getKey(0), "none");
     String r = f.getOne();
     Assert.assertTrue(f.isDone());
@@ -216,13 +213,12 @@ public class KeyedPoolImplTest {
    */ public void testTimeout()
       throws Exception {
     ScheduledExecutorService timedExecutor = new ScheduledThreadPoolExecutor(1);
-    ExecutorService service = MoreExecutors.sameThreadExecutor();
     int numKeys = 5;
     int numResourcesPerKey = 1;
     TestResourceManager rm = new TestResourceManager(buildCreateMap(numKeys, numResourcesPerKey), null, null, null);
 
     // Idle Timeout 1 second
-    KeyedPool<String> kPool = new KeyedPoolImpl<>(0, 5, 1000L, 100, rm, timedExecutor, service, null);
+    KeyedPool<String> kPool = new KeyedPoolImpl<>(0, 5, 1000L, 100, rm, timedExecutor, EXECUTOR_SERVICE, null);
 
     // Create a countdown latch that waits for all resources to be deleted
     CountDownLatch latch = new CountDownLatch(numKeys * numResourcesPerKey);
@@ -279,11 +275,11 @@ public class KeyedPoolImplTest {
    */ public void testPoolImpl1()
       throws Exception {
     ScheduledExecutorService timedExecutor = new ScheduledThreadPoolExecutor(1);
-    ExecutorService service = MoreExecutors.sameThreadExecutor();
     int numKeys = 5;
     int numResourcesPerKey = 5;
     TestResourceManager rm = new TestResourceManager(buildCreateMap(numKeys, numResourcesPerKey), null, null, null);
-    KeyedPool<String> kPool = new KeyedPoolImpl<>(5, 5, 1000 * 60 * 60L, 100, rm, timedExecutor, service, null);
+    KeyedPool<String> kPool =
+        new KeyedPoolImpl<>(5, 5, 1000 * 60 * 60L, 100, rm, timedExecutor, EXECUTOR_SERVICE, null);
 
     kPool.start();
     AggregatedPoolStats s = (AggregatedPoolStats) kPool.getStats();
@@ -355,11 +351,11 @@ public class KeyedPoolImplTest {
    */ public void testShutdown()
       throws Exception {
     ScheduledExecutorService timedExecutor = new ScheduledThreadPoolExecutor(1);
-    ExecutorService service = MoreExecutors.sameThreadExecutor();
     int numKeys = 5;
     int numResourcesPerKey = 5;
     TestResourceManager rm = new TestResourceManager(buildCreateMap(numKeys, numResourcesPerKey), null, null, null);
-    KeyedPool<String> kPool = new KeyedPoolImpl<>(5, 5, 1000 * 60 * 60L, 100, rm, timedExecutor, service, null);
+    KeyedPool<String> kPool =
+        new KeyedPoolImpl<>(5, 5, 1000 * 60 * 60L, 100, rm, timedExecutor, EXECUTOR_SERVICE, null);
 
     kPool.start();
     AggregatedPoolStats s = (AggregatedPoolStats) kPool.getStats();
@@ -483,7 +479,6 @@ public class KeyedPoolImplTest {
       } catch (InterruptedException e) {
         e.printStackTrace();
       }
-      LOGGER.info("Create Latch opened. Proceding with creating resource !!");
       return super.create(key);
     }
 
diff --git a/pom.xml b/pom.xml
index a734f94..8844345 100644
--- a/pom.xml
+++ b/pom.xml
@@ -324,7 +324,7 @@
       <dependency>
         <groupId>com.google.guava</groupId>
         <artifactId>guava</artifactId>
-        <version>20.0</version>
+        <version>27.1-jre</version>
       </dependency>
       <dependency>
         <groupId>com.microsoft.azure</groupId>
@@ -375,7 +375,7 @@
       <dependency>
         <groupId>it.unimi.dsi</groupId>
         <artifactId>fastutil</artifactId>
-	<version>8.2.3</version>
+        <version>8.2.3</version>
       </dependency>
       <dependency>
         <groupId>joda-time</groupId>
@@ -1142,11 +1142,11 @@
         </configuration>
         <!--Uncomment to enable style check during build-->
         <!--<executions>-->
-          <!--<execution>-->
-            <!--<goals>-->
-              <!--<goal>check</goal>-->
-            <!--</goals>-->
-          <!--</execution>-->
+        <!--<execution>-->
+        <!--<goals>-->
+        <!--<goal>check</goal>-->
+        <!--</goals>-->
+        <!--</execution>-->
         <!--</executions>-->
       </plugin>
       <plugin>


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org