accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject [2/2] git commit: ACCUMULO-2952 move IT to proper location
Date Mon, 30 Jun 2014 15:23:42 GMT
ACCUMULO-2952 move IT to proper location


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/1b89892d
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/1b89892d
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/1b89892d

Branch: refs/heads/master
Commit: 1b89892da316edc4ba1d76efb3ca94f8447a6515
Parents: 1425450
Author: Eric C. Newton <eric.newton@gmail.com>
Authored: Mon Jun 30 11:22:26 2014 -0400
Committer: Eric C. Newton <eric.newton@gmail.com>
Committed: Mon Jun 30 11:22:26 2014 -0400

----------------------------------------------------------------------
 .../org/apache/accumulo/test/BalanceFaster.java | 80 ------------------
 .../apache/accumulo/test/BalanceFasterIT.java   | 86 ++++++++++++++++++++
 2 files changed, 86 insertions(+), 80 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/1b89892d/test/src/main/java/org/apache/accumulo/test/BalanceFaster.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/BalanceFaster.java b/test/src/main/java/org/apache/accumulo/test/BalanceFaster.java
deleted file mode 100644
index a6fe5d3..0000000
--- a/test/src/main/java/org/apache/accumulo/test/BalanceFaster.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.accumulo.test;
-
-import static org.junit.Assert.*;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.SortedSet;
-import java.util.TreeSet;
-
-import org.apache.accumulo.core.client.Connector;
-import org.apache.accumulo.core.client.Scanner;
-import org.apache.accumulo.core.data.Key;
-import org.apache.accumulo.core.data.Value;
-import org.apache.accumulo.core.metadata.MetadataTable;
-import org.apache.accumulo.core.metadata.schema.MetadataSchema;
-import org.apache.accumulo.core.security.Authorizations;
-import org.apache.accumulo.core.util.UtilWaitThread;
-import org.apache.accumulo.minicluster.impl.MiniAccumuloConfigImpl;
-import org.apache.accumulo.test.functional.ConfigurableMacIT;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.io.Text;
-import org.junit.Test;
-
-// ACCUMULO-2952
-public class BalanceFaster extends ConfigurableMacIT {
-  
-  @Override
-  public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
-    cfg.setNumTservers(3);
-  }
-
-  @Test(timeout=30*1000)
-  public void test() throws Exception {
-    String tableName = getUniqueNames(1)[0];
-    Connector conn = getConnector();
-    conn.tableOperations().create(tableName);
-    SortedSet<Text> splits = new TreeSet<Text>();
-    for (int i = 0; i < 1000; i++) {
-      splits.add(new Text("" + i));
-    }
-    conn.tableOperations().addSplits(tableName, splits);
-    Scanner s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-    UtilWaitThread.sleep(5000);
-    s.fetchColumnFamily(MetadataSchema.TabletsSection.CurrentLocationColumnFamily.NAME);
-    s.setRange(MetadataSchema.TabletsSection.getRange());
-    Map<String, Integer> counts = new HashMap<String, Integer>();
-    for (Entry<Key,Value> kv : s) {
-      String host = kv.getValue().toString();
-      if (!counts.containsKey(host))
-        counts.put(host, 0);
-      counts.put(host, counts.get(host) + 1);
-    }
-    assertTrue(counts.size() == 3);
-    Iterator<Integer> i = counts.values().iterator();
-    int a = i.next();
-    int b = i.next();
-    int c = i.next();
-    assertTrue(Math.abs(a - b) < 3);
-    assertTrue(Math.abs(a - c) < 3);
-  }
-  
-}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/1b89892d/test/src/test/java/org/apache/accumulo/test/BalanceFasterIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/BalanceFasterIT.java b/test/src/test/java/org/apache/accumulo/test/BalanceFasterIT.java
new file mode 100644
index 0000000..a1a7f1c
--- /dev/null
+++ b/test/src/test/java/org/apache/accumulo/test/BalanceFasterIT.java
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.test;
+
+import static org.junit.Assert.*;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.client.Scanner;
+import org.apache.accumulo.core.data.Key;
+import org.apache.accumulo.core.data.Value;
+import org.apache.accumulo.core.metadata.MetadataTable;
+import org.apache.accumulo.core.metadata.schema.MetadataSchema;
+import org.apache.accumulo.core.security.Authorizations;
+import org.apache.accumulo.core.util.UtilWaitThread;
+import org.apache.accumulo.minicluster.impl.MiniAccumuloConfigImpl;
+import org.apache.accumulo.test.functional.ConfigurableMacIT;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.io.Text;
+import org.junit.Test;
+
+// ACCUMULO-2952
+public class BalanceFasterIT extends ConfigurableMacIT {
+  
+  @Override
+  public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
+    cfg.setNumTservers(3);
+  }
+
+  @Test(timeout=30*1000)
+  public void test() throws Exception {
+    // create a table, add a bunch of splits
+    String tableName = getUniqueNames(1)[0];
+    Connector conn = getConnector();
+    conn.tableOperations().create(tableName);
+    SortedSet<Text> splits = new TreeSet<Text>();
+    for (int i = 0; i < 1000; i++) {
+      splits.add(new Text("" + i));
+    }
+    conn.tableOperations().addSplits(tableName, splits);
+    // give a short wait for balancing
+    UtilWaitThread.sleep(10*1000);
+    // find out where the tabets are
+    Scanner s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
+    s.fetchColumnFamily(MetadataSchema.TabletsSection.CurrentLocationColumnFamily.NAME);
+    s.setRange(MetadataSchema.TabletsSection.getRange());
+    Map<String, Integer> counts = new HashMap<String, Integer>();
+    for (Entry<Key,Value> kv : s) {
+      String host = kv.getValue().toString();
+      if (!counts.containsKey(host))
+        counts.put(host, 0);
+      counts.put(host, counts.get(host) + 1);
+    }
+    // should be on all three servers
+    assertTrue(counts.size() == 3);
+    // and distributed evenly
+    Iterator<Integer> i = counts.values().iterator();
+    int a = i.next();
+    int b = i.next();
+    int c = i.next();
+    assertTrue(Math.abs(a - b) < 3);
+    assertTrue(Math.abs(a - c) < 3);
+    assertTrue(a > 330);
+  }
+  
+}


Mime
View raw message