You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2011/11/19 19:36:03 UTC
svn commit: r1204036 - in /hbase/branches/0.92: CHANGES.txt
src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
src/main/java/org/apache/hadoop/hbase/regionserver/LogRoller.java
src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java
Author: stack
Date: Sat Nov 19 18:36:03 2011
New Revision: 1204036
URL: http://svn.apache.org/viewvc?rev=1204036&view=rev
Log:
HBASE-4789 On split, parent region is sticking around in oldest sequenceid to region map though not online; we don't cleanup WALs
Modified:
hbase/branches/0.92/CHANGES.txt
hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/regionserver/LogRoller.java
hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java
Modified: hbase/branches/0.92/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/branches/0.92/CHANGES.txt?rev=1204036&r1=1204035&r2=1204036&view=diff
==============================================================================
--- hbase/branches/0.92/CHANGES.txt (original)
+++ hbase/branches/0.92/CHANGES.txt Sat Nov 19 18:36:03 2011
@@ -433,6 +433,8 @@ Release 0.92.0 - Unreleased
HBASE-4796 Race between SplitRegionHandlers for the same region kills the master
HBASE-4799 Catalog Janitor logic bug causes region leackage
HBASE-4436 Remove @deprecated Scan methods in 0.90 from TRUNK and 0.92
+ HBASE-4789 On split, parent region is sticking around in oldest sequenceid to
+ region map though not online; we don't cleanup WALs
TESTS
HBASE-4492 TestRollingRestart fails intermittently
Modified: hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java?rev=1204036&r1=1204035&r2=1204036&view=diff
==============================================================================
--- hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java (original)
+++ hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java Sat Nov 19 18:36:03 2011
@@ -1169,7 +1169,7 @@ public class HRegion implements HeapSize
long currentMemStoreSize = 0;
List<StoreFlusher> storeFlushers = new ArrayList<StoreFlusher>(stores.size());
try {
- sequenceId = (wal == null)? myseqid :
+ sequenceId = (wal == null)? myseqid:
wal.startCacheFlush(this.regionInfo.getEncodedNameAsBytes());
completeSequenceId = this.getCompleteCacheFlushSequenceId(sequenceId);
@@ -1184,9 +1184,9 @@ public class HRegion implements HeapSize
} finally {
this.updatesLock.writeLock().unlock();
}
- status.setStatus("Flushing stores");
-
- LOG.debug("Finished snapshotting, commencing flushing stores");
+ String s = "Finished snapshotting " + this + ", commencing wait for rwcc";
+ status.setStatus(s);
+ LOG.debug(s);
// Any failure from here on out will be catastrophic requiring server
// restart so hlog content can be replayed and put back into the memstore.
Modified: hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/regionserver/LogRoller.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/regionserver/LogRoller.java?rev=1204036&r1=1204035&r2=1204036&view=diff
==============================================================================
--- hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/regionserver/LogRoller.java (original)
+++ hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/regionserver/LogRoller.java Sat Nov 19 18:36:03 2011
@@ -115,11 +115,11 @@ class LogRoller extends HasThread implem
}
/**
- * @param region Encoded name of region to flush.
+ * @param encodedRegionName Encoded name of region to flush.
*/
- private void scheduleFlush(final byte [] region) {
+ private void scheduleFlush(final byte [] encodedRegionName) {
boolean scheduled = false;
- HRegion r = this.services.getFromOnlineRegions(Bytes.toString(region));
+ HRegion r = this.services.getFromOnlineRegions(Bytes.toString(encodedRegionName));
FlushRequester requester = null;
if (r != null) {
requester = this.services.getFlushRequester();
@@ -129,8 +129,9 @@ class LogRoller extends HasThread implem
}
}
if (!scheduled) {
- LOG.warn("Failed to schedule flush of " +
- Bytes.toString(region) + "r=" + r + ", requester=" + requester);
+ LOG.warn("Failed to schedule flush of " +
+ Bytes.toString(encodedRegionName) + ", region=" + r + ", requester=" +
+ requester);
}
}
Modified: hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java?rev=1204036&r1=1204035&r2=1204036&view=diff
==============================================================================
--- hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java (original)
+++ hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java Sat Nov 19 18:36:03 2011
@@ -183,8 +183,8 @@ public class HLog implements Syncable {
Collections.synchronizedSortedMap(new TreeMap<Long, Path>());
/*
- * Map of regions to most recent sequence/edit id in their memstore.
- * Key is encoded region name.
+ * Map of encoded region names to their most recent sequence/edit id in their
+ * memstore.
*/
private final ConcurrentSkipListMap<byte [], Long> lastSeqWritten =
new ConcurrentSkipListMap<byte [], Long>(Bytes.BYTES_COMPARATOR);
@@ -713,9 +713,8 @@ public class HLog implements Syncable {
// If too many log files, figure which regions we need to flush.
// Array is an array of encoded region names.
byte [][] regions = null;
- int logCount = this.outputfiles.size();
- if (logCount > this.maxLogs && this.outputfiles != null &&
- this.outputfiles.size() > 0) {
+ int logCount = this.outputfiles == null? 0: this.outputfiles.size();
+ if (logCount > this.maxLogs && logCount > 0) {
// This is an array of encoded region names.
regions = findMemstoresWithEditsEqualOrOlderThan(this.outputfiles.firstKey(),
this.lastSeqWritten);
@@ -737,7 +736,7 @@ public class HLog implements Syncable {
* Return regions (memstores) that have edits that are equal or less than
* the passed <code>oldestWALseqid</code>.
* @param oldestWALseqid
- * @param regionsToSeqids
+ * @param regionsToSeqids Encoded region names to sequence ids
* @return All regions whose seqid is < than <code>oldestWALseqid</code> (Not
* necessarily in order). Null if no regions found.
*/
@@ -748,6 +747,7 @@ public class HLog implements Syncable {
for (Map.Entry<byte [], Long> e: regionsToSeqids.entrySet()) {
if (e.getValue().longValue() <= oldestWALseqid) {
if (regions == null) regions = new ArrayList<byte []>();
+ // Key is encoded region name.
regions.add(e.getKey());
}
}
@@ -770,6 +770,7 @@ public class HLog implements Syncable {
byte [] oldestRegion = null;
for (Map.Entry<byte [], Long> e: this.lastSeqWritten.entrySet()) {
if (e.getValue().longValue() == oldestOutstandingSeqNum.longValue()) {
+ // Key is encoded region name.
oldestRegion = e.getKey();
break;
}
@@ -1015,9 +1016,9 @@ public class HLog implements Syncable {
// is greater than or equal to the value in lastSeqWritten.
// Use encoded name. Its shorter, guaranteed unique and a subset of
// actual name.
- byte [] hriKey = info.getEncodedNameAsBytes();
- this.lastSeqWritten.putIfAbsent(hriKey, seqNum);
- HLogKey logKey = makeKey(hriKey, tableName, seqNum, now, clusterId);
+ byte [] encodedRegionName = info.getEncodedNameAsBytes();
+ this.lastSeqWritten.putIfAbsent(encodedRegionName, seqNum);
+ HLogKey logKey = makeKey(encodedRegionName, tableName, seqNum, now, clusterId);
doWrite(info, logKey, edits, htd);
this.numEntries.incrementAndGet();
if (htd.isDeferredLogFlush()) {
@@ -1358,6 +1359,11 @@ public class HLog implements Syncable {
// Cleaning up of lastSeqWritten is in the finally clause because we
// don't want to confuse getOldestOutstandingSeqNum()
this.lastSeqWritten.remove(getSnapshotName(encodedRegionName));
+ Long l = this.lastSeqWritten.remove(encodedRegionName);
+ if (l != null) {
+ LOG.warn("Why is there a raw encodedRegionName in lastSeqWritten? name=" +
+ Bytes.toString(encodedRegionName) + ", seqid=" + l);
+ }
this.cacheFlushLock.unlock();
}
}