Return-Path: Delivered-To: apmail-hadoop-hbase-commits-archive@minotaur.apache.org Received: (qmail 72159 invoked from network); 19 Sep 2009 21:40:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 19 Sep 2009 21:40:13 -0000 Received: (qmail 93253 invoked by uid 500); 19 Sep 2009 21:40:13 -0000 Delivered-To: apmail-hadoop-hbase-commits-archive@hadoop.apache.org Received: (qmail 93213 invoked by uid 500); 19 Sep 2009 21:40:13 -0000 Mailing-List: contact hbase-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hbase-dev@hadoop.apache.org Delivered-To: mailing list hbase-commits@hadoop.apache.org Received: (qmail 93204 invoked by uid 99); 19 Sep 2009 21:40:12 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 19 Sep 2009 21:40:12 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 19 Sep 2009 21:40:11 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id DF58C23888A6; Sat, 19 Sep 2009 21:39:50 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r816955 - in /hadoop/hbase/trunk: CHANGES.txt src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java Date: Sat, 19 Sep 2009 21:39:50 -0000 To: hbase-commits@hadoop.apache.org From: stack@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090919213950.DF58C23888A6@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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