[GitHub] [incubator-druid] ccaominh commented on a change in pull request #9021: Allow startup scripts to specify java home

2019-12-12 Thread GitBox
ccaominh commented on a change in pull request #9021: Allow startup scripts to 
specify java home
URL: https://github.com/apache/incubator-druid/pull/9021#discussion_r357445331
 
 

 ##
 File path: docs/tutorials/cluster.md
 ##
 @@ -135,6 +135,8 @@ We recommend running your favorite Linux distribution. You 
will also need:
   * **Java 8**
 
 > **Warning:** Java 8 is required to run Druid. While Druid will start with a 
 > higher version of Java it will not function correctly.
+>
+> If needed, you can specify where to find Java using the environment 
variables DRUID_JAVA_HOME or JAVA_HOME. For more details run the verify-java 
script 
 
 Review comment:
   Missing a period at the end


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org
For additional commands, e-mail: commits-h...@druid.apache.org



[GitHub] [incubator-druid] ccaominh commented on a change in pull request #9021: Allow startup scripts to specify java home

2019-12-12 Thread GitBox
ccaominh commented on a change in pull request #9021: Allow startup scripts to 
specify java home
URL: https://github.com/apache/incubator-druid/pull/9021#discussion_r357445420
 
 

 ##
 File path: docs/tutorials/index.md
 ##
 @@ -39,6 +39,8 @@ You will need:
 * Linux, Mac OS X, or other Unix-like OS (Windows is not supported)
 
 > **Warning:** Java 8 is required to run Druid. While Druid will start with a 
 > higher version of Java it will not function correctly.
+>
+> If needed, you can specify where to find Java using the environment 
variables DRUID_JAVA_HOME or JAVA_HOME. For more details run the verify-java 
script 
 
 Review comment:
   Missing period at end


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org
For additional commands, e-mail: commits-h...@druid.apache.org



[GitHub] [incubator-druid] ccaominh commented on a change in pull request #9021: Allow startup scripts to specify java home

2019-12-12 Thread GitBox
ccaominh commented on a change in pull request #9021: Allow startup scripts to 
specify java home
URL: https://github.com/apache/incubator-druid/pull/9021#discussion_r357446069
 
 

 ##
 File path: examples/bin/run-zk
 ##
 @@ -19,7 +19,7 @@
 
 if [ "$#" -gt 1 ]
 then
-  echo "usage: $0 [conf-dir]" >&2
+  >&2 echo "usage: $0 [conf-dir]" >&2
 
 Review comment:
   Looks like this line was already redirecting to stderr before


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org
For additional commands, e-mail: commits-h...@druid.apache.org



[GitHub] [incubator-druid] ccaominh commented on a change in pull request #9021: Allow startup scripts to specify java home

2019-12-12 Thread GitBox
ccaominh commented on a change in pull request #9021: Allow startup scripts to 
specify java home
URL: https://github.com/apache/incubator-druid/pull/9021#discussion_r357445951
 
 

 ##
 File path: examples/bin/run-druid
 ##
 @@ -17,9 +17,9 @@
 # specific language governing permissions and limitations
 # under the License.
 
-if [ "$#" -gt 2 ] || [ "$#" == 0 ]
+if [ "$#" -gt 2 ] || [ "$#" -eq 0 ]
 then
-  echo "usage: $0  [conf-dir]" >&2
+  >&2 echo "usage: $0  [conf-dir]" >&2
 
 Review comment:
   Looks like this line was already redirecting to stderr before


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org
For additional commands, e-mail: commits-h...@druid.apache.org



[GitHub] [incubator-druid] ccaominh commented on a change in pull request #9021: Allow startup scripts to specify java home

2019-12-12 Thread GitBox
ccaominh commented on a change in pull request #9021: Allow startup scripts to 
specify java home
URL: https://github.com/apache/incubator-druid/pull/9021#discussion_r357403722
 
 

 ##
 File path: examples/bin/verify-java
 ##
 @@ -44,7 +45,18 @@ if ($skip_var && $skip_var ne "0" && $skip_var ne "false" 
&& $skip_var ne "f") {
   exit 0;
 }
 
-my $java_version = qx[java -version 2>&1];
+my $cwd =  dirname(__FILE__);
+my $java_bin = `source $cwd/java-util && get_java_bin 2>&1`;
+# Strip trailing whitespace. Executing get_java_bin appears to append a
+# new line character at the end
 
 Review comment:
   In `get_java_bin`, you can use the "-n" option so that `echo` doesn't append 
a newline


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org
For additional commands, e-mail: commits-h...@druid.apache.org



[GitHub] [incubator-druid] ccaominh commented on a change in pull request #9021: Allow startup scripts to specify java home

2019-12-12 Thread GitBox
ccaominh commented on a change in pull request #9021: Allow startup scripts to 
specify java home
URL: https://github.com/apache/incubator-druid/pull/9021#discussion_r357406603
 
 

 ##
 File path: examples/bin/java-util
 ##
 @@ -0,0 +1,39 @@
