HBASE-26039 TestReplicationKillRS is useless after HBASE-23956 (#3440)

Signed-off-by: Michael Stack <stack@apache.org>
This commit is contained in:
Duo Zhang 2021-06-30 08:00:17 +08:00
parent 270b3facce
commit c5a6e19be0
7 changed files with 33 additions and 44 deletions

View File

@ -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;

View File

@ -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 {

View File

@ -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();
}
}

View File

@ -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();
}
}

View File

@ -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())) {

View File

@ -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 {

View File

@ -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();
}
}