accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r1397050 - in /accumulo/trunk: ./ core/ fate/src/main/java/org/apache/accumulo/fate/ZooStore.java server/ server/src/main/java/org/apache/accumulo/server/master/balancer/DefaultLoadBalancer.java src/
Date Thu, 11 Oct 2012 13:46:17 GMT
Author: ecn
Date: Thu Oct 11 13:46:16 2012
New Revision: 1397050

URL: http://svn.apache.org/viewvc?rev=1397050&view=rev
Log:
ACCUMULO-770 randomize the list of potential locations when assigning tablets: merge to trunk

Modified:
    accumulo/trunk/   (props changed)
    accumulo/trunk/core/   (props changed)
    accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java   (props changed)
    accumulo/trunk/server/   (props changed)
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/balancer/DefaultLoadBalancer.java
    accumulo/trunk/src/   (props changed)

Propchange: accumulo/trunk/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.4/src:r1397048
  Merged /accumulo/branches/1.4:r1397048

Propchange: accumulo/trunk/core/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.4/core:r1397048
  Merged /accumulo/branches/1.4/src/core:r1397048

Propchange: accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.4/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java:r1397048
  Merged /accumulo/branches/1.4/src/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java:r1397048

Propchange: accumulo/trunk/server/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.4/server:r1397048
  Merged /accumulo/branches/1.4/src/server:r1397048

Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/balancer/DefaultLoadBalancer.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/balancer/DefaultLoadBalancer.java?rev=1397050&r1=1397049&r2=1397050&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/balancer/DefaultLoadBalancer.java
(original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/balancer/DefaultLoadBalancer.java
Thu Oct 11 13:46:16 2012
@@ -50,6 +50,12 @@ public class DefaultLoadBalancer extends
     tableToBalance = table;
   }
   
+  List<TServerInstance> randomize(Set<TServerInstance> locations) {
+    List<TServerInstance> result = new ArrayList<TServerInstance>(locations);
+    Collections.shuffle(result);
+    return result;
+  }
+  
   public TServerInstance getAssignment(SortedMap<TServerInstance,TabletServerStatus>
locations, KeyExtent extent, TServerInstance last) {
     if (locations.size() == 0)
       return null;
@@ -68,11 +74,11 @@ public class DefaultLoadBalancer extends
     // The strategy here is to walk through the locations and hand them back, one at a time
     // Grab an iterator off of the set of options; use a new iterator if it hands back something
not in the current list.
     if (assignments == null || !assignments.hasNext())
-      assignments = locations.keySet().iterator();
+      assignments = randomize(locations.keySet()).iterator();
     TServerInstance result = assignments.next();
     if (!locations.containsKey(result)) {
       assignments = null;
-      return locations.keySet().iterator().next();
+      return randomize(locations.keySet()).iterator().next();
     }
     return result;
   }

Propchange: accumulo/trunk/src/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.4/src:r1397048
  Merged /accumulo/branches/1.4/src/src:r1397048



Mime
View raw message