diff options
author | Sergei Golubchik <sergii@pisem.net> | 2013-11-11 09:31:13 +0100 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2013-11-11 09:31:13 +0100 |
commit | 41fc2493ed66d334eec11d466ca09ee9049970ce (patch) | |
tree | 06b5d559f177fc8ea4103fe179ffd3b4848d9bba | |
parent | e10d42d93b373080ec9acb28f9ed29857000c0ae (diff) | |
download | mariadb-git-41fc2493ed66d334eec11d466ca09ee9049970ce.tar.gz |
MDEV-5186 /usr/bin/mysqld_safe doesn't have NUMA options support
port mysqld_safe numa extensions from percona-server: --flush-caches and --numa-interleave
-rw-r--r-- | scripts/mysqld_safe.sh | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh index 3c63acddc0c..430b0067c11 100644 --- a/scripts/mysqld_safe.sh +++ b/scripts/mysqld_safe.sh @@ -18,6 +18,8 @@ niceness=0 nowatch=0 mysqld_ld_preload= mysqld_ld_library_path= +flush_caches=0 +numa_interleave=0 # Initial logging status: error log is not open, and not using syslog logging=init @@ -85,6 +87,10 @@ Usage: $0 [OPTIONS] --syslog Log messages to syslog with 'logger' --skip-syslog Log messages to error log (default) --syslog-tag=TAG Pass -t "mysqld-TAG" to 'logger' + --flush-caches Flush and purge buffers/caches before + starting the server + --numa-interleave Run mysqld with its memory interleaved + on all NUMA nodes All other options are passed to the mysqld program. @@ -244,6 +250,8 @@ parse_arguments() { --skip-syslog) want_syslog=0 ;; --syslog-tag=*) syslog_tag="$val" ;; --timezone=*) TZ="$val"; export TZ; ;; + --flush-caches) flush_caches=1 ;; + --numa-interleave) numa_interleave=1 ;; --help) usage ;; @@ -762,6 +770,41 @@ mysqld daemon not started" fi # +# Flush and purge buffers/caches. +# + +if @TARGET_LINUX@ && test $flush_caches -eq 1 +then + # Locate sync, ensure it exists. + if ! my_which sync > /dev/null 2>&1 + then + log_error "sync command not found, required for --flush-caches" + exit 1 + # Flush file system buffers. + elif ! sync + then + # Huh, the sync() function is always successful... + log_error "sync failed, check if sync is properly installed" + fi + + # Locate sysctl, ensure it exists. + if ! my_which sysctl > /dev/null 2>&1 + then + log_error "sysctl command not found, required for --flush-caches" + exit 1 + # Purge page cache, dentries and inodes. + elif ! sysctl -q -w vm.drop_caches=3 + then + log_error "sysctl failed, check the error message for details" + exit 1 + fi +elif test $flush_caches -eq 1 +then + log_error "--flush-caches is not supported on this platform" + exit 1 +fi + +# # Uncomment the following lines if you want all tables to be automatically # checked and repaired during startup. You should add sensible key_buffer # and sort_buffer values to my.cnf to improve check performance or require @@ -781,6 +824,31 @@ fi cmd="`mysqld_ld_preload_text`$NOHUP_NICENESS" +# +# Set mysqld's memory interleave policy. +# + +if @TARGET_LINUX@ && test $numa_interleave -eq 1 +then + # Locate numactl, ensure it exists. + if ! my_which numactl > /dev/null 2>&1 + then + log_error "numactl command not found, required for --numa-interleave" + exit 1 + # Attempt to run a command, ensure it works. + elif ! numactl --interleave=all true + then + log_error "numactl failed, check if numactl is properly installed" + fi + + # Launch mysqld with numactl. + cmd="$cmd numactl --interleave=all" +elif test $numa_interleave -eq 1 +then + log_error "--numa-interleave is not supported on this platform" + exit 1 +fi + for i in "$ledir/$MYSQLD" "$defaults" "--basedir=$MY_BASEDIR_VERSION" \ "--datadir=$DATADIR" "--plugin-dir=$plugin_dir" "$USER_OPTION" do |