HBASE-10004 Some fixes for scoping sequence Ids to region level (Himanshu Vashishtha)

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1543658 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
mbertozzi 2013-11-20 00:09:09 +00:00
parent 56d089a3e4
commit e0c324f9d5
3 changed files with 9 additions and 7 deletions

View File

@ -809,7 +809,8 @@ class FSHLog implements HLog, Syncable {
// The path should start with dir/<prefix>.
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));

View File

@ -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 {

View File

@ -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<byte[], Long> oldestFlushingSeqNo = new HashMap<byte[], Long>();
Map<byte[], Long> oldestUnFlushedSeqNo = new HashMap<byte[], Long>();
Map<byte[], Long> seqNo = new HashMap<byte[], Long>();