Files
impala/testdata/bin/kill-ranger-server.sh
Joe McDonnell 893c55b523 IMPALA-12198: Create $RANGER_LOG_DIR before stopping in kill-ranger-server.sh
If the $RANGER_LOG_DIR directory doesn't exist, then Ranger's
ranger-admin-services.sh will fail to issue the stop command
because it tries and fails to write to that directory. Ranger's
script believes that it has issued the stop to Ranger, so it
waits for 30 seconds for Ranger to stop. When Ranger doesn't stop,
it kills Ranger. This is an unnecessary delay in stopping Ranger.
It is common if a developer runs bin/clean.sh after starting
Ranger.

This modifies kill-ranger-server.sh to create $RANGER_LOG_DIR
before running ranger-admin-services.sh with the stop command.
Since the directory exists, the stop command is successfully
issued and the script won't wait 30 seconds.

Testing:
 - Hand testing with starting Ranger, then running bin/clean.sh,
   then running kill-ranger-server.sh

Change-Id: I6ba5a90172affde3949e9f9a7618bde0dfa8c309
Reviewed-on: http://gerrit.cloudera.org:8080/20028
Reviewed-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
2023-06-10 02:04:46 +00:00

33 lines
1.2 KiB
Bash
Executable File

#!/bin/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
#
# 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.
set -euo pipefail
. $IMPALA_HOME/bin/report_build_error.sh
setup_report_build_error
# If this directory doesn't exist, then the stop command will immediately error
# trying to write to this directory. The stop won't be issued, and shutdown will
# take 30 seconds longer.
RANGER_LOG_DIR="${IMPALA_CLUSTER_LOGS_DIR}/ranger"
if [[ ! -d "${RANGER_LOG_DIR}" ]]; then
mkdir -p "${RANGER_LOG_DIR}"
fi
"${RANGER_HOME}"/ews/ranger-admin-services.sh stop