You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by el...@apache.org on 2014/09/17 00:02:46 UTC

[2/3] git commit: ACCUMULO-3136 Be a little more rigid on the ActiveScans we observe.

ACCUMULO-3136 Be a little more rigid on the ActiveScans we observe.

We might get scans by the system to the metadata table instead of
the scan we run in the test case. When this happens, the test will
timeout because the interrupt happens before the scan is running, and then
the scan just sits on the SlowIterator.


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/2e273505
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/2e273505
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/2e273505

Branch: refs/heads/master
Commit: 2e273505d9ca2d32db48d2052f38be2625119bec
Parents: 0055bab
Author: Josh Elser <el...@apache.org>
Authored: Tue Sep 16 17:54:42 2014 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Tue Sep 16 18:00:17 2014 -0400

----------------------------------------------------------------------
 .../apache/accumulo/test/Accumulo3030IT.java    | 27 +++++++++++++++-----
 1 file changed, 21 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/2e273505/test/src/test/java/org/apache/accumulo/test/Accumulo3030IT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/Accumulo3030IT.java b/test/src/test/java/org/apache/accumulo/test/Accumulo3030IT.java
index bc56346..91674a5 100644
--- a/test/src/test/java/org/apache/accumulo/test/Accumulo3030IT.java
+++ b/test/src/test/java/org/apache/accumulo/test/Accumulo3030IT.java
@@ -16,15 +16,17 @@
  */
 package org.apache.accumulo.test;
 
+import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.Map.Entry;
 
 import org.apache.accumulo.core.client.Connector;
 import org.apache.accumulo.core.client.IteratorSetting;
 import org.apache.accumulo.core.client.Scanner;
+import org.apache.accumulo.core.client.admin.ActiveScan;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.Value;
 import org.apache.accumulo.core.security.Authorizations;
-import org.apache.accumulo.core.util.UtilWaitThread;
 import org.apache.accumulo.minicluster.impl.MiniAccumuloConfigImpl;
 import org.apache.accumulo.test.functional.ConfigurableMacIT;
 import org.apache.accumulo.test.functional.SlowIterator;
@@ -33,7 +35,7 @@ import org.junit.Assert;
 import org.junit.Test;
 
 public class Accumulo3030IT extends ConfigurableMacIT {
-  
+
   @Override
   public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
     cfg.setNumTservers(1);
@@ -58,9 +60,22 @@ public class Accumulo3030IT extends ConfigurableMacIT {
         try {
           // ensure the scan is running: not perfect, the metadata tables could be scanned, too.
           String tserver = conn.instanceOperations().getTabletServers().iterator().next();
-          while (conn.instanceOperations().getActiveScans(tserver).size() < 1) {
-            UtilWaitThread.sleep(1000);
-          }
+          do {
+            ArrayList<ActiveScan> scans = new ArrayList<ActiveScan>(conn.instanceOperations().getActiveScans(tserver));
+            Iterator<ActiveScan> iter = scans.iterator();
+            while (iter.hasNext()) {
+              ActiveScan scan = iter.next();
+              // Remove scans not against our table and not owned by us
+              if (!"root".equals(scan.getUser()) || !tableName.equals(scan.getTable())) {
+                iter.remove();
+              }
+            }
+
+            if (!scans.isEmpty()) {
+              // We found our scan
+              break;
+            }
+          } while (true);
         } catch (Exception e) {
           e.printStackTrace();
         }
@@ -79,5 +94,5 @@ public class Accumulo3030IT extends ConfigurableMacIT {
       thread.join();
     }
   }
-  
+
 }