You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by zh...@apache.org on 2018/04/23 08:11:53 UTC
[02/50] [abbrv] hbase git commit: HBASE-20128 Add new UTs which
extends the old replication UTs but set replication scope to SERIAL
HBASE-20128 Add new UTs which extends the old replication UTs but set replication scope to SERIAL
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/42d5447c
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/42d5447c
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/42d5447c
Branch: refs/heads/HBASE-19064
Commit: 42d5447cfbc593becfc26684e03f482eb3a0fc49
Parents: 1fe3d6a
Author: huzheng <op...@gmail.com>
Authored: Thu Apr 12 15:17:32 2018 +0800
Committer: huzheng <op...@gmail.com>
Committed: Tue Apr 17 10:56:21 2018 +0800
----------------------------------------------------------------------
.../TestReplicationAdminWithClusters.java | 10 ++++-
.../replication/TestMasterReplication.java | 2 +-
.../replication/TestMultiSlaveReplication.java | 2 +-
.../replication/TestNamespaceReplication.java | 26 +++++++++--
.../hbase/replication/TestReplicationBase.java | 46 ++++++++++---------
...estReplicationChangingPeerRegionservers.java | 30 ++++++++++---
.../TestReplicationDroppedTables.java | 6 +++
.../replication/TestReplicationEndpoint.java | 8 +++-
.../TestReplicationKillMasterRS.java | 6 +--
.../TestReplicationKillMasterRSCompressed.java | 2 +-
...licationKillMasterRSWithSeparateOldWALs.java | 47 ++++++++++++++++++++
.../replication/TestReplicationKillSlaveRS.java | 5 +--
...plicationKillSlaveRSWithSeparateOldWALs.java | 47 ++++++++++++++++++++
.../replication/TestReplicationSmallTests.java | 24 +++++++++-
.../replication/TestReplicationSyncUpTool.java | 9 +++-
15 files changed, 222 insertions(+), 48 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/42d5447c/hbase-server/src/test/java/org/apache/hadoop/hbase/client/replication/TestReplicationAdminWithClusters.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/replication/TestReplicationAdminWithClusters.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/replication/TestReplicationAdminWithClusters.java
index bc21f1a..7be8c16 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/replication/TestReplicationAdminWithClusters.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/replication/TestReplicationAdminWithClusters.java
@@ -96,12 +96,13 @@ public class TestReplicationAdminWithClusters extends TestReplicationBase {
admin1.modifyTable(tableName, table);
admin1.enableTable(tableName);
-
admin1.disableTableReplication(tableName);
table = admin1.getTableDescriptor(tableName);
for (HColumnDescriptor fam : table.getColumnFamilies()) {
assertEquals(HConstants.REPLICATION_SCOPE_LOCAL, fam.getScope());
}
+
+ admin1.deleteColumnFamily(table.getTableName(), f.getName());
}
@Test
@@ -158,6 +159,9 @@ public class TestReplicationAdminWithClusters extends TestReplicationBase {
for (HColumnDescriptor fam : table.getColumnFamilies()) {
assertEquals(HConstants.REPLICATION_SCOPE_GLOBAL, fam.getScope());
}
+
+ admin1.deleteColumnFamily(tableName, f.getName());
+ admin2.deleteColumnFamily(tableName, f.getName());
}
@Test
@@ -252,12 +256,14 @@ public class TestReplicationAdminWithClusters extends TestReplicationBase {
rpc.getConfiguration().put("key1", "value2");
admin.updatePeerConfig(peerId, rpc);
if (!TestUpdatableReplicationEndpoint.hasCalledBack()) {
- synchronized(TestUpdatableReplicationEndpoint.class) {
+ synchronized (TestUpdatableReplicationEndpoint.class) {
TestUpdatableReplicationEndpoint.class.wait(2000L);
}
}
assertEquals(true, TestUpdatableReplicationEndpoint.hasCalledBack());
+
+ admin.removePeer(peerId);
}
public static class TestUpdatableReplicationEndpoint extends BaseReplicationEndpoint {
http://git-wip-us.apache.org/repos/asf/hbase/blob/42d5447c/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestMasterReplication.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestMasterReplication.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestMasterReplication.java
index de0b94f..37ca7dc 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestMasterReplication.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestMasterReplication.java
@@ -90,7 +90,7 @@ public class TestMasterReplication {
public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestMasterReplication.class);
- private static final Logger LOG = LoggerFactory.getLogger(TestReplicationBase.class);
+ private static final Logger LOG = LoggerFactory.getLogger(TestMasterReplication.class);
private Configuration baseConfiguration;
http://git-wip-us.apache.org/repos/asf/hbase/blob/42d5447c/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestMultiSlaveReplication.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestMultiSlaveReplication.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestMultiSlaveReplication.java
index f30c48d..225ca7f 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestMultiSlaveReplication.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestMultiSlaveReplication.java
@@ -58,7 +58,7 @@ public class TestMultiSlaveReplication {
public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestMultiSlaveReplication.class);
- private static final Logger LOG = LoggerFactory.getLogger(TestReplicationBase.class);
+ private static final Logger LOG = LoggerFactory.getLogger(TestMultiSlaveReplication.class);
private static Configuration conf1;
private static Configuration conf2;
http://git-wip-us.apache.org/repos/asf/hbase/blob/42d5447c/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestNamespaceReplication.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestNamespaceReplication.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestNamespaceReplication.java
index 37da482..d8a02c7 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestNamespaceReplication.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestNamespaceReplication.java
@@ -49,10 +49,17 @@ import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameter;
+import org.junit.runners.Parameterized.Parameters;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-@Category({MediumTests.class})
+import org.apache.hbase.thirdparty.com.google.common.collect.ImmutableList;
+
+@RunWith(Parameterized.class)
+@Category({ MediumTests.class })
public class TestNamespaceReplication extends TestReplicationBase {
@ClassRule
@@ -77,6 +84,19 @@ public class TestNamespaceReplication extends TestReplicationBase {
private static Admin admin1;
private static Admin admin2;
+ @Parameter
+ public boolean serialPeer;
+
+ @Override
+ protected boolean isSerialPeer() {
+ return serialPeer;
+ }
+
+ @Parameters(name = "{index}: serialPeer={0}")
+ public static List<Boolean> parameters() {
+ return ImmutableList.of(true, false);
+ }
+
@BeforeClass
public static void setUpBeforeClass() throws Exception {
TestReplicationBase.setUpBeforeClass();
@@ -224,7 +244,7 @@ public class TestNamespaceReplication extends TestReplicationBase {
assertArrayEquals(val, res.value());
break;
}
- Thread.sleep(SLEEP_TIME);
+ Thread.sleep(10 * SLEEP_TIME);
}
}
}
@@ -244,7 +264,7 @@ public class TestNamespaceReplication extends TestReplicationBase {
} else {
break;
}
- Thread.sleep(SLEEP_TIME);
+ Thread.sleep(10 * SLEEP_TIME);
}
}
}
http://git-wip-us.apache.org/repos/asf/hbase/blob/42d5447c/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationBase.java
----------------------------------------------------------------------
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 397d6e2..e0798a4 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
@@ -24,7 +24,6 @@ import static org.junit.Assert.fail;
import java.io.IOException;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import java.util.NavigableMap;
import java.util.TreeMap;
@@ -50,13 +49,12 @@ import org.apache.hadoop.hbase.client.TableDescriptorBuilder;
import org.apache.hadoop.hbase.client.replication.ReplicationAdmin;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.JVMClusterUtil;
-import org.apache.hadoop.hbase.wal.AbstractFSWALProvider;
import org.apache.hadoop.hbase.zookeeper.MiniZooKeeperCluster;
import org.apache.hadoop.hbase.zookeeper.ZKWatcher;
+import org.junit.After;
import org.junit.AfterClass;
+import org.junit.Before;
import org.junit.BeforeClass;
-import org.junit.runners.Parameterized.Parameter;
-import org.junit.runners.Parameterized.Parameters;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -67,11 +65,6 @@ import org.slf4j.LoggerFactory;
* All other tests should have their own classes and extend this one
*/
public class TestReplicationBase {
-/*
- {
- ((Log4JLogger) ReplicationSource.LOG).getLogger().setLevel(Level.ALL);
- }*/
-
private static final Logger LOG = LoggerFactory.getLogger(TestReplicationBase.class);
protected static Configuration conf1 = HBaseConfiguration.create();
@@ -100,13 +93,10 @@ public class TestReplicationBase {
protected static final byte[] famName = Bytes.toBytes("f");
protected static final byte[] row = Bytes.toBytes("row");
protected static final byte[] noRepfamName = Bytes.toBytes("norep");
+ protected static final String PEER_ID2 = "2";
- @Parameter
- public static boolean seperateOldWALs;
-
- @Parameters
- public static List<Boolean> params() {
- return Arrays.asList(false, true);
+ protected boolean isSerialPeer() {
+ return false;
}
protected final void cleanUp() throws IOException, InterruptedException {
@@ -196,9 +186,6 @@ public class TestReplicationBase {
conf1.setFloat("replication.source.ratio", 1.0f);
conf1.setBoolean("replication.source.eof.autorecovery", true);
- // Parameter config
- conf1.setBoolean(AbstractFSWALProvider.SEPARATE_OLDLOGDIR, seperateOldWALs);
-
utility1 = new HBaseTestingUtility(conf1);
utility1.startMiniZKCluster();
MiniZooKeeperCluster miniZK = utility1.getZkCluster();
@@ -226,10 +213,7 @@ public class TestReplicationBase {
// as a component in deciding maximum number of parallel batches to send to the peer cluster.
utility2.startMiniCluster(4);
- ReplicationPeerConfig rpc =
- ReplicationPeerConfig.newBuilder().setClusterKey(utility2.getClusterKey()).build();
hbaseAdmin = ConnectionFactory.createConnection(conf1).getAdmin();
- hbaseAdmin.addReplicationPeer("2", rpc);
TableDescriptor table = TableDescriptorBuilder.newBuilder(tableName)
.setColumnFamily(ColumnFamilyDescriptorBuilder.newBuilder(famName).setMaxVersions(100)
@@ -253,6 +237,26 @@ public class TestReplicationBase {
htable2 = connection2.getTable(tableName);
}
+ private boolean peerExist(String peerId) throws IOException {
+ return hbaseAdmin.listReplicationPeers().stream().anyMatch(p -> peerId.equals(p.getPeerId()));
+ }
+
+ @Before
+ public void setUpBase() throws IOException {
+ if (!peerExist(PEER_ID2)) {
+ ReplicationPeerConfig rpc = ReplicationPeerConfig.newBuilder()
+ .setClusterKey(utility2.getClusterKey()).setSerial(isSerialPeer()).build();
+ hbaseAdmin.addReplicationPeer(PEER_ID2, rpc);
+ }
+ }
+
+ @After
+ public void tearDownBase() throws IOException {
+ if (peerExist(PEER_ID2)) {
+ hbaseAdmin.removeReplicationPeer(PEER_ID2);
+ }
+ }
+
protected static void runSimplePutDeleteTest() throws IOException, InterruptedException {
Put put = new Put(row);
put.addColumn(famName, row, row);
http://git-wip-us.apache.org/repos/asf/hbase/blob/42d5447c/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationChangingPeerRegionservers.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationChangingPeerRegionservers.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationChangingPeerRegionservers.java
index 5492cf6..b94b443 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationChangingPeerRegionservers.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationChangingPeerRegionservers.java
@@ -22,6 +22,8 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import java.io.IOException;
+import java.util.List;
+
import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.MiniHBaseCluster;
import org.apache.hadoop.hbase.client.Get;
@@ -37,13 +39,20 @@ import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameter;
+import org.junit.runners.Parameterized.Parameters;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.apache.hbase.thirdparty.com.google.common.collect.ImmutableList;
+
/**
* Test handling of changes to the number of a peer's regionservers.
*/
-@Category({ReplicationTests.class, LargeTests.class})
+@RunWith(Parameterized.class)
+@Category({ ReplicationTests.class, LargeTests.class })
public class TestReplicationChangingPeerRegionservers extends TestReplicationBase {
@ClassRule
@@ -53,6 +62,19 @@ public class TestReplicationChangingPeerRegionservers extends TestReplicationBas
private static final Logger LOG =
LoggerFactory.getLogger(TestReplicationChangingPeerRegionservers.class);
+ @Parameter
+ public boolean serialPeer;
+
+ @Override
+ protected boolean isSerialPeer() {
+ return serialPeer;
+ }
+
+ @Parameters(name = "{index}: serialPeer={0}")
+ public static List<Boolean> parameters() {
+ return ImmutableList.of(true, false);
+ }
+
/**
* @throws java.lang.Exception
*/
@@ -60,8 +82,8 @@ public class TestReplicationChangingPeerRegionservers extends TestReplicationBas
public void setUp() throws Exception {
// Starting and stopping replication can make us miss new logs,
// rolling like this makes sure the most recent one gets added to the queue
- for (JVMClusterUtil.RegionServerThread r :
- utility1.getHBaseCluster().getRegionServerThreads()) {
+ for (JVMClusterUtil.RegionServerThread r : utility1.getHBaseCluster()
+ .getRegionServerThreads()) {
utility1.getAdmin().rollWALWriter(r.getRegionServer().getServerName());
}
utility1.deleteTableData(tableName);
@@ -94,7 +116,6 @@ public class TestReplicationChangingPeerRegionservers extends TestReplicationBas
@Test
public void testChangingNumberOfPeerRegionServers() throws IOException, InterruptedException {
-
LOG.info("testSimplePutDelete");
MiniHBaseCluster peerCluster = utility2.getMiniHBaseCluster();
int numRS = peerCluster.getRegionServerThreads().size();
@@ -116,7 +137,6 @@ public class TestReplicationChangingPeerRegionservers extends TestReplicationBas
assertEquals(numRS, peerCluster.getRegionServerThreads().size());
doPutTest(Bytes.toBytes(3));
-
}
private void doPutTest(byte[] row) throws IOException, InterruptedException {
http://git-wip-us.apache.org/repos/asf/hbase/blob/42d5447c/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationDroppedTables.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationDroppedTables.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationDroppedTables.java
index e9e92b8..cd051d2 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationDroppedTables.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationDroppedTables.java
@@ -119,6 +119,12 @@ public class TestReplicationDroppedTables extends TestReplicationBase {
admin2.createNamespace(NamespaceDescriptor.create("NS").build());
}
testEditsBehindDroppedTable(true, "NS:test_dropped");
+ try (Admin admin1 = connection1.getAdmin()) {
+ admin1.deleteNamespace("NS");
+ }
+ try (Admin admin2 = connection2.getAdmin()) {
+ admin2.deleteNamespace("NS");
+ }
}
private void testEditsBehindDroppedTable(boolean allowProceeding, String tName) throws Exception {
http://git-wip-us.apache.org/repos/asf/hbase/blob/42d5447c/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationEndpoint.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationEndpoint.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationEndpoint.java
index 173287c..3fca0ec 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationEndpoint.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationEndpoint.java
@@ -64,7 +64,7 @@ import org.slf4j.LoggerFactory;
/**
* Tests ReplicationSource and ReplicationEndpoint interactions
*/
-@Category({ReplicationTests.class, MediumTests.class})
+@Category({ ReplicationTests.class, MediumTests.class })
public class TestReplicationEndpoint extends TestReplicationBase {
@ClassRule
@@ -78,7 +78,6 @@ public class TestReplicationEndpoint extends TestReplicationBase {
@BeforeClass
public static void setUpBeforeClass() throws Exception {
TestReplicationBase.setUpBeforeClass();
- admin.removePeer("2");
numRegionServers = utility1.getHBaseCluster().getRegionServerThreads().size();
}
@@ -389,6 +388,7 @@ public class TestReplicationEndpoint extends TestReplicationBase {
static volatile List<Entry> lastEntries = null;
public ReplicationEndpointForTest() {
+ replicateCount.set(0);
contructedCount.incrementAndGet();
}
@@ -433,6 +433,10 @@ public class TestReplicationEndpoint extends TestReplicationBase {
static AtomicInteger replicateCount = new AtomicInteger();
static boolean failedOnce;
+ public InterClusterReplicationEndpointForTest() {
+ replicateCount.set(0);
+ }
+
@Override
public boolean replicate(ReplicateContext replicateContext) {
boolean success = super.replicate(replicateContext);
http://git-wip-us.apache.org/repos/asf/hbase/blob/42d5447c/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationKillMasterRS.java
----------------------------------------------------------------------
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 4b8e634..41cc9bc 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
@@ -23,15 +23,12 @@ import org.apache.hadoop.hbase.testclassification.ReplicationTests;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
/**
* Runs the TestReplicationKillRS test and selects the RS to kill in the master cluster
* Do not add other tests in this class.
*/
-@RunWith(Parameterized.class)
-@Category({ReplicationTests.class, LargeTests.class})
+@Category({ ReplicationTests.class, LargeTests.class })
public class TestReplicationKillMasterRS extends TestReplicationKillRS {
@ClassRule
@@ -42,5 +39,4 @@ public class TestReplicationKillMasterRS extends TestReplicationKillRS {
public void killOneMasterRS() throws Exception {
loadTableAndKillRS(utility1);
}
-
}
http://git-wip-us.apache.org/repos/asf/hbase/blob/42d5447c/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationKillMasterRSCompressed.java
----------------------------------------------------------------------
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 90b9bd8..6cbae83 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
@@ -29,7 +29,7 @@ import org.junit.experimental.categories.Category;
* Run the same test as TestReplicationKillMasterRS but with WAL compression enabled
* Do not add other tests in this class.
*/
-@Category({ReplicationTests.class, LargeTests.class})
+@Category({ ReplicationTests.class, LargeTests.class })
public class TestReplicationKillMasterRSCompressed extends TestReplicationKillMasterRS {
@ClassRule
http://git-wip-us.apache.org/repos/asf/hbase/blob/42d5447c/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationKillMasterRSWithSeparateOldWALs.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..108f274
--- /dev/null
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationKillMasterRSWithSeparateOldWALs.java
@@ -0,0 +1,47 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * 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;
+import org.apache.hadoop.hbase.testclassification.LargeTests;
+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 {
+
+ @ClassRule
+ public static final HBaseClassTestRule CLASS_RULE =
+ 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(utility1);
+ }
+}
http://git-wip-us.apache.org/repos/asf/hbase/blob/42d5447c/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationKillSlaveRS.java
----------------------------------------------------------------------
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 a6a5738..96630b2 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
@@ -23,15 +23,12 @@ import org.apache.hadoop.hbase.testclassification.ReplicationTests;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
/**
* Runs the TestReplicationKillRS test and selects the RS to kill in the slave cluster
* Do not add other tests in this class.
*/
-@RunWith(Parameterized.class)
-@Category({ReplicationTests.class, LargeTests.class})
+@Category({ ReplicationTests.class, LargeTests.class })
public class TestReplicationKillSlaveRS extends TestReplicationKillRS {
@ClassRule
http://git-wip-us.apache.org/repos/asf/hbase/blob/42d5447c/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationKillSlaveRSWithSeparateOldWALs.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..a852b81
--- /dev/null
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationKillSlaveRSWithSeparateOldWALs.java
@@ -0,0 +1,47 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * 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;
+import org.apache.hadoop.hbase.testclassification.LargeTests;
+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 {
+
+ @ClassRule
+ public static final HBaseClassTestRule CLASS_RULE =
+ 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(utility2);
+ }
+}
http://git-wip-us.apache.org/repos/asf/hbase/blob/42d5447c/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationSmallTests.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationSmallTests.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationSmallTests.java
index 8d24f5e..2c8dc4c 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationSmallTests.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationSmallTests.java
@@ -55,9 +55,16 @@ import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameter;
+import org.junit.runners.Parameterized.Parameters;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.apache.hbase.thirdparty.com.google.common.collect.ImmutableList;
+
+@RunWith(Parameterized.class)
@Category({ ReplicationTests.class, LargeTests.class })
public class TestReplicationSmallTests extends TestReplicationBase {
@@ -68,6 +75,19 @@ public class TestReplicationSmallTests extends TestReplicationBase {
private static final Logger LOG = LoggerFactory.getLogger(TestReplicationSmallTests.class);
private static final String PEER_ID = "2";
+ @Parameter
+ public boolean serialPeer;
+
+ @Override
+ protected boolean isSerialPeer() {
+ return serialPeer;
+ }
+
+ @Parameters(name = "{index}: serialPeer={0}")
+ public static List<Boolean> parameters() {
+ return ImmutableList.of(true, false);
+ }
+
@Before
public void setUp() throws Exception {
cleanUp();
@@ -316,8 +336,8 @@ public class TestReplicationSmallTests extends TestReplicationBase {
lastRow = currentRow;
}
LOG.error("Last row: " + lastRow);
- fail("Waited too much time for normal batch replication, " + res.length + " instead of " +
- NB_ROWS_IN_BIG_BATCH + "; waited=" + (System.currentTimeMillis() - start) + "ms");
+ fail("Waited too much time for normal batch replication, " + res.length + " instead of "
+ + NB_ROWS_IN_BIG_BATCH + "; waited=" + (System.currentTimeMillis() - start) + "ms");
} else {
LOG.info("Only got " + res.length + " rows... retrying");
Thread.sleep(SLEEP_TIME);
http://git-wip-us.apache.org/repos/asf/hbase/blob/42d5447c/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationSyncUpTool.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationSyncUpTool.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationSyncUpTool.java
index 6c487ad..3d2cdfb 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationSyncUpTool.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationSyncUpTool.java
@@ -19,6 +19,7 @@ package org.apache.hadoop.hbase.replication;
import static org.junit.Assert.assertEquals;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.apache.hadoop.hbase.HBaseClassTestRule;
@@ -39,6 +40,7 @@ import org.apache.hadoop.hbase.testclassification.LargeTests;
import org.apache.hadoop.hbase.testclassification.ReplicationTests;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.util.ToolRunner;
+import org.junit.After;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Test;
@@ -46,7 +48,7 @@ import org.junit.experimental.categories.Category;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-@Category({ReplicationTests.class, LargeTests.class})
+@Category({ ReplicationTests.class, LargeTests.class })
public class TestReplicationSyncUpTool extends TestReplicationBase {
@ClassRule
@@ -97,7 +99,12 @@ public class TestReplicationSyncUpTool extends TestReplicationBase {
t2_syncupTarget.addFamily(fam);
fam = new HColumnDescriptor(noRepfamName);
t2_syncupTarget.addFamily(fam);
+ }
+ @After
+ public void tearDownBase() throws IOException {
+ // Do nothing, just replace the super tearDown. because the super tearDown will use the
+ // out-of-data HBase admin to remove replication peer, which will be result in failure.
}
/**