mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-23 12:47:56 +00:00
PT-1554 Improved jemalloc detection
This commit is contained in:
@@ -2254,24 +2254,19 @@ report_jemalloc_enabled() {
|
|||||||
local JEMALLOC_LOCATION=''
|
local JEMALLOC_LOCATION=''
|
||||||
|
|
||||||
for PID in $(pidof mysqld); do
|
for PID in $(pidof mysqld); do
|
||||||
grep -qc jemalloc /proc/${PID}/environ || ldd $(which mysqld) 2>/dev/null | grep -qc jemalloc
|
grep -qc jemalloc /proc/${pid}/environ || ldd $(which mysqld) 2>/dev/null | grep -qc jemalloc
|
||||||
JEMALLOC_STATUS=$?
|
jemalloc_status=$?
|
||||||
if [ $JEMALLOC_STATUS = 1 ]; then
|
if [ $jemalloc_status = 1 ]; then
|
||||||
echo "jemalloc is not enabled in MySQL config for process with ID ${PID}"
|
echo "jemalloc is not enabled in mysql config for process with id ${pid}"
|
||||||
else
|
else
|
||||||
echo "jemalloc enabled in MySQL config for process with ID ${PID}"
|
echo "jemalloc enabled in mysql config for process with id ${pid}"
|
||||||
GENERAL_JEMALLOC_STATUS=1
|
GENERAL_JEMALLOC_STATUS=1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ $GENERAL_JEMALLOC_STATUS = 1 ]; then
|
if [ $GENERAL_JEMALLOC_STATUS -eq 1 ]; then
|
||||||
for libjemall in "/usr/lib64" "/usr/lib/x86_64-linux-gnu" "/usr/lib"; do
|
JEMALLOC_LOCATION=$(find /usr/lib64/ /usr/lib/x86_64-linux-gnu /usr/lib -name "libjemalloc.*" 2>/dev/null | head -n 1)
|
||||||
if [ -r "$libjemall/libjemalloc.so.1" ]; then
|
if [ -z "$JEMALLOC_LOCATION" ]; then
|
||||||
JEMALLOC_LOCATION="$libjemall/libjemalloc.so.1"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
if [ -z $JEMALLOC_LOCATION ]; then
|
|
||||||
echo "Jemalloc library not found"
|
echo "Jemalloc library not found"
|
||||||
else
|
else
|
||||||
echo "Using jemalloc from $JEMALLOC_LOCATION"
|
echo "Using jemalloc from $JEMALLOC_LOCATION"
|
||||||
|
@@ -1256,26 +1256,19 @@ report_jemalloc_enabled() {
|
|||||||
local JEMALLOC_LOCATION=''
|
local JEMALLOC_LOCATION=''
|
||||||
|
|
||||||
for PID in $(pidof mysqld); do
|
for PID in $(pidof mysqld); do
|
||||||
grep -qc jemalloc /proc/${PID}/environ || ldd $(which mysqld) 2>/dev/null | grep -qc jemalloc
|
grep -qc jemalloc /proc/${pid}/environ || ldd $(which mysqld) 2>/dev/null | grep -qc jemalloc
|
||||||
JEMALLOC_STATUS=$?
|
jemalloc_status=$?
|
||||||
if [ $JEMALLOC_STATUS = 1 ]; then
|
if [ $jemalloc_status = 1 ]; then
|
||||||
echo "jemalloc is not enabled in MySQL config for process with ID ${PID}"
|
echo "jemalloc is not enabled in mysql config for process with id ${pid}"
|
||||||
else
|
else
|
||||||
echo "jemalloc enabled in MySQL config for process with ID ${PID}"
|
echo "jemalloc enabled in mysql config for process with id ${pid}"
|
||||||
GENERAL_JEMALLOC_STATUS=1
|
GENERAL_JEMALLOC_STATUS=1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ $GENERAL_JEMALLOC_STATUS = 1 ]; then
|
if [ $GENERAL_JEMALLOC_STATUS -eq 1 ]; then
|
||||||
# Check location for libjemalloc.so.1
|
JEMALLOC_LOCATION=$(find /usr/lib64/ /usr/lib/x86_64-linux-gnu /usr/lib -name "libjemalloc.*" 2>/dev/null | head -n 1)
|
||||||
#for libjemall in "${SCRIPT_PWD}/lib/mysql" "/usr/lib64" "/usr/lib/x86_64-linux-gnu" "/usr/lib"; do
|
if [ -z "$JEMALLOC_LOCATION" ]; then
|
||||||
for libjemall in "/usr/lib64" "/usr/lib/x86_64-linux-gnu" "/usr/lib"; do
|
|
||||||
if [ -r "$libjemall/libjemalloc.so.1" ]; then
|
|
||||||
JEMALLOC_LOCATION="$libjemall/libjemalloc.so.1"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
if [ -z $JEMALLOC_LOCATION ]; then
|
|
||||||
echo "Jemalloc library not found"
|
echo "Jemalloc library not found"
|
||||||
else
|
else
|
||||||
echo "Using jemalloc from $JEMALLOC_LOCATION"
|
echo "Using jemalloc from $JEMALLOC_LOCATION"
|
||||||
|
@@ -277,5 +277,3 @@ report-port = 12345
|
|||||||
log-error = mysqld.log
|
log-error = mysqld.log
|
||||||
innodb_lock_wait_timeout = 3
|
innodb_lock_wait_timeout = 3
|
||||||
# Memory management library ##################################
|
# Memory management library ##################################
|
||||||
Jemalloc library not found
|
|
||||||
# The End ####################################################
|
|
||||||
|
@@ -220,5 +220,3 @@ report-port = 12345
|
|||||||
log-error = mysqld.log
|
log-error = mysqld.log
|
||||||
innodb_lock_wait_timeout = 3
|
innodb_lock_wait_timeout = 3
|
||||||
# Memory management library ##################################
|
# Memory management library ##################################
|
||||||
Jemalloc library not found
|
|
||||||
# The End ####################################################
|
|
||||||
|
@@ -219,5 +219,3 @@ report-port = 12345
|
|||||||
log-error = mysqld.log
|
log-error = mysqld.log
|
||||||
innodb_lock_wait_timeout = 3
|
innodb_lock_wait_timeout = 3
|
||||||
# Memory management library ##################################
|
# Memory management library ##################################
|
||||||
Jemalloc library not found
|
|
||||||
# The End ####################################################
|
|
||||||
|
@@ -292,5 +292,3 @@ report-port = 12345
|
|||||||
log-error = mysqld.log
|
log-error = mysqld.log
|
||||||
innodb_lock_wait_timeout = 3
|
innodb_lock_wait_timeout = 3
|
||||||
# Memory management library ##################################
|
# Memory management library ##################################
|
||||||
Jemalloc library not found
|
|
||||||
# The End ####################################################
|
|
||||||
|
@@ -341,5 +341,3 @@ log_queries_not_using_indexes | OFF
|
|||||||
# Configuration File #########################################
|
# Configuration File #########################################
|
||||||
Config File | Cannot autodetect or find, giving up
|
Config File | Cannot autodetect or find, giving up
|
||||||
# Memory management library ##################################
|
# Memory management library ##################################
|
||||||
Jemalloc library not found
|
|
||||||
# The End ####################################################
|
|
||||||
|
@@ -295,5 +295,3 @@ log_queries_not_using_indexes | OFF
|
|||||||
# Configuration File #########################################
|
# Configuration File #########################################
|
||||||
Config File | Cannot autodetect or find, giving up
|
Config File | Cannot autodetect or find, giving up
|
||||||
# Memory management library ##################################
|
# Memory management library ##################################
|
||||||
Jemalloc library not found
|
|
||||||
# The End ####################################################
|
|
||||||
|
Reference in New Issue
Block a user