HBASE-7530 [replication] Work around HDFS-4380 else we get NPEs

HBASE-7531  [replication] NPE in SequenceFileLogReader because
            ReplicationSource doesn't nullify the reader
HBASE-7534  [replication] TestReplication.queueFailover can fail
            because HBaseTestingUtility.createMultiRegions is dangerous


git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1431768 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jean-Daniel Cryans 2013-01-11 00:53:28 +00:00
parent 2eb9249ac2
commit 72bf55b224
3 changed files with 16 additions and 6 deletions

View File

@ -553,6 +553,7 @@ public class ReplicationSource extends Thread
} }
} catch (IOException ioe) { } catch (IOException ioe) {
LOG.warn(peerClusterZnode + " Got: ", ioe); LOG.warn(peerClusterZnode + " Got: ", ioe);
this.reader = null;
// TODO Need a better way to determinate if a file is really gone but // TODO Need a better way to determinate if a file is really gone but
// TODO without scanning all logs dir // TODO without scanning all logs dir
if (sleepMultiplier == this.maxRetriesMultiplier) { if (sleepMultiplier == this.maxRetriesMultiplier) {

View File

@ -1260,6 +1260,18 @@ public class HBaseTestingUtility extends HBaseCommonTestingUtility {
Bytes.toBytes("xxx"), Bytes.toBytes("yyy") Bytes.toBytes("xxx"), Bytes.toBytes("yyy")
}; };
public static final byte[][] KEYS_FOR_HBA_CREATE_TABLE = {
Bytes.toBytes("bbb"),
Bytes.toBytes("ccc"), Bytes.toBytes("ddd"), Bytes.toBytes("eee"),
Bytes.toBytes("fff"), Bytes.toBytes("ggg"), Bytes.toBytes("hhh"),
Bytes.toBytes("iii"), Bytes.toBytes("jjj"), Bytes.toBytes("kkk"),
Bytes.toBytes("lll"), Bytes.toBytes("mmm"), Bytes.toBytes("nnn"),
Bytes.toBytes("ooo"), Bytes.toBytes("ppp"), Bytes.toBytes("qqq"),
Bytes.toBytes("rrr"), Bytes.toBytes("sss"), Bytes.toBytes("ttt"),
Bytes.toBytes("uuu"), Bytes.toBytes("vvv"), Bytes.toBytes("www"),
Bytes.toBytes("xxx"), Bytes.toBytes("yyy"), Bytes.toBytes("zzz")
};
/** /**
* Creates many regions names "aaa" to "zzz". * Creates many regions names "aaa" to "zzz".
* @param c Configuration to use. * @param c Configuration to use.

View File

@ -91,9 +91,8 @@ public class TestReplication {
@BeforeClass @BeforeClass
public static void setUpBeforeClass() throws Exception { public static void setUpBeforeClass() throws Exception {
conf1.set(HConstants.ZOOKEEPER_ZNODE_PARENT, "/1"); conf1.set(HConstants.ZOOKEEPER_ZNODE_PARENT, "/1");
// smaller block size and capacity to trigger more operations // smaller log roll size to trigger more events
// and test them conf1.setFloat("hbase.regionserver.logroll.multiplier", 0.0003f);
conf1.setInt("hbase.regionserver.hlog.blocksize", 1024*20);
conf1.setInt("replication.source.size.capacity", 1024); conf1.setInt("replication.source.size.capacity", 1024);
conf1.setLong("replication.source.sleepforretries", 100); conf1.setLong("replication.source.sleepforretries", 100);
conf1.setInt("hbase.regionserver.maxlogs", 10); conf1.setInt("hbase.regionserver.maxlogs", 10);
@ -142,7 +141,7 @@ public class TestReplication {
table.addFamily(fam); table.addFamily(fam);
HBaseAdmin admin1 = new HBaseAdmin(conf1); HBaseAdmin admin1 = new HBaseAdmin(conf1);
HBaseAdmin admin2 = new HBaseAdmin(conf2); HBaseAdmin admin2 = new HBaseAdmin(conf2);
admin1.createTable(table); admin1.createTable(table, HBaseTestingUtility.KEYS_FOR_HBA_CREATE_TABLE);
admin2.createTable(table); admin2.createTable(table);
htable1 = new HTable(conf1, tableName); htable1 = new HTable(conf1, tableName);
htable1.setWriteBufferSize(1024); htable1.setWriteBufferSize(1024);
@ -716,8 +715,6 @@ public class TestReplication {
*/ */
@Test(timeout=300000) @Test(timeout=300000)
public void queueFailover() throws Exception { public void queueFailover() throws Exception {
utility1.createMultiRegions(htable1, famName);
// killing the RS with .META. can result into failed puts until we solve // killing the RS with .META. can result into failed puts until we solve
// IO fencing // IO fencing
int rsToKill1 = int rsToKill1 =