Repository: accumulo Updated Branches: refs/heads/1.8 dddd22558 -> cd43958fe
ACCUMULO-4505: Fix for Shell erroneously reading accumulo-site.xml Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/a361f63d Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/a361f63d Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/a361f63d Branch: refs/heads/1.8 Commit: a361f63d62272b161365c400e476b04272c21906 Parents: 32fd100 Author: milleruntime <mmil...@apache.org> Authored: Tue Nov 1 15:17:27 2016 -0400 Committer: Mike Miller <mmil...@apache.org> Committed: Tue Nov 8 14:21:43 2016 -0500 ---------------------------------------------------------------------- .../main/java/org/apache/accumulo/server/init/Initialize.java | 3 ++- shell/src/main/java/org/apache/accumulo/shell/Shell.java | 3 +-- .../main/java/org/apache/accumulo/shell/ShellOptionsJC.java | 7 +++++++ 3 files changed, 10 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/a361f63d/server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java ---------------------------------------------------------------------- diff --git a/server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java b/server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java index 4886f5b..e16572b 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java +++ b/server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java @@ -127,7 +127,7 @@ public class Initialize implements KeywordExecutable { private static final String TABLE_TABLETS_TABLET_DIR = "/table_info"; private static ConsoleReader reader = null; - private static IZooReaderWriter zoo = ZooReaderWriter.getInstance(); + private static IZooReaderWriter zoo = null; private static ConsoleReader getConsoleReader() throws IOException { if (reader == null) @@ -745,6 +745,7 @@ public class Initialize implements KeywordExecutable { opts.parseArgs(Initialize.class.getName(), args); try { + zoo = ZooReaderWriter.getInstance(); AccumuloConfiguration acuConf = SiteConfiguration.getInstance(); SecurityUtil.serverLogin(acuConf); Configuration conf = CachedConfiguration.getInstance(); http://git-wip-us.apache.org/repos/asf/accumulo/blob/a361f63d/shell/src/main/java/org/apache/accumulo/shell/Shell.java ---------------------------------------------------------------------- diff --git a/shell/src/main/java/org/apache/accumulo/shell/Shell.java b/shell/src/main/java/org/apache/accumulo/shell/Shell.java index ce9d60c..776c4f4 100644 --- a/shell/src/main/java/org/apache/accumulo/shell/Shell.java +++ b/shell/src/main/java/org/apache/accumulo/shell/Shell.java @@ -60,7 +60,6 @@ import org.apache.accumulo.core.client.security.tokens.AuthenticationToken; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.conf.Property; -import org.apache.accumulo.core.conf.SiteConfiguration; import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Value; import org.apache.accumulo.core.data.thrift.TConstraintViolationSummary; @@ -492,7 +491,7 @@ public class Shell extends ShellOptions implements KeywordExecutable { if (instanceName == null) { instanceName = clientConfig.get(ClientProperty.INSTANCE_NAME); } - AccumuloConfiguration conf = SiteConfiguration.getInstance(ClientContext.convertClientConfig(clientConfig)); + AccumuloConfiguration conf = ClientContext.convertClientConfig(clientConfig); String keepers = getZooKeepers(keepersOption, clientConfig, conf); if (instanceName == null) { Path instanceDir = new Path(VolumeConfiguration.getVolumeUris(conf)[0], "instance_id"); http://git-wip-us.apache.org/repos/asf/accumulo/blob/a361f63d/shell/src/main/java/org/apache/accumulo/shell/ShellOptionsJC.java ---------------------------------------------------------------------- diff --git a/shell/src/main/java/org/apache/accumulo/shell/ShellOptionsJC.java b/shell/src/main/java/org/apache/accumulo/shell/ShellOptionsJC.java index 20063b8..f6d1ac9 100644 --- a/shell/src/main/java/org/apache/accumulo/shell/ShellOptionsJC.java +++ b/shell/src/main/java/org/apache/accumulo/shell/ShellOptionsJC.java @@ -311,6 +311,13 @@ public class ShellOptionsJC { if (useSasl()) { clientConfig.setProperty(ClientProperty.INSTANCE_RPC_SASL_ENABLED, "true"); } + if (!getZooKeeperInstance().isEmpty()) { + List<String> zkOpts = getZooKeeperInstance(); + String instanceName = zkOpts.get(0); + String hosts = zkOpts.get(1); + clientConfig.setProperty(ClientProperty.INSTANCE_ZK_HOST, hosts); + clientConfig.setProperty(ClientProperty.INSTANCE_NAME, instanceName); + } // Automatically try to add in the proper ZK from accumulo-site for backwards compat. if (!clientConfig.containsKey(ClientProperty.INSTANCE_ZK_HOST.getKey())) {