You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by kt...@apache.org on 2015/06/24 00:37:21 UTC
[1/4] accumulo git commit: ACCUMULO-3912 Only configure conurrent
namespaces in conucurrent test
Repository: accumulo
Updated Branches:
refs/heads/1.7 8dd229c8a -> 77066e35c
ACCUMULO-3912 Only configure conurrent namespaces in conucurrent test
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/2721bc83
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/2721bc83
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/2721bc83
Branch: refs/heads/1.7
Commit: 2721bc839944cc86cb0a6045293e5d928a0ea520
Parents: 3509547
Author: Keith Turner <kt...@apache.org>
Authored: Tue Jun 23 16:33:41 2015 -0400
Committer: Keith Turner <kt...@apache.org>
Committed: Tue Jun 23 16:49:04 2015 -0400
----------------------------------------------------------------------
.../org/apache/accumulo/test/randomwalk/concurrent/Config.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/2721bc83/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Config.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Config.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Config.java
index 402f139..1f4a284 100644
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Config.java
+++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Config.java
@@ -201,7 +201,7 @@ public class Config extends Test {
Setting setting = tableSettings[choice];
// pick a random table
- SortedSet<String> namespaces = state.getConnector().namespaceOperations().list();
+ SortedSet<String> namespaces = state.getConnector().namespaceOperations().list().tailSet("nspc").headSet("nspd");
if (namespaces.isEmpty())
return;
String namespace = random.nextSample(namespaces, 1)[0].toString();
[3/4] accumulo git commit: ACCUMULO-3747 put IT in its place and give
it a correct name
Posted by kt...@apache.org.
ACCUMULO-3747 put IT in its place and give it a correct name
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/fc15de74
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/fc15de74
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/fc15de74
Branch: refs/heads/1.7
Commit: fc15de748d2a02dba5fee4133c71f2645b6ae230
Parents: 2721bc8
Author: Keith Turner <kt...@apache.org>
Authored: Tue Jun 23 18:07:15 2015 -0400
Committer: Keith Turner <kt...@apache.org>
Committed: Tue Jun 23 18:07:15 2015 -0400
----------------------------------------------------------------------
.../accumulo/test/DetectDeadTabletServers.java | 96 --------------------
.../test/DetectDeadTabletServersIT.java | 96 ++++++++++++++++++++
2 files changed, 96 insertions(+), 96 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/fc15de74/test/src/main/java/org/apache/accumulo/test/DetectDeadTabletServers.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/DetectDeadTabletServers.java b/test/src/main/java/org/apache/accumulo/test/DetectDeadTabletServers.java
deleted file mode 100644
index 15afd25..0000000
--- a/test/src/main/java/org/apache/accumulo/test/DetectDeadTabletServers.java
+++ /dev/null
@@ -1,96 +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.apache.accumulo.minicluster.ServerType.TABLET_SERVER;
-import static org.junit.Assert.assertEquals;
-
-import org.apache.accumulo.core.client.Connector;
-import org.apache.accumulo.core.client.impl.MasterClient;
-import org.apache.accumulo.core.client.security.tokens.PasswordToken;
-import org.apache.accumulo.core.conf.Property;
-import org.apache.accumulo.core.master.thrift.MasterClientService;
-import org.apache.accumulo.core.master.thrift.MasterMonitorInfo;
-import org.apache.accumulo.core.metadata.MetadataTable;
-import org.apache.accumulo.core.security.Authorizations;
-import org.apache.accumulo.core.security.Credentials;
-import org.apache.accumulo.fate.util.UtilWaitThread;
-import org.apache.accumulo.minicluster.impl.MiniAccumuloConfigImpl;
-import org.apache.accumulo.test.functional.ConfigurableMacIT;
-import org.apache.accumulo.trace.instrument.Tracer;
-import org.apache.hadoop.conf.Configuration;
-import org.junit.Test;
-
-import com.google.common.collect.Iterators;
-
-public class DetectDeadTabletServers extends ConfigurableMacIT {
-
- @Override
- protected void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
- cfg.setProperty(Property.INSTANCE_ZK_TIMEOUT, "3s");
- }
-
- @Test
- public void test() throws Exception {
- Connector c = getConnector();
- log.info("verifying that everything is up");
- Iterators.size(c.createScanner(MetadataTable.NAME, Authorizations.EMPTY).iterator());
-
- MasterMonitorInfo stats = getStats(c);
- assertEquals(2, stats.tServerInfo.size());
- assertEquals(0, stats.badTServers.size());
- assertEquals(0, stats.deadTabletServers.size());
- log.info("Killing a tablet server");
- getCluster().killProcess(TABLET_SERVER, getCluster().getProcesses().get(TABLET_SERVER).iterator().next());
-
- while (true) {
- stats = getStats(c);
- if (2 != stats.tServerInfo.size()) {
- break;
- }
- UtilWaitThread.sleep(500);
- }
- assertEquals(1, stats.tServerInfo.size());
- assertEquals(1, stats.badTServers.size() + stats.deadTabletServers.size());
- while (true) {
- stats = getStats(c);
- if (0 != stats.deadTabletServers.size()) {
- break;
- }
- UtilWaitThread.sleep(500);
- }
- assertEquals(1, stats.tServerInfo.size());
- assertEquals(0, stats.badTServers.size());
- assertEquals(1, stats.deadTabletServers.size());
- }
-
- private MasterMonitorInfo getStats(Connector c) throws Exception {
- Credentials creds = new Credentials("root", new PasswordToken(ROOT_PASSWORD));
- MasterClientService.Iface client = null;
- try {
- client = MasterClient.getConnectionWithRetry(c.getInstance());
- log.info("Fetching master stats");
- return client.getMasterStats(Tracer.traceInfo(), creds.toThrift(c.getInstance()));
- } finally {
- if (client != null) {
- MasterClient.close(client);
- }
- }
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/fc15de74/test/src/test/java/org/apache/accumulo/test/DetectDeadTabletServersIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/DetectDeadTabletServersIT.java b/test/src/test/java/org/apache/accumulo/test/DetectDeadTabletServersIT.java
new file mode 100644
index 0000000..11fa06b
--- /dev/null
+++ b/test/src/test/java/org/apache/accumulo/test/DetectDeadTabletServersIT.java
@@ -0,0 +1,96 @@
+/*
+ * 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.apache.accumulo.minicluster.ServerType.TABLET_SERVER;
+import static org.junit.Assert.assertEquals;
+
+import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.client.impl.MasterClient;
+import org.apache.accumulo.core.client.security.tokens.PasswordToken;
+import org.apache.accumulo.core.conf.Property;
+import org.apache.accumulo.core.master.thrift.MasterClientService;
+import org.apache.accumulo.core.master.thrift.MasterMonitorInfo;
+import org.apache.accumulo.core.metadata.MetadataTable;
+import org.apache.accumulo.core.security.Authorizations;
+import org.apache.accumulo.core.security.Credentials;
+import org.apache.accumulo.fate.util.UtilWaitThread;
+import org.apache.accumulo.minicluster.impl.MiniAccumuloConfigImpl;
+import org.apache.accumulo.test.functional.ConfigurableMacIT;
+import org.apache.accumulo.trace.instrument.Tracer;
+import org.apache.hadoop.conf.Configuration;
+import org.junit.Test;
+
+import com.google.common.collect.Iterators;
+
+public class DetectDeadTabletServersIT extends ConfigurableMacIT {
+
+ @Override
+ protected void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
+ cfg.setProperty(Property.INSTANCE_ZK_TIMEOUT, "3s");
+ }
+
+ @Test
+ public void test() throws Exception {
+ Connector c = getConnector();
+ log.info("verifying that everything is up");
+ Iterators.size(c.createScanner(MetadataTable.NAME, Authorizations.EMPTY).iterator());
+
+ MasterMonitorInfo stats = getStats(c);
+ assertEquals(2, stats.tServerInfo.size());
+ assertEquals(0, stats.badTServers.size());
+ assertEquals(0, stats.deadTabletServers.size());
+ log.info("Killing a tablet server");
+ getCluster().killProcess(TABLET_SERVER, getCluster().getProcesses().get(TABLET_SERVER).iterator().next());
+
+ while (true) {
+ stats = getStats(c);
+ if (2 != stats.tServerInfo.size()) {
+ break;
+ }
+ UtilWaitThread.sleep(500);
+ }
+ assertEquals(1, stats.tServerInfo.size());
+ assertEquals(1, stats.badTServers.size() + stats.deadTabletServers.size());
+ while (true) {
+ stats = getStats(c);
+ if (0 != stats.deadTabletServers.size()) {
+ break;
+ }
+ UtilWaitThread.sleep(500);
+ }
+ assertEquals(1, stats.tServerInfo.size());
+ assertEquals(0, stats.badTServers.size());
+ assertEquals(1, stats.deadTabletServers.size());
+ }
+
+ private MasterMonitorInfo getStats(Connector c) throws Exception {
+ Credentials creds = new Credentials("root", new PasswordToken(ROOT_PASSWORD));
+ MasterClientService.Iface client = null;
+ try {
+ client = MasterClient.getConnectionWithRetry(c.getInstance());
+ log.info("Fetching master stats");
+ return client.getMasterStats(Tracer.traceInfo(), creds.toThrift(c.getInstance()));
+ } finally {
+ if (client != null) {
+ MasterClient.close(client);
+ }
+ }
+ }
+
+
+}
[4/4] accumulo git commit: Merge branch '1.6' into 1.7
Posted by kt...@apache.org.
Merge branch '1.6' into 1.7
Conflicts:
test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CheckBalance.java
test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/ConcurrentFixture.java
test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Config.java
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/77066e35
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/77066e35
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/77066e35
Branch: refs/heads/1.7
Commit: 77066e35c3778fee18ef17be9c82322f0660138c
Parents: 8dd229c fc15de7
Author: Keith Turner <kt...@apache.org>
Authored: Tue Jun 23 18:11:31 2015 -0400
Committer: Keith Turner <kt...@apache.org>
Committed: Tue Jun 23 18:11:31 2015 -0400
----------------------------------------------------------------------
.../accumulo/test/DetectDeadTabletServers.java | 98 -----------------
.../randomwalk/concurrent/CheckBalance.java | 110 -------------------
.../concurrent/ConcurrentFixture.java | 5 +-
.../test/randomwalk/concurrent/Config.java | 2 +-
.../test/DetectDeadTabletServersIT.java | 97 ++++++++++++++++
.../randomwalk/conf/modules/Concurrent.xml | 5 -
6 files changed, 99 insertions(+), 218 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/77066e35/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/ConcurrentFixture.java
----------------------------------------------------------------------
diff --cc test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/ConcurrentFixture.java
index a32e463,7963c8b..b27f34c
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/ConcurrentFixture.java
+++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/ConcurrentFixture.java
@@@ -34,13 -33,11 +34,10 @@@ import org.apache.hadoop.io.Text
public class ConcurrentFixture extends Fixture {
@Override
- public void setUp(State state) throws Exception {}
+ public void setUp(State state, Environment env) throws Exception {}
@Override
- public void tearDown(State state, Environment env) throws Exception {
- state.remove(CheckBalance.LAST_UNBALANCED_TIME);
- state.remove(CheckBalance.UNBALANCED_COUNT);
- public void tearDown(State state) throws Exception {
-- }
++ public void tearDown(State state, Environment env) throws Exception {}
/**
*
http://git-wip-us.apache.org/repos/asf/accumulo/blob/77066e35/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Config.java
----------------------------------------------------------------------
diff --cc test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Config.java
index 6e02c23,1f4a284..7e95d3b
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Config.java
+++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Config.java
@@@ -201,7 -201,7 +201,7 @@@ public class Config extends Test
Setting setting = tableSettings[choice];
// pick a random table
- SortedSet<String> namespaces = env.getConnector().namespaceOperations().list();
- SortedSet<String> namespaces = state.getConnector().namespaceOperations().list().tailSet("nspc").headSet("nspd");
++ SortedSet<String> namespaces = env.getConnector().namespaceOperations().list().tailSet("nspc").headSet("nspd");
if (namespaces.isEmpty())
return;
String namespace = random.nextSample(namespaces, 1)[0].toString();
http://git-wip-us.apache.org/repos/asf/accumulo/blob/77066e35/test/src/test/java/org/apache/accumulo/test/DetectDeadTabletServersIT.java
----------------------------------------------------------------------
diff --cc test/src/test/java/org/apache/accumulo/test/DetectDeadTabletServersIT.java
index 0000000,11fa06b..04c781b
mode 000000,100644..100644
--- a/test/src/test/java/org/apache/accumulo/test/DetectDeadTabletServersIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/DetectDeadTabletServersIT.java
@@@ -1,0 -1,96 +1,97 @@@
+ /*
+ * 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.apache.accumulo.minicluster.ServerType.TABLET_SERVER;
+ import static org.junit.Assert.assertEquals;
+
+ import org.apache.accumulo.core.client.Connector;
++import org.apache.accumulo.core.client.impl.ClientContext;
++import org.apache.accumulo.core.client.impl.Credentials;
+ import org.apache.accumulo.core.client.impl.MasterClient;
+ import org.apache.accumulo.core.client.security.tokens.PasswordToken;
+ import org.apache.accumulo.core.conf.Property;
-import org.apache.accumulo.core.master.thrift.MasterClientService;
++import org.apache.accumulo.core.master.thrift.MasterClientService.Client;
+ import org.apache.accumulo.core.master.thrift.MasterMonitorInfo;
+ import org.apache.accumulo.core.metadata.MetadataTable;
+ import org.apache.accumulo.core.security.Authorizations;
-import org.apache.accumulo.core.security.Credentials;
++import org.apache.accumulo.core.trace.Tracer;
+ import org.apache.accumulo.fate.util.UtilWaitThread;
+ import org.apache.accumulo.minicluster.impl.MiniAccumuloConfigImpl;
+ import org.apache.accumulo.test.functional.ConfigurableMacIT;
-import org.apache.accumulo.trace.instrument.Tracer;
+ import org.apache.hadoop.conf.Configuration;
+ import org.junit.Test;
+
+ import com.google.common.collect.Iterators;
+
+ public class DetectDeadTabletServersIT extends ConfigurableMacIT {
+
+ @Override
+ protected void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
+ cfg.setProperty(Property.INSTANCE_ZK_TIMEOUT, "3s");
+ }
+
+ @Test
+ public void test() throws Exception {
+ Connector c = getConnector();
+ log.info("verifying that everything is up");
+ Iterators.size(c.createScanner(MetadataTable.NAME, Authorizations.EMPTY).iterator());
+
+ MasterMonitorInfo stats = getStats(c);
+ assertEquals(2, stats.tServerInfo.size());
+ assertEquals(0, stats.badTServers.size());
+ assertEquals(0, stats.deadTabletServers.size());
+ log.info("Killing a tablet server");
+ getCluster().killProcess(TABLET_SERVER, getCluster().getProcesses().get(TABLET_SERVER).iterator().next());
+
+ while (true) {
+ stats = getStats(c);
+ if (2 != stats.tServerInfo.size()) {
+ break;
+ }
+ UtilWaitThread.sleep(500);
+ }
+ assertEquals(1, stats.tServerInfo.size());
+ assertEquals(1, stats.badTServers.size() + stats.deadTabletServers.size());
+ while (true) {
+ stats = getStats(c);
+ if (0 != stats.deadTabletServers.size()) {
+ break;
+ }
+ UtilWaitThread.sleep(500);
+ }
+ assertEquals(1, stats.tServerInfo.size());
+ assertEquals(0, stats.badTServers.size());
+ assertEquals(1, stats.deadTabletServers.size());
+ }
+
+ private MasterMonitorInfo getStats(Connector c) throws Exception {
+ Credentials creds = new Credentials("root", new PasswordToken(ROOT_PASSWORD));
- MasterClientService.Iface client = null;
++ ClientContext context = new ClientContext(c.getInstance(), creds, getClientConfig());
++ Client client = null;
+ try {
- client = MasterClient.getConnectionWithRetry(c.getInstance());
++ client = MasterClient.getConnectionWithRetry(context);
+ log.info("Fetching master stats");
- return client.getMasterStats(Tracer.traceInfo(), creds.toThrift(c.getInstance()));
++ return client.getMasterStats(Tracer.traceInfo(), context.rpcCreds());
+ } finally {
+ if (client != null) {
+ MasterClient.close(client);
+ }
+ }
+ }
+
-
+ }
http://git-wip-us.apache.org/repos/asf/accumulo/blob/77066e35/test/system/randomwalk/conf/modules/Concurrent.xml
----------------------------------------------------------------------
[2/4] accumulo git commit: ACCUMULO-3141 removed CheckBalance node
from RW
Posted by kt...@apache.org.
ACCUMULO-3141 removed CheckBalance node from RW
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/35095474
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/35095474
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/35095474
Branch: refs/heads/1.7
Commit: 35095474f7ae0b096117313273b57f7a1ed05226
Parents: c3bb4c6
Author: Keith Turner <kt...@apache.org>
Authored: Tue Jun 23 16:31:56 2015 -0400
Committer: Keith Turner <kt...@apache.org>
Committed: Tue Jun 23 16:49:04 2015 -0400
----------------------------------------------------------------------
.../randomwalk/concurrent/CheckBalance.java | 109 -------------------
.../concurrent/ConcurrentFixture.java | 2 -
.../randomwalk/conf/modules/Concurrent.xml | 5 -
3 files changed, 116 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/35095474/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CheckBalance.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CheckBalance.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CheckBalance.java
deleted file mode 100644
index 6a20bfc..0000000
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CheckBalance.java
+++ /dev/null
@@ -1,109 +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.randomwalk.concurrent;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Properties;
-
-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.TabletsSection;
-import org.apache.accumulo.core.security.Authorizations;
-import org.apache.accumulo.test.randomwalk.State;
-import org.apache.accumulo.test.randomwalk.Test;
-
-/**
- *
- */
-public class CheckBalance extends Test {
-
- static final String LAST_UNBALANCED_TIME = "lastUnbalancedTime";
- static final String UNBALANCED_COUNT = "unbalancedCount";
-
- @Override
- public void visit(State state, Properties props) throws Exception {
- log.debug("checking balance");
- Map<String,Long> counts = new HashMap<String,Long>();
- Scanner scanner = state.getConnector().createScanner(MetadataTable.NAME, Authorizations.EMPTY);
- scanner.fetchColumnFamily(TabletsSection.CurrentLocationColumnFamily.NAME);
- for (Entry<Key,Value> entry : scanner) {
- String location = entry.getKey().getColumnQualifier().toString();
- Long count = counts.get(location);
- if (count == null)
- count = Long.valueOf(0);
- counts.put(location, count + 1);
- }
- double total = 0.;
- for (Long count : counts.values()) {
- total += count.longValue();
- }
- final double average = total / counts.size();
- final double sd = stddev(counts.values(), average);
- log.debug("average " + average + ", standard deviation " + sd);
-
- // Check for balanced # of tablets on each node
- double maxDifference = 2.0 * sd;
- String unbalancedLocation = null;
- long lastCount = 0L;
- boolean balanced = true;
- for (Entry<String,Long> entry : counts.entrySet()) {
- long thisCount = entry.getValue().longValue();
- if (Math.abs(thisCount - average) > maxDifference) {
- balanced = false;
- log.debug("unbalanced: " + entry.getKey() + " has " + entry.getValue() + " tablets and the average is " + average);
- unbalancedLocation = entry.getKey();
- lastCount = thisCount;
- }
- }
-
- // It is expected that the number of tablets will be uneven for short
- // periods of time. Don't complain unless we've seen it only unbalanced
- // over a 15 minute period and it's been at least three checks.
- if (!balanced) {
- Long last = state.getLong(LAST_UNBALANCED_TIME);
- if (last != null && System.currentTimeMillis() - last > 15 * 60 * 1000) {
- Integer count = state.getInteger(UNBALANCED_COUNT);
- if (count == null)
- count = Integer.valueOf(0);
- if (count > 3)
- throw new Exception("servers are unbalanced! location " + unbalancedLocation + " count " + lastCount + " too far from average " + average);
- count++;
- state.set(UNBALANCED_COUNT, count);
- }
- if (last == null)
- state.set(LAST_UNBALANCED_TIME, System.currentTimeMillis());
- } else {
- state.remove(LAST_UNBALANCED_TIME);
- state.remove(UNBALANCED_COUNT);
- }
- }
-
- private static double stddev(Collection<Long> samples, double avg) {
- int num = samples.size();
- double sqrtotal = 0.0;
- for (Long s : samples) {
- double diff = s.doubleValue() - avg;
- sqrtotal += diff * diff;
- }
- return Math.sqrt(sqrtotal / num);
- }
-}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/35095474/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/ConcurrentFixture.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/ConcurrentFixture.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/ConcurrentFixture.java
index e8b6cf4..7963c8b 100644
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/ConcurrentFixture.java
+++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/ConcurrentFixture.java
@@ -37,8 +37,6 @@ public class ConcurrentFixture extends Fixture {
@Override
public void tearDown(State state) throws Exception {
- state.remove(CheckBalance.LAST_UNBALANCED_TIME);
- state.remove(CheckBalance.UNBALANCED_COUNT);
}
/**
http://git-wip-us.apache.org/repos/asf/accumulo/blob/35095474/test/system/randomwalk/conf/modules/Concurrent.xml
----------------------------------------------------------------------
diff --git a/test/system/randomwalk/conf/modules/Concurrent.xml b/test/system/randomwalk/conf/modules/Concurrent.xml
index 96fbbce..f45f244 100644
--- a/test/system/randomwalk/conf/modules/Concurrent.xml
+++ b/test/system/randomwalk/conf/modules/Concurrent.xml
@@ -44,7 +44,6 @@
<edge id="ct.ChangeAuthorizations" weight="1000"/>
<edge id="ct.ChangePermissions" weight="1000"/>
<edge id="ct.CheckPermission" weight="1000"/>
- <edge id="ct.CheckBalance" weight="1000"/>
<edge id="ct.StopTabletServer" weight="100"/>
<edge id="ct.StartAll" weight="1000"/>
<edge id="ct.Shutdown" weight="10"/>
@@ -142,10 +141,6 @@
<edge id="dummy.ToAll" weight="1"/>
</node>
-<node id="ct.CheckBalance">
- <edge id="dummy.ToAll" weight="1"/>
-</node>
-
<node id="ct.StopTabletServer">
<edge id="dummy.ToAll" weight="1"/>
</node>