hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r948939 - in /hbase/branches/0.20: CHANGES.txt docs/index.html docs/index.pdf docs/linkmap.html docs/linkmap.pdf docs/metrics.html src/java/org/apache/hadoop/hbase/master/RegionManager.java
Date Thu, 27 May 2010 18:13:27 GMT
Author: stack
Date: Thu May 27 18:13:26 2010
New Revision: 948939

URL: http://svn.apache.org/viewvc?rev=948939&view=rev
Log:
HBASE-2167 Load balancer falls into pathological state if one server under average - slop;
endless churn

Modified:
    hbase/branches/0.20/CHANGES.txt
    hbase/branches/0.20/docs/index.html
    hbase/branches/0.20/docs/index.pdf
    hbase/branches/0.20/docs/linkmap.html
    hbase/branches/0.20/docs/linkmap.pdf
    hbase/branches/0.20/docs/metrics.html
    hbase/branches/0.20/src/java/org/apache/hadoop/hbase/master/RegionManager.java

Modified: hbase/branches/0.20/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/branches/0.20/CHANGES.txt?rev=948939&r1=948938&r2=948939&view=diff
==============================================================================
--- hbase/branches/0.20/CHANGES.txt (original)
+++ hbase/branches/0.20/CHANGES.txt Thu May 27 18:13:26 2010
@@ -16,6 +16,8 @@ Release 0.20.5 - Wed May 26 00:15:56 PDT
    HBASE-2530  HBASE-2165 removed compactionQueueSize metric
                (Ruifang Ge via Stack)
    HBASE-2610  ValueFilter copy pasted javadoc from QualifierFilter
+   HBASE-2167  Load balancer falls into pathological state if one server under
+               average - slop; endless churn
 
   IMPROVEMENTS
    HBASE-2567  [stargate] minimize differences between 0.20 branch and trunk

Modified: hbase/branches/0.20/docs/index.html
URL: http://svn.apache.org/viewvc/hbase/branches/0.20/docs/index.html?rev=948939&r1=948938&r2=948939&view=diff
==============================================================================
--- hbase/branches/0.20/docs/index.html (original)
+++ hbase/branches/0.20/docs/index.html Thu May 27 18:13:26 2010
@@ -20,7 +20,7 @@
     |breadtrail
     +-->
 <div class="breadtrail">
-<a href="http://www.apache.org/">Apache</a> &gt; <a href="http://hadoop.apache.org/">Hadoop</a>
&gt; <a href="http://hadoop.apache.org/hbase/">HBase</a><script src="skin/breadcrumbs.js"
language="JavaScript" type="text/javascript"></script>
+<a href="http://www.apache.org/">Apache</a> &gt; <a href="http://hadoop.apache.org/">Hadoop</a>
&gt; <a href="http://hbase.apache.org/">HBase</a><script src="skin/breadcrumbs.js"
language="JavaScript" type="text/javascript"></script>
 </div>
 <!--+
     |header
@@ -39,7 +39,7 @@
     |start Project Logo
     +-->
 <div class="projectlogo">
-<a href="http://hadoop.apache.org/hbase/"><img class="logoImage" alt="HBase" src="images/hbase_small.gif"
title="The Hadoop database"></a>
+<a href="http://hbase.apache.org/"><img class="logoImage" alt="HBase" src="images/hbase_small.gif"
title="The Hadoop database"></a>
 </div>
 <!--+
     |end Project Logo
@@ -49,7 +49,7 @@
     +-->
 <div class="searchbox">
 <form action="http://www.google.com/search" method="get" class="roundtopsmall">
-<input value="hadoop.apache.org" name="sitesearch" type="hidden"><input onFocus="getBlank
(this, 'Search the site with google');" size="25" name="q" id="query" type="text" value="Search
the site with google">&nbsp; 
+<input value="hbase.apache.org" name="sitesearch" type="hidden"><input onFocus="getBlank
(this, 'Search the site with google');" size="25" name="q" id="query" type="text" value="Search
the site with google">&nbsp; 
                     <input name="Search" value="Search" type="submit">
 </form>
 </div>
@@ -61,7 +61,7 @@
     +-->
 <ul id="tabs">
 <li>
-<a class="unselected" href="http://hadoop.apache.org/hbase/">Project</a>
+<a class="unselected" href="http://hbase.apache.org/">Project</a>
 </li>
 <li>
 <a class="unselected" href="http://wiki.apache.org/hadoop/Hbase">Wiki</a>
