Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 04581200B5A for ; Thu, 21 Jul 2016 06:57:33 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 031EA160A86; Thu, 21 Jul 2016 04:57:33 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 49E8A160A64 for ; Thu, 21 Jul 2016 06:57:32 +0200 (CEST) Received: (qmail 28554 invoked by uid 500); 21 Jul 2016 04:57:31 -0000 Mailing-List: contact dev-help@drill.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@drill.apache.org Delivered-To: mailing list dev@drill.apache.org Received: (qmail 28542 invoked by uid 99); 21 Jul 2016 04:57:30 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 Jul 2016 04:57:30 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 88299E04BA; Thu, 21 Jul 2016 04:57:30 +0000 (UTC) From: paul-rogers To: dev@drill.apache.org Reply-To: dev@drill.apache.org References: In-Reply-To: Subject: [GitHub] drill pull request #547: Drill-4581: Extensive revisions to the Drill launch... Content-Type: text/plain Message-Id: <20160721045730.88299E04BA@git1-us-west.apache.org> Date: Thu, 21 Jul 2016 04:57:30 +0000 (UTC) archived-at: Thu, 21 Jul 2016 04:57:33 -0000 Github user paul-rogers commented on a diff in the pull request: https://github.com/apache/drill/pull/547#discussion_r71647038 --- Diff: distribution/src/resources/drill-config.sh --- @@ -50,94 +70,252 @@ home=`cd "$bin/..">/dev/null; pwd` this="$home/bin/$script" # the root of the drill installation -if [ -z "$DRILL_HOME" ]; then - DRILL_HOME="$home" -fi +DRILL_HOME=${DRILL_HOME:-$home} -#check to see if the conf dir or drill home are given as an optional arguments -while [ $# -gt 1 ]; do - if [ "--config" = "$1" ]; then +# Standardize error messages + +fatal_error() { + echo "ERROR: $@" 1>&2 + exit 1 +} + +# Check to see if the conf dir or drill home are given as an optional arguments +# Arguments may appear anywhere on the command line. --site is an alias, better +# specifies that the location contains all site-specific files, not just config. +# +# Remaining arguments go into the args array - use that instead of $@. + +args=() +while [[ $# > 0 ]] +do + arg="$1" + case "$arg" in + --site|--config) shift - confdir=$1 + DRILL_CONF_DIR=$1 shift - DRILL_CONF_DIR=$confdir - else - # Presume we are at end of options and break - break - fi + ;; + *) + args+=("$1") + shift + ;; + esac done +export args + +# If config dir is given, it must exist. + +if [ -n "$DRILL_CONF_DIR" ]; then + if [[ ! -d "$DRILL_CONF_DIR" ]]; then + fatal_error "Config dir does not exist:" $DRILL_CONF_DIR + fi +else -# Allow alternate drill conf dir location. -DRILL_CONF_DIR="${DRILL_CONF_DIR:-/etc/drill/conf}" + # Allow alternate drill conf dir location. + DRILL_CONF_DIR="/etc/drill/conf" -if [ ! -d $DRILL_CONF_DIR ]; then - DRILL_CONF_DIR=$DRILL_HOME/conf + # Otherwise, use the default + if [[ ! -d "$DRILL_CONF_DIR" ]]; then + DRILL_CONF_DIR="$DRILL_HOME/conf" + fi +fi + +# However we got the config dir, it must contain a config +# file, and that file must be readable. +# Most files are optional, so check the one that is required: +# drill-override.conf. + +testFile="$DRILL_CONF_DIR/drill-override.conf" +if [[ ! -a "$testFile" ]]; then + fatal_error "Drill config file missing: $testFile -- Wrong config dir?" +fi +if [[ ! -r "$testFile" ]]; then + fatal_error "Drill config file not readable: $testFile - Wrong user?" +fi + +# Set Drill-provided defaults here. Do not put Drill defaults +# in the distribution or user environment config files. + +# The SQLline client does not need the code cache. + +export SQLLINE_JAVA_OPTS=${SQLLINE_JAVA_OPTS:-"-XX:MaxPermSize=512M"} + +# Class unloading is disabled by default in Java 7 +# http://hg.openjdk.java.net/jdk7u/jdk7u60/hotspot/file/tip/src/share/vm/runtime/globals.hpp#l1622 +export SERVER_GC_OPTS="$SERVER_GC_OPTS -XX:+CMSClassUnloadingEnabled -XX:+UseG1GC" + +# No GC options by default for SQLLine +export CLIENT_GC_OPTS=${CLIENT_GC_OPTS:-""} + +# Source the optional drill-env.sh for any user configured values. +# We read the file only in the $DRILL_CONF_DIR, which might be a +# site-specific folder. By design, we do not search both the site +# folder and the $DRILL_HOME/conf folder; we look in just the one +# identified by $DRILL_CONF_DIR. +# +# Note: the env files must set properties as follows for "inheritance" +# to work correctly: +# +# export FOO=${FOO:-"value"} + +drillEnv="$DRILL_CONF_DIR/drill-env.sh" +if [ -r "$drillEnv" ]; then --- End diff -- Because memory defaults have moved out of drill-env.sh into drill-config.sh, drill-env.sh is now optional. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastructure@apache.org or file a JIRA ticket with INFRA. ---