HBASE-3889 NPE in Distributed Log Splitting

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1136659 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2011-06-16 20:43:28 +00:00
parent 0f15fcac46
commit bd7c8e327f
3 changed files with 39 additions and 4 deletions

View File

@ -127,6 +127,7 @@ Release 0.91.0 - Unreleased
HBASE-3983 list command in shell seems broken
HBASE-3793 HBASE-3468 Broke checkAndPut with null value (Ming Ma)
HBASE-3995 HBASE-3946 broke TestMasterFailover
HBASE-3889 NPE in Distributed Log Splitting (Anirudh Todi)
IMPROVEMENTS
HBASE-3290 Max Compaction Size (Nicolas Spiegelberg via Stack)

View File

@ -136,6 +136,7 @@ public class SplitLogWorker extends ZooKeeperListener implements Runnable {
@Override
public void run() {
try {
LOG.info("SplitLogWorker " + this.serverName + " starting");
this.watcher.registerListener(this);
int res;
@ -162,8 +163,13 @@ public class SplitLogWorker extends ZooKeeperListener implements Runnable {
}
taskLoop();
LOG.info("SplitLogWorker " + this.serverName + " exiting");
} catch (Throwable t) {
// only a logical error can cause here. Printing it out
// to make debugging easier
LOG.error("unexpected error ", t);
} finally {
LOG.info("SplitLogWorker " + this.serverName + " exiting");
}
}
/**

View File

@ -152,7 +152,8 @@ public class TestHLogSplit {
* @throws IOException
* @see https://issues.apache.org/jira/browse/HBASE-3020
*/
@Test public void testRecoveredEditsPathForMeta() throws IOException {
@Test
public void testRecoveredEditsPathForMeta() throws IOException {
FileSystem fs = FileSystem.get(TEST_UTIL.getConfiguration());
byte [] encoded = HRegionInfo.FIRST_META_REGIONINFO.getEncodedNameAsBytes();
Path tdir = new Path(hbaseDir, Bytes.toString(HConstants.META_TABLE_NAME));
@ -952,7 +953,35 @@ public class TestHLogSplit {
assertEquals(true, logsAreEqual(originalLog, splitLog));
}
@Test
public void testSplitLogFileDeletedRegionDir()
throws IOException {
LOG.info("testSplitLogFileDeletedRegionDir");
final String REGION = "region__1";
regions.removeAll(regions);
regions.add(REGION);
generateHLogs(1, 10, -1);
FileStatus logfile = fs.listStatus(hlogDir)[0];
fs.initialize(fs.getUri(), conf);
Path regiondir = new Path(tabledir, REGION);
LOG.info("Region directory is" + regiondir);
fs.delete(regiondir, true);
HLogSplitter.splitLogFileToTemp(hbaseDir, "tmpdir", logfile, fs,
conf, reporter);
HLogSplitter.moveRecoveredEditsFromTemp("tmpdir", hbaseDir, oldLogDir,
logfile.getPath().toString(), conf);
assertTrue(!fs.exists(regiondir));
assertTrue(true);
}
@Test
public void testSplitLogFileEmpty() throws IOException {
LOG.info("testSplitLogFileEmpty");
@ -1009,7 +1038,6 @@ public class TestHLogSplit {
assertEquals(1, fs.listStatus(corruptDir).length);
}
private void flushToConsole(String s) {
System.out.println(s);
System.out.flush();