You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by GitBox <gi...@apache.org> on 2023/01/19 14:24:05 UTC

[GitHub] [cassandra] Claudenw commented on a diff in pull request #1950: WIP: Initial implementation of cassandra-conf with nodetool example - CASSANDRA-17773

Claudenw commented on code in PR #1950:
URL: https://github.com/apache/cassandra/pull/1950#discussion_r1081312367


##########
bin/cassandra-conf.sh:
##########
@@ -0,0 +1,168 @@
+#!/bin/sh -x
+
+# 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 script to include the cassandra.in.sh file, set NUMACTL, and load 
+#          $CASSANDRA_CONF/cassandra-env.sh"
+#
+# Creates a validate_env() function to verify criticla environment vars are set
+# and display them if desired
+
+## Environment variables:
+# ENV_DEBUG: Show all var settings during the validate_env() call.

Review Comment:
   Added CASSANDRA_ before all ENV_ e.g. CASSANDRA_ENV_PRESERVE



##########
bin/cassandra-conf.sh:
##########
@@ -0,0 +1,168 @@
+#!/bin/sh -x
+
+# 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 script to include the cassandra.in.sh file, set NUMACTL, and load 
+#          $CASSANDRA_CONF/cassandra-env.sh"
+#
+# Creates a validate_env() function to verify criticla environment vars are set

Review Comment:
   changed to define and fixed typo.



