[5/6] accumulo git commit: Merge branch '1.6' into 1.7
Merge branch '1.6' into 1.7 Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/e04ea77d Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/e04ea77d Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/e04ea77d Branch: refs/heads/1.7 Commit: e04ea77d770755f61c9318290bb041923334a791 Parents: c5aa060 b754d12 Author: Josh Elser Authored: Thu Jun 4 00:13:05 2015 -0400 Committer: Josh Elser Committed: Thu Jun 4 00:13:05 2015 -0400 -- .../apache/accumulo/test/functional/ScanIdIT.java | 18 +- 1 file changed, 17 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/accumulo/blob/e04ea77d/test/src/test/java/org/apache/accumulo/test/functional/ScanIdIT.java --
[2/6] accumulo git commit: ACCUMULO-3889 Make ScanIdIT a bit more reliable for TNFE
ACCUMULO-3889 Make ScanIdIT a bit more reliable for TNFE Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/b754d121 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/b754d121 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/b754d121 Branch: refs/heads/1.7 Commit: b754d12125331ee20fe9cdc65f4712706e93ac98 Parents: 9a4dd30 Author: Josh Elser Authored: Wed Jun 3 23:52:03 2015 -0400 Committer: Josh Elser Committed: Wed Jun 3 23:52:03 2015 -0400 -- .../apache/accumulo/test/functional/ScanIdIT.java | 18 +- 1 file changed, 17 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/accumulo/blob/b754d121/test/src/test/java/org/apache/accumulo/test/functional/ScanIdIT.java -- diff --git a/test/src/test/java/org/apache/accumulo/test/functional/ScanIdIT.java b/test/src/test/java/org/apache/accumulo/test/functional/ScanIdIT.java index de4a47e..726ab8b 100644 --- a/test/src/test/java/org/apache/accumulo/test/functional/ScanIdIT.java +++ b/test/src/test/java/org/apache/accumulo/test/functional/ScanIdIT.java @@ -17,6 +17,7 @@ package org.apache.accumulo.test.functional; import static com.google.common.base.Charsets.UTF_8; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -140,7 +141,22 @@ public class ScanIdIT extends AccumuloClusterIT { for (String tserver : tservers) { - List activeScans = conn.instanceOperations().getActiveScans(tserver); + List activeScans = null; + for (int i = 0; i < 10; i++) { +try { + activeScans = conn.instanceOperations().getActiveScans(tserver); + break; +} catch (AccumuloException e) { + if (e.getCause() instanceof TableNotFoundException) { +log.debug("Got TableNotFoundException, will retry"); +Thread.sleep(200); +continue; + } + throw e; +} + } + + assertNotNull("Repeatedly got exception trying to active scans", activeScans); log.debug("TServer {} has {} active scans", tserver, activeScans.size());
[6/6] accumulo git commit: Merge branch '1.7'
Merge branch '1.7' Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/044e46df Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/044e46df Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/044e46df Branch: refs/heads/master Commit: 044e46df5bcd78864d063a35c69ecc0695507826 Parents: 6965c41 e04ea77 Author: Josh Elser Authored: Thu Jun 4 00:13:12 2015 -0400 Committer: Josh Elser Committed: Thu Jun 4 00:13:12 2015 -0400 -- .../apache/accumulo/test/functional/ScanIdIT.java | 18 +- 1 file changed, 17 insertions(+), 1 deletion(-) --
[4/6] accumulo git commit: Merge branch '1.6' into 1.7
Merge branch '1.6' into 1.7 Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/e04ea77d Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/e04ea77d Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/e04ea77d Branch: refs/heads/master Commit: e04ea77d770755f61c9318290bb041923334a791 Parents: c5aa060 b754d12 Author: Josh Elser Authored: Thu Jun 4 00:13:05 2015 -0400 Committer: Josh Elser Committed: Thu Jun 4 00:13:05 2015 -0400 -- .../apache/accumulo/test/functional/ScanIdIT.java | 18 +- 1 file changed, 17 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/accumulo/blob/e04ea77d/test/src/test/java/org/apache/accumulo/test/functional/ScanIdIT.java --
[3/6] accumulo git commit: ACCUMULO-3889 Make ScanIdIT a bit more reliable for TNFE
ACCUMULO-3889 Make ScanIdIT a bit more reliable for TNFE Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/b754d121 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/b754d121 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/b754d121 Branch: refs/heads/master Commit: b754d12125331ee20fe9cdc65f4712706e93ac98 Parents: 9a4dd30 Author: Josh Elser Authored: Wed Jun 3 23:52:03 2015 -0400 Committer: Josh Elser Committed: Wed Jun 3 23:52:03 2015 -0400 -- .../apache/accumulo/test/functional/ScanIdIT.java | 18 +- 1 file changed, 17 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/accumulo/blob/b754d121/test/src/test/java/org/apache/accumulo/test/functional/ScanIdIT.java -- diff --git a/test/src/test/java/org/apache/accumulo/test/functional/ScanIdIT.java b/test/src/test/java/org/apache/accumulo/test/functional/ScanIdIT.java index de4a47e..726ab8b 100644 --- a/test/src/test/java/org/apache/accumulo/test/functional/ScanIdIT.java +++ b/test/src/test/java/org/apache/accumulo/test/functional/ScanIdIT.java @@ -17,6 +17,7 @@ package org.apache.accumulo.test.functional; import static com.google.common.base.Charsets.UTF_8; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -140,7 +141,22 @@ public class ScanIdIT extends AccumuloClusterIT { for (String tserver : tservers) { - List activeScans = conn.instanceOperations().getActiveScans(tserver); + List activeScans = null; + for (int i = 0; i < 10; i++) { +try { + activeScans = conn.instanceOperations().getActiveScans(tserver); + break; +} catch (AccumuloException e) { + if (e.getCause() instanceof TableNotFoundException) { +log.debug("Got TableNotFoundException, will retry"); +Thread.sleep(200); +continue; + } + throw e; +} + } + + assertNotNull("Repeatedly got exception trying to active scans", activeScans); log.debug("TServer {} has {} active scans", tserver, activeScans.size());
[1/6] accumulo git commit: ACCUMULO-3889 Make ScanIdIT a bit more reliable for TNFE
Repository: accumulo Updated Branches: refs/heads/1.6 9a4dd3000 -> b754d1212 refs/heads/1.7 c5aa060ee -> e04ea77d7 refs/heads/master 6965c41c1 -> 044e46df5 ACCUMULO-3889 Make ScanIdIT a bit more reliable for TNFE Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/b754d121 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/b754d121 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/b754d121 Branch: refs/heads/1.6 Commit: b754d12125331ee20fe9cdc65f4712706e93ac98 Parents: 9a4dd30 Author: Josh Elser Authored: Wed Jun 3 23:52:03 2015 -0400 Committer: Josh Elser Committed: Wed Jun 3 23:52:03 2015 -0400 -- .../apache/accumulo/test/functional/ScanIdIT.java | 18 +- 1 file changed, 17 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/accumulo/blob/b754d121/test/src/test/java/org/apache/accumulo/test/functional/ScanIdIT.java -- diff --git a/test/src/test/java/org/apache/accumulo/test/functional/ScanIdIT.java b/test/src/test/java/org/apache/accumulo/test/functional/ScanIdIT.java index de4a47e..726ab8b 100644 --- a/test/src/test/java/org/apache/accumulo/test/functional/ScanIdIT.java +++ b/test/src/test/java/org/apache/accumulo/test/functional/ScanIdIT.java @@ -17,6 +17,7 @@ package org.apache.accumulo.test.functional; import static com.google.common.base.Charsets.UTF_8; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -140,7 +141,22 @@ public class ScanIdIT extends AccumuloClusterIT { for (String tserver : tservers) { - List activeScans = conn.instanceOperations().getActiveScans(tserver); + List activeScans = null; + for (int i = 0; i < 10; i++) { +try { + activeScans = conn.instanceOperations().getActiveScans(tserver); + break; +} catch (AccumuloException e) { + if (e.getCause() instanceof TableNotFoundException) { +log.debug("Got TableNotFoundException, will retry"); +Thread.sleep(200); +continue; + } + throw e; +} + } + + assertNotNull("Repeatedly got exception trying to active scans", activeScans); log.debug("TServer {} has {} active scans", tserver, activeScans.size());
[5/5] accumulo git commit: Merge branch '1.7'
Merge branch '1.7' Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/6965c41c Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/6965c41c Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/6965c41c Branch: refs/heads/master Commit: 6965c41c12b9a51e4d5d08ee022975dc8cf28958 Parents: e6e85cf c5aa060 Author: Josh Elser Authored: Wed Jun 3 21:00:12 2015 -0400 Committer: Josh Elser Committed: Wed Jun 3 21:00:12 2015 -0400 -- .../apache/accumulo/core/conf/PropertyType.java | 2 +- .../accumulo/core/conf/PropertyTypeTest.java| 15 .../accumulo/server/master/LiveTServerSet.java | 27 +- .../org/apache/accumulo/server/util/Admin.java | 45 +- .../server/master/LiveTServerSetTest.java | 52 +++ .../apache/accumulo/server/util/AdminTest.java | 94 .../master/MasterClientServiceHandler.java | 5 ++ .../master/tserverOps/ShutdownTServer.java | 2 +- 8 files changed, 235 insertions(+), 7 deletions(-) -- http://git-wip-us.apache.org/repos/asf/accumulo/blob/6965c41c/server/master/src/main/java/org/apache/accumulo/master/MasterClientServiceHandler.java --
[2/5] accumulo git commit: ACCUMULO-3886 Allow True and False as valid boolean values
ACCUMULO-3886 Allow True and False as valid boolean values Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/d764d272 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/d764d272 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/d764d272 Branch: refs/heads/1.7 Commit: d764d2724379f0304b501af84615d89e3ff77008 Parents: c475af0 Author: Josh Elser Authored: Wed Jun 3 17:24:16 2015 -0400 Committer: Josh Elser Committed: Wed Jun 3 21:00:06 2015 -0400 -- .../org/apache/accumulo/core/conf/PropertyType.java | 2 +- .../apache/accumulo/core/conf/PropertyTypeTest.java | 15 +++ 2 files changed, 16 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/accumulo/blob/d764d272/core/src/main/java/org/apache/accumulo/core/conf/PropertyType.java -- diff --git a/core/src/main/java/org/apache/accumulo/core/conf/PropertyType.java b/core/src/main/java/org/apache/accumulo/core/conf/PropertyType.java index a100513..3814b6f 100644 --- a/core/src/main/java/org/apache/accumulo/core/conf/PropertyType.java +++ b/core/src/main/java/org/apache/accumulo/core/conf/PropertyType.java @@ -74,7 +74,7 @@ public enum PropertyType { STRING("string", ".*", "An arbitrary string of characters whose format is unspecified and interpreted based on the context of the property to which it applies."), BOOLEAN( - "boolean", "(?:true|false)", "Has a value of either 'true' or 'false'"), URI("uri", ".*", "A valid URI"); + "boolean", "(?:True|true|False|false)", "Has a value of either 'true' or 'false'"), URI("uri", ".*", "A valid URI"); private String shortname, format; private Pattern regex; http://git-wip-us.apache.org/repos/asf/accumulo/blob/d764d272/core/src/test/java/org/apache/accumulo/core/conf/PropertyTypeTest.java -- diff --git a/core/src/test/java/org/apache/accumulo/core/conf/PropertyTypeTest.java b/core/src/test/java/org/apache/accumulo/core/conf/PropertyTypeTest.java index b70806d..73174c2 100644 --- a/core/src/test/java/org/apache/accumulo/core/conf/PropertyTypeTest.java +++ b/core/src/test/java/org/apache/accumulo/core/conf/PropertyTypeTest.java @@ -20,6 +20,9 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import java.util.Arrays; +import java.util.List; + import org.junit.Test; public class PropertyTypeTest { @@ -70,4 +73,16 @@ public class PropertyTypeTest { // assertTrue(PropertyType.PREFIX.isValidFormat("whatever")); currently forbidden assertTrue(PropertyType.PREFIX.isValidFormat(null)); } + + @Test + public void testBooleans() { +List goodValues = Arrays.asList("True", "true", "False", "false"); +for (String value : goodValues) { + assertTrue(value + " should be a valid boolean format", PropertyType.BOOLEAN.isValidFormat(value)); +} +List badValues = Arrays.asList("foobar", "tRUE", "fAlSe"); +for (String value : badValues) { + assertFalse(value + " should not be a valid boolean format", PropertyType.BOOLEAN.isValidFormat(value)); +} + } }
[4/5] accumulo git commit: ACCUMULO-3886 Allow True and False as valid boolean values
ACCUMULO-3886 Allow True and False as valid boolean values Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/d764d272 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/d764d272 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/d764d272 Branch: refs/heads/master Commit: d764d2724379f0304b501af84615d89e3ff77008 Parents: c475af0 Author: Josh Elser Authored: Wed Jun 3 17:24:16 2015 -0400 Committer: Josh Elser Committed: Wed Jun 3 21:00:06 2015 -0400 -- .../org/apache/accumulo/core/conf/PropertyType.java | 2 +- .../apache/accumulo/core/conf/PropertyTypeTest.java | 15 +++ 2 files changed, 16 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/accumulo/blob/d764d272/core/src/main/java/org/apache/accumulo/core/conf/PropertyType.java -- diff --git a/core/src/main/java/org/apache/accumulo/core/conf/PropertyType.java b/core/src/main/java/org/apache/accumulo/core/conf/PropertyType.java index a100513..3814b6f 100644 --- a/core/src/main/java/org/apache/accumulo/core/conf/PropertyType.java +++ b/core/src/main/java/org/apache/accumulo/core/conf/PropertyType.java @@ -74,7 +74,7 @@ public enum PropertyType { STRING("string", ".*", "An arbitrary string of characters whose format is unspecified and interpreted based on the context of the property to which it applies."), BOOLEAN( - "boolean", "(?:true|false)", "Has a value of either 'true' or 'false'"), URI("uri", ".*", "A valid URI"); + "boolean", "(?:True|true|False|false)", "Has a value of either 'true' or 'false'"), URI("uri", ".*", "A valid URI"); private String shortname, format; private Pattern regex; http://git-wip-us.apache.org/repos/asf/accumulo/blob/d764d272/core/src/test/java/org/apache/accumulo/core/conf/PropertyTypeTest.java -- diff --git a/core/src/test/java/org/apache/accumulo/core/conf/PropertyTypeTest.java b/core/src/test/java/org/apache/accumulo/core/conf/PropertyTypeTest.java index b70806d..73174c2 100644 --- a/core/src/test/java/org/apache/accumulo/core/conf/PropertyTypeTest.java +++ b/core/src/test/java/org/apache/accumulo/core/conf/PropertyTypeTest.java @@ -20,6 +20,9 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import java.util.Arrays; +import java.util.List; + import org.junit.Test; public class PropertyTypeTest { @@ -70,4 +73,16 @@ public class PropertyTypeTest { // assertTrue(PropertyType.PREFIX.isValidFormat("whatever")); currently forbidden assertTrue(PropertyType.PREFIX.isValidFormat(null)); } + + @Test + public void testBooleans() { +List goodValues = Arrays.asList("True", "true", "False", "false"); +for (String value : goodValues) { + assertTrue(value + " should be a valid boolean format", PropertyType.BOOLEAN.isValidFormat(value)); +} +List badValues = Arrays.asList("foobar", "tRUE", "fAlSe"); +for (String value : badValues) { + assertFalse(value + " should not be a valid boolean format", PropertyType.BOOLEAN.isValidFormat(value)); +} + } }
[3/5] accumulo git commit: ACCUMULO-3887 Support optional sessionId in tserver stop.
ACCUMULO-3887 Support optional sessionId in tserver stop. Also added more debuggin inside the master around the FATE shutdownTServer op. New unit tests as well. Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/c5aa060e Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/c5aa060e Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/c5aa060e Branch: refs/heads/master Commit: c5aa060ee90fe5fa1fe9923973394d4b204f7f62 Parents: d764d27 Author: Josh Elser Authored: Wed Jun 3 20:08:46 2015 -0400 Committer: Josh Elser Committed: Wed Jun 3 21:00:06 2015 -0400 -- .../accumulo/server/master/LiveTServerSet.java | 27 +- .../org/apache/accumulo/server/util/Admin.java | 45 +- .../server/master/LiveTServerSetTest.java | 52 +++ .../apache/accumulo/server/util/AdminTest.java | 94 .../master/MasterClientServiceHandler.java | 5 ++ .../master/tserverOps/ShutdownTServer.java | 2 +- 6 files changed, 219 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/accumulo/blob/c5aa060e/server/base/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java -- diff --git a/server/base/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java b/server/base/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java index 0ea6b41..0c0cceb 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java +++ b/server/base/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java @@ -367,10 +367,29 @@ public class LiveTServerSet implements Watcher { } public synchronized TServerInstance find(String tabletServer) { -HostAndPort addr = AddressUtil.parseAddress(tabletServer, false); -for (Entry entry : current.entrySet()) { - if (entry.getValue().instance.getLocation().equals(addr)) -return entry.getValue().instance; +return find(current, tabletServer); + } + + TServerInstance find(Map servers, String tabletServer) { +HostAndPort addr; +String sessionId = null; +if (']' == tabletServer.charAt(tabletServer.length() - 1)) { + int index = tabletServer.indexOf('['); + if (-1 == index) { +throw new IllegalArgumentException("Could not parse tabletserver '" + tabletServer + "'"); + } + addr = AddressUtil.parseAddress(tabletServer.substring(0, index), false); + // Strip off the last bracket + sessionId = tabletServer.substring(index + 1, tabletServer.length() - 1); +} else { + addr = AddressUtil.parseAddress(tabletServer, false); +} +for (Entry entry : servers.entrySet()) { + if (entry.getValue().instance.getLocation().equals(addr)) { +// Return the instance if we have no desired session ID, or we match the desired session ID +if (null == sessionId || sessionId.equals(entry.getValue().instance.getSession())) + return entry.getValue().instance; + } } return null; } http://git-wip-us.apache.org/repos/asf/accumulo/blob/c5aa060e/server/base/src/main/java/org/apache/accumulo/server/util/Admin.java -- diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/Admin.java b/server/base/src/main/java/org/apache/accumulo/server/util/Admin.java index bdbc7f0..c7f9739 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/util/Admin.java +++ b/server/base/src/main/java/org/apache/accumulo/server/util/Admin.java @@ -31,6 +31,7 @@ import java.util.SortedSet; import java.util.TreeMap; import java.util.concurrent.atomic.AtomicInteger; +import org.apache.accumulo.core.Constants; import org.apache.accumulo.core.client.AccumuloException; import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.Connector; @@ -54,12 +55,17 @@ import org.apache.accumulo.core.security.SystemPermission; import org.apache.accumulo.core.security.TablePermission; import org.apache.accumulo.core.trace.Tracer; import org.apache.accumulo.core.util.AddressUtil; +import org.apache.accumulo.core.zookeeper.ZooUtil; +import org.apache.accumulo.fate.zookeeper.ZooCache; +import org.apache.accumulo.fate.zookeeper.ZooCacheFactory; +import org.apache.accumulo.fate.zookeeper.ZooLock; import org.apache.accumulo.server.AccumuloServerContext; import org.apache.accumulo.server.cli.ClientOpts; import org.apache.accumulo.server.conf.ServerConfigurationFactory; import org.apache.accumulo.server.security.SecurityUtil; import org.apache.accumulo.start.spi.KeywordExecutable; import org.apache.hadoop.conf.Configuration; +import org.apache.zookeeper.KeeperException;
[1/5] accumulo git commit: ACCUMULO-3887 Support optional sessionId in tserver stop.
Repository: accumulo Updated Branches: refs/heads/1.7 c475af0f9 -> c5aa060ee refs/heads/master e6e85cfa1 -> 6965c41c1 ACCUMULO-3887 Support optional sessionId in tserver stop. Also added more debuggin inside the master around the FATE shutdownTServer op. New unit tests as well. Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/c5aa060e Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/c5aa060e Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/c5aa060e Branch: refs/heads/1.7 Commit: c5aa060ee90fe5fa1fe9923973394d4b204f7f62 Parents: d764d27 Author: Josh Elser Authored: Wed Jun 3 20:08:46 2015 -0400 Committer: Josh Elser Committed: Wed Jun 3 21:00:06 2015 -0400 -- .../accumulo/server/master/LiveTServerSet.java | 27 +- .../org/apache/accumulo/server/util/Admin.java | 45 +- .../server/master/LiveTServerSetTest.java | 52 +++ .../apache/accumulo/server/util/AdminTest.java | 94 .../master/MasterClientServiceHandler.java | 5 ++ .../master/tserverOps/ShutdownTServer.java | 2 +- 6 files changed, 219 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/accumulo/blob/c5aa060e/server/base/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java -- diff --git a/server/base/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java b/server/base/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java index 0ea6b41..0c0cceb 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java +++ b/server/base/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java @@ -367,10 +367,29 @@ public class LiveTServerSet implements Watcher { } public synchronized TServerInstance find(String tabletServer) { -HostAndPort addr = AddressUtil.parseAddress(tabletServer, false); -for (Entry entry : current.entrySet()) { - if (entry.getValue().instance.getLocation().equals(addr)) -return entry.getValue().instance; +return find(current, tabletServer); + } + + TServerInstance find(Map servers, String tabletServer) { +HostAndPort addr; +String sessionId = null; +if (']' == tabletServer.charAt(tabletServer.length() - 1)) { + int index = tabletServer.indexOf('['); + if (-1 == index) { +throw new IllegalArgumentException("Could not parse tabletserver '" + tabletServer + "'"); + } + addr = AddressUtil.parseAddress(tabletServer.substring(0, index), false); + // Strip off the last bracket + sessionId = tabletServer.substring(index + 1, tabletServer.length() - 1); +} else { + addr = AddressUtil.parseAddress(tabletServer, false); +} +for (Entry entry : servers.entrySet()) { + if (entry.getValue().instance.getLocation().equals(addr)) { +// Return the instance if we have no desired session ID, or we match the desired session ID +if (null == sessionId || sessionId.equals(entry.getValue().instance.getSession())) + return entry.getValue().instance; + } } return null; } http://git-wip-us.apache.org/repos/asf/accumulo/blob/c5aa060e/server/base/src/main/java/org/apache/accumulo/server/util/Admin.java -- diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/Admin.java b/server/base/src/main/java/org/apache/accumulo/server/util/Admin.java index bdbc7f0..c7f9739 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/util/Admin.java +++ b/server/base/src/main/java/org/apache/accumulo/server/util/Admin.java @@ -31,6 +31,7 @@ import java.util.SortedSet; import java.util.TreeMap; import java.util.concurrent.atomic.AtomicInteger; +import org.apache.accumulo.core.Constants; import org.apache.accumulo.core.client.AccumuloException; import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.Connector; @@ -54,12 +55,17 @@ import org.apache.accumulo.core.security.SystemPermission; import org.apache.accumulo.core.security.TablePermission; import org.apache.accumulo.core.trace.Tracer; import org.apache.accumulo.core.util.AddressUtil; +import org.apache.accumulo.core.zookeeper.ZooUtil; +import org.apache.accumulo.fate.zookeeper.ZooCache; +import org.apache.accumulo.fate.zookeeper.ZooCacheFactory; +import org.apache.accumulo.fate.zookeeper.ZooLock; import org.apache.accumulo.server.AccumuloServerContext; import org.apache.accumulo.server.cli.ClientOpts; import org.apache.accumulo.server.conf.ServerConfigurationFactory; import org.apache.accumulo.server.security.SecurityUtil; import org.apache.accumulo.s