I have a look at the following method in 0.89. Is the the following line
correct ?

nRegions *= e.getValue().size();


private int regionsToGiveOtherServers(final int numUnassignedRegions,
    final HServerLoad thisServersLoad) {
    SortedMap<HServerLoad, Set<String>> lightServers =
      new TreeMap<HServerLoad, Set<String>>();
    this.master.getLightServers(thisServersLoad, lightServers);
    // Examine the list of servers that are more lightly loaded than this
one.
    // Pretend that we will assign regions to these more lightly loaded
servers
    // until they reach load equal with ours. Then, see how many regions are
left
    // unassigned. That is how many regions we should assign to this server.
    int nRegions = 0;
    for (Map.Entry<HServerLoad, Set<String>> e: lightServers.entrySet()) {
      HServerLoad lightLoad = new HServerLoad(e.getKey());
      do {
        lightLoad.setNumberOfRegions(lightLoad.getNumberOfRegions() + 1);
        nRegions += 1;
      } while (lightLoad.compareTo(thisServersLoad) <= 0
          && nRegions < numUnassignedRegions);
      nRegions *= e.getValue().size();
      if (nRegions >= numUnassignedRegions) {
        break;
      }
    }
    return nRegions;
  }



2010/9/7 Jonathan Gray <[email protected]>

> That code does actually exist in the latest 0.89 release.
>
> It was a protection put in place to guard against a weird behavior that we
> had seen during load balancing.
>
> As Ryan suggests, this code was in need of a rewrite and was just committed
> last week to trunk/0.90.  If you're interested in the new load balancing
> code, it's in o.a.h.h.regionserver.LoadBalancer
>
> At the least, you should upgrade to 0.20.6 as there are some important
> fixes from 0.20.4 (until 0.90 is released, at which point everyone should
> move to it).
>
> JG
>
> > -----Original Message-----
> > From: Ryan Rawson [mailto:[email protected]]
> > Sent: Monday, September 06, 2010 7:10 PM
> > To: [email protected]
> > Subject: Re: question about RegionManager
> >
> > That code was completely rewritten in 0.89/0.90... its pretty dodgy so
> > I'd
> > highly consider upgrading to 0.89 asap.
> > > hi, all
> > >
> > > I'm reading the code of RegionManager, I find in the following method
> > there
> > > is an situation when nRegionsToAssign <= nregions, the code only
> > assigns 1
> > > region.
> > > Is this correct? Hbase version 0.20.4.
> > >
> > > private void assignRegionsToMultipleServers(final HServerLoad
> > > thisServersLoad,
> > > final Set<RegionState> regionsToAssign, final HServerInfo info,
> > > final ArrayList<HMsg> returnMsgs) {
> > > boolean isMetaAssign = false;
> > > for (RegionState s : regionsToAssign) {
> > > if (s.getRegionInfo().isMetaRegion())
> > > 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 {
>

Reply via email to