##########
bin/cassandra-conf.sh:
##########
@@ -0,0 +1,168 @@
+#!/bin/sh -x
+
+# 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 script to include the cassandra.in.sh file, set NUMACTL, and load 
+#          $CASSANDRA_CONF/cassandra-env.sh"
+#
+# Creates a validate_env() function to verify criticla environment vars are set
+# and display them if desired
+
+## Environment variables:
+# ENV_DEBUG: Show all var settings during the validate_env() call.
+# ENV_PRESERVE: A list of environment variables to preserve from being set 
+#       by $CASSANDRA_CONF/cassandra-env.sh"
+# ENV_SHOW: A list of additional environment variables to display during validate_env.
+
+## validate_env
+## Args:  Arguments are additional environment variables to show.
+##
+## Validates that required environment variables are set. 
+## Required Environment Vars:
+##      CASSANDRA_INCLUDE
+##      CASSANDRA_HOME
+##      CASSANDRA_LOG_DIR
+## 
+## Environment Vars:
+##      ENV_DEBUG   Enables display of variables.
+##      ENV_SHOW    List of additional variables to display.
+##
+validate_env() {
+    retval=0
+    if [ -n "$ENV_DEBUG" ] ; then
+        echo ""
+        echo "ENVIRONMENT"
+        echo "-----------"
+        echo "PWD=$PWD"
+        echo "CASSANDRA_CONF=$CASSANDRA_CONF"
+    fi
+    
+    if [ "x$CASSANDRA_INCLUDE" = "x" ]; then
+        echo ">>> cassandra.in.sh not found or CASSANDRA_INCLUDE not set" >&2
+        retval=1
+    else
+        if [ -n "$ENV_DEBUG" ] ; then
+            echo "CASSANDRA_INCLUDE=$CASSANDRA_INCLUDE"
+        fi
+    fi
+    
+    if [ "x$CASSANDRA_HOME" = "x" ]; then
+        echo ">>> CASSANDRA_HOME not set" >&2
+        retval=1
+    else
+        if [ -n "$ENV_DEBUG" ] ; then
+            echo "CASSANDRA_HOME=$CASSANDRA_HOME"
+        fi
+    fi
+
+    if [ "x$CASSANDRA_LOG_DIR" = "x" ]; then
+        echo ">>> CASSANDRA_LOG_DIR not set" >&2
+        retval=1
+    else
+        if [ -n "$ENV_DEBUG" ] ; then
+            echo "CASSANDRA_LOG_DIR=$CASSANDRA_LOG_DIR"
+        fi
+    fi
+
+    if [ -n "$ENV_DEBUG" ] ; then

Review Comment:
   The documentation says if it is set.  Doesn't say anything about value.  I suppose it could be changed.



##########
bin/cassandra-conf.sh:
##########
@@ -0,0 +1,168 @@
+#!/bin/sh -x
+
+# 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 script to include the cassandra.in.sh file, set NUMACTL, and load 
+#          $CASSANDRA_CONF/cassandra-env.sh"
+#
+# Creates a validate_env() function to verify criticla environment vars are set
+# and display them if desired
+
+## Environment variables:
+# ENV_DEBUG: Show all var settings during the validate_env() call.
+# ENV_PRESERVE: A list of environment variables to preserve from being set 
+#       by $CASSANDRA_CONF/cassandra-env.sh"
+# ENV_SHOW: A list of additional environment variables to display during validate_env.
+
+## validate_env
+## Args:  Arguments are additional environment variables to show.
+##
+## Validates that required environment variables are set. 
+## Required Environment Vars:
+##      CASSANDRA_INCLUDE
+##      CASSANDRA_HOME
+##      CASSANDRA_LOG_DIR
+## 
+## Environment Vars:
+##      ENV_DEBUG   Enables display of variables.
+##      ENV_SHOW    List of additional variables to display.

Review Comment:
   added



##########
bin/cassandra-conf.sh:
##########
@@ -0,0 +1,168 @@
+#!/bin/sh -x
+
+# 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 script to include the cassandra.in.sh file, set NUMACTL, and load 
+#          $CASSANDRA_CONF/cassandra-env.sh"
+#
+# Creates a validate_env() function to verify criticla environment vars are set
+# and display them if desired
+
+## Environment variables:
+# ENV_DEBUG: Show all var settings during the validate_env() call.
+# ENV_PRESERVE: A list of environment variables to preserve from being set 
+#       by $CASSANDRA_CONF/cassandra-env.sh"
+# ENV_SHOW: A list of additional environment variables to display during validate_env.
+
+## validate_env
+## Args:  Arguments are additional environment variables to show.
+##
+## Validates that required environment variables are set. 
+## Required Environment Vars:
+##      CASSANDRA_INCLUDE
+##      CASSANDRA_HOME
+##      CASSANDRA_LOG_DIR
+## 
+## Environment Vars:
+##      ENV_DEBUG   Enables display of variables.
+##      ENV_SHOW    List of additional variables to display.
+##
+validate_env() {
+    retval=0
+    if [ -n "$ENV_DEBUG" ] ; then
+        echo ""
+        echo "ENVIRONMENT"
+        echo "-----------"
+        echo "PWD=$PWD"
+        echo "CASSANDRA_CONF=$CASSANDRA_CONF"
+    fi
+    
+    if [ "x$CASSANDRA_INCLUDE" = "x" ]; then
+        echo ">>> cassandra.in.sh not found or CASSANDRA_INCLUDE not set" >&2
+        retval=1
+    else
+        if [ -n "$ENV_DEBUG" ] ; then
+            echo "CASSANDRA_INCLUDE=$CASSANDRA_INCLUDE"
+        fi
+    fi
+    
+    if [ "x$CASSANDRA_HOME" = "x" ]; then
+        echo ">>> CASSANDRA_HOME not set" >&2
+        retval=1
+    else
+        if [ -n "$ENV_DEBUG" ] ; then
+            echo "CASSANDRA_HOME=$CASSANDRA_HOME"
+        fi
+    fi
+
+    if [ "x$CASSANDRA_LOG_DIR" = "x" ]; then
+        echo ">>> CASSANDRA_LOG_DIR not set" >&2
+        retval=1
+    else
+        if [ -n "$ENV_DEBUG" ] ; then
+            echo "CASSANDRA_LOG_DIR=$CASSANDRA_LOG_DIR"
+        fi
+    fi
+
+    if [ -n "$ENV_DEBUG" ] ; then
+        if [ -z $NUMACTL ]; then
+            echo "numactl not found"

Review Comment:
   This is not an error, it is a message that only is displayed while debugging.  Not having it set was not an error before.



##########
bin/cassandra-conf.sh:
##########
@@ -0,0 +1,168 @@
+#!/bin/sh -x
+
+# 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 script to include the cassandra.in.sh file, set NUMACTL, and load 
+#          $CASSANDRA_CONF/cassandra-env.sh"
+#
+# Creates a validate_env() function to verify criticla environment vars are set
+# and display them if desired
+
+## Environment variables:
+# ENV_DEBUG: Show all var settings during the validate_env() call.
+# ENV_PRESERVE: A list of environment variables to preserve from being set 
+#       by $CASSANDRA_CONF/cassandra-env.sh"
+# ENV_SHOW: A list of additional environment variables to display during validate_env.
+
+## validate_env
+## Args:  Arguments are additional environment variables to show.
+##
+## Validates that required environment variables are set. 
+## Required Environment Vars:
+##      CASSANDRA_INCLUDE
+##      CASSANDRA_HOME
+##      CASSANDRA_LOG_DIR
+## 
+## Environment Vars:
+##      ENV_DEBUG   Enables display of variables.
+##      ENV_SHOW    List of additional variables to display.
+##
+validate_env() {
+    retval=0
+    if [ -n "$ENV_DEBUG" ] ; then
+        echo ""
+        echo "ENVIRONMENT"
+        echo "-----------"
+        echo "PWD=$PWD"
+        echo "CASSANDRA_CONF=$CASSANDRA_CONF"
+    fi
+    
+    if [ "x$CASSANDRA_INCLUDE" = "x" ]; then
+        echo ">>> cassandra.in.sh not found or CASSANDRA_INCLUDE not set" >&2
+        retval=1
+    else
+        if [ -n "$ENV_DEBUG" ] ; then
+            echo "CASSANDRA_INCLUDE=$CASSANDRA_INCLUDE"
+        fi
+    fi
+    
+    if [ "x$CASSANDRA_HOME" = "x" ]; then
+        echo ">>> CASSANDRA_HOME not set" >&2
+        retval=1
+    else
+        if [ -n "$ENV_DEBUG" ] ; then
+            echo "CASSANDRA_HOME=$CASSANDRA_HOME"
+        fi
+    fi
+
+    if [ "x$CASSANDRA_LOG_DIR" = "x" ]; then
+        echo ">>> CASSANDRA_LOG_DIR not set" >&2
+        retval=1
+    else
+        if [ -n "$ENV_DEBUG" ] ; then
+            echo "CASSANDRA_LOG_DIR=$CASSANDRA_LOG_DIR"
+        fi
+    fi
+
+    if [ -n "$ENV_DEBUG" ] ; then
+        if [ -z $NUMACTL ]; then
+            echo "numactl not found"
+        fi
+
+        while [ -n "$1" ] ; do
+            eval echo "$1=\$$1"
+            shift
+        done
+        
+        if [ -n "$ENV_SHOW" ]
+        then

Review Comment:
   fixed



##########
bin/cassandra-conf.sh:
##########
@@ -0,0 +1,168 @@
+#!/bin/sh -x
+
+# 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 script to include the cassandra.in.sh file, set NUMACTL, and load 
+#          $CASSANDRA_CONF/cassandra-env.sh"
+#
+# Creates a validate_env() function to verify criticla environment vars are set
+# and display them if desired
+
+## Environment variables:
+# ENV_DEBUG: Show all var settings during the validate_env() call.
+# ENV_PRESERVE: A list of environment variables to preserve from being set 
+#       by $CASSANDRA_CONF/cassandra-env.sh"
+# ENV_SHOW: A list of additional environment variables to display during validate_env.
+
+## validate_env
+## Args:  Arguments are additional environment variables to show.
+##
+## Validates that required environment variables are set. 
+## Required Environment Vars:
+##      CASSANDRA_INCLUDE
+##      CASSANDRA_HOME
+##      CASSANDRA_LOG_DIR
+## 
+## Environment Vars:
+##      ENV_DEBUG   Enables display of variables.
+##      ENV_SHOW    List of additional variables to display.
+##
+validate_env() {
+    retval=0
+    if [ -n "$ENV_DEBUG" ] ; then
+        echo ""
+        echo "ENVIRONMENT"
+        echo "-----------"
+        echo "PWD=$PWD"
+        echo "CASSANDRA_CONF=$CASSANDRA_CONF"
+    fi
+    
+    if [ "x$CASSANDRA_INCLUDE" = "x" ]; then
+        echo ">>> cassandra.in.sh not found or CASSANDRA_INCLUDE not set" >&2
+        retval=1
+    else
+        if [ -n "$ENV_DEBUG" ] ; then
+            echo "CASSANDRA_INCLUDE=$CASSANDRA_INCLUDE"
+        fi
+    fi
+    
+    if [ "x$CASSANDRA_HOME" = "x" ]; then
+        echo ">>> CASSANDRA_HOME not set" >&2
+        retval=1
+    else
+        if [ -n "$ENV_DEBUG" ] ; then
+            echo "CASSANDRA_HOME=$CASSANDRA_HOME"
+        fi
+    fi
+
+    if [ "x$CASSANDRA_LOG_DIR" = "x" ]; then
+        echo ">>> CASSANDRA_LOG_DIR not set" >&2
+        retval=1
+    else
+        if [ -n "$ENV_DEBUG" ] ; then
+            echo "CASSANDRA_LOG_DIR=$CASSANDRA_LOG_DIR"
+        fi
+    fi
+
+    if [ -n "$ENV_DEBUG" ] ; then
+        if [ -z $NUMACTL ]; then
+            echo "numactl not found"
+        fi
+
+        while [ -n "$1" ] ; do
+            eval echo "$1=\$$1"
+            shift
+        done
+        
+        if [ -n "$ENV_SHOW" ]

Review Comment:
   The CASSANDRA_ENV_SHOW is a list of variables to show so if it is set then we use it, if it is not set we don't display anything,



##########
bin/cassandra-conf.sh:
##########
@@ -0,0 +1,168 @@
+#!/bin/sh -x
+
+# 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 script to include the cassandra.in.sh file, set NUMACTL, and load 
+#          $CASSANDRA_CONF/cassandra-env.sh"
+#
+# Creates a validate_env() function to verify criticla environment vars are set
+# and display them if desired
+
+## Environment variables:
+# ENV_DEBUG: Show all var settings during the validate_env() call.
+# ENV_PRESERVE: A list of environment variables to preserve from being set 
+#       by $CASSANDRA_CONF/cassandra-env.sh"
+# ENV_SHOW: A list of additional environment variables to display during validate_env.
+
+## validate_env
+## Args:  Arguments are additional environment variables to show.
+##
+## Validates that required environment variables are set. 
+## Required Environment Vars:
+##      CASSANDRA_INCLUDE
+##      CASSANDRA_HOME
+##      CASSANDRA_LOG_DIR
+## 
+## Environment Vars:
+##      ENV_DEBUG   Enables display of variables.
+##      ENV_SHOW    List of additional variables to display.
+##
+validate_env() {
+    retval=0
+    if [ -n "$ENV_DEBUG" ] ; then
+        echo ""
+        echo "ENVIRONMENT"
+        echo "-----------"
+        echo "PWD=$PWD"
+        echo "CASSANDRA_CONF=$CASSANDRA_CONF"
+    fi
+    
+    if [ "x$CASSANDRA_INCLUDE" = "x" ]; then
+        echo ">>> cassandra.in.sh not found or CASSANDRA_INCLUDE not set" >&2
+        retval=1
+    else

Review Comment:
   It could, but this solution lists all the missing symbols in one run.



##########
bin/nodetool:
##########
@@ -98,6 +71,8 @@ if [ "x$MAX_HEAP_SIZE" = "x" ]; then
     MAX_HEAP_SIZE="128m"
 fi
 
+validate_env JMX_PORT

Review Comment:
   It is not checking just the JMX_PORT, however when debugging the JMX_PORT will be displayed, this is added because the JMX_PORT can be set above.  
   
   Added a comment reflecting this.



-- 
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.

To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org