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

mwalch pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/master by this push:
     new d88f462  Fixes #600 - TransportCachingIT fills up disk with messages 
(#962)
d88f462 is described below

commit d88f4629eb9a3e830b4afd69bb85fc1c14b311ec
Author: Jeffrey Zeiberg <jzeib...@gmail.com>
AuthorDate: Fri Feb 22 12:23:31 2019 -0500

    Fixes #600 - TransportCachingIT fills up disk with messages (#962)
    
    * TransportCachingIT fails if server can't be obtained in 100 trys
---
 .../apache/accumulo/test/TransportCachingIT.java   | 33 ++++++++++++++++------
 1 file changed, 25 insertions(+), 8 deletions(-)

diff --git 
a/test/src/main/java/org/apache/accumulo/test/TransportCachingIT.java 
b/test/src/main/java/org/apache/accumulo/test/TransportCachingIT.java
index 3196ac0..7044314 100644
--- a/test/src/main/java/org/apache/accumulo/test/TransportCachingIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/TransportCachingIT.java
@@ -47,6 +47,7 @@ import org.slf4j.LoggerFactory;
  */
 public class TransportCachingIT extends AccumuloClusterHarness {
   private static final Logger log = 
LoggerFactory.getLogger(TransportCachingIT.class);
+  private static int ATTEMPTS = 0;
 
   @Test
   public void testCachedTransport() throws InterruptedException {
@@ -70,14 +71,30 @@ public class TransportCachingIT extends 
AccumuloClusterHarness {
       }
 
       ArrayList<ThriftTransportKey> servers = new ArrayList<>();
-      for (String tserver : children) {
-        String path = zkRoot + Constants.ZTSERVERS + "/" + tserver;
-        byte[] data = ZooUtil.getLockData(zc, path);
-        if (data != null) {
-          String strData = new String(data, UTF_8);
-          if (!strData.equals("master"))
-            servers.add(new ThriftTransportKey(
-                new ServerServices(strData).getAddress(Service.TSERV_CLIENT), 
rpcTimeout, context));
+      while (servers.isEmpty()) {
+        for (String tserver : children) {
+          String path = zkRoot + Constants.ZTSERVERS + "/" + tserver;
+          byte[] data = ZooUtil.getLockData(zc, path);
+          if (data != null) {
+            String strData = new String(data, UTF_8);
+            if (!strData.equals("master"))
+              servers.add(new ThriftTransportKey(
+                  new 
ServerServices(strData).getAddress(Service.TSERV_CLIENT), rpcTimeout,
+                  context));
+          }
+        }
+        ATTEMPTS++;
+        if (!servers.isEmpty())
+          break;
+        else {
+          if (ATTEMPTS < 100) {
+            log.warn("Making another attempt to add ThriftTransportKey 
servers");
+            Thread.sleep(100);
+          } else {
+            log.error("Failed to add ThriftTransportKey servers - Failing 
TransportCachingIT test");
+            org.junit.Assert
+                .fail("Failed to add ThriftTransportKey servers - Failing 
TransportCachingIT test");
+          }
         }
       }
 

Reply via email to