incubator-accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vi...@apache.org
Subject svn commit: r1294700 - /incubator/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/master/balancer/ChaoticLoadBalancer.java
Date Tue, 28 Feb 2012 15:45:45 GMT
Author: vines
Date: Tue Feb 28 15:45:45 2012
New Revision: 1294700

URL: http://svn.apache.org/viewvc?rev=1294700&view=rev
Log:
updating ACCUMULO-426 - only shuffle when all migrations are complete. Then it reshuffles.


Modified:
    incubator/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/master/balancer/ChaoticLoadBalancer.java

Modified: incubator/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/master/balancer/ChaoticLoadBalancer.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/master/balancer/ChaoticLoadBalancer.java?rev=1294700&r1=1294699&r2=1294700&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/master/balancer/ChaoticLoadBalancer.java
(original)
+++ incubator/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/master/balancer/ChaoticLoadBalancer.java
Tue Feb 28 15:45:45 2012
@@ -85,6 +85,9 @@ public class ChaoticLoadBalancer extends
     Map<TServerInstance,Long> numTablets = new HashMap<TServerInstance,Long>();
     List<TServerInstance> underCapacityTServer = new ArrayList<TServerInstance>();
 
+    if (!migrations.isEmpty())
+      return 100;
+
     long totalTablets = 0;
     for (Entry<TServerInstance,TabletServerStatus> e : current.entrySet()) {
       long tabletCount = 0;
@@ -105,17 +108,20 @@ public class ChaoticLoadBalancer extends
       {
         try {
           for (TabletStats ts : getOnlineTabletsForTable(e.getKey(), table)) {
-            
+            KeyExtent ke = new KeyExtent(ts.extent);
             int index = r.nextInt(underCapacityTServer.size());
             TServerInstance dest = underCapacityTServer.get(index);
             if (dest.equals(e.getKey()))
               continue;
-            migrationsOut.add(new TabletMigration(new KeyExtent(ts.extent), e.getKey(), dest));
+            migrationsOut.add(new TabletMigration(ke, e.getKey(), dest));
             if (numTablets.put(dest, numTablets.get(dest) + 1) > avg)
               underCapacityTServer.remove(index);
             if (numTablets.put(e.getKey(), numTablets.get(e.getKey()) - 1) <= avg &&
!underCapacityTServer.contains(e.getKey()))
               underCapacityTServer.add(e.getKey());
-
+            
+            // We can get some craziness with only 1 tserver, so lets make sure there's always
an option!
+            if (underCapacityTServer.isEmpty())
+              underCapacityTServer.addAll(numTablets.keySet());
           }
         } catch (ThriftSecurityException e1) {
           // Shouldn't happen, but carry on if it does
@@ -127,8 +133,7 @@ public class ChaoticLoadBalancer extends
       }
     }
     
-    // Yes, it can run every 5ms
-    return 5;
+    return 100;
   }
   
 }



Mime
View raw message