diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/FSHLog.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/FSHLog.java index c97f7d3a9a2..2af14b88518 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/FSHLog.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/FSHLog.java @@ -809,7 +809,8 @@ class FSHLog implements HLog, Syncable { // The path should start with dir/. String prefixPathStr = new Path(dir, prefix + ".").toString(); if (!fileName.toString().startsWith(prefixPathStr)) { - throw new IllegalArgumentException("The log doesn't belong to this regionserver"); + throw new IllegalArgumentException("The log file " + fileName + " doesn't belong to" + + " this regionserver " + prefixPathStr); } String chompedPath = fileName.toString().substring(prefixPathStr.length()); if (forMeta) chompedPath = chompedPath.substring(0, chompedPath.indexOf(META_HLOG_FILE_EXTN)); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/HLogPerformanceEvaluation.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/HLogPerformanceEvaluation.java index f27028bd612..852980db379 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/HLogPerformanceEvaluation.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/HLogPerformanceEvaluation.java @@ -289,9 +289,9 @@ public final class HLogPerformanceEvaluation extends Configured implements Tool + sequenceIds.get(Bytes.toString(e.getKey().getEncodedRegionName())) + ", current seqid = " + seqid); } - } else { - sequenceIds.put(Bytes.toString(e.getKey().getEncodedRegionName()), seqid); } + // update the sequence Id. + sequenceIds.put(Bytes.toString(e.getKey().getEncodedRegionName()), seqid); if (verbose) LOG.info("seqid=" + seqid); } } finally { diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestHLog.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestHLog.java index 1780928145e..e19fcf24c24 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestHLog.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestHLog.java @@ -1090,14 +1090,14 @@ public class TestHLog { // get the regions to flush; since there is only one region in the oldest wal, it should // return only one region. byte[][] regionsToFlush = ((FSHLog) hlog).findRegionsToForceFlush(); - assertEquals(regionsToFlush.length, 1); - assertEquals(regionsToFlush[0], hri1.getEncodedNameAsBytes()); + assertEquals(1, regionsToFlush.length); + assertEquals(hri1.getEncodedNameAsBytes(), regionsToFlush[0]); // insert edits in second region addEdits(hlog, hri2, t2, 2, sequenceId2); // get the regions to flush, it should still read region1. regionsToFlush = ((FSHLog) hlog).findRegionsToForceFlush(); assertEquals(regionsToFlush.length, 1); - assertEquals(regionsToFlush[0], hri1.getEncodedNameAsBytes()); + assertEquals(hri1.getEncodedNameAsBytes(), regionsToFlush[0]); // flush region 1, and roll the wal file. Only last wal which has entries for region1 should // remain. flushRegion(hlog, hri1.getEncodedNameAsBytes()); @@ -1120,7 +1120,7 @@ public class TestHLog { // it should return two regions to flush, as the oldest wal file has entries // for both regions. regionsToFlush = ((FSHLog) hlog).findRegionsToForceFlush(); - assertEquals(regionsToFlush.length, 2); + assertEquals(2, regionsToFlush.length); // flush both regions flushRegion(hlog, hri1.getEncodedNameAsBytes()); flushRegion(hlog, hri2.getEncodedNameAsBytes()); @@ -1147,6 +1147,7 @@ public class TestHLog { */ @Test public void testAllRegionsFlushed() { + LOG.debug("testAllRegionsFlushed"); Map oldestFlushingSeqNo = new HashMap(); Map oldestUnFlushedSeqNo = new HashMap(); Map seqNo = new HashMap();