accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject [2/3] accumulo git commit: ACCUMULO-4362 Fix TabletStateChangeIteratorIT
Date Tue, 09 Aug 2016 21:23:30 GMT
ACCUMULO-4362 Fix TabletStateChangeIteratorIT

Ensure MetadataTableUtil.createCloneScanner uses the correct metadata
table.

Ensure TabletStateChangeIteratorIT waits until tablets are stable before
proceeding with the test.


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

Branch: refs/heads/master
Commit: 3fded56a1793839364ddb9ce8be937e03669ece3
Parents: 10da04b
Author: Christopher Tubbs <ctubbsii@apache.org>
Authored: Tue Aug 9 17:21:32 2016 -0400
Committer: Christopher Tubbs <ctubbsii@apache.org>
Committed: Tue Aug 9 17:21:32 2016 -0400

----------------------------------------------------------------------
 .../accumulo/server/util/MetadataTableUtil.java |  2 ++
 .../functional/TabletStateChangeIteratorIT.java | 22 +++++++-------------
 2 files changed, 9 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/3fded56a/server/base/src/main/java/org/apache/accumulo/server/util/MetadataTableUtil.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/MetadataTableUtil.java
b/server/base/src/main/java/org/apache/accumulo/server/util/MetadataTableUtil.java
index b38083f..c07114b 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/util/MetadataTableUtil.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/util/MetadataTableUtil.java
@@ -708,6 +708,8 @@ public class MetadataTableUtil {
   }
 
   private static Scanner createCloneScanner(String tableName, String tableId, Connector conn)
throws TableNotFoundException {
+    if (tableId.equals(MetadataTable.ID))
+      tableName = RootTable.NAME;
     Scanner mscanner = new IsolatedScanner(conn.createScanner(tableName, Authorizations.EMPTY));
     mscanner.setRange(new KeyExtent(tableId, null, null).toMetadataRange());
     mscanner.fetchColumnFamily(DataFileColumnFamily.NAME);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/3fded56a/test/src/main/java/org/apache/accumulo/test/functional/TabletStateChangeIteratorIT.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/TabletStateChangeIteratorIT.java
b/test/src/main/java/org/apache/accumulo/test/functional/TabletStateChangeIteratorIT.java
index 0cc0b94..5001f1b 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/TabletStateChangeIteratorIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/TabletStateChangeIteratorIT.java
@@ -49,8 +49,9 @@ import org.apache.accumulo.core.metadata.MetadataTable;
 import org.apache.accumulo.core.metadata.schema.MetadataSchema;
 import org.apache.accumulo.core.security.Authorizations;
 import org.apache.accumulo.core.zookeeper.ZooUtil;
+import org.apache.accumulo.fate.util.UtilWaitThread;
 import org.apache.accumulo.fate.zookeeper.ZooCache;
-import org.apache.accumulo.harness.SharedMiniClusterBase;
+import org.apache.accumulo.harness.AccumuloClusterHarness;
 import org.apache.accumulo.server.master.state.CurrentState;
 import org.apache.accumulo.server.master.state.MergeInfo;
 import org.apache.accumulo.server.master.state.MetaDataTableScanner;
@@ -58,8 +59,6 @@ import org.apache.accumulo.server.master.state.TServerInstance;
 import org.apache.accumulo.server.master.state.TabletStateChangeIterator;
 import org.apache.accumulo.server.zookeeper.ZooLock;
 import org.apache.hadoop.io.Text;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
 import org.junit.Test;
 
 import com.google.common.base.Predicate;
@@ -69,21 +68,11 @@ import com.google.common.collect.Sets;
  * Test to ensure that the {@link TabletStateChangeIterator} properly skips over tablet information
in the metadata table when there is no work to be done on
  * the tablet (see ACCUMULO-3580)
  */
-public class TabletStateChangeIteratorIT extends SharedMiniClusterBase {
+public class TabletStateChangeIteratorIT extends AccumuloClusterHarness {
 
   @Override
   public int defaultTimeoutSeconds() {
-    return 2 * 60;
-  }
-
-  @BeforeClass
-  public static void setup() throws Exception {
-    SharedMiniClusterBase.startMiniCluster();
-  }
-
-  @AfterClass
-  public static void teardown() throws Exception {
-    SharedMiniClusterBase.stopMiniCluster();
+    return 3 * 60;
   }
 
   @Test
@@ -103,6 +92,9 @@ public class TabletStateChangeIteratorIT extends SharedMiniClusterBase
{
     cloneMetadataTable(cloned);
 
     State state = new State();
+    while (findTabletsNeedingAttention(cloned, state) > 0) {
+      UtilWaitThread.sleep(500);
+    }
     assertEquals("No tables should need attention", 0, findTabletsNeedingAttention(cloned,
state));
 
     // test the assigned case (no location)


Mime
View raw message