@@ -111,7 +111,7 @@ document.write("Last Published: " + docu
 <a href="api/overview-summary.html#overview_description">Getting Started</a>
 </div>
 <div class="menuitem">
-<a href="releasenotes.html">0.20.4 Release Notes</a>
+<a href="releasenotes.html">Release Notes</a>
 </div>
 <div class="menuitem">
 <a href="api/index.html">API Docs</a>
@@ -132,7 +132,7 @@ document.write("Last Published: " + docu
 <a href="http://wiki.apache.org/hadoop/Hbase/FAQ">FAQ</a>
 </div>
 <div class="menuitem">
-<a href="http://hadoop.apache.org/hbase/mailing_lists.html">Mailing Lists</a>
+<a href="http://hbase.apache.org/mailing_lists.html">Mailing Lists</a>
 </div>
 </div>
 <div id="credit">
@@ -162,7 +162,7 @@ document.write("Last Published: " + docu
 <p>
     The following documents provide concepts and procedures that will help you 
     get started using HBase. If you have more questions, you can ask the 
-    <a href="http://hadoop.apache.org/hbase/mailing_lists.html">mailing list</a>
or browse the archives.
+    <a href="http://hbase.apache.org/mailing_lists.html">mailing list</a> or
browse the archives.
     </p>
     
 <ul>

Modified: hbase/branches/0.20/docs/index.pdf
URL: http://svn.apache.org/viewvc/hbase/branches/0.20/docs/index.pdf?rev=948939&r1=948938&r2=948939&view=diff
==============================================================================
--- hbase/branches/0.20/docs/index.pdf (original)
+++ hbase/branches/0.20/docs/index.pdf Thu May 27 18:13:26 2010
@@ -35,7 +35,7 @@ endobj
 /Rect [ 370.956 572.6 425.304 560.6 ]
 /C [ 0 0 0 ]
 /Border [ 0 0 0 ]
-/A << /URI (http://hadoop.apache.org/hbase/mailing_lists.html)
+/A << /URI (http://hbase.apache.org/mailing_lists.html)
 /S /URI >>
 /H /I
 >>
@@ -130,22 +130,22 @@ endobj
 xref
 0 17
 0000000000 65535 f 
-0000002510 00000 n 
-0000002568 00000 n 
-0000002618 00000 n 
+0000002503 00000 n 
+0000002561 00000 n 
+0000002611 00000 n 
 0000000015 00000 n 
 0000000071 00000 n 
 0000000972 00000 n 
 0000001092 00000 n 
 0000001144 00000 n 
-0000001342 00000 n 
-0000001535 00000 n 
-0000001697 00000 n 
-0000001878 00000 n 
-0000002063 00000 n 
-0000002171 00000 n 
-0000002281 00000 n 
-0000002394 00000 n 
+0000001335 00000 n 
+0000001528 00000 n 
+0000001690 00000 n 
+0000001871 00000 n 
+0000002056 00000 n 
+0000002164 00000 n 
+0000002274 00000 n 
+0000002387 00000 n 
 trailer
 <<
 /Size 17
@@ -153,5 +153,5 @@ trailer
 /Info 4 0 R
 >>
 startxref
-2730
+2723
 %%EOF

Modified: hbase/branches/0.20/docs/linkmap.html
URL: http://svn.apache.org/viewvc/hbase/branches/0.20/docs/linkmap.html?rev=948939&r1=948938&r2=948939&view=diff
==============================================================================
--- hbase/branches/0.20/docs/linkmap.html (original)
+++ hbase/branches/0.20/docs/linkmap.html Thu May 27 18:13:26 2010
@@ -20,7 +20,7 @@
     |breadtrail
     +-->
 <div class="breadtrail">
-<a href="http://www.apache.org/">Apache</a> &gt; <a href="http://hadoop.apache.org/">Hadoop</a>
&gt; <a href="http://hadoop.apache.org/hbase/">HBase</a><script src="skin/breadcrumbs.js"
language="JavaScript" type="text/javascript"></script>
+<a href="http://www.apache.org/">Apache</a> &gt; <a href="http://hadoop.apache.org/">Hadoop</a>
&gt; <a href="http://hbase.apache.org/">HBase</a><script src="skin/breadcrumbs.js"
language="JavaScript" type="text/javascript"></script>
 </div>
 <!--+
     |header
@@ -39,7 +39,7 @@
     |start Project Logo
     +-->
 <div class="projectlogo">
-<a href="http://hadoop.apache.org/hbase/"><img class="logoImage" alt="HBase" src="images/hbase_small.gif"
title="The Hadoop database"></a>
+<a href="http://hbase.apache.org/"><img class="logoImage" alt="HBase" src="images/hbase_small.gif"
title="The Hadoop database"></a>
 </div>
 <!--+
     |end Project Logo
@@ -49,7 +49,7 @@
     +-->
 <div class="searchbox">
 <form action="http://www.google.com/search" method="get" class="roundtopsmall">
-<input value="hadoop.apache.org" name="sitesearch" type="hidden"><input onFocus="getBlank
(this, 'Search the site with google');" size="25" name="q" id="query" type="text" value="Search
the site with google">&nbsp; 
+<input value="hbase.apache.org" name="sitesearch" type="hidden"><input onFocus="getBlank
(this, 'Search the site with google');" size="25" name="q" id="query" type="text" value="Search
the site with google">&nbsp; 
                     <input name="Search" value="Search" type="submit">
 </form>
 </div>
@@ -61,7 +61,7 @@
     +-->
 <ul id="tabs">
 <li>
-<a class="unselected" href="http://hadoop.apache.org/hbase/">Project</a>
+<a class="unselected" href="http://hbase.apache.org/">Project</a>
 </li>
 <li>
 <a class="unselected" href="http://wiki.apache.org/hadoop/Hbase">Wiki</a>
@@ -111,7 +111,7 @@ document.write("Last Published: " + docu
 <a href="api/overview-summary.html#overview_description">Getting Started</a>
 </div>
 <div class="menuitem">
-<a href="releasenotes.html">0.20.4 Release Notes</a>
+<a href="releasenotes.html">Release Notes</a>
 </div>
 <div class="menuitem">
 <a href="api/index.html">API Docs</a>
@@ -132,7 +132,7 @@ document.write("Last Published: " + docu
 <a href="http://wiki.apache.org/hadoop/Hbase/FAQ">FAQ</a>
 </div>
 <div class="menuitem">
-<a href="http://hadoop.apache.org/hbase/mailing_lists.html">Mailing Lists</a>
+<a href="http://hbase.apache.org/mailing_lists.html">Mailing Lists</a>
 </div>
 </div>
 <div id="credit"></div>
@@ -185,7 +185,7 @@ document.write("Last Published: " + docu
     
 <ul>
 <li>
-<a href="releasenotes.html">0.20.4 Release Notes</a>&nbsp;&nbsp;___________________&nbsp;&nbsp;<em>api</em>
+<a href="releasenotes.html">Release Notes</a>&nbsp;&nbsp;___________________&nbsp;&nbsp;<em>api</em>
 </li>
 </ul>
     
@@ -227,7 +227,7 @@ document.write("Last Published: " + docu
     
 <ul>
 <li>
-<a href="http://hadoop.apache.org/hbase/mailing_lists.html">Mailing Lists</a>&nbsp;&nbsp;___________________&nbsp;&nbsp;<em>lists</em>
+<a href="http://hbase.apache.org/mailing_lists.html">Mailing Lists</a>&nbsp;&nbsp;___________________&nbsp;&nbsp;<em>lists</em>
 </li>
 </ul>
   

Modified: hbase/branches/0.20/docs/linkmap.pdf
URL: http://svn.apache.org/viewvc/hbase/branches/0.20/docs/linkmap.pdf?rev=948939&r1=948938&r2=948939&view=diff
==============================================================================
--- hbase/branches/0.20/docs/linkmap.pdf (original)
+++ hbase/branches/0.20/docs/linkmap.pdf Thu May 27 18:13:26 2010
@@ -5,10 +5,10 @@
 /Producer (FOP 0.20.5) >>
 endobj
 5 0 obj
-<< /Length 805 /Filter [ /ASCII85Decode /FlateDecode ]
+<< /Length 797 /Filter [ /ASCII85Decode /FlateDecode ]
  >>
 stream
-GatUrhf%6l&BE],=7Fj+PQ:u)5PE./DJHY'[FBtSRTPL^<6(dmC"303fM2gMEYBaUP]2D*hp2=YmjsM`?,hCkLd599W;E&P#YZHOOSrXMFZrP4N-Pd$3V\#EVi3_B-R;:NbgEhu+6R+l*4biGH1SUhj)\KF=e#+%quQUPX3:PjK5r*TOp#en#J#5Zg+ENoArceoE5OQL?jr49fZ^-I-@3D)V"$RLnh!]TSs&W>>15#MB%]`M`f<RA=U)3Sc2Ks6q]K%#\n,:i62I&;Ppj$-Eabm_rql]d(6H9=8.l?;N.`@0*603.miX$5"9mF*(_=_qkfIj_pIuL$l[@/i)@pMq:n]6Y*<s_L#:&qd"RX79Cn?nsm7kQ/(h4V%kdR5>a:Npe#h^#.N2ifD#i-BG(g63"C.ftuGc9<0`nUVfe(>Db"t6e3!NG,W,qCEJY:@8%,MRXO.8'F?%LC!>D+Ea<*T7Ige"9tfhF2pKp>(2G+3Hib-T]C>bN8"?=M>_g)Kc$hG8E"I.dhuBeb*g9(U=auauG0iW(T!R2@!5EV;9^d&7d//`(/!cK=n*dO7-(Skg]\]e_Zj2)QN7X)lLekES[Zc[J.teBJ]Lb&%@ORVk]MuH$Xf[NZYnJ:YTSs2HhOg6<1iBH*(7k5c**[L!if&)C"kcIEnUc^:3?6eC`VO#m7P9[[/*=N<Eg7)kD+7&[Cr24]+fab.O#G1BoY\5Sc_Q$o7!ln^=B#bd_9JJM?FAJl(V&82IG:3aIPuDr9g-X@2)o0(lM&qHAR/@o_WL?G#lHg"LY;/>,Z75:@mU1B~>
+GatUrhf%6l&BE],=7Fj+PQ:u)5GmhZDJHY'[FBtSRTPL^<6(dmC"303rfICUjX,!\.H(d4^7PK;hg$,f\dAJ3&:lYK;#<0\&=<V<T]V.udeYpl0]XrZ(Z>&0]e]-mS<54;Akm5Cq6U]+lU]"0_O9#d*FJ$YaO8S9i"&An29H>8dOTZb/;bQ?[$OGKWbt2.G36^`$Tm,ToL:LeO3Lp5A#^?g65mmC/(YDFjsV*;W]&CBC0$UQ>BW-Ec4ZM_)tlcgfE]N-e1M-h#h$1uY=5=2RgVTSnDEu4D*\(Q+GhdG'&n]5Eu]oW]S3!q''*Jn@GE5[WMcdcZZ!]/?&h>]C"T2k6CFEoF;Q]M*K2hi")'o*AG)\XH8H?E@>MItTsm>^OWaed!O=B,(felJ&\9oq1,9eCg6>EsE*or#Mn'(W`h=u_*RJ0!OJ6oui4CnQ*fin)"n`SK;XI!8e/m9``6$?/(@SOj1Lmn`FGJ3V4,Ap&_=G*"pQk8KRS"TOf\V%8pkf;"[WQs7ihal<W\E#O>g0aIXfA-GSC4@hHK'Ps7#q%M)=<N0FIVfQ.PnaZ^!IHNG@_cklA+;PEAUck&*c`GhY@`M7ULAup@7WsY]?lnG=UZ&_/o.ZT8"\FQ#\BSiSB>LW]!@H9%0#$l73Wu`9s>FC%0pN1>Rj+UBj<tcqYHE_E]D5*o$q^D%B%'q6qCn-4sfa$\TCM$"k@e+cCZ7$b^qie80#=F7Vp>[MD.WEI+@idh,<?@d;\A3]ChO3M%b7.^Q8nU%;A`=JO?J*F%+>4%j24VZ%[&Ce\=~>
 endstream
 endobj
 6 0 obj
@@ -72,17 +72,17 @@ endobj
 xref
 0 12
 0000000000 65535 f 
-0000001628 00000 n 
-0000001686 00000 n 
-0000001736 00000 n 
+0000001620 00000 n 
+0000001678 00000 n 
+0000001728 00000 n 
 0000000015 00000 n 
 0000000071 00000 n 
-0000000967 00000 n 
-0000001073 00000 n 
-0000001180 00000 n 
-0000001289 00000 n 
-0000001401 00000 n 
-0000001517 00000 n 
+0000000959 00000 n 
+0000001065 00000 n 
+0000001172 00000 n 
+0000001281 00000 n 
+0000001393 00000 n 
+0000001509 00000 n 
 trailer
 <<
 /Size 12
@@ -90,5 +90,5 @@ trailer
 /Info 4 0 R
 >>
 startxref
-1856
+1848
 %%EOF

Modified: hbase/branches/0.20/docs/metrics.html
URL: http://svn.apache.org/viewvc/hbase/branches/0.20/docs/metrics.html?rev=948939&r1=948938&r2=948939&view=diff
==============================================================================
--- hbase/branches/0.20/docs/metrics.html (original)
+++ hbase/branches/0.20/docs/metrics.html Thu May 27 18:13:26 2010
@@ -22,7 +22,7 @@
     |breadtrail
     +-->
 <div class="breadtrail">
-<a href="http://www.apache.org/">Apache</a> &gt; <a href="http://hadoop.apache.org/">Hadoop</a>
&gt; <a href="http://hadoop.apache.org/hbase/">HBase</a><script src="skin/breadcrumbs.js"
language="JavaScript" type="text/javascript"></script>
+<a href="http://www.apache.org/">Apache</a> &gt; <a href="http://hadoop.apache.org/">Hadoop</a>
&gt; <a href="http://hbase.apache.org/">HBase</a><script src="skin/breadcrumbs.js"
language="JavaScript" type="text/javascript"></script>
 </div>
 <!--+
     |header
@@ -41,7 +41,7 @@
     |start Project Logo
     +-->
 <div class="projectlogo">
-<a href="http://hadoop.apache.org/hbase/"><img class="logoImage" alt="HBase" src="images/hbase_small.gif"
title="The Hadoop database"></a>
+<a href="http://hbase.apache.org/"><img class="logoImage" alt="HBase" src="images/hbase_small.gif"
title="The Hadoop database"></a>
 </div>
 <!--+
     |end Project Logo
@@ -51,7 +51,7 @@
     +-->
 <div class="searchbox">
 <form action="http://www.google.com/search" method="get" class="roundtopsmall">
-<input value="hadoop.apache.org" name="sitesearch" type="hidden"><input onFocus="getBlank
(this, 'Search the site with google');" size="25" name="q" id="query" type="text" value="Search
the site with google">&nbsp; 
+<input value="hbase.apache.org" name="sitesearch" type="hidden"><input onFocus="getBlank
(this, 'Search the site with google');" size="25" name="q" id="query" type="text" value="Search
the site with google">&nbsp; 
                     <input name="Search" value="Search" type="submit">
 </form>
 </div>
@@ -63,7 +63,7 @@
     +-->
 <ul id="tabs">
 <li>
-<a class="unselected" href="http://hadoop.apache.org/hbase/">Project</a>
+<a class="unselected" href="http://hbase.apache.org/">Project</a>
 </li>
 <li>
 <a class="unselected" href="http://wiki.apache.org/hadoop/Hbase">Wiki</a>
@@ -113,7 +113,7 @@ document.write("Last Published: " + docu
 <a href="api/overview-summary.html#overview_description">Getting Started</a>
 </div>
 <div class="menuitem">
-<a href="releasenotes.html">0.20.4 Release Notes</a>
+<a href="releasenotes.html">Release Notes</a>
 </div>
 <div class="menuitem">
 <a href="api/index.html">API Docs</a>
@@ -134,7 +134,7 @@ document.write("Last Published: " + docu
 <a href="http://wiki.apache.org/hadoop/Hbase/FAQ">FAQ</a>
 </div>
 <div class="menuitem">
-<a href="http://hadoop.apache.org/hbase/mailing_lists.html">Mailing Lists</a>
+<a href="http://hbase.apache.org/mailing_lists.html">Mailing Lists</a>
 </div>
 </div>
 <div id="credit"></div>

Modified: hbase/branches/0.20/src/java/org/apache/hadoop/hbase/master/RegionManager.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/master/RegionManager.java?rev=948939&r1=948938&r2=948939&view=diff
==============================================================================
--- hbase/branches/0.20/src/java/org/apache/hadoop/hbase/master/RegionManager.java (original)
+++ hbase/branches/0.20/src/java/org/apache/hadoop/hbase/master/RegionManager.java Thu May
27 18:13:26 2010
@@ -234,51 +234,44 @@ class RegionManager implements HConstant
         isMetaAssign = true;
     }
     int nRegionsToAssign = regionsToAssign.size();
-    // Now many regions to assign this server.
-    int nregions = regionsPerServer(nRegionsToAssign, thisServersLoad);
-    LOG.debug("Assigning for " + info + ": total nregions to assign=" +
-      nRegionsToAssign + ", nregions to reach balance=" + nregions +
-      ", isMetaAssign=" + isMetaAssign);
-    if (nRegionsToAssign <= nregions) {
-      // I do not know whats supposed to happen in this case.  Assign one.
-      LOG.debug("Assigning one region only (playing it safe..)");
-      assignRegions(regionsToAssign, 1, info, returnMsgs);
-    } else {
-      nRegionsToAssign -= nregions;
-      if (nRegionsToAssign > 0 || isMetaAssign) {
-        // We still have more regions to assign. See how many we can assign
-        // before this server becomes more heavily loaded than the next
-        // most heavily loaded server.
-        HServerLoad heavierLoad = new HServerLoad();
-        int nservers = computeNextHeaviestLoad(thisServersLoad, heavierLoad);
-        nregions = 0;
-        // Advance past any less-loaded servers
-        for (HServerLoad load = new HServerLoad(thisServersLoad);
-        load.compareTo(heavierLoad) <= 0 && nregions < nRegionsToAssign;
-        load.setNumberOfRegions(load.getNumberOfRegions() + 1), nregions++) {
-          // continue;
-        }
-        LOG.debug("Doing for " + info + " nregions: " + nregions +
-            " and nRegionsToAssign: " + nRegionsToAssign);
-        if (nregions < nRegionsToAssign) {
-          // There are some more heavily loaded servers
-          // but we can't assign all the regions to this server.
-          if (nservers > 0) {
-            // There are other servers that can share the load.
-            // Split regions that need assignment across the servers.
-            nregions = (int) Math.ceil((1.0 * nRegionsToAssign)/(1.0 * nservers));
-          } else {
-            // No other servers with same load.
-            // Split regions over all available servers
-            nregions = (int) Math.ceil((1.0 * nRegionsToAssign)/
-                (1.0 * master.serverManager.numServers()));
-          }
+    int otherServersRegionsCount =
+      regionsToGiveOtherServers(nRegionsToAssign, thisServersLoad);
+    nRegionsToAssign -= otherServersRegionsCount;
+    if (nRegionsToAssign > 0 || isMetaAssign) {
+      LOG.debug("Assigning for " + info + ": total nregions to assign=" +
+        nRegionsToAssign + ", regions to give other servers than this=" +
+        otherServersRegionsCount + ", isMetaAssign=" + isMetaAssign);
+
+      // See how many we can assign before this server becomes more heavily
+      // loaded than the next most heavily loaded server.
+      HServerLoad heavierLoad = new HServerLoad();
+      int nservers = computeNextHeaviestLoad(thisServersLoad, heavierLoad);
+      int nregions = 0;
+      // Advance past any less-loaded servers
+      for (HServerLoad load = new HServerLoad(thisServersLoad);
+      load.compareTo(heavierLoad) <= 0 && nregions < nRegionsToAssign;
+      load.setNumberOfRegions(load.getNumberOfRegions() + 1), nregions++) {
+        // continue;
+      }
+      if (nregions < nRegionsToAssign) {
+        // There are some more heavily loaded servers
+        // but we can't assign all the regions to this server.
+        if (nservers > 0) {
+          // There are other servers that can share the load.
+          // Split regions that need assignment across the servers.
+          nregions = (int) Math.ceil((1.0 * nRegionsToAssign)/(1.0 * nservers));
         } else {
-          // Assign all regions to this server
-          nregions = nRegionsToAssign;
+          // No other servers with same load.
+          // Split regions over all available servers
+          nregions = (int) Math.ceil((1.0 * nRegionsToAssign)/
+              (1.0 * master.serverManager.numServers()));
         }
-        assignRegions(regionsToAssign, nregions, info, returnMsgs);
+      } else {
+        // Assign all regions to this server
+        nregions = nRegionsToAssign;
       }
+      LOG.debug("Assigning " + info + " " + nregions + " regions");
+      assignRegions(regionsToAssign, nregions, info, returnMsgs);
     }
   }
 
@@ -344,9 +337,10 @@ class RegionManager implements HConstant
   /*
    * @param nRegionsToAssign
    * @param thisServersLoad
-   * @return How many regions we can assign to more lightly loaded servers
+   * @return How many regions should go to servers other than this one; i.e.
+   * more lightly loaded servers
    */
-  private int regionsPerServer(final int numUnassignedRegions,
+  private int regionsToGiveOtherServers(final int numUnassignedRegions,
     final HServerLoad thisServersLoad) {
     SortedMap<HServerLoad, Set<String>> lightServers =
       new TreeMap<HServerLoad, Set<String>>();
@@ -485,9 +479,8 @@ class RegionManager implements HConstant
   void unassignSomeRegions(final HServerInfo info, 
       int numRegionsToClose, final HRegionInfo[] mostLoadedRegions,
       ArrayList<HMsg> returnMsgs) {
-    LOG.debug("Choosing to reassign " + numRegionsToClose 
-      + " regions. mostLoadedRegions has " + mostLoadedRegions.length 
-      + " regions in it.");
+    LOG.debug("Unassigning " + numRegionsToClose + " regions from " +
+      info.getServerName());
     int regionIdx = 0;
     int regionsClosed = 0;
     int skipped = 0;
@@ -516,7 +509,8 @@ class RegionManager implements HConstant
       // increment the count of regions we've marked
       regionsClosed++;
     }
-    LOG.info("Skipped " + skipped + " region(s) that are in transition states");
+    LOG.info("Skipped assigning " + skipped + " region(s) to " +
+      info.getServerName() + "because already in transition");
   }
 
   /*
@@ -1434,7 +1428,8 @@ class RegionManager implements HConstant
       }
       
       // check if current server is overloaded
-      int numRegionsToClose = balanceFromOverloaded(servLoad, avg);
+      int numRegionsToClose = balanceFromOverloaded(info.getServerName(),
+        servLoad, avg);
       
       // check if we can unload server by low loaded servers
       if(numRegionsToClose <= 0) {
@@ -1456,13 +1451,14 @@ class RegionManager implements HConstant
      * Check if server load is not overloaded (with load > avgLoadPlusSlop).
      * @return number of regions to unassign.
      */
-    private int balanceFromOverloaded(HServerLoad srvLoad, double avgLoad) {
+    private int balanceFromOverloaded(final String serverName,
+        HServerLoad srvLoad, double avgLoad) {
       int avgLoadPlusSlop = (int)Math.ceil(avgLoad * (1 + this.slop));
       int numSrvRegs = srvLoad.getNumberOfRegions();
       if (numSrvRegs > avgLoadPlusSlop) {
         if (LOG.isDebugEnabled()) {
-          LOG.debug("Server is overloaded: load=" + numSrvRegs +
-              ", avg=" + avgLoad + ", slop=" + this.slop);
+          LOG.debug("Server " + serverName + " is overloaded: " +
+            "load=" + numSrvRegs + ", avg=" + avgLoad + ", slop=" + this.slop);
         }
         return numSrvRegs - (int)Math.ceil(avgLoad);
       }
@@ -1499,10 +1495,10 @@ class RegionManager implements HConstant
       numRegionsToClose = numSrvRegs - (int)Math.ceil(avgLoad);
       numRegionsToClose = Math.min(numRegionsToClose, numMoveToLowLoaded);
       if (LOG.isDebugEnabled()) {
-        LOG.debug("Server " + srvName + " will be unloaded for " +
-            "balance. Server load: " + numSrvRegs + " avg: " +
-            avgLoad + ", regions can be moved: " + numMoveToLowLoaded +
-            ". Regions to close: " + numRegionsToClose);
+        LOG.debug("Server(s) are carrying only " + lowestLoad + " regions. " +
+          "Server " + srvName + " is most loaded (" + numSrvRegs +
+          "). Shedding " + numRegionsToClose + " regions to pass to " +
+          " least loaded (numMoveToLowLoaded=" + numMoveToLowLoaded +")");
       }
       return numRegionsToClose;
     }



Mime
View raw message