Skip to content

Commit 965a6a4

Browse files
authored
HIVE-28973: Metastore service in Docker fails to start unless --verbose is explicitly set (#5830)
When VERBOSE is not set, an empty string argument ("") is passed to the startup command, which causes a parsing error. This commit avoids appending the --verbose flag when it's not explicitly set, preventing invalid arguments from being passed during metastore startup.
1 parent 413069e commit 965a6a4

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

packaging/src/docker/entrypoint.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,18 @@ set -x
2222
: "${DB_DRIVER:=derby}"
2323

2424
SKIP_SCHEMA_INIT="${IS_RESUME:-false}"
25-
[[ $VERBOSE = "true" ]] && VERBOSE_MODE="--verbose" || VERBOSE_MODE=""
25+
[[ $VERBOSE = "true" ]] && VERBOSE_MODE="--verbose"
2626

2727
function initialize_hive {
2828
COMMAND="-initOrUpgradeSchema"
2929
if [ "$(echo "$HIVE_VER" | cut -d '.' -f1)" -lt "4" ]; then
3030
COMMAND="-${SCHEMA_COMMAND:-initSchema}"
3131
fi
32-
"$HIVE_HOME/bin/schematool" -dbType "$DB_DRIVER" "$COMMAND" "$VERBOSE_MODE"
32+
if [[ -n "$VERBOSE_MODE" ]]; then
33+
"$HIVE_HOME/bin/schematool" -dbType "$DB_DRIVER" "$COMMAND" "$VERBOSE_MODE"
34+
else
35+
"$HIVE_HOME/bin/schematool" -dbType "$DB_DRIVER" "$COMMAND"
36+
fi
3337
if [ $? -eq 0 ]; then
3438
echo "Initialized Hive Metastore Server schema successfully.."
3539
else
@@ -57,5 +61,9 @@ if [ "${SERVICE_NAME}" == "hiveserver2" ]; then
5761
exec "$HIVE_HOME/bin/hive" --skiphadoopversion --skiphbasecp --service "$SERVICE_NAME"
5862
elif [ "${SERVICE_NAME}" == "metastore" ]; then
5963
export METASTORE_PORT=${METASTORE_PORT:-9083}
60-
exec "$HIVE_HOME/bin/hive" --skiphadoopversion --skiphbasecp "$VERBOSE_MODE" --service "$SERVICE_NAME"
64+
if [[ -n "$VERBOSE_MODE" ]]; then
65+
exec "$HIVE_HOME/bin/hive" --skiphadoopversion --skiphbasecp "$VERBOSE_MODE" --service "$SERVICE_NAME"
66+
else
67+
exec "$HIVE_HOME/bin/hive" --skiphadoopversion --skiphbasecp --service "$SERVICE_NAME"
68+
fi
6169
fi

0 commit comments

Comments
 (0)