You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ct...@apache.org on 2020/01/31 13:48:19 UTC

[accumulo] 01/02: Fix #1491 Stabilize ChaoticBalancerIT in 1.x

This is an automated email from the ASF dual-hosted git repository.

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

commit e6f059e9ba05db952f85b3a10d1fc99f0e84d313
Author: Christopher Tubbs <ct...@apache.org>
AuthorDate: Fri Jan 31 05:32:29 2020 -0500

    Fix #1491 Stabilize ChaoticBalancerIT in 1.x
    
    Backport fixes from ACCUMULO-4602
    (520d23d85dfce9297bab887726322861163a1fb2)
---
 .../master/balancer/ChaoticLoadBalancer.java       |  2 +-
 .../test/functional/ChaoticBalancerIT.java         | 25 +++++++++++-----------
 2 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/server/base/src/main/java/org/apache/accumulo/server/master/balancer/ChaoticLoadBalancer.java b/server/base/src/main/java/org/apache/accumulo/server/master/balancer/ChaoticLoadBalancer.java
index 2a02555..ae06bb8 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/master/balancer/ChaoticLoadBalancer.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/master/balancer/ChaoticLoadBalancer.java
@@ -75,7 +75,7 @@ public class ChaoticLoadBalancer extends TabletBalancer {
       for (TableInfo ti : e.getValue().getTableMap().values()) {
         numTablets += ti.tablets;
       }
-      if (numTablets < avg) {
+      if (numTablets <= avg) {
         tServerArray.add(e.getKey());
         toAssign.put(e.getKey(), avg - numTablets);
       }
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ChaoticBalancerIT.java b/test/src/main/java/org/apache/accumulo/test/functional/ChaoticBalancerIT.java
index 4b0580b..188770c 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/ChaoticBalancerIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/ChaoticBalancerIT.java
@@ -17,21 +17,22 @@
 package org.apache.accumulo.test.functional;
 
 import java.util.Map;
-import java.util.SortedSet;
-import java.util.TreeSet;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 import org.apache.accumulo.core.cli.BatchWriterOpts;
 import org.apache.accumulo.core.cli.ScannerOpts;
 import org.apache.accumulo.core.client.ClientConfiguration;
 import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.client.admin.NewTableConfiguration;
 import org.apache.accumulo.core.conf.Property;
+import org.apache.accumulo.core.util.Pair;
 import org.apache.accumulo.harness.AccumuloClusterHarness;
 import org.apache.accumulo.minicluster.impl.MiniAccumuloConfigImpl;
 import org.apache.accumulo.server.master.balancer.ChaoticLoadBalancer;
 import org.apache.accumulo.test.TestIngest;
 import org.apache.accumulo.test.VerifyIngest;
 import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.io.Text;
 import org.junit.Test;
 
 public class ChaoticBalancerIT extends AccumuloClusterHarness {
@@ -54,16 +55,14 @@ public class ChaoticBalancerIT extends AccumuloClusterHarness {
   @Test
   public void test() throws Exception {
     Connector c = getConnector();
-    String[] names = getUniqueNames(2);
-    String tableName = names[0], unused = names[1];
-    c.tableOperations().create(tableName);
-    c.tableOperations().setProperty(tableName, Property.TABLE_SPLIT_THRESHOLD.getKey(), "10K");
-    SortedSet<Text> splits = new TreeSet<>();
-    for (int i = 0; i < 100; i++) {
-      splits.add(new Text(String.format("%03d", i)));
-    }
-    c.tableOperations().create(unused);
-    c.tableOperations().addSplits(unused, splits);
+    String[] names = getUniqueNames(1);
+    String tableName = names[0];
+    NewTableConfiguration ntc = new NewTableConfiguration();
+    ntc.setProperties(Stream
+        .of(new Pair<>(Property.TABLE_SPLIT_THRESHOLD.getKey(), "10K"),
+            new Pair<>(Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE.getKey(), "1K"))
+        .collect(Collectors.toMap(Pair::getFirst, Pair::getSecond)));
+    c.tableOperations().create(tableName, ntc);
     TestIngest.Opts opts = new TestIngest.Opts();
     VerifyIngest.Opts vopts = new VerifyIngest.Opts();
     vopts.rows = opts.rows = 20000;