summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorJan Lindström <jplindst@mariadb.org>2013-09-09 10:38:58 +0300
committerJan Lindström <jplindst@mariadb.org>2013-09-09 10:38:58 +0300
commit9c85ced30dc4f6d28b4fe7ad1b73ca76f3c43a44 (patch)
tree07be8bddba2953d42b8f16d637bdcea505eb2513 /scripts
parent0880db56407c8eb2d8cd7804471ee2fd5662d150 (diff)
downloadmariadb-git-9c85ced30dc4f6d28b4fe7ad1b73ca76f3c43a44.tar.gz
Merge fix.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/mysqld_safe.sh68
1 files changed, 68 insertions, 0 deletions
diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh
index 7db2a5605e1..113c3236fab 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.
@@ -312,6 +318,8 @@ parse_arguments() {
--syslog-tag=*) syslog_tag="$val" ;;
--timezone=*) TZ="$val"; export TZ; ;;
--wsrep[-_]urls=*) wsrep_urls="$val"; ;;
+ --flush-caches) flush_caches=1 ;;
+ --numa-interleave) numa_interleave=1 ;;
--wsrep[-_]provider=*)
if test -n "$val" && test "$val" != "none"
then
@@ -834,6 +842,40 @@ mysqld daemon not started"
fi
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
@@ -854,6 +896,32 @@ 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