This is an automated email from the ASF dual-hosted git repository.
stoty pushed a commit to branch 5.1
in repository https://gitbox.apache.org/repos/asf/phoenix.git
The following commit(s) were added to refs/heads/5.1 by this push:
new bec90f0c63 PHOENIX-7520 Use HBASE_OPTS from hbase-env.sh in startup
scripts (#2072)
bec90f0c63 is described below
commit bec90f0c6394c1cedb40c01df1955f5098555fdb
Author: Istvan Toth <[email protected]>
AuthorDate: Fri Feb 7 10:06:23 2025 +0100
PHOENIX-7520 Use HBASE_OPTS from hbase-env.sh in startup scripts (#2072)
also apply all environment variables set in hbase-env.sh to startup shell
---
bin/performance.py | 2 +-
bin/phoenix_utils.py | 25 +++++++++++++------------
bin/psql.py | 3 ++-
bin/sqlline.py | 3 ++-
4 files changed, 18 insertions(+), 15 deletions(-)
diff --git a/bin/performance.py b/bin/performance.py
index 5b09a29c93..0b72ff4482 100755
--- a/bin/performance.py
+++ b/bin/performance.py
@@ -65,7 +65,7 @@ phoenix_utils.setPath()
java_cmd = phoenix_utils.java
-execute = ('%s %s $PHOENIX_OPTS -cp
"%s%s%s%s%s"-Dlog4j2.configurationFile=file:' +
+execute = ('%s %s $HBASE_OPTS $PHOENIX_OPTS -cp
"%s%s%s%s%s"-Dlog4j2.configurationFile=file:' +
os.path.join(phoenix_utils.current_dir, "log4j2.properties") +
' org.apache.phoenix.util.PhoenixRuntime -t %s %s ') % \
(java_cmd, phoenix_utils.jvm_module_flags, hbase_config_path, os.pathsep,
diff --git a/bin/phoenix_utils.py b/bin/phoenix_utils.py
index 1161b9e715..22f344475a 100755
--- a/bin/phoenix_utils.py
+++ b/bin/phoenix_utils.py
@@ -24,6 +24,7 @@ import os
import fnmatch
import re
import subprocess
+import sys
def find(pattern, classPaths):
paths = classPaths.split(os.pathsep)
@@ -186,7 +187,8 @@ def setPath():
if logging_jar is None or logging_jar == "":
logging_jar = findFileInPathWithoutRecursion(LOGGING_JAR_PATTERN,
os.path.join(current_dir, "..","lib"))
- __set_java_home()
+ __read_hbase_env()
+ __set_java()
__set_jvm_flags()
return ""
@@ -205,13 +207,19 @@ def shell_quote(args):
import pipes
return " ".join([pipes.quote(tryDecode(v)) for v in args])
-
-def __set_java_home():
+def __set_java():
global java_home
global java
java_home = os.getenv('JAVA_HOME')
- java = 'java'
+ if java_home:
+ java = os.path.join(java_home, 'bin', 'java')
+ else:
+ java = 'java'
+
+def __read_hbase_env():
+ if os.getenv("SKIP_HBASE_ENV"):
+ return ""
# HBase configuration folder path (where hbase-site.xml reside) for
# HBase/Phoenix client side property override
hbase_config_path = hbase_conf_dir
@@ -229,18 +237,11 @@ def __set_java_home():
sys.stderr.write("hbase-env file unknown on platform
{}{}".format(os.name, os.linesep))
sys.exit(-1)
- hbase_env = {}
if os.path.isfile(hbase_env_path):
p = subprocess.Popen(hbase_env_cmd, stdout = subprocess.PIPE)
for x in p.stdout:
(k, _, v) = tryDecode(x).partition('=')
- hbase_env[k.strip()] = v.strip()
-
- if 'JAVA_HOME' in hbase_env:
- java_home = hbase_env['JAVA_HOME']
-
- if java_home:
- java = os.path.join(java_home, 'bin', 'java')
+ os.environ[k.strip()] = v.strip()
return ""
diff --git a/bin/psql.py b/bin/psql.py
index 58c04ddf8f..db9ceb7e0f 100755
--- a/bin/psql.py
+++ b/bin/psql.py
@@ -30,7 +30,8 @@ phoenix_utils.setPath()
args = phoenix_utils.shell_quote(sys.argv[1:])
-java_cmd = phoenix_utils.java + ' ' + phoenix_utils.jvm_module_flags + '
$PHOENIX_OPTS ' + \
+java_cmd = phoenix_utils.java + ' ' + phoenix_utils.jvm_module_flags + \
+ ' $HBASE_OPTS $PHOENIX_OPTS ' + \
' -cp "' + phoenix_utils.hbase_conf_dir + os.pathsep +
phoenix_utils.hadoop_conf + \
os.pathsep + phoenix_utils.slf4j_backend_jar + \
os.pathsep + phoenix_utils.logging_jar + \
diff --git a/bin/sqlline.py b/bin/sqlline.py
index 291fc21568..ca0e7525c4 100755
--- a/bin/sqlline.py
+++ b/bin/sqlline.py
@@ -90,7 +90,8 @@ if os.uname()[4].startswith('ppc'):
else:
disable_jna = ""
-java_cmd = phoenix_utils.java + ' ' + phoenix_utils.jvm_module_flags + '
$PHOENIX_OPTS ' + \
+java_cmd = phoenix_utils.java + ' ' + phoenix_utils.jvm_module_flags + \
+ ' $HBASE_OPTS $PHOENIX_OPTS ' + \
' -cp "' + phoenix_utils.hbase_conf_dir + os.pathsep + \
phoenix_utils.hadoop_conf + os.pathsep + \
phoenix_utils.sqlline_with_deps_jar + os.pathsep + \