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 2009/09/19 23:39:50 UTC
svn commit: r816955 - in /hadoop/hbase/trunk: CHANGES.txt
src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
Author: stack
Date: Sat Sep 19 21:39:49 2009
New Revision: 816955
URL: http://svn.apache.org/viewvc?rev=816955&view=rev
Log:
HBASE-1853 Each time around the regionserver core loop, we clear the messages to pass master, even if we failed to deliver them
Modified:
hadoop/hbase/trunk/CHANGES.txt
hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
Modified: hadoop/hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/CHANGES.txt?rev=816955&r1=816954&r2=816955&view=diff
==============================================================================
--- hadoop/hbase/trunk/CHANGES.txt (original)
+++ hadoop/hbase/trunk/CHANGES.txt Sat Sep 19 21:39:49 2009
@@ -34,6 +34,8 @@
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
Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java?rev=816955&r1=816954&r2=816955&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java Sat Sep 19 21:39:49 2009
@@ -433,6 +433,7 @@
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 @@
" 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 @@
}
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 @@
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