+#!/bin/bash
+# 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.
+
+###
+# A utility script to search for java. The order in which we look for java
+# goes from most specific to least specific, i.e.
+# ${DRUID_JAVA_HOME}
+# ${JAVA_HOME}
+# ${PATH}
+# Arguments:
+#   None
+# Returns:
+#   The bin folder of java if it exists, otherwise an empty string
+###
+get_java_bin() {
+if [ ! -z "${DRUID_JAVA_HOME-}" ]; then
+  echo "$DRUID_JAVA_HOME/bin"
+elif [ ! -z "${JAVA_HOME-}" ]; then
+  echo "$JAVA_HOME/bin"
+elif [ ! -z `which java` ]; then
+  # Strip /java from the location of where java is installed
+  echo "${test_var%/java}"
 
 Review comment:
   Where is `test_var` initialized? Do you want to make it a local variable?


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org
For additional commands, e-mail: commits-h...@druid.apache.org



[GitHub] [incubator-druid] ccaominh commented on a change in pull request #9021: Allow startup scripts to specify java home

2019-12-12 Thread GitBox
ccaominh commented on a change in pull request #9021: Allow startup scripts to 
specify java home
URL: https://github.com/apache/incubator-druid/pull/9021#discussion_r357408691
 
 

 ##
 File path: examples/bin/java-util
 ##
 @@ -0,0 +1,39 @@
+#!/bin/bash
 
 Review comment:
   I like that this logic is in one place and reused by the other scripts!


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org
For additional commands, e-mail: commits-h...@druid.apache.org



[GitHub] [incubator-druid] ccaominh commented on a change in pull request #9021: Allow startup scripts to specify java home

2019-12-12 Thread GitBox
ccaominh commented on a change in pull request #9021: Allow startup scripts to 
specify java home
URL: https://github.com/apache/incubator-druid/pull/9021#discussion_r357406938
 
 

 ##
 File path: examples/bin/java-util
 ##
 @@ -0,0 +1,39 @@
+#!/bin/bash
+# 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.
+
+###
+# A utility script to search for java. The order in which we look for java
+# goes from most specific to least specific, i.e.
+# ${DRUID_JAVA_HOME}
+# ${JAVA_HOME}
+# ${PATH}
+# Arguments:
+#   None
+# Returns:
+#   The bin folder of java if it exists, otherwise an empty string
+###
+get_java_bin() {
+if [ ! -z "${DRUID_JAVA_HOME-}" ]; then
+  echo "$DRUID_JAVA_HOME/bin"
+elif [ ! -z "${JAVA_HOME-}" ]; then
+  echo "$JAVA_HOME/bin"
+elif [ ! -z `which java` ]; then
 
 Review comment:
   Consider using "$()" instead of "``", since this is bash and the former is 
more flexible


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org
For additional commands, e-mail: commits-h...@druid.apache.org



[GitHub] [incubator-druid] ccaominh commented on a change in pull request #9021: Allow startup scripts to specify java home

2019-12-12 Thread GitBox
ccaominh commented on a change in pull request #9021: Allow startup scripts to 
specify java home
URL: https://github.com/apache/incubator-druid/pull/9021#discussion_r357413942
 
 

 ##
 File path: examples/bin/run-druid
 ##
 @@ -17,7 +17,7 @@
 # specific language governing permissions and limitations
 # under the License.
 
-if [ "$#" -gt 2 ]
+if [ "$#" -gt 2 ] || [ "$#" == 0 ]
 
 Review comment:
   I think the `==` should be `-eq` since this is a numeric compare and not a 
string compare


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org
For additional commands, e-mail: commits-h...@druid.apache.org



[GitHub] [incubator-druid] ccaominh commented on a change in pull request #9021: Allow startup scripts to specify java home

2019-12-12 Thread GitBox
ccaominh commented on a change in pull request #9021: Allow startup scripts to 
specify java home
URL: https://github.com/apache/incubator-druid/pull/9021#discussion_r357408219
 
 

 ##
 File path: examples/bin/java-util
 ##
 @@ -0,0 +1,39 @@
+#!/bin/bash
+# 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.
+
+###
+# A utility script to search for java. The order in which we look for java
+# goes from most specific to least specific, i.e.
+# ${DRUID_JAVA_HOME}
+# ${JAVA_HOME}
+# ${PATH}
+# Arguments:
+#   None
+# Returns:
+#   The bin folder of java if it exists, otherwise an empty string
+###
+get_java_bin() {
 
 Review comment:
   Consider renaming "bin" to something like "bin_dir". "bin" could be 
interpreted to mean the directory or the binary executable. (similar comment 
for the JAVA_BIN variables).


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org
For additional commands, e-mail: commits-h...@druid.apache.org