mirror of
https://github.com/apache/impala.git
synced 2025-12-19 18:12:08 -05:00
IMPALA-13076 Add pstack and jstack to Impala Redhat docker images
When the Impala docker images are deployed in production environments, it can be hard to add debugging tools at runtime. Two of the most useful diagnostic tools are jstack and pstack, which can be used to print Java and native stack traces. Install these tools into Redhat images which are the most commonly used in production. To install pstack we install gdb To install jstack we install a development jdk on top of the headless jdk. Extend the install_os_packages.sh script to add an argument to --install-debug-tools to set the level of diagnostic tools to install. The possible arguments are: none - install no extra tools basic - install pstack and jstack full - install more debugging tools. In a Centos 8.5 build, the size of a impalad_coord_exec image increased from 1.74GB to 1.85GB, as reported by ‘docker image list’. What other tools might be added? - Installing perf is tricky as in a container perf requires an installation specific to the underlying linux kernel image, which is hard to predict at build time. - Installing pprof is hard as installation seems to require compiling from sources. Clearly there are many options and we cannot install everything. TESTING Built release and debug docker images, and used jstack and pstack in a running container to print Impala's stacks. Change-Id: I25e6827b86564a9c0fc25678e4a194ee8e0be0e9 Reviewed-on: http://gerrit.cloudera.org:8080/21433 Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com> Reviewed-by: Joe McDonnell <joemcdonnell@cloudera.com>
This commit is contained in:
committed by
stiga-huang
parent
221d4f1e28
commit
c3fff37236
@@ -101,13 +101,13 @@ if (NOT ${DISTRO_BASE_IMAGE} STREQUAL "UNSUPPORTED")
|
||||
VERBATIM
|
||||
)
|
||||
endfunction()
|
||||
add_base_image(release "" "")
|
||||
add_base_image(release_java11 "" "--java 11")
|
||||
add_base_image(release_java17 "" "--java 17")
|
||||
# Debug images include debug tools
|
||||
add_base_image(debug "--debug-build" "--install-debug-tools")
|
||||
add_base_image(debug_java11 "--debug-build" "--install-debug-tools --java 11")
|
||||
add_base_image(debug_java17 "--debug-build" "--install-debug-tools --java 17")
|
||||
add_base_image(release "" "--install-debug-tools basic")
|
||||
add_base_image(release_java11 "" "--install-debug-tools basic --java 11")
|
||||
add_base_image(release_java17 "" "--install-debug-tools basic --java 17")
|
||||
# Debug images include full debug tools
|
||||
add_base_image(debug "--debug-build" "--install-debug-tools full")
|
||||
add_base_image(debug_java11 "--debug-build" "--install-debug-tools full --java 11")
|
||||
add_base_image(debug_java17 "--debug-build" "--install-debug-tools full --java 17")
|
||||
|
||||
# Target to build all docker images. Dependencies are added for each docker image
|
||||
# instantiated below.
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
ARG BASE_IMAGE=REPLACED_WITH_BASE_IMAGE
|
||||
FROM ${BASE_IMAGE}
|
||||
|
||||
# If set to "--install-debug-tools", then extra utilities will be installed.
|
||||
ARG INSTALL_OS_PACKAGES_ARGS=""
|
||||
# The level of debugging tools to install is set by the argument to "--install-debug-tools".
|
||||
ARG INSTALL_OS_PACKAGES_ARGS="--install-debug-tools none"
|
||||
|
||||
# Install minimal dependencies required for Impala services to run.
|
||||
ADD helper/install_os_packages.sh /root
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
ARG BASE_IMAGE=REPLACED_WITH_BASE_IMAGE
|
||||
FROM ${BASE_IMAGE}
|
||||
|
||||
# If set to "--install-debug-tools", then extra utilities will be installed
|
||||
ARG INSTALL_OS_PACKAGES_ARGS="--install-debug-tools"
|
||||
# If set to "--install-debug-tools full", then extra utilities will be installed.
|
||||
ARG INSTALL_OS_PACKAGES_ARGS="--install-debug-tools full"
|
||||
|
||||
# Install dependencies required for Impala utility binaries to run, plus
|
||||
# some useful utilities.
|
||||
|
||||
@@ -23,7 +23,9 @@
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
INSTALL_DEBUG_TOOLS=false
|
||||
# Default level of extra debugging tools, controlled by the --install-debug-tools flag.
|
||||
INSTALL_DEBUG_TOOLS=none
|
||||
|
||||
JAVA_VERSION=8
|
||||
DRY_RUN=false
|
||||
PKG_LIST=""
|
||||
@@ -31,7 +33,8 @@ NON_PKG_NAMES=(apt-get yum install update)
|
||||
|
||||
function print_usage {
|
||||
echo "install_os_packages.sh - Helper script to install OS dependencies"
|
||||
echo "[--install-debug-tools] : Also install debug tools like curl, iproute, etc"
|
||||
echo "[--install-debug-tools <none|basic|full>] : set the level of debug tools"\
|
||||
"to install"
|
||||
echo "[--java <version>] : Use specified Java version rather than the default Java 8."
|
||||
echo "[--dry-run] : Print the list of packages to install."
|
||||
}
|
||||
@@ -61,7 +64,8 @@ while [ -n "$*" ]
|
||||
do
|
||||
case "$1" in
|
||||
--install-debug-tools)
|
||||
INSTALL_DEBUG_TOOLS=true
|
||||
INSTALL_DEBUG_TOOLS="${2-}"
|
||||
shift;
|
||||
;;
|
||||
--java)
|
||||
JAVA_VERSION="${2-}"
|
||||
@@ -82,6 +86,18 @@ echo "INSTALL_DEBUG_TOOLS=${INSTALL_DEBUG_TOOLS}"
|
||||
echo "JAVA_VERSION=${JAVA_VERSION}"
|
||||
echo "DRY_RUN=${DRY_RUN}"
|
||||
|
||||
case "$INSTALL_DEBUG_TOOLS" in
|
||||
none | basic | full)
|
||||
# These are valid.
|
||||
;;
|
||||
"" | *)
|
||||
# The argument to --install-debug-tools is either missing, or is not a recognized
|
||||
# value.
|
||||
print_usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# This can get more detailed if there are specific steps
|
||||
# for specific versions, but at the moment the distribution
|
||||
# is all we need.
|
||||
@@ -124,8 +140,11 @@ if [[ $DISTRIBUTION == Ubuntu ]]; then
|
||||
libsasl2-modules-gssapi-mit \
|
||||
openjdk-${JAVA_VERSION}-jre-headless \
|
||||
tzdata
|
||||
if $INSTALL_DEBUG_TOOLS ; then
|
||||
echo "Installing extra debug tools"
|
||||
|
||||
# On Ubuntu there are no extra tools installed for $INSTALL_DEBUG_TOOLS == basic
|
||||
|
||||
if [[ $INSTALL_DEBUG_TOOLS == full ]]; then
|
||||
echo "Installing full debug tools"
|
||||
wrap apt-get install -y \
|
||||
curl \
|
||||
dnsutils \
|
||||
@@ -159,8 +178,15 @@ elif [[ $DISTRIBUTION == Redhat ]]; then
|
||||
langpacks-en
|
||||
fi
|
||||
|
||||
if $INSTALL_DEBUG_TOOLS ; then
|
||||
echo "Installing extra debug tools"
|
||||
if [[ $INSTALL_DEBUG_TOOLS == basic || $INSTALL_DEBUG_TOOLS == full ]]; then
|
||||
echo "Installing basic debug tools"
|
||||
wrap yum install -y --disableplugin=subscription-manager \
|
||||
java-${JAVA_VERSION}-openjdk-devel \
|
||||
gdb
|
||||
fi
|
||||
|
||||
if [[ $INSTALL_DEBUG_TOOLS == full ]]; then
|
||||
echo "Installing full debug tools"
|
||||
wrap yum install -y --disableplugin=subscription-manager \
|
||||
bind-utils \
|
||||
curl \
|
||||
|
||||
Reference in New Issue
Block a user