hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zhang...@apache.org
Subject [hbase] branch master updated: HBASE-26039 TestReplicationKillRS is useless after HBASE-23956 (#3440)
Date Wed, 30 Jun 2021 00:01:09 GMT
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
     new 64d4915  HBASE-26039 TestReplicationKillRS is useless after HBASE-23956 (#3440)
64d4915 is described below

commit 64d4915ca800622eafe09afe717608513a7e7771
Author: Duo Zhang <zhangduo@apache.org>
AuthorDate: Wed Jun 30 08:00:17 2021 +0800

    HBASE-26039 TestReplicationKillRS is useless after HBASE-23956 (#3440)
    
    Signed-off-by: Michael Stack <stack@apache.org>
---
 .../hadoop/hbase/replication/TestReplicationBase.java      |  2 +-
 .../hbase/replication/TestReplicationKillMasterRS.java     | 13 ++++++++++---
 .../replication/TestReplicationKillMasterRSCompressed.java |  5 +----
 .../TestReplicationKillMasterRSWithSeparateOldWALs.java    | 13 +++----------
 .../hadoop/hbase/replication/TestReplicationKillRS.java    | 14 ++------------
 .../hbase/replication/TestReplicationKillSlaveRS.java      | 13 ++++++++++---
 .../TestReplicationKillSlaveRSWithSeparateOldWALs.java     | 12 +++---------
 7 files changed, 30 insertions(+), 42 deletions(-)

diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationBase.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationBase.java
index b40ee94..967ab75 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationBase.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationBase.java
@@ -83,7 +83,7 @@ public class TestReplicationBase {
   protected static Configuration CONF2 = UTIL2.getConfiguration();
 
   protected static int NUM_SLAVES1 = 1;
-  protected static final int NUM_SLAVES2 = 1;
+  protected static int NUM_SLAVES2 = 1;
   protected static final int NB_ROWS_IN_BATCH = 100;
   protected static final int NB_ROWS_IN_BIG_BATCH =
       NB_ROWS_IN_BATCH * 10;
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationKillMasterRS.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationKillMasterRS.java
index ae99eb8..b261b25 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationKillMasterRS.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationKillMasterRS.java
@@ -20,20 +20,27 @@ package org.apache.hadoop.hbase.replication;
 import org.apache.hadoop.hbase.HBaseClassTestRule;
 import org.apache.hadoop.hbase.testclassification.LargeTests;
 import org.apache.hadoop.hbase.testclassification.ReplicationTests;
+import org.junit.BeforeClass;
 import org.junit.ClassRule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
 /**
- * Runs the TestReplicationKillRS test and selects the RS to kill in the master cluster
- * Do not add other tests in this class.
+ * Runs the TestReplicationKillRS test and selects the RS to kill in the master cluster Do
not add
+ * other tests in this class.
  */
 @Category({ ReplicationTests.class, LargeTests.class })
 public class TestReplicationKillMasterRS extends TestReplicationKillRS {
 
   @ClassRule
   public static final HBaseClassTestRule CLASS_RULE =
-      HBaseClassTestRule.forClass(TestReplicationKillMasterRS.class);
+    HBaseClassTestRule.forClass(TestReplicationKillMasterRS.class);
+
+  @BeforeClass
+  public static void setUpBeforeClass() throws Exception {
+    NUM_SLAVES1 = 2;
+    TestReplicationBase.setUpBeforeClass();
+  }
 
   @Test
   public void killOneMasterRS() throws Exception {
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationKillMasterRSCompressed.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationKillMasterRSCompressed.java
index e649149..8cfe802 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationKillMasterRSCompressed.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationKillMasterRSCompressed.java
@@ -36,12 +36,9 @@ public class TestReplicationKillMasterRSCompressed extends TestReplicationKillMa
   public static final HBaseClassTestRule CLASS_RULE =
       HBaseClassTestRule.forClass(TestReplicationKillMasterRSCompressed.class);
 
-  /**
-   * @throws java.lang.Exception
-   */
   @BeforeClass
   public static void setUpBeforeClass() throws Exception {
     CONF1.setBoolean(HConstants.ENABLE_WAL_COMPRESSION, true);
-    TestReplicationBase.setUpBeforeClass();
+    TestReplicationKillMasterRS.setUpBeforeClass();
   }
 }
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationKillMasterRSWithSeparateOldWALs.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationKillMasterRSWithSeparateOldWALs.java
index aa3aadd..d0ceb6b 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationKillMasterRSWithSeparateOldWALs.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationKillMasterRSWithSeparateOldWALs.java
@@ -15,7 +15,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.hadoop.hbase.replication;
 
 import org.apache.hadoop.hbase.HBaseClassTestRule;
@@ -24,24 +23,18 @@ import org.apache.hadoop.hbase.testclassification.ReplicationTests;
 import org.apache.hadoop.hbase.wal.AbstractFSWALProvider;
 import org.junit.BeforeClass;
 import org.junit.ClassRule;
-import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
 @Category({ ReplicationTests.class, LargeTests.class })
-public class TestReplicationKillMasterRSWithSeparateOldWALs extends TestReplicationKillRS
{
+public class TestReplicationKillMasterRSWithSeparateOldWALs extends TestReplicationKillMasterRS
{
 
   @ClassRule
   public static final HBaseClassTestRule CLASS_RULE =
-      HBaseClassTestRule.forClass(TestReplicationKillMasterRSWithSeparateOldWALs.class);
+    HBaseClassTestRule.forClass(TestReplicationKillMasterRSWithSeparateOldWALs.class);
 
   @BeforeClass
   public static void setUpBeforeClass() throws Exception {
     CONF1.setBoolean(AbstractFSWALProvider.SEPARATE_OLDLOGDIR, true);
-    TestReplicationBase.setUpBeforeClass();
-  }
-
-  @Test
-  public void killOneMasterRS() throws Exception {
-    loadTableAndKillRS(UTIL1);
+    TestReplicationKillMasterRS.setUpBeforeClass();
   }
 }
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationKillRS.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationKillRS.java
index 360424a..c1f0760 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationKillRS.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationKillRS.java
@@ -19,7 +19,6 @@ package org.apache.hadoop.hbase.replication;
 
 import static org.junit.Assert.fail;
 
-import org.apache.hadoop.hbase.HBaseClassTestRule;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.UnknownScannerException;
 import org.apache.hadoop.hbase.client.Connection;
@@ -28,20 +27,11 @@ import org.apache.hadoop.hbase.client.Result;
 import org.apache.hadoop.hbase.client.ResultScanner;
 import org.apache.hadoop.hbase.client.Scan;
 import org.apache.hadoop.hbase.client.Table;
-import org.apache.hadoop.hbase.testclassification.LargeTests;
-import org.apache.hadoop.hbase.testclassification.ReplicationTests;
 import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
-import org.junit.ClassRule;
-import org.junit.experimental.categories.Category;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-@Category({ ReplicationTests.class, LargeTests.class })
-public class TestReplicationKillRS extends TestReplicationBase {
-
-  @ClassRule
-  public static final HBaseClassTestRule CLASS_RULE =
-      HBaseClassTestRule.forClass(TestReplicationKillRS.class);
+public abstract class TestReplicationKillRS extends TestReplicationBase {
 
   private static final Logger LOG = LoggerFactory.getLogger(TestReplicationKillRS.class);
 
@@ -49,7 +39,7 @@ public class TestReplicationKillRS extends TestReplicationBase {
    * Load up 1 tables over 2 region servers and kill a source during the upload. The failover
    * happens internally. WARNING this test sometimes fails because of HBASE-3515
    */
-  public void loadTableAndKillRS(HBaseTestingUtility util) throws Exception {
+  protected void loadTableAndKillRS(HBaseTestingUtility util) throws Exception {
     // killing the RS with hbase:meta can result into failed puts until we solve
     // IO fencing
     int rsToKill1 = util.getHBaseCluster().getServerWithMeta() == 0 ? 1 : 0;
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationKillSlaveRS.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationKillSlaveRS.java
index 733fa3a..16663f0 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationKillSlaveRS.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationKillSlaveRS.java
@@ -20,20 +20,27 @@ package org.apache.hadoop.hbase.replication;
 import org.apache.hadoop.hbase.HBaseClassTestRule;
 import org.apache.hadoop.hbase.testclassification.LargeTests;
 import org.apache.hadoop.hbase.testclassification.ReplicationTests;
+import org.junit.BeforeClass;
 import org.junit.ClassRule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
 /**
- * Runs the TestReplicationKillRS test and selects the RS to kill in the slave cluster
- * Do not add other tests in this class.
+ * Runs the TestReplicationKillRS test and selects the RS to kill in the slave cluster Do
not add
+ * other tests in this class.
  */
 @Category({ ReplicationTests.class, LargeTests.class })
 public class TestReplicationKillSlaveRS extends TestReplicationKillRS {
 
   @ClassRule
   public static final HBaseClassTestRule CLASS_RULE =
-      HBaseClassTestRule.forClass(TestReplicationKillSlaveRS.class);
+    HBaseClassTestRule.forClass(TestReplicationKillSlaveRS.class);
+
+  @BeforeClass
+  public static void setUpBeforeClass() throws Exception {
+    NUM_SLAVES2 = 2;
+    TestReplicationBase.setUpBeforeClass();
+  }
 
   @Test
   public void killOneSlaveRS() throws Exception {
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationKillSlaveRSWithSeparateOldWALs.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationKillSlaveRSWithSeparateOldWALs.java
index abff3e2..195ad89 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationKillSlaveRSWithSeparateOldWALs.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationKillSlaveRSWithSeparateOldWALs.java
@@ -24,24 +24,18 @@ import org.apache.hadoop.hbase.testclassification.ReplicationTests;
 import org.apache.hadoop.hbase.wal.AbstractFSWALProvider;
 import org.junit.BeforeClass;
 import org.junit.ClassRule;
-import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
 @Category({ ReplicationTests.class, LargeTests.class })
-public class TestReplicationKillSlaveRSWithSeparateOldWALs extends TestReplicationKillRS
{
+public class TestReplicationKillSlaveRSWithSeparateOldWALs extends TestReplicationKillSlaveRS
{
 
   @ClassRule
   public static final HBaseClassTestRule CLASS_RULE =
-      HBaseClassTestRule.forClass(TestReplicationKillSlaveRSWithSeparateOldWALs.class);
+    HBaseClassTestRule.forClass(TestReplicationKillSlaveRSWithSeparateOldWALs.class);
 
   @BeforeClass
   public static void setUpBeforeClass() throws Exception {
     CONF1.setBoolean(AbstractFSWALProvider.SEPARATE_OLDLOGDIR, true);
-    TestReplicationBase.setUpBeforeClass();
-  }
-
-  @Test
-  public void killOneSlaveRS() throws Exception {
-    loadTableAndKillRS(UTIL2);
+    TestReplicationKillSlaveRS.setUpBeforeClass();
   }
 }

Mime
View raw message