You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by el...@apache.org on 2015/05/14 03:06:50 UTC

[1/5] accumulo git commit: ACCUMULO-3814 Include ACCUMULO_CONF_DIR when exec'ing commands

Repository: accumulo
Updated Branches:
  refs/heads/1.7 d81ef2241 -> 25da2e3e9
  refs/heads/master eeca25db8 -> dbea79825


ACCUMULO-3814 Include ACCUMULO_CONF_DIR when exec'ing commands

Makes sure things like SetGoalState will properly run.


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

Branch: refs/heads/1.7
Commit: e622196c8eda64469252683c669b1730ea8efd32
Parents: d81ef22
Author: Josh Elser <el...@apache.org>
Authored: Wed May 13 20:32:18 2015 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Wed May 13 20:32:18 2015 -0400

----------------------------------------------------------------------
 .../cluster/standalone/StandaloneClusterControl.java     | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/e622196c/minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControl.java
----------------------------------------------------------------------
diff --git a/minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControl.java b/minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControl.java
index 89027e7..029cd4c 100644
--- a/minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControl.java
+++ b/minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControl.java
@@ -102,11 +102,13 @@ public class StandaloneClusterControl implements ClusterControl {
   public Entry<Integer,String> execWithStdout(Class<?> clz, String[] args) throws IOException {
     File confDir = getConfDir();
     String master = getHosts(new File(confDir, "masters")).get(0);
-    String[] cmd = new String[2 + args.length];
-    cmd[0] = accumuloPath;
-    cmd[1] = clz.getName();
+    String[] cmd = new String[3 + args.length];
+    // Make sure we always set the right ACCUMULO_CONF_DIR
+    cmd[0] = ACCUMULO_CONF_DIR + confDir;
+    cmd[1] = accumuloPath;
+    cmd[2] = clz.getName();
     // Quote the arguments to prevent shell expansion
-    for (int i = 0, j = 2; i < args.length; i++, j++) {
+    for (int i = 0, j = 3; i < args.length; i++, j++) {
       cmd[j] = "'" + args[i] + "'";
     }
     log.info("Running: '{}' on {}", StringUtils.join(cmd, " "), master);
@@ -141,6 +143,7 @@ public class StandaloneClusterControl implements ClusterControl {
     File confDir = getConfDir();
     String master = getHosts(new File(confDir, "masters")).get(0);
     String[] cmd = new String[] {SUDO_CMD, "-u", user, ACCUMULO_CONF_DIR + accumuloConfDir, accumuloPath, Admin.class.getName(), "stopAll"};
+    // Directly invoke the RemoteShell
     Entry<Integer,String> pair = exec(master, cmd);
     if (0 != pair.getKey().intValue()) {
       throw new IOException("stopAll did not finish successfully, retcode=" + pair.getKey() + ", stdout=" + pair.getValue());


[4/5] accumulo git commit: ACCUMULO-3815 Don't call getCanonicalPath on on accumulo home and confdir.

Posted by el...@apache.org.
ACCUMULO-3815 Don't call getCanonicalPath on on accumulo home and confdir.

If we alter the passed-in paths, we might not grep the right thing.


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

Branch: refs/heads/1.7
Commit: 25da2e3e960f2c2e983a1380d6d614824adca088
Parents: e622196
Author: Josh Elser <el...@apache.org>
Authored: Wed May 13 20:54:08 2015 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Wed May 13 21:06:26 2015 -0400

----------------------------------------------------------------------
 .../standalone/StandaloneClusterControl.java    |  8 ++---
 .../StandaloneClusterControlTest.java           | 38 ++++++++++++++++++++
 2 files changed, 40 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/25da2e3e/minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControl.java
----------------------------------------------------------------------
diff --git a/minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControl.java b/minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControl.java
index 029cd4c..c652b0b 100644
--- a/minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControl.java
+++ b/minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControl.java
@@ -64,12 +64,8 @@ public class StandaloneClusterControl implements ClusterControl {
   public StandaloneClusterControl(String user, String accumuloHome, String accumuloConfDir) {
     this.user = user;
     this.options = new RemoteShellOptions();
-    try {
-      this.accumuloHome = new File(accumuloHome).getCanonicalPath();
-      this.accumuloConfDir = new File(accumuloConfDir).getCanonicalPath();
-    } catch (IOException e) {
-      throw new RuntimeException("Failed to compute canonical path", e);
-    }
+    this.accumuloHome = accumuloHome;
+    this.accumuloConfDir = accumuloConfDir;
 
     File bin = new File(accumuloHome, "bin");
     this.startServerPath = new File(bin, START_SERVER_SCRIPT).getAbsolutePath();

http://git-wip-us.apache.org/repos/asf/accumulo/blob/25da2e3e/minicluster/src/test/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControlTest.java
----------------------------------------------------------------------
diff --git a/minicluster/src/test/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControlTest.java b/minicluster/src/test/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControlTest.java
new file mode 100644
index 0000000..b68a6e6
--- /dev/null
+++ b/minicluster/src/test/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControlTest.java
@@ -0,0 +1,38 @@
+/*
+ * 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.cluster.standalone;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class StandaloneClusterControlTest {
+
+  @Test
+  public void testPaths() {
+    String accumuloHome = "/usr/lib/accumulo", accumuloConfDir = "/etc/accumulo/conf";
+
+    StandaloneClusterControl control = new StandaloneClusterControl("accumulo", accumuloHome, accumuloConfDir);
+
+    assertEquals(accumuloHome, control.accumuloHome);
+    assertEquals(accumuloConfDir, control.accumuloConfDir);
+
+    assertEquals(accumuloHome + "/bin/accumulo", control.accumuloPath);
+    assertEquals(accumuloHome + "/bin/start-server.sh", control.startServerPath);
+  }
+
+}


[5/5] accumulo git commit: Merge branch '1.7'

Posted by el...@apache.org.
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/dbea7982
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/dbea7982
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/dbea7982

Branch: refs/heads/master
Commit: dbea79825eb5b8882178cfaa09855b5704e890c4
Parents: eeca25d 25da2e3
Author: Josh Elser <el...@apache.org>
Authored: Wed May 13 21:06:34 2015 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Wed May 13 21:06:34 2015 -0400

----------------------------------------------------------------------
 .../standalone/StandaloneClusterControl.java    | 19 +++++-----
 .../StandaloneClusterControlTest.java           | 38 ++++++++++++++++++++
 2 files changed, 47 insertions(+), 10 deletions(-)
----------------------------------------------------------------------



[3/5] accumulo git commit: ACCUMULO-3815 Don't call getCanonicalPath on on accumulo home and confdir.

Posted by el...@apache.org.
ACCUMULO-3815 Don't call getCanonicalPath on on accumulo home and confdir.

If we alter the passed-in paths, we might not grep the right thing.


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

Branch: refs/heads/master
Commit: 25da2e3e960f2c2e983a1380d6d614824adca088
Parents: e622196
Author: Josh Elser <el...@apache.org>
Authored: Wed May 13 20:54:08 2015 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Wed May 13 21:06:26 2015 -0400

----------------------------------------------------------------------
 .../standalone/StandaloneClusterControl.java    |  8 ++---
 .../StandaloneClusterControlTest.java           | 38 ++++++++++++++++++++
 2 files changed, 40 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/25da2e3e/minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControl.java
----------------------------------------------------------------------
diff --git a/minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControl.java b/minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControl.java
index 029cd4c..c652b0b 100644
--- a/minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControl.java
+++ b/minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControl.java
@@ -64,12 +64,8 @@ public class StandaloneClusterControl implements ClusterControl {
   public StandaloneClusterControl(String user, String accumuloHome, String accumuloConfDir) {
     this.user = user;
     this.options = new RemoteShellOptions();
-    try {
-      this.accumuloHome = new File(accumuloHome).getCanonicalPath();
-      this.accumuloConfDir = new File(accumuloConfDir).getCanonicalPath();
-    } catch (IOException e) {
-      throw new RuntimeException("Failed to compute canonical path", e);
-    }
+    this.accumuloHome = accumuloHome;
+    this.accumuloConfDir = accumuloConfDir;
 
     File bin = new File(accumuloHome, "bin");
     this.startServerPath = new File(bin, START_SERVER_SCRIPT).getAbsolutePath();

http://git-wip-us.apache.org/repos/asf/accumulo/blob/25da2e3e/minicluster/src/test/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControlTest.java
----------------------------------------------------------------------
diff --git a/minicluster/src/test/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControlTest.java b/minicluster/src/test/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControlTest.java
new file mode 100644
index 0000000..b68a6e6
--- /dev/null
+++ b/minicluster/src/test/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControlTest.java
@@ -0,0 +1,38 @@
+/*
+ * 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.cluster.standalone;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class StandaloneClusterControlTest {
+
+  @Test
+  public void testPaths() {
+    String accumuloHome = "/usr/lib/accumulo", accumuloConfDir = "/etc/accumulo/conf";
+
+    StandaloneClusterControl control = new StandaloneClusterControl("accumulo", accumuloHome, accumuloConfDir);
+
+    assertEquals(accumuloHome, control.accumuloHome);
+    assertEquals(accumuloConfDir, control.accumuloConfDir);
+
+    assertEquals(accumuloHome + "/bin/accumulo", control.accumuloPath);
+    assertEquals(accumuloHome + "/bin/start-server.sh", control.startServerPath);
+  }
+
+}


[2/5] accumulo git commit: ACCUMULO-3814 Include ACCUMULO_CONF_DIR when exec'ing commands

Posted by el...@apache.org.
ACCUMULO-3814 Include ACCUMULO_CONF_DIR when exec'ing commands

Makes sure things like SetGoalState will properly run.


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

Branch: refs/heads/master
Commit: e622196c8eda64469252683c669b1730ea8efd32
Parents: d81ef22
Author: Josh Elser <el...@apache.org>
Authored: Wed May 13 20:32:18 2015 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Wed May 13 20:32:18 2015 -0400

----------------------------------------------------------------------
 .../cluster/standalone/StandaloneClusterControl.java     | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/e622196c/minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControl.java
----------------------------------------------------------------------
diff --git a/minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControl.java b/minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControl.java
index 89027e7..029cd4c 100644
--- a/minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControl.java
+++ b/minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControl.java
@@ -102,11 +102,13 @@ public class StandaloneClusterControl implements ClusterControl {
   public Entry<Integer,String> execWithStdout(Class<?> clz, String[] args) throws IOException {
     File confDir = getConfDir();
     String master = getHosts(new File(confDir, "masters")).get(0);
-    String[] cmd = new String[2 + args.length];
-    cmd[0] = accumuloPath;
-    cmd[1] = clz.getName();
+    String[] cmd = new String[3 + args.length];
+    // Make sure we always set the right ACCUMULO_CONF_DIR
+    cmd[0] = ACCUMULO_CONF_DIR + confDir;
+    cmd[1] = accumuloPath;
+    cmd[2] = clz.getName();
     // Quote the arguments to prevent shell expansion
-    for (int i = 0, j = 2; i < args.length; i++, j++) {
+    for (int i = 0, j = 3; i < args.length; i++, j++) {
       cmd[j] = "'" + args[i] + "'";
     }
     log.info("Running: '{}' on {}", StringUtils.join(cmd, " "), master);
@@ -141,6 +143,7 @@ public class StandaloneClusterControl implements ClusterControl {
     File confDir = getConfDir();
     String master = getHosts(new File(confDir, "masters")).get(0);
     String[] cmd = new String[] {SUDO_CMD, "-u", user, ACCUMULO_CONF_DIR + accumuloConfDir, accumuloPath, Admin.class.getName(), "stopAll"};
+    // Directly invoke the RemoteShell
     Entry<Integer,String> pair = exec(master, cmd);
     if (0 != pair.getKey().intValue()) {
       throw new IOException("stopAll did not finish successfully, retcode=" + pair.getKey() + ", stdout=" + pair.getValue());