hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nspiegelb...@apache.org
Subject svn commit: r1227430 - in /hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase: master/BaseScanner.java master/RegionManager.java regionserver/HRegionServer.java
Date Thu, 05 Jan 2012 01:41:05 GMT
Author: nspiegelberg
Date: Thu Jan  5 01:41:05 2012
New Revision: 1227430

URL: http://svn.apache.org/viewvc?rev=1227430&view=rev
Log:
[master] Add some log statements for the locality load balancer

Summary: Add some log statements for the locality load balancer to understand
the load balancer behavior well.

Test Plan: will test it on dev cluster and titanmigrate002

Reviewers: kannan, kranganathan

Reviewed By: kannan

CC: hbase-eng@lists, kannan

Differential Revision: 381257

Modified:
    hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/BaseScanner.java
    hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/RegionManager.java
    hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java

Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/BaseScanner.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/BaseScanner.java?rev=1227430&r1=1227429&r2=1227430&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/BaseScanner.java (original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/BaseScanner.java Thu
Jan  5 01:41:05 2012
@@ -19,6 +19,13 @@
  */
 package org.apache.hadoop.hbase.master;
 
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicBoolean;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.fs.FileStatus;
@@ -46,13 +53,6 @@ import org.apache.hadoop.hbase.util.Writ
 import org.apache.hadoop.io.BooleanWritable;
 import org.apache.hadoop.ipc.RemoteException;
 
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicBoolean;
-
 
 /**
  * Base HRegion scanner class. Holds utilty common to <code>ROOT</code> and
@@ -145,6 +145,8 @@ abstract class BaseScanner extends Chore
     this.readFavoredNodes = master.getConfiguration().getClass(
         HConstants.LOAD_BALANCER_IMPL, Object.class).equals(
         RegionManager.AssignmentLoadBalancer.class);
+    LOG.debug("Whether to read the favoredNodes from meta: " +
+        (readFavoredNodes ? "Yes" : "No"));
   }
 
   /** @return true if initial scan completed successfully */

Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/RegionManager.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/RegionManager.java?rev=1227430&r1=1227429&r2=1227430&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/RegionManager.java
(original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/RegionManager.java
Thu Jan  5 01:41:05 2012
@@ -32,13 +32,8 @@ import java.util.NavigableMap;
 import java.util.Set;
 import java.util.SortedMap;
 import java.util.TreeMap;
-import java.util.TreeSet;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentSkipListMap;
-import java.util.concurrent.ConcurrentSkipListSet;
-import java.util.concurrent.DelayQueue;
-import java.util.concurrent.Delayed;
-import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicReference;
 
@@ -66,7 +61,6 @@ import org.apache.hadoop.hbase.util.Thre
 import org.apache.hadoop.hbase.util.Writables;
 import org.apache.hadoop.hbase.zookeeper.ZooKeeperWrapper;
 import org.apache.hadoop.io.Text;
-import org.apache.hadoop.util.ReflectionUtils;
 
 /**
  * Class to manage assigning regions to servers, state of root and meta, etc.
@@ -196,6 +190,7 @@ public class RegionManager {
       loadBalancerImpl = new DefaultLoadBalancer();
     }
     this.loadBalancer = loadBalancerImpl;
+    LOG.info("The load balancer is " + this.loadBalancer.getClass().getName());
 
     this.assignmentManager = new PreferredAssignmentManager(master);
 
@@ -1703,6 +1698,10 @@ public class RegionManager {
           if (unassignRegion(info, region, returnMsgs)) {
             regionsUnassigned++;
             if (regionsUnassigned >= maxRegToClose && maxRegToClose > 0) {
+              LOG.debug("Unassigned " + region.getRegionNameAsString()
+                  + " from the server " + info.getHostnamePort()
+                  + " because the primary server: " + preferences.get(0)
+                  + " is a live");
               return regionsUnassigned;
             }
           }
@@ -1755,6 +1754,10 @@ public class RegionManager {
           if (unassignRegion(info, region, returnMsgs)) {
             regionsUnassigned++;
             if (regionsUnassigned >= maxRegToClose && maxRegToClose > 0) {
+              LOG.debug("Unassigned " + region.getRegionNameAsString()
+                  + " from the unfavoraed server " + info.getHostnamePort()
+                  + " because one least loaded secondary server: "
+                  + leastLoadedSecondary + " is a live");
               return regionsUnassigned;
             }
           }
@@ -1815,10 +1818,15 @@ public class RegionManager {
               // for the region to its current server when unassigning.
               assignmentManager.removeTransientAssignment(
                   info.getServerAddress(), region);
-              assignmentManager.addTransientAssignment(
-                  preferences.get(i), region);
+              assignmentManager.addTransientAssignment(preferences.get(i),
+                  region);
               regionsUnassigned++;
               if (regionsUnassigned >= maxRegToClose && maxRegToClose > 0)
{
+                LOG.debug("Unassigned " + region.getRegionNameAsString()
+                    + " from the overloaded secondary server: "
+                    + info.getHostnamePort()
+                    + " because another low loaded secondary server: "
+                    + preferences.get(i) + " is a live");
                 return regionsUnassigned;
               }
             }

Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java?rev=1227430&r1=1227429&r2=1227430&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
(original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
Thu Jan  5 01:41:05 2012
@@ -1733,13 +1733,17 @@ public class HRegionServer implements HR
   private void setFavoredNodes(HRegion region, String[] favoredNodes) {
     if (favoredNodes != null && favoredNodes.length > 0) {
       InetSocketAddress[] nodes = new InetSocketAddress[favoredNodes.length];
+      StringBuilder favoratedNodesList = new StringBuilder();
       for (int i = 0; i < favoredNodes.length; i++) {
         int colon = favoredNodes[i].indexOf(':');
         String hostname = colon >= 0 ? favoredNodes[i].substring(0, colon) :
           favoredNodes[i];
+        favoratedNodesList.append(hostname + ",");
         nodes[i] = new InetSocketAddress(hostname, 0);
       }
       region.setFavoredNodes(nodes);
+      LOG.debug("Set the region " + region.getRegionNameAsString() +
+          " with the favored nodes: " + favoratedNodesList);
     }
   }
 



Mime
View raw message