From ac388d191ddb6a910a5c74575d3ba6aa5a31e062 Mon Sep 17 00:00:00 2001 From: Cheng Pan Date: Mon, 22 Jan 2024 21:32:22 +0800 Subject: [PATCH] [KYUUBI #5987] Always export KYUUBI_HOME in `load-kyuubi-env.sh` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # :mag: Description ## Issue References ๐Ÿ”— This is a follow-up of #5987, after applying #5987, I found a regression, the Kyuubi Server Java process can not see KYUUBI_HOME env if we don't declare KYUUBI_HOME as an env var explicitly, this breaks the main resources jar discovery of the engine, and eventually fails the engine bootstrap. ## Describe Your Solution ๐Ÿ”ง Restore `export KYUUBI_HOME` logic in `load-kyuubi-env.sh` ## Types of changes :bookmark: - [x] Bugfix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) ## Test Plan ๐Ÿงช Build and start Kyuubi Server. ``` export SPARK_HOME=/Users/chengpan/app/spark-3.5.0-bin-hadoop3 build/dist --spark-provided --flink-provided --hive-provided dist/bin/kyuubi run ``` Open session to launch a Spark engine ``` dist/bin/beeline -u 'jdbc:hive2://0.0.0.0:10009/default' ``` #### Behavior Without This Pull Request :coffin: A wrong `kyuubi-spark-sql-engine_2.12-1.9.0-SNAPSHOT.jar` location was found. ``` /Users/chengpan/app/spark-3.5.0-bin-hadoop3/bin/spark-submit \ ... --proxy-user chengpan /Users/chengpan/Projects/apache-kyuubi/dist/jars/externals/kyuubi-spark-sql-engine/target/kyuubi-spark-sql-engine_2.12-1.9.0-SNAPSHOT.jar ``` #### Behavior With This Pull Request :tada: The correct `kyuubi-spark-sql-engine_2.12-1.9.0-SNAPSHOT.jar` location was found. ``` /Users/chengpan/app/spark-3.5.0-bin-hadoop3/bin/spark-submit \ ... --proxy-user chengpan /Users/chengpan/Projects/apache-kyuubi/dist/externals/engines/spark/kyuubi-spark-sql-engine_2.12-1.9.0-SNAPSHOT.jar ``` --- # Checklist ๐Ÿ“ - [x] This patch was not authored or co-authored using [Generative Tooling](https://www.apache.org/legal/generative-tooling.html) **Be nice. Be informative.** Closes #6004 from pan3793/5987-followup. Closes #5987 a4e40b687 [Cheng Pan] [KYUUBI #5987] Always export KYUUBI_HOME in load-kyuubi-env.sh Authored-by: Cheng Pan Signed-off-by: Cheng Pan --- bin/load-kyuubi-env.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/bin/load-kyuubi-env.sh b/bin/load-kyuubi-env.sh index fdff1e0c571..779ac2bea5a 100755 --- a/bin/load-kyuubi-env.sh +++ b/bin/load-kyuubi-env.sh @@ -16,10 +16,7 @@ # limitations under the License. # - -if [ -z "${KYUUBI_HOME}" ]; then - export KYUUBI_HOME="$(cd "$(dirname "$0")"/.. || exit; pwd)" -fi +export KYUUBI_HOME="${KYUUBI_HOME:-"$(cd "$(dirname "$0")"/.. || exit; pwd)"}" export KYUUBI_CONF_DIR="${KYUUBI_CONF_DIR:-"${KYUUBI_HOME}"/conf}" silent=0