HBASE-1853 Each time around the regionserver core loop, we clear the messages to pass master, even if we failed to deliver them
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@816955 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ce44c03988
commit
882de7a962
|
@ -34,6 +34,8 @@ Release 0.21.0 - Unreleased
|
|||
HBASE-1847 Delete latest of a null qualifier when non-null qualifiers
|
||||
exist throws a RuntimeException
|
||||
HBASE-1850 src/examples/mapred do not compile after HBASE-1822
|
||||
HBASE-1853 Each time around the regionserver core loop, we clear the
|
||||
messages to pass master, even if we failed to deliver them
|
||||
|
||||
IMPROVEMENTS
|
||||
HBASE-1760 Cleanup TODOs in HTable
|
||||
|
|
|
@ -433,6 +433,7 @@ public class HRegionServer implements HConstants, HRegionInterface,
|
|||
LOG.warn("No response from master on reportForDuty. Sleeping and " +
|
||||
"then trying again.");
|
||||
}
|
||||
HMsg outboundArray[] = null;
|
||||
long lastMsg = 0;
|
||||
// Now ask master what it wants us to do and tell it what we have done
|
||||
for (int tries = 0; !stopRequested.get() && isHealthy();) {
|
||||
|
@ -454,12 +455,6 @@ public class HRegionServer implements HConstants, HRegionInterface,
|
|||
" milliseconds - retrying");
|
||||
}
|
||||
if ((now - lastMsg) >= msgInterval) {
|
||||
HMsg outboundArray[] = null;
|
||||
synchronized(this.outboundMsgs) {
|
||||
outboundArray =
|
||||
this.outboundMsgs.toArray(new HMsg[outboundMsgs.size()]);
|
||||
this.outboundMsgs.clear();
|
||||
}
|
||||
try {
|
||||
doMetrics();
|
||||
MemoryUsage memory =
|
||||
|
@ -472,9 +467,11 @@ public class HRegionServer implements HConstants, HRegionInterface,
|
|||
}
|
||||
this.serverInfo.setLoad(hsl);
|
||||
this.requestCount.set(0);
|
||||
outboundArray = getOutboundMsgs(outboundArray);
|
||||
HMsg msgs[] = hbaseMaster.regionServerReport(
|
||||
serverInfo, outboundArray, getMostLoadedRegions());
|
||||
lastMsg = System.currentTimeMillis();
|
||||
outboundArray = updateOutboundMsgs(outboundArray);
|
||||
if (this.quiesced.get() && onlineRegions.size() == 0) {
|
||||
// We've just told the master we're exiting because we aren't
|
||||
// serving any regions. So set the stop bit and exit.
|
||||
|
@ -685,6 +682,34 @@ public class HRegionServer implements HConstants, HRegionInterface,
|
|||
LOG.info(Thread.currentThread().getName() + " exiting");
|
||||
}
|
||||
|
||||
/*
|
||||
* @param msgs Current outboundMsgs array
|
||||
* @return Messages to send or returns current outboundMsgs if it already had
|
||||
* content to send.
|
||||
*/
|
||||
private HMsg [] getOutboundMsgs(final HMsg [] msgs) {
|
||||
// If passed msgs are not null, means we haven't passed them to master yet.
|
||||
if (msgs != null) return msgs;
|
||||
synchronized(this.outboundMsgs) {
|
||||
return this.outboundMsgs.toArray(new HMsg[outboundMsgs.size()]);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* @param msgs Messages we sent the master.
|
||||
* @return Null
|
||||
*/
|
||||
private HMsg [] updateOutboundMsgs(final HMsg [] msgs) {
|
||||
if (msgs == null) return null;
|
||||
synchronized(this.outboundMsgs) {
|
||||
for (HMsg m: msgs) {
|
||||
int index = this.outboundMsgs.indexOf(m);
|
||||
if (index != -1) this.outboundMsgs.remove(index);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run and wait on passed thread in HRS context.
|
||||
* @param t
|
||||
|
|
Loading…
Reference in New Issue