This is an automated email from the ASF dual-hosted git repository.

dlmarion pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/main by this push:
     new 47b498e1e6 Reimplemented resource group jvm and property overrides 
(#5126)
47b498e1e6 is described below

commit 47b498e1e6108e49c2e4f3ddfcd44d8494dbcdf9
Author: Dave Marion <dlmar...@apache.org>
AuthorDate: Mon Dec 2 14:56:24 2024 -0500

    Reimplemented resource group jvm and property overrides (#5126)
    
    Reversed some changes made in #5111 and implemented them
    differently based on conversation on that PR. I was able
    to handle per-group per-process JVM configuration in the
    accumulo-env.sh file negating the need for a seperate
    group specific file. I also included an "includeOptional"
    property in the accumulo.properties file that will be
    resolved at runtime to add additional properties to the
    configuration. Users can change this to "include" if they
    want the process to fail when the file is missing.
    
    
    Co-authored-by: Christopher Tubbs <ctubb...@apache.org>
---
 assemble/bin/accumulo-service      | 20 ++--------
 assemble/conf/accumulo-env.sh      | 26 +++++++++----
 assemble/conf/accumulo.properties  |  5 +++
 assemble/conf/default-group-env.sh | 80 --------------------------------------
 4 files changed, 26 insertions(+), 105 deletions(-)

diff --git a/assemble/bin/accumulo-service b/assemble/bin/accumulo-service
index ea77129fe2..ebc486b73f 100755
--- a/assemble/bin/accumulo-service
+++ b/assemble/bin/accumulo-service
@@ -70,15 +70,6 @@ function get_group() {
   echo "${group}"
 }
 
-function get_group_overrides() {
-  service="$1"
-  group="$2"
-  if [[ -f "${conf}/${group}-group-env.sh" ]]; then
-    #shellcheck source=../conf/default-group-env.sh
-    source "${conf}/${group}-group-env.sh" "${service}"
-  fi
-}
-
 function start_service() {
   local service_type=$1
   local service_name=$2
@@ -93,14 +84,6 @@ function start_service() {
     servers_per_host=${ACCUMULO_CLUSTER_ARG:-1}
   fi
 
-  group=$(get_group "$@")
-
-  #
-  # Get any resource group overrides, this should
-  # export ACCUMULO_JAVA_OPTS and PROPERTY_OVERRIDES
-  #
-  get_group_overrides "$service_type" "$group"
-
   for ((process_num = 1; process_num <= servers_per_host; process_num++)); do
     if [[ ${build_service_name} == "true" ]]; then
       service_name="${service_type}_${group}_${process_num}"
@@ -253,6 +236,9 @@ function main() {
   export conf="${ACCUMULO_CONF_DIR:-${basedir}/conf}"
   export lib="${basedir}/lib"
 
+  group=$(get_group "$@")
+  export ACCUMULO_RESOURCE_GROUP="$group"
+
   if [[ -f "${conf}/accumulo-env.sh" ]]; then
     #shellcheck source=../conf/accumulo-env.sh
     source "${conf}/accumulo-env.sh"
diff --git a/assemble/conf/accumulo-env.sh b/assemble/conf/accumulo-env.sh
index 7bdc570380..b39b1b94e7 100644
--- a/assemble/conf/accumulo-env.sh
+++ b/assemble/conf/accumulo-env.sh
@@ -89,14 +89,24 @@ JAVA_OPTS=(
 ## JVM options set for individual applications
 # cmd is set by calling script that sources this env file
 #shellcheck disable=SC2154
-case "$cmd" in
-  manager) JAVA_OPTS=('-Xmx512m' '-Xms512m' "${JAVA_OPTS[@]}") ;;
-  monitor) JAVA_OPTS=('-Xmx256m' '-Xms256m' "${JAVA_OPTS[@]}") ;;
-  gc) JAVA_OPTS=('-Xmx256m' '-Xms256m' "${JAVA_OPTS[@]}") ;;
-  tserver) JAVA_OPTS=('-Xmx768m' '-Xms768m' "${JAVA_OPTS[@]}") ;;
-  compactor) JAVA_OPTS=('-Xmx256m' '-Xms256m' "${JAVA_OPTS[@]}") ;;
-  sserver) JAVA_OPTS=('-Xmx512m' '-Xms512m' "${JAVA_OPTS[@]}") ;;
-  *) JAVA_OPTS=('-Xmx256m' '-Xms64m' "${JAVA_OPTS[@]}") ;;
+case "${ACCUMULO_RESOURCE_GROUP:-default}" in
+  default)
+    # shellcheck disable=SC2154
+    # $cmd is exported in the accumulo script, but not the accumulo-service 
script
+    case "$cmd" in
+      manager) JAVA_OPTS=('-Xmx512m' '-Xms512m' "${JAVA_OPTS[@]}") ;;
+      monitor) JAVA_OPTS=('-Xmx256m' '-Xms256m' "${JAVA_OPTS[@]}") ;;
+      gc) JAVA_OPTS=('-Xmx256m' '-Xms256m' "${JAVA_OPTS[@]}") ;;
+      tserver) JAVA_OPTS=('-Xmx768m' '-Xms768m' "${JAVA_OPTS[@]}") ;;
+      compactor) JAVA_OPTS=('-Xmx256m' '-Xms256m' "${JAVA_OPTS[@]}") ;;
+      sserver) JAVA_OPTS=('-Xmx512m' '-Xms512m' "${JAVA_OPTS[@]}") ;;
+      *) JAVA_OPTS=('-Xmx256m' '-Xms64m' "${JAVA_OPTS[@]}") ;;
+    esac
+    ;;
+  *)
+    echo "ACCUMULO_RESOURCE_GROUP named $ACCUMULO_RESOURCE_GROUP is not 
configured"
+    exit 1
+    ;;
 esac
 
 ## JVM options set for logging. Review log4j2.properties file to see how they 
are used.
diff --git a/assemble/conf/accumulo.properties 
b/assemble/conf/accumulo.properties
index 8aea483153..6e6de34cc6 100644
--- a/assemble/conf/accumulo.properties
+++ b/assemble/conf/accumulo.properties
@@ -31,3 +31,8 @@ instance.secret=DEFAULT
 
 ## Set to false if 'accumulo-util build-native' fails
 tserver.memory.maps.native.enabled=true
+
+## (optional) include additional property files for a resource group
+## based on the ACCUMULO_RESOURCE_GROUP env var set in accumulo-service
+#include=group-${env:ACCUMULO_RESOURCE_GROUP}.properties
+#includeOptional=group-${env:ACCUMULO_RESOURCE_GROUP}.properties
diff --git a/assemble/conf/default-group-env.sh 
b/assemble/conf/default-group-env.sh
deleted file mode 100644
index a1a46260da..0000000000
--- a/assemble/conf/default-group-env.sh
+++ /dev/null
@@ -1,80 +0,0 @@
-#! /usr/bin/env 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
-#
-#   https://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.
-#
-
-# This script is called from accumulo-service and serves as a mechanism to set
-# ACCUMULO_JAVA_OPTS and provide property overrides for the server processes in
-# a resource group. This allows the user to set a base configuration in
-# accumulo-env.sh and accumulo.properties and then tailor the configuration of
-# the individual processes in a resource group. For example, when you have a
-# cluster comprised of sets of servers with different amounts of memory, then
-# the user can set default JVM heap settings in accumulo-env.sh, and then
-# increase or decrease in this file.
-#
-# This script will export ACCUMULO_JAVA_OPTS and PROPERTY_OVERRIDES variables
-# based on the service type for the default resource group.  Additional files 
can
-# be created based on the groups configured in cluster.yaml and should be named
-# "{groupName}-group-env.sh". The contents of ACCUMULO_JAVA_OPTS will be 
appended
-# to the JAVA_OPTS variable that is created in accumulo-env.sh, allowing the 
user
-# to override any setting for this resource group. Likewise, the contents of
-# PROPERTY_OVERRIDES will be appended to the arguments provided to the server
-# class allowing the user to override any Accumulo property for this resource 
group.
-# Overriding the bind address and group name properties would not be advisable 
as
-# this could lead to deployment issues.
-
-#  Examples:
-#
-#    Override JVM args
-#    export ACCUMULO_JAVA_OPTS="-Xms1024m -Xmx1024m"
-#
-#    Override Accumulo properties
-#    export PROPERTY_OVERRIDES=('-o' 'rpc.backlog=1000' '-o' 
'tserver.hold.time.max=10m')
-
-service=$1
-
-case "$service" in
-  manager)
-    export ACCUMULO_JAVA_OPTS=""
-    export PROPERTY_OVERRIDES=()
-    ;;
-  monitor)
-    export ACCUMULO_JAVA_OPTS=""
-    export PROPERTY_OVERRIDES=()
-    ;;
-  gc)
-    export ACCUMULO_JAVA_OPTS=""
-    export PROPERTY_OVERRIDES=()
-    ;;
-  tserver)
-    export ACCUMULO_JAVA_OPTS=""
-    export PROPERTY_OVERRIDES=()
-    ;;
-  compactor)
-    export ACCUMULO_JAVA_OPTS=""
-    export PROPERTY_OVERRIDES=()
-    ;;
-  sserver)
-    export ACCUMULO_JAVA_OPTS=""
-    export PROPERTY_OVERRIDES=()
-    ;;
-  *)
-    export ACCUMULO_JAVA_OPTS=""
-    export PROPERTY_OVERRIDES=()
-    ;;
-esac

Reply via email to