accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mmil...@apache.org
Subject [accumulo] branch master updated: ACCUMULO-3238 Fix missed Table.ID
Date Fri, 16 Mar 2018 21:34:18 GMT
This is an automated email from the ASF dual-hosted git repository.

mmiller pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/master by this push:
     new 24a6573  ACCUMULO-3238 Fix missed Table.ID
24a6573 is described below

commit 24a6573e620b63cf256463a9955d417cad235e85
Author: Mike Miller <mmiller@apache.org>
AuthorDate: Fri Mar 16 17:28:41 2018 -0400

    ACCUMULO-3238 Fix missed Table.ID
---
 .../accumulo/server/master/balancer/GroupBalancer.java     | 14 +++++++-------
 .../server/master/balancer/RegexGroupBalancer.java         |  8 ++++----
 .../accumulo/server/master/balancer/GroupBalancerTest.java |  2 +-
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/server/base/src/main/java/org/apache/accumulo/server/master/balancer/GroupBalancer.java
b/server/base/src/main/java/org/apache/accumulo/server/master/balancer/GroupBalancer.java
index 9a49b7d..c26ee8c 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/master/balancer/GroupBalancer.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/master/balancer/GroupBalancer.java
@@ -36,6 +36,7 @@ import java.util.function.Function;
 import org.apache.accumulo.core.client.IsolatedScanner;
 import org.apache.accumulo.core.client.RowIterator;
 import org.apache.accumulo.core.client.Scanner;
+import org.apache.accumulo.core.client.impl.Table;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.Value;
 import org.apache.accumulo.core.data.impl.KeyExtent;
@@ -54,7 +55,6 @@ import com.google.common.collect.HashBasedTable;
 import com.google.common.collect.HashMultimap;
 import com.google.common.collect.Iterators;
 import com.google.common.collect.Multimap;
-import com.google.common.collect.Table;
 
 /**
  * A balancer that evenly spreads groups of tablets across all tablet server. This balancer
accomplishes the following two goals :
@@ -70,7 +70,7 @@ import com.google.common.collect.Table;
 
 public abstract class GroupBalancer extends TabletBalancer {
 
-  private final String tableId;
+  private final Table.ID tableId;
   private long lastRun = 0;
 
   /**
@@ -78,7 +78,7 @@ public abstract class GroupBalancer extends TabletBalancer {
    */
   protected abstract Function<KeyExtent,String> getPartitioner();
 
-  public GroupBalancer(String tableId) {
+  public GroupBalancer(Table.ID tableId) {
     this.tableId = tableId;
   }
 
@@ -450,7 +450,7 @@ public abstract class GroupBalancer extends TabletBalancer {
 
   private static class Moves {
 
-    private final Table<TServerInstance,String,List<Move>> moves = HashBasedTable.create();
+    private final com.google.common.collect.Table<TServerInstance,String,List<Move>>
moves = HashBasedTable.create();
     private int totalMoves = 0;
 
     public void move(String group, int num, TserverGroupInfo src, TserverGroupInfo dest)
{
@@ -497,7 +497,7 @@ public abstract class GroupBalancer extends TabletBalancer {
   }
 
   private void balanceExtraExtra(Map<TServerInstance,TserverGroupInfo> tservers, int
maxExtraGroups, Moves moves) {
-    Table<String,TServerInstance,TserverGroupInfo> surplusExtra = HashBasedTable.create();
+    HashBasedTable<String,TServerInstance,TserverGroupInfo> surplusExtra = HashBasedTable.create();
     for (TserverGroupInfo tgi : tservers.values()) {
       Map<String,Integer> extras = tgi.getExtras();
       if (extras.size() > maxExtraGroups) {
@@ -615,7 +615,7 @@ public abstract class GroupBalancer extends TabletBalancer {
 
   private void balanceExtraExpected(Map<TServerInstance,TserverGroupInfo> tservers,
int expectedExtra, Moves moves) {
 
-    Table<String,TServerInstance,TserverGroupInfo> extraSurplus = HashBasedTable.create();
+    HashBasedTable<String,TServerInstance,TserverGroupInfo> extraSurplus = HashBasedTable.create();
 
     for (TserverGroupInfo tgi : tservers.values()) {
       Map<String,Integer> extras = tgi.getExtras();
@@ -774,7 +774,7 @@ public abstract class GroupBalancer extends TabletBalancer {
         Scanner scanner = new IsolatedScanner(context.getConnector().createScanner(MetadataTable.NAME,
Authorizations.EMPTY));
         scanner.fetchColumnFamily(MetadataSchema.TabletsSection.CurrentLocationColumnFamily.NAME);
         MetadataSchema.TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.fetch(scanner);
-        scanner.setRange(MetadataSchema.TabletsSection.getRange(org.apache.accumulo.core.client.impl.Table.ID.of(tableId)));
+        scanner.setRange(MetadataSchema.TabletsSection.getRange(tableId));
 
         RowIterator rowIter = new RowIterator(scanner);
 
diff --git a/server/base/src/main/java/org/apache/accumulo/server/master/balancer/RegexGroupBalancer.java
b/server/base/src/main/java/org/apache/accumulo/server/master/balancer/RegexGroupBalancer.java
index e11557a..bd9f686 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/master/balancer/RegexGroupBalancer.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/master/balancer/RegexGroupBalancer.java
@@ -49,16 +49,16 @@ public class RegexGroupBalancer extends GroupBalancer {
   public static final String DEFAUT_GROUP_PROPERTY = Property.TABLE_ARBITRARY_PROP_PREFIX.getKey()
+ "balancer.group.regex.default";
   public static final String WAIT_TIME_PROPERTY = Property.TABLE_ARBITRARY_PROP_PREFIX.getKey()
+ "balancer.group.regex.wait.time";
 
-  private final String tableId;
+  private final Table.ID tableId;
 
-  public RegexGroupBalancer(String tableId) {
+  public RegexGroupBalancer(Table.ID tableId) {
     super(tableId);
     this.tableId = tableId;
   }
 
   @Override
   protected long getWaitTime() {
-    Map<String,String> customProps = context.getServerConfigurationFactory().getTableConfiguration(Table.ID.of(tableId))
+    Map<String,String> customProps = context.getServerConfigurationFactory().getTableConfiguration(tableId)
         .getAllPropertiesWithPrefix(Property.TABLE_ARBITRARY_PROP_PREFIX);
     if (customProps.containsKey(WAIT_TIME_PROPERTY)) {
       return ConfigurationTypeHelper.getTimeInMillis(customProps.get(WAIT_TIME_PROPERTY));
@@ -70,7 +70,7 @@ public class RegexGroupBalancer extends GroupBalancer {
   @Override
   protected Function<KeyExtent,String> getPartitioner() {
 
-    Map<String,String> customProps = context.getServerConfigurationFactory().getTableConfiguration(Table.ID.of(tableId))
+    Map<String,String> customProps = context.getServerConfigurationFactory().getTableConfiguration(tableId)
         .getAllPropertiesWithPrefix(Property.TABLE_ARBITRARY_PROP_PREFIX);
     String regex = customProps.get(REGEX_PROPERTY);
     final String defaultGroup = customProps.get(DEFAUT_GROUP_PROPERTY);
diff --git a/server/base/src/test/java/org/apache/accumulo/server/master/balancer/GroupBalancerTest.java
b/server/base/src/test/java/org/apache/accumulo/server/master/balancer/GroupBalancerTest.java
index f58ab65..159e9f5 100644
--- a/server/base/src/test/java/org/apache/accumulo/server/master/balancer/GroupBalancerTest.java
+++ b/server/base/src/test/java/org/apache/accumulo/server/master/balancer/GroupBalancerTest.java
@@ -77,7 +77,7 @@ public class GroupBalancerTest {
     }
 
     public void balance(final int maxMigrations) {
-      GroupBalancer balancer = new GroupBalancer("1") {
+      GroupBalancer balancer = new GroupBalancer(Table.ID.of("1")) {
 
         @Override
         protected Iterable<Pair<KeyExtent,Location>> getLocationProvider() {

-- 
To stop receiving notification emails like this one, please contact
mmiller@apache.org.

Mime
View raw message