Skip to content

Commit 286e975

Browse files
anirbanr-fbfacebook-github-bot
authored andcommitted
adding numa_nodebind=${node} option to mysqld_safe
Summary: Automation will pass in the right value to this option if it needs to bind mysqld to a particular socket. That will happen via systemd scripts. This is only adding the capability on the mysqld_safe side to be able to pass in numactl to the server. The turning on of this feature will need more testing and slow roll, and that will happen in different diffs on the ops repo. Differential Revision: D6067155 fbshipit-source-id: a4242d2
1 parent 2d47615 commit 286e975

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

scripts/mysqld_safe.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ mysqld_ld_preload=
1919
mysqld_ld_library_path=
2020
flush_caches=0
2121
numa_interleave=0
22+
numa_nodebind=
2223

2324
# Initial logging status: error log is not open, and not using syslog
2425
logging=init
@@ -87,6 +88,7 @@ Usage: $0 [OPTIONS]
8788
--flush-caches Flush and purge buffers/caches
8889
--numa-interleave Run mysqld with its memory interleaved
8990
on all CPUs
91+
--numa-nodebind Run mysqld with numa binding to one socket
9092
9193
All other options are passed to the mysqld program.
9294
@@ -261,6 +263,7 @@ parse_arguments() {
261263
--timezone=*) TZ="$val"; export TZ; ;;
262264
--flush-caches) flush_caches=1 ;;
263265
--numa-interleave) numa_interleave=1 ;;
266+
--numa-nodebind=*) numa_nodebind="$val" ;;
264267

265268
--help) usage ;;
266269

@@ -888,6 +891,30 @@ then
888891
exit 1
889892
fi
890893

894+
if @TARGET_LINUX@ && test ! -z "$numa_nodebind"
895+
then
896+
# Locate numactl, ensure it exists.
897+
if ! my_which numactl > /dev/null 2>&1
898+
then
899+
log_error "numactl command not found, required for --numa-nodebind"
900+
exit 1
901+
fi
902+
903+
# Attempt to run a command, ensure it works.
904+
if ! numactl --cpunodebind=$numa_nodebind --preferred=$numa_nodebind true
905+
then
906+
log_error "numactl failed, check if numa-nodebind value is correct"
907+
exit 1
908+
fi
909+
910+
# Launch mysqld with numactl.
911+
cmd="$cmd numactl --cpunodebind=$numa_nodebind --preferred=$numa_nodebind"
912+
elif test ! -z "$numa_nodebind"
913+
then
914+
log_error "--numa-nodebind is not supported on this platform"
915+
exit 1
916+
fi
917+
891918
for i in "$ledir/$MYSQLD" "$defaults" "--basedir=$MY_BASEDIR_VERSION" \
892919
"--datadir=$DATADIR" "--plugin-dir=$plugin_dir" "$USER_OPTION"
893920
do

0 commit comments

Comments
 (0)