HBASE-11517 TestReplicaWithCluster turns zombie (Mikhail Antonov) -- REAPPLY
This commit is contained in:
parent
782b1456f2
commit
3455065a75
@ -65,6 +65,9 @@ public class TestReplicaWithCluster {
|
|||||||
private static final int NB_SERVERS = 2;
|
private static final int NB_SERVERS = 2;
|
||||||
private static final byte[] row = TestReplicaWithCluster.class.getName().getBytes();
|
private static final byte[] row = TestReplicaWithCluster.class.getName().getBytes();
|
||||||
private static final HBaseTestingUtility HTU = new HBaseTestingUtility();
|
private static final HBaseTestingUtility HTU = new HBaseTestingUtility();
|
||||||
|
|
||||||
|
// second minicluster used in testing of replication
|
||||||
|
private static HBaseTestingUtility HTU2;
|
||||||
private static final byte[] f = HConstants.CATALOG_FAMILY;
|
private static final byte[] f = HConstants.CATALOG_FAMILY;
|
||||||
|
|
||||||
private final static int REFRESH_PERIOD = 1000;
|
private final static int REFRESH_PERIOD = 1000;
|
||||||
@ -126,6 +129,7 @@ public class TestReplicaWithCluster {
|
|||||||
|
|
||||||
@AfterClass
|
@AfterClass
|
||||||
public static void afterClass() throws Exception {
|
public static void afterClass() throws Exception {
|
||||||
|
HTU2.shutdownMiniCluster();
|
||||||
HTU.shutdownMiniCluster();
|
HTU.shutdownMiniCluster();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,17 +214,14 @@ public class TestReplicaWithCluster {
|
|||||||
|
|
||||||
HTU.getHBaseCluster().stopMaster(0);
|
HTU.getHBaseCluster().stopMaster(0);
|
||||||
HBaseAdmin admin = new HBaseAdmin(HTU.getConfiguration());
|
HBaseAdmin admin = new HBaseAdmin(HTU.getConfiguration());
|
||||||
try {
|
nHdt =admin.getTableDescriptor(hdt.getTableName());
|
||||||
nHdt = admin.getTableDescriptor(hdt.getTableName());
|
Assert.assertEquals("fams=" + Arrays.toString(nHdt.getColumnFamilies()),
|
||||||
Assert.assertEquals("fams=" + Arrays.toString(nHdt.getColumnFamilies()),
|
|
||||||
bHdt.getColumnFamilies().length + 1, nHdt.getColumnFamilies().length);
|
bHdt.getColumnFamilies().length + 1, nHdt.getColumnFamilies().length);
|
||||||
|
|
||||||
admin.disableTable(hdt.getTableName());
|
admin.disableTable(hdt.getTableName());
|
||||||
admin.deleteTable(hdt.getTableName());
|
admin.deleteTable(hdt.getTableName());
|
||||||
HTU.getHBaseCluster().startMaster();
|
HTU.getHBaseCluster().startMaster();
|
||||||
} finally {
|
admin.close();
|
||||||
if (admin != null) admin.close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test (timeout=30000)
|
@Test (timeout=30000)
|
||||||
@ -239,30 +240,28 @@ public class TestReplicaWithCluster {
|
|||||||
conf2.set(HConstants.HBASE_CLIENT_INSTANCE_ID, String.valueOf(-1));
|
conf2.set(HConstants.HBASE_CLIENT_INSTANCE_ID, String.valueOf(-1));
|
||||||
conf2.set(HConstants.ZOOKEEPER_ZNODE_PARENT, "/2");
|
conf2.set(HConstants.ZOOKEEPER_ZNODE_PARENT, "/2");
|
||||||
MiniZooKeeperCluster miniZK = HTU.getZkCluster();
|
MiniZooKeeperCluster miniZK = HTU.getZkCluster();
|
||||||
HBaseTestingUtility HTU2 = new HBaseTestingUtility(conf2);
|
|
||||||
|
HTU2 = new HBaseTestingUtility(conf2);
|
||||||
HTU2.setZkCluster(miniZK);
|
HTU2.setZkCluster(miniZK);
|
||||||
HTU2.startMiniCluster(NB_SERVERS);
|
HTU2.startMiniCluster(NB_SERVERS);
|
||||||
LOG.info("Setup second Zk");
|
LOG.info("Setup second Zk");
|
||||||
HTU2.getHBaseAdmin().createTable(hdt, HBaseTestingUtility.KEYS_FOR_HBA_CREATE_TABLE);
|
HTU2.getHBaseAdmin().createTable(hdt, HBaseTestingUtility.KEYS_FOR_HBA_CREATE_TABLE);
|
||||||
|
|
||||||
ReplicationAdmin admin = new ReplicationAdmin(HTU.getConfiguration());
|
ReplicationAdmin admin = new ReplicationAdmin(HTU.getConfiguration());
|
||||||
try {
|
admin.addPeer("2", HTU2.getClusterKey());
|
||||||
admin.addPeer("2", HTU2.getClusterKey());
|
admin.close();
|
||||||
} finally {
|
|
||||||
if (admin != null) admin.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
Put p = new Put(row);
|
Put p = new Put(row);
|
||||||
p.add(row, row, row);
|
p.add(row, row, row);
|
||||||
final HTable table = new HTable(HTU.getConfiguration(), hdt.getTableName());
|
final HTable table = new HTable(HTU.getConfiguration(), hdt.getTableName());
|
||||||
try {
|
table.put(p);
|
||||||
table.put(p);
|
|
||||||
HTU.getHBaseAdmin().flush(table.getTableName());
|
|
||||||
LOG.info("Put & flush done on the first cluster. Now doing a get on the same cluster.");
|
|
||||||
|
|
||||||
Waiter.waitFor(HTU.getConfiguration(), 1000, new Waiter.Predicate<Exception>() {
|
HTU.getHBaseAdmin().flush(table.getTableName());
|
||||||
@Override
|
LOG.info("Put & flush done on the first cluster. Now doing a get on the same cluster.");
|
||||||
public boolean evaluate() throws Exception {
|
|
||||||
|
Waiter.waitFor(HTU.getConfiguration(), 1000, new Waiter.Predicate<Exception>() {
|
||||||
|
@Override
|
||||||
|
public boolean evaluate() throws Exception {
|
||||||
try {
|
try {
|
||||||
SlowMeCopro.cdl.set(new CountDownLatch(1));
|
SlowMeCopro.cdl.set(new CountDownLatch(1));
|
||||||
Get g = new Get(row);
|
Get g = new Get(row);
|
||||||
@ -275,16 +274,13 @@ public class TestReplicaWithCluster {
|
|||||||
SlowMeCopro.sleepTime.set(0);
|
SlowMeCopro.sleepTime.set(0);
|
||||||
}
|
}
|
||||||
}});
|
}});
|
||||||
} finally {
|
table.close();
|
||||||
if (table != null) table.close();
|
|
||||||
}
|
|
||||||
LOG.info("stale get on the first cluster done. Now for the second.");
|
LOG.info("stale get on the first cluster done. Now for the second.");
|
||||||
|
|
||||||
final HTable table2 = new HTable(HTU.getConfiguration(), hdt.getTableName());
|
final HTable table2 = new HTable(HTU.getConfiguration(), hdt.getTableName());
|
||||||
try {
|
Waiter.waitFor(HTU.getConfiguration(), 1000, new Waiter.Predicate<Exception>() {
|
||||||
Waiter.waitFor(HTU.getConfiguration(), 1000, new Waiter.Predicate<Exception>() {
|
@Override
|
||||||
@Override
|
public boolean evaluate() throws Exception {
|
||||||
public boolean evaluate() throws Exception {
|
|
||||||
try {
|
try {
|
||||||
SlowMeCopro.cdl.set(new CountDownLatch(1));
|
SlowMeCopro.cdl.set(new CountDownLatch(1));
|
||||||
Get g = new Get(row);
|
Get g = new Get(row);
|
||||||
@ -297,9 +293,7 @@ public class TestReplicaWithCluster {
|
|||||||
SlowMeCopro.sleepTime.set(0);
|
SlowMeCopro.sleepTime.set(0);
|
||||||
}
|
}
|
||||||
}});
|
}});
|
||||||
} finally {
|
table2.close();
|
||||||
if (table2 != null) table2.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
HTU.getHBaseAdmin().disableTable(hdt.getTableName());
|
HTU.getHBaseAdmin().disableTable(hdt.getTableName());
|
||||||
HTU.deleteTable(hdt.getTableName());
|
HTU.deleteTable(hdt.getTableName());
|
||||||
@ -307,10 +301,11 @@ public class TestReplicaWithCluster {
|
|||||||
HTU2.getHBaseAdmin().disableTable(hdt.getTableName());
|
HTU2.getHBaseAdmin().disableTable(hdt.getTableName());
|
||||||
HTU2.deleteTable(hdt.getTableName());
|
HTU2.deleteTable(hdt.getTableName());
|
||||||
|
|
||||||
HTU2.shutdownMiniCluster();
|
// We shutdown HTU2 minicluster later, in afterClass(), as shutting down
|
||||||
|
// the minicluster has negative impact of deleting all HConnections in JVM.
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test (timeout=30000)
|
||||||
public void testBulkLoad() throws IOException {
|
public void testBulkLoad() throws IOException {
|
||||||
// Create table then get the single region for our new table.
|
// Create table then get the single region for our new table.
|
||||||
LOG.debug("Creating test table");
|
LOG.debug("Creating test table");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user