Repository: hbase
Updated Branches:
  refs/heads/master 4570451f7 -> be2ad98b1


HBASE-12180 Fix and reenable TestRegionReplicaReplicationEndpoint


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

Branch: refs/heads/master
Commit: be2ad98b1c159c9804f6dd43a69ade49a67366fd
Parents: 4570451
Author: Enis Soztutar <e...@apache.org>
Authored: Thu Mar 5 14:59:38 2015 -0800
Committer: Enis Soztutar <e...@apache.org>
Committed: Thu Mar 5 14:59:38 2015 -0800

----------------------------------------------------------------------
 .../TestRegionReplicaReplicationEndpoint.java   | 48 ++++++++------------
 1 file changed, 18 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/be2ad98b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestRegionReplicaReplicationEndpoint.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestRegionReplicaReplicationEndpoint.java
 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestRegionReplicaReplicationEndpoint.java
index 7ca12f0..886bd6e 100644
--- 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestRegionReplicaReplicationEndpoint.java
+++ 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestRegionReplicaReplicationEndpoint.java
@@ -39,9 +39,7 @@ import org.apache.hadoop.hbase.Waiter;
 import org.apache.hadoop.hbase.client.ClusterConnection;
 import org.apache.hadoop.hbase.client.Connection;
 import org.apache.hadoop.hbase.client.ConnectionFactory;
-import org.apache.hadoop.hbase.client.HConnection;
-import org.apache.hadoop.hbase.client.HConnectionManager;
-import org.apache.hadoop.hbase.client.RpcRetryingCaller;
+import org.apache.hadoop.hbase.client.RegionLocator;
 import org.apache.hadoop.hbase.client.RpcRetryingCallerImpl;
 import org.apache.hadoop.hbase.client.Table;
 import org.apache.hadoop.hbase.client.replication.ReplicationAdmin;
@@ -59,7 +57,6 @@ import org.apache.hadoop.hbase.zookeeper.ZKUtil;
 import org.apache.log4j.Level;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
@@ -84,7 +81,6 @@ public class TestRegionReplicaReplicationEndpoint {
 
   @BeforeClass
   public static void beforeClass() throws Exception {
-    /*
     Configuration conf = HTU.getConfiguration();
     conf.setFloat("hbase.regionserver.logroll.multiplier", 0.0003f);
     conf.setInt("replication.source.size.capacity", 10240);
@@ -98,20 +94,17 @@ public class TestRegionReplicaReplicationEndpoint {
     conf.setLong(HConstants.THREAD_WAKE_FREQUENCY, 100);
     conf.setInt("replication.stats.thread.period.seconds", 5);
     conf.setBoolean("hbase.tests.use.shortcircuit.reads", false);
-    conf.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 3); // less number of 
retries is needed
+    conf.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 5); // less number of 
retries is needed
     conf.setInt("hbase.client.serverside.retries.multiplier", 1);
 
-    HTU.startMiniCluster(NB_SERVERS);*/
+    HTU.startMiniCluster(NB_SERVERS);
   }
 
   @AfterClass
   public static void afterClass() throws Exception {
-    /*
     HTU.shutdownMiniCluster();
-    */
   }
 
-  @Ignore("To be fixed before 1.0")
   @Test
   public void testRegionReplicaReplicationPeerIsCreated() throws IOException, 
ReplicationException {
     // create a table with region replicas. Check whether the replication peer 
is created
@@ -167,7 +160,7 @@ public class TestRegionReplicaReplicationEndpoint {
       // load the data to the table
       HTU.loadNumericRows(table, HBaseTestingUtility.fam1, 0, 1000);
 
-      verifyReplication(tableName, regionReplication, 0, 6000);
+      verifyReplication(tableName, regionReplication, 0, 1000);
 
     } finally {
       table.close();
@@ -197,7 +190,7 @@ public class TestRegionReplicaReplicationEndpoint {
     for (int i = 1; i < regionReplication; i++) {
       final HRegion region = regions[i];
       // wait until all the data is replicated to all secondary regions
-      Waiter.waitFor(HTU.getConfiguration(), 60000, new 
Waiter.Predicate<Exception>() {
+      Waiter.waitFor(HTU.getConfiguration(), 90000, new 
Waiter.Predicate<Exception>() {
         @Override
         public boolean evaluate() throws Exception {
           LOG.info("verifying replication for region replica:" + 
region.getRegionInfo());
@@ -215,26 +208,22 @@ public class TestRegionReplicaReplicationEndpoint {
     }
   }
 
-  @Ignore("To be fixed before 1.0")
-  @Test(timeout = 60000)
+  @Test(timeout = 240000)
   public void testRegionReplicaReplicationWith2Replicas() throws Exception {
     testRegionReplicaReplication(2);
   }
 
-  @Ignore("To be fixed before 1.0")
-  @Test(timeout = 60000)
+  @Test(timeout = 240000)
   public void testRegionReplicaReplicationWith3Replicas() throws Exception {
     testRegionReplicaReplication(3);
   }
 
-  @Ignore("To be fixed before 1.0")
-  @Test(timeout = 60000)
+  @Test(timeout = 240000)
   public void testRegionReplicaReplicationWith10Replicas() throws Exception {
     testRegionReplicaReplication(10);
   }
 
-  @Ignore("To be fixed before 1.0")
-  @Test (timeout = 60000)
+  @Test (timeout = 240000)
   public void testRegionReplicaReplicationForFlushAndCompaction() throws 
Exception {
     // Tests a table with region replication 3. Writes some data, and causes 
flushes and
     // compactions. Verifies that the data is readable from the replicas. Note 
that this
@@ -262,21 +251,19 @@ public class TestRegionReplicaReplicationEndpoint {
         HTU.compact(tableName, false);
       }
 
-      verifyReplication(tableName, regionReplication, 0, 6000);
+      verifyReplication(tableName, regionReplication, 0, 1000);
     } finally {
       table.close();
       connection.close();
     }
   }
 
-  @Ignore("To be fixed before 1.0")
-  @Test (timeout = 60000)
+  @Test (timeout = 240000)
   public void testRegionReplicaReplicationIgnoresDisabledTables() throws 
Exception {
     testRegionReplicaReplicationIgnoresDisabledTables(false);
   }
 
-  @Ignore("To be fixed before 1.0")
-  @Test (timeout = 60000)
+  @Test (timeout = 240000)
   public void testRegionReplicaReplicationIgnoresDroppedTables() throws 
Exception {
     testRegionReplicaReplicationIgnoresDisabledTables(true);
   }
@@ -305,7 +292,7 @@ public class TestRegionReplicaReplicationEndpoint {
 
     // now that the replication is disabled, write to the table to be dropped, 
then drop the table.
 
-    HConnection connection = 
HConnectionManager.createConnection(HTU.getConfiguration());
+    Connection connection = 
ConnectionFactory.createConnection(HTU.getConfiguration());
     Table table = connection.getTable(tableName);
     Table tableToBeDisabled = connection.getTable(toBeDisabledTable);
 
@@ -318,9 +305,9 @@ public class TestRegionReplicaReplicationEndpoint {
     RegionReplicaReplicationEndpoint.RegionReplicaSinkWriter sinkWriter =
         new RegionReplicaReplicationEndpoint.RegionReplicaSinkWriter(sink,
           (ClusterConnection) connection,
-          Executors.newSingleThreadExecutor(), 1000);
-
-    HRegionLocation hrl = connection.locateRegion(toBeDisabledTable, 
HConstants.EMPTY_BYTE_ARRAY);
+          Executors.newSingleThreadExecutor(), Integer.MAX_VALUE);
+    RegionLocator rl = connection.getRegionLocator(toBeDisabledTable);
+    HRegionLocation hrl = rl.getRegionLocation(HConstants.EMPTY_BYTE_ARRAY);
     byte[] encodedRegionName = hrl.getRegionInfo().getEncodedNameAsBytes();
 
     Entry entry = new Entry(
@@ -346,11 +333,12 @@ public class TestRegionReplicaReplicationEndpoint {
       // now enable the replication
       admin.enablePeer(ServerRegionReplicaUtil.getReplicationPeerId());
 
-      verifyReplication(tableName, regionReplication, 0, 6000);
+      verifyReplication(tableName, regionReplication, 0, 1000);
 
     } finally {
       admin.close();
       table.close();
+      rl.close();
       tableToBeDisabled.close();
       HTU.deleteTableIfAny(toBeDisabledTable);
       connection.close();

Reply via email to