HBASE-1386 NPE in housekeeping

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@772703 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2009-05-07 16:47:39 +00:00
parent 6940db02c9
commit bc6ad67d67
2 changed files with 12 additions and 5 deletions

View File

@ -115,6 +115,7 @@ Release 0.20.0 - Unreleased
HBASE-1377 RS address is null in master web UI HBASE-1377 RS address is null in master web UI
HBASE-1344 WARN IllegalStateException: Cannot set a region as open if it has HBASE-1344 WARN IllegalStateException: Cannot set a region as open if it has
not been pending not been pending
HBASE-1386 NPE in housekeeping
IMPROVEMENTS IMPROVEMENTS
HBASE-1089 Add count of regions on filesystem to master UI; add percentage HBASE-1089 Add count of regions on filesystem to master UI; add percentage

View File

@ -1124,6 +1124,7 @@ public class HRegionServer implements HConstants, HRegionInterface,
} }
return true; return true;
} }
/* /*
* Run some housekeeping tasks before we go into 'hibernation' sleeping at * Run some housekeeping tasks before we go into 'hibernation' sleeping at
* the end of the main HRegionServer run loop. * the end of the main HRegionServer run loop.
@ -1132,12 +1133,16 @@ public class HRegionServer implements HConstants, HRegionInterface,
// If the todo list has > 0 messages, iterate looking for open region // If the todo list has > 0 messages, iterate looking for open region
// messages. Send the master a message that we're working on its // messages. Send the master a message that we're working on its
// processing so it doesn't assign the region elsewhere. // processing so it doesn't assign the region elsewhere.
if (this.toDo.size() <= 0) { if (this.toDo.isEmpty()) {
return; return;
} }
// This iterator is 'safe'. We are guaranteed a view on state of the // This iterator is 'safe'. We are guaranteed a view on state of the
// queue at time iterator was taken out. Apparently goes from oldest. // queue at time iterator was taken out. Apparently goes from oldest.
for (ToDoEntry e: this.toDo) { for (ToDoEntry e: this.toDo) {
HMsg msg = e.msg;
if (msg == null) {
LOG.warn("Message is empty: " + e);
}
if (e.msg.isType(HMsg.Type.MSG_REGION_OPEN)) { if (e.msg.isType(HMsg.Type.MSG_REGION_OPEN)) {
addProcessingMessage(e.msg.getRegionInfo()); addProcessingMessage(e.msg.getRegionInfo());
} }
@ -1299,10 +1304,11 @@ public class HRegionServer implements HConstants, HRegionInterface,
/* /*
* Data structure to hold a HMsg and retries count. * Data structure to hold a HMsg and retries count.
*/ */
private static class ToDoEntry { private static final class ToDoEntry {
protected int tries; protected volatile int tries;
protected final HMsg msg; protected final HMsg msg;
ToDoEntry(HMsg msg) {
ToDoEntry(final HMsg msg) {
this.tries = 0; this.tries = 0;
this.msg = msg; this.msg = msg;
} }