This is an automated email from the ASF dual-hosted git repository.
zhangduo pushed a commit to branch branch-2.4
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-2.4 by this push:
new c5a6e19 HBASE-26039 TestReplicationKillRS is useless after
HBASE-23956 (#3440)
c5a6e19 is described below
commit c5a6e19be012c4d639f82728363845ca525c99d6
Author: Duo Zhang <[email protected]>
AuthorDate: Wed Jun 30 08:00:17 2021 +0800
HBASE-26039 TestReplicationKillRS is useless after HBASE-23956 (#3440)
Signed-off-by: Michael Stack <[email protected]>
---
.../hadoop/hbase/replication/TestReplicationBase.java | 2 +-
.../replication/TestReplicationKillMasterRS.java | 13 ++++++++++---
.../TestReplicationKillMasterRSCompressed.java | 5 +----
...estReplicationKillMasterRSWithSeparateOldWALs.java | 13 +++----------
.../hbase/replication/TestReplicationKillRS.java | 19 +++++--------------
.../hbase/replication/TestReplicationKillSlaveRS.java | 13 ++++++++++---
...TestReplicationKillSlaveRSWithSeparateOldWALs.java | 12 +++---------
7 files changed, 33 insertions(+), 44 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 e26fbb1..6d40f85 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
@@ -82,7 +82,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 c245726..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,19 +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.junit.ClassRule;
-import org.junit.experimental.categories.Category;
+import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
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);
@@ -48,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;
@@ -84,14 +75,14 @@ public class TestReplicationKillRS extends
TestReplicationBase {
}
int lastCount = 0;
- final long start = System.currentTimeMillis();
+ final long start = EnvironmentEdgeManager.currentTime();
int i = 0;
try (Connection conn = ConnectionFactory.createConnection(CONF2)) {
try (Table table = conn.getTable(tableName)) {
while (true) {
if (i == NB_RETRIES - 1) {
fail("Waited too much time for queueFailover replication. " +
"Waited "
- + (System.currentTimeMillis() - start) + "ms.");
+ + (EnvironmentEdgeManager.currentTime() - start) + "ms.");
}
Result[] res2;
try (ResultScanner scanner = table.getScanner(new Scan())) {
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();
}
}