[packages/percona-server/v5.0.x: 156/202] This commit was manufactured by cvs2git to create branch 'MYSQL_5_0'.
glen
glen at pld-linux.org
Wed Oct 21 16:22:08 CEST 2015
commit b9c8dcd33857e9b0ee1f71263c538a675e07780c
Author: cvs2git <feedback at pld-linux.org>
Date: Thu Dec 16 18:25:16 2010 +0000
This commit was manufactured by cvs2git to create branch 'MYSQL_5_0'.
Cherrypick from master 2010-12-16 18:25:16 UTC Elan Ruusamäe <glen at pld-linux.org> '- skip broken and unwanted patches':
my.cnf -> 1.1
mysql-client.conf -> 1.4
percona.sh -> 1.7
Cherrypick from master 2009-10-27 12:34:13 UTC Elan Ruusamäe <glen at pld-linux.org> '- fixing php-cli with php-mysql ext segfault:':
mysql-fix-dummy-thread-race-condition.patch -> 1.1
Cherrypick from master 2010-04-21 08:51:17 UTC Elan Ruusamäe <glen at pld-linux.org> '- skip empty lines with db cluster finding':
mysql.init -> 1.143
my.cnf | 2 +
mysql-client.conf | 7 +
mysql-fix-dummy-thread-race-condition.patch | 64 +++
mysql.init | 652 ++++++++++++++++++++++++++++
percona.sh | 70 +++
5 files changed, 795 insertions(+)
---
diff --git a/my.cnf b/my.cnf
new file mode 100644
index 0000000..c84a6cf
--- /dev/null
+++ b/my.cnf
@@ -0,0 +1,2 @@
+[client]
+user=mysql
diff --git a/mysql-client.conf b/mysql-client.conf
new file mode 100644
index 0000000..ccaab92
--- /dev/null
+++ b/mysql-client.conf
@@ -0,0 +1,7 @@
+#[client]
+#default-character-set=utf8
+#default-character-set=latin2
+
+[mysql]
+prompt='\\R:\\m:\\s mysql{\\c}> '
+show-warnings
diff --git a/mysql-fix-dummy-thread-race-condition.patch b/mysql-fix-dummy-thread-race-condition.patch
new file mode 100644
index 0000000..f19cf43
--- /dev/null
+++ b/mysql-fix-dummy-thread-race-condition.patch
@@ -0,0 +1,64 @@
+## fix-dummy-thread-race-condition.dpatch by <mkoegler at auto.tuwien.ac.at>
+##
+## Avoid dummy thread for pthread_exit workaround
+
+--- mysql-5.0.87/mysys/my_thr_init.c~ 2009-10-27 13:28:45.000000000 +0200
++++ mysql-5.0.87/mysys/my_thr_init.c 2009-10-27 13:29:49.502552171 +0200
+@@ -47,23 +47,6 @@
+ pthread_mutexattr_t my_errorcheck_mutexattr;
+ #endif
+
+-#ifdef TARGET_OS_LINUX
+-
+-/*
+- Dummy thread spawned in my_thread_global_init() below to avoid
+- race conditions in NPTL pthread_exit code.
+-*/
+-
+-static pthread_handler_t
+-nptl_pthread_exit_hack_handler(void *arg __attribute__((unused)))
+-{
+- /* Do nothing! */
+- pthread_exit(0);
+- return 0;
+-}
+-
+-#endif /* TARGET_OS_LINUX */
+-
+ static uint get_thread_lib(void);
+
+ /*
+@@ -71,33 +71,6 @@
+ return 1;
+ }
+
+-#ifdef TARGET_OS_LINUX
+- /*
+- BUG#24507: Race conditions inside current NPTL pthread_exit()
+- implementation.
+-
+- To avoid a possible segmentation fault during concurrent
+- executions of pthread_exit(), a dummy thread is spawned which
+- initializes internal variables of pthread lib. See bug description
+- for a full explanation.
+-
+- TODO: Remove this code when fixed versions of glibc6 are in common
+- use.
+- */
+- if (thd_lib_detected == THD_LIB_NPTL)
+- {
+- pthread_t dummy_thread;
+- pthread_attr_t dummy_thread_attr;
+-
+- pthread_attr_init(&dummy_thread_attr);
+- pthread_attr_setdetachstate(&dummy_thread_attr, PTHREAD_CREATE_JOINABLE);
+-
+- if (pthread_create(&dummy_thread,&dummy_thread_attr,
+- nptl_pthread_exit_hack_handler, NULL) == 0)
+- (void)pthread_join(dummy_thread, NULL);
+- }
+-#endif /* TARGET_OS_LINUX */
+-
+ #ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
+ /*
+ Set mutex type to "fast" a.k.a "adaptive"
diff --git a/mysql.init b/mysql.init
new file mode 100644
index 0000000..3072aad
--- /dev/null
+++ b/mysql.init
@@ -0,0 +1,652 @@
+#!/bin/sh
+#
+# mysql A very fast and reliable SQL database engine
+#
+# chkconfig: 2345 84 25
+#
+# description: A very fast and reliable SQL database engine.
+#
+# $Id$
+
+# Source function library
+. /etc/rc.d/init.d/functions
+
+# Get network config
+. /etc/sysconfig/network
+
+# Get service config
+if [ -f /etc/sysconfig/mysql ]; then
+ . /etc/sysconfig/mysql
+else
+ nls "Error: %s not found" /etc/sysconfig/mysql
+ nls "%s can't be run." MySQL
+ exit 1
+fi
+
+if [ -n "$MYSQL_DB_CLUSTERS" ]; then
+ nls "Warning: MYSQL_DB_CLUSTERS is set. It's obsolete. Use %s instead." /etc/mysql/clusters.conf
+fi
+
+if [ -f /etc/mysql/clusters.conf ]; then
+ MYSQL_DB_CLUSTERS=$(awk -F= '!/^#/ && /=/{print $2}' /etc/mysql/clusters.conf)
+ if [ -z "$MYSQL_DB_CLUSTERS" ]; then
+ nls "Warning: there are no configured clusters."
+ fi
+
+else
+ nls "Warning: Missing clusters config file %s" /etc/mysql/clusters.conf
+ if [ -z "$MYSQL_DB_CLUSTERS" ]; then
+ nls "Warning: there are no configured clusters."
+ nls "Using default cluster /var/lib/mysql (compatibility mode)"
+ MYSQL_DB_CLUSTERS=/var/lib/mysql
+ fi
+fi
+
+
+# Check that networking is up
+if is_yes "${NETWORKING}"; then
+ if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status -a "$1" != init ]; then
+ msg_network_down MySQL
+ exit 1
+ fi
+else
+ exit 0
+fi
+
+action="$1"
+
+# any db cluster as command line argument?
+if [ $# -gt 1 ]; then
+ shift
+ # perform action for specified clusters only
+ for a in "$@"; do
+ # try auto resolving from /etc/mysql/clusters.conf
+ if [[ "$a" != /* ]]; then
+ m=$(awk -va="$a" -F= 'substr($0, 1, length(a)) == a {print $1}' /etc/mysql/clusters.conf)
+ if [ -z "$m" ]; then
+ echo >&2 "Cluster name '$a' did not match anything!"
+ exit 1
+ fi
+ if [ $(echo "$m" | wc -l) -gt 1 ]; then
+ echo >&2 "Cluster name '$a' ambiguous:" $m
+ exit 1
+ fi
+ a=$(awk -va="$a" -F= 'substr($0, 1, length(a)) == a {print $2}' /etc/mysql/clusters.conf)
+ fi
+ DB_CLUSTERS="$DB_CLUSTERS $a"
+ done
+else
+ DB_CLUSTERS="$MYSQL_DB_CLUSTERS"
+fi
+
+# global error log, if mysqld.conf hasn't migrated to log-error style
+MYSQL_ERRLOG=/var/log/mysql/mysqld.log
+MYSQL_STOP_WAIT_TIME=${MYSQL_STOP_WAIT_TIME:-900}
+
+#
+# Useful functions.
+#
+
+#
+# check for mysql status
+#
+# arguments:
+# $1 - db cluster
+# $2 - start|stop
+#
+# sets variables:
+# MYSQL_STATUS = starting | running | not running | died
+# MYSQL_PID = pid of mysqld process
+#
+mysqlstatus() {
+ clusterdir="$1"
+ mode="$2"
+
+ mysqlgetconfig "$clusterdir"
+
+ MYSQL_STATUS="not running"
+ MYSQL_PID="unknown"
+ MYSQL_PIDFILE_PID=""
+ MYSQL_GREP_PID=""
+
+ if [ -f "$MYSQL_PIDFILE" ]; then
+ MYSQL_PIDFILE_PID=$(cat "$MYSQL_PIDFILE")
+ fi
+
+ if [ -n "$MYSQL_PIDFILE_PID" ]; then
+ MYSQL_PID=$MYSQL_PIDFILE_PID
+ if [ ! -d "/proc/$MYSQL_PID" ]; then
+ MYSQL_STATUS="died"
+ return
+ elif (grep -qa "$MYSQL_PIDFILE" /proc/$MYSQL_PID/cmdline 2> /dev/null); then
+ MYSQL_STATUS="running"
+ return
+ fi
+ fi
+
+ if [ "$mode" = "start" ]; then
+ MYSQL_GREP_PID=$(grep -lE "^/usr/sbin/mysqld.*${MYSQL_PIDFILE}" /proc/[0-9]*/cmdline 2> /dev/null | awk -F "/" '{ print $3; exit; }')
+ if [ -n "$MYSQL_GREP_PID" ]; then
+ MYSQL_PID=$MYSQL_GREP_PID
+ if grep -qa "$MYSQL_PIDFILE" /proc/$MYSQL_PID/cmdline 2> /dev/null; then
+ if [ -f "$MYSQL_PIDFILE" ]; then
+ MYSQL_PIDFILE_PID=$(cat "$MYSQL_PIDFILE")
+ fi
+ if [ -n "$MYSQL_PIDFILE_PID" ]; then
+ MYSQL_PID=$MYSQL_PIDFILE_PID
+ MYSQL_STATUS="running"
+ return
+ else
+ MYSQL_STATUS="starting"
+ return
+ fi
+ fi
+ fi
+ fi
+
+ # else default, "not running"
+}
+
+# get mysql configuration in variables
+# MYSQL_CONFIG MYSQL_CLUSTER_DIR
+# MYSQL_DATA_DIR MYSQL_USER MYSQL_PIDFILE MYSQL_SOCKET MYSQL_PORT MYSQL_BIND_ADDRESS MYSQL_SKIP_NETWORKING MYSQL_LOG_ERROR
+#
+# arguments
+# $1 - db cluster
+
+mysqlgetconfig() {
+ local clusterdir="$1" config_file
+
+ # emulate old behaviour if only one cluster specified
+ if [ "$clusterdir" = "$MYSQL_DB_CLUSTERS" -a "$clusterdir" = "/var/lib/mysql" -a -f /etc/mysqld.conf ]; then
+ MYSQL_RA_COMPAT=yes
+ config_file=/etc/mysqld.conf
+ else
+ local config=$(awk -F= -vclusterdir="$clusterdir" '!/^#/{ if (clusterdir == $2) print $1}' /etc/mysql/clusters.conf)
+ if [[ $config = /* ]]; then
+ config_file="$config"
+ elif [ -f "/etc/mysql/$config" ]; then
+ config_file="/etc/mysql/$config"
+ else
+ config_file="$clusterdir/mysqld.conf"
+ fi
+ fi
+
+ MYSQL_CLUSTER_DIR="$clusterdir"
+
+ if [ -z "$config_file" ]; then
+ nls "Error: Can't find config file for %s cluster" "$clusterdir"
+ exit 6
+ else
+ MYSQL_CONFIG="$config_file"
+ fi
+
+ if [ ! -f "$config_file" ]; then
+ nls "Error: config file %s not found" "$config_file"
+ nls "MySQL can't be run. Did you initialize DB by doing \`$0 init'?"
+ exit 6
+ fi
+
+ # reset to initial state
+ MYSQL_DATA_DIR= MYSQL_USER= MYSQL_PIDFILE= MYSQL_SOCKET= MYSQL_PORT= MYSQL_BIND_ADDRESS= MYSQL_SKIP_NETWORKING= MYSQL_LOG_ERROR=
+
+ eval `awk -F= '
+ {
+ # undos
+ gsub(/\r$/, "");
+
+ # trim spaces
+ gsub(/^[\t ]*|[\t ]*$/, "", $1);
+ gsub(/^[\t ]*|[\t ]*$/, "", $2);
+ }
+
+ # skip comments and empty lines
+ /^[;#]|^ *$/ { next }
+
+ /^[ \t]*\[.*\][ \t]*$/ {
+ match($0, /\[.*\]/);
+ section = substr($0, RSTART + 1, RSTART + RLENGTH - 3);
+ next;
+ }
+
+ section == "mysqld" {
+ if ($1 == "datadir") {
+ printf("MYSQL_DATA_DIR=%s;", $2);
+ } else if ($1 == "user") {
+ printf("MYSQL_USER=%s;", $2);
+ } else if ($1 == "pid-file") {
+ printf("MYSQL_PIDFILE=%s;", $2);
+ } else if ($1 == "socket") {
+ printf("MYSQL_SOCKET=%s;", $2);
+ } else if ($1 == "port") {
+ printf("MYSQL_PORT=%s;", $2);
+ } else if ($1 == "bind-address") {
+ printf("MYSQL_BIND_ADDRESS=%s;", $2);
+ } else if ($1 == "skip-networking") {
+ printf("MYSQL_SKIP_NETWORKING=1;");
+ } else if ($1 == "log-error") {
+ printf("MYSQL_LOG_ERROR=%s;", $2);
+ }
+ }
+ ' $config_file`
+
+ # error log not defined in config file. add one
+ if [ -z "$MYSQL_LOG_ERROR" ]; then
+ MYSQL_LOG_ERROR=$MYSQL_ERRLOG
+ else
+ # unset, so mysqld would use value from config itself
+ unset MYSQL_LOG_ERROR
+ fi
+
+ if is_yes "$MYSQL_RA_COMPAT"; then
+ MYSQL_DATA_DIR_SUB=""
+ else
+ MYSQL_DATA_DIR_SUB="/mysqldb"
+ fi
+
+ if [ -z "$MYSQL_DATA_DIR" -o "$MYSQL_DATA_DIR" != "${clusterdir}${MYSQL_DATA_DIR_SUB}/db" ]; then
+ nls "Error: datadir specified in %s should be %s" "$config_file" "$clusterdir${MYSQL_DATA_DIR_SUB}/db"
+ nls " MySQL can't be run."
+ exit 6
+ fi
+
+ if [ -z "$MYSQL_PIDFILE" -o "$MYSQL_PIDFILE" != "$clusterdir${MYSQL_DATA_DIR_SUB}/mysql.pid" ]; then
+ nls "Error: pid-file specified in %s should be %s" "$config_file" "$clusterdir${MYSQL_DATA_DIR_SUB}/mysql.pid"
+ nls " MySQL can't be run."
+ exit 6
+ fi
+
+ if [ -z "$MYSQL_USER" ]; then
+ echo "$(nls 'MySQL user not configured properly')"'!' >&2
+ nls "Edit %s and configure it." "$config_file" >&2
+ exit 6
+ fi
+}
+
+# start mysql
+mysqlstart() {
+ local clusterdir="$1"
+ mysqlgetconfig "$clusterdir"
+ if [ ! -d "$MYSQL_DATA_DIR/mysql" ]; then
+ nls "MySQL cluster %s not initialized." "$clusterdir"
+ nls "Try \`%s init %s' before start." "$0" "$clusterdir"
+ exit 6
+ fi
+
+ msg_starting "MySQL $clusterdir"; busy
+ [ -z "$DEFAULT_SERVICE_RUN_NICE_LEVEL" ] && DEFAULT_SERVICE_RUN_NICE_LEVEL=0
+ rm -f "$MYSQL_PIDFILE"
+
+
+ TMPDIR=/tmp nice -n ${SERVICE_RUN_NICE_LEVEL:-$DEFAULT_SERVICE_RUN_NICE_LEVEL} \
+ /usr/bin/setsid /usr/sbin/mysqld \
+ --defaults-file=$MYSQL_CONFIG \
+ --datadir=$MYSQL_DATA_DIR \
+ --pid-file=$MYSQL_PIDFILE \
+ ${MYSQL_LOG_ERROR:+--log-error="$MYSQL_LOG_ERROR"} \
+ $MYSQL_OPTIONS &
+ pid=$!
+
+ sleep 0.1
+ mysqlstatus "$clusterdir" start
+ # it takes longer for mysqld to start and create pidfile if it has to recover innodb transactions
+ if [ "$MYSQL_STATUS" = "starting" ]; then
+ echo ""
+ show "Waiting for MySQL to start"
+ busy
+
+ # while the pid is running, mysql is starting up
+ # if the pidfile was created, it started up successfully
+ # if either case fails we break and report status
+ while true; do
+ [ -d /proc/$pid ] || break
+ [ -f "$MYSQL_PIDFILE" ] && break
+ sleep 0.2
+ done
+ fi
+
+ mysqlstatus "$clusterdir" start
+ if [ "$MYSQL_STATUS" = "running" -a "$MYSQL_PID" != "unknown" ]; then
+ ok
+ elif [ "$MYSQL_STATUS" = "died" ]; then
+ RETVAL=1
+ died
+ else
+ RETVAL=1
+ fail
+ fi
+}
+
+# stop mysql
+mysqlstop() {
+ local clusterdir="$1"
+ mysqlstatus "$clusterdir" stop
+ msg_stopping "MySQL $clusterdir"
+ busy
+
+ # try graceful shutdown -- send shutdown command
+ # requires mysql_sysadmin user proper privs
+ /usr/bin/mysqladmin --defaults-file=$MYSQL_CONFIG ${MYSQL_SOCKET:+--socket=$MYSQL_SOCKET} shutdown >/dev/null 2>&1
+ mysqlstatus "$clusterdir" stop
+
+ if [ "$MYSQL_PID" != "unknown" ]; then
+ kill -TERM "$MYSQL_PID" 2> /dev/null
+ for nr in $(seq 1 $(($MYSQL_STOP_WAIT_TIME*10))); do
+ [ -d "/proc/$MYSQL_PID" ] || break
+ sleep 0.1
+ done
+ fi
+
+ mysqlstatus "$clusterdir" stop
+ if [ "$MYSQL_STATUS" = "died" ]; then
+ died
+ elif [ "$MYSQL_STATUS" = "running" -o "$MYSQL_STATUS" = "starting" ]; then
+ fail
+ else
+ ok
+ fi
+}
+
+#
+# check for running mysql instances; if any instance is running then
+# create subsys lock file
+#
+mysqlsubsys() {
+ # check for every defined db cluster in sysconfig file
+ for mysqldir in $DB_CLUSTERS; do
+ mysqlstatus "$mysqldir"
+ if [ "$MYSQL_STATUS" = "running" ]; then
+ touch /var/lock/subsys/mysql
+ return
+ fi
+ done
+ rm -f /var/lock/subsys/mysql
+}
+
+mysqlinit() {
+ local clusterdir="$1"
+
+ if [ -f /etc/mysqld.conf ]; then
+ nls "Running in \`no cluster compat' mode: can't initialize database."
+ nls "Move /etc/mysqld.conf away and rerun \`$0 init' (new config will be in $clusterdir)."
+ exit 1
+ fi
+
+ if [ -f "$clusterdir/mysqld.conf" ]; then
+ mysqlgetconfig "$clusterdir"
+ else
+ MYSQL_USER="mysql"
+ MYSQL_CLUSTER_DIR="$clusterdir"
+ MYSQL_DATA_DIR="$clusterdir/mysqldb/db"
+ MYSQL_PIDFILE="$clusterdir/mysqldb/mysql.pid"
+ MYSQL_SOCKET="$clusterdir/mysqldb/mysql.sock"
+
+ # this $MYSQL_CONFIG will be created later
+ MYSQL_CONFIG="$MYSQL_CLUSTER_DIR/mysqld.conf"
+ fi
+
+ show "Initializing cluster %s" "$clusterdir"; echo
+
+ # Check if not exist init database
+ if [ -d "$MYSQL_DATA_DIR/mysql" ]; then
+ nls "Seems that database is initialized now. Remove by hand %s" "$MYSQL_DATA_DIR/mysql"
+ nls "before initializing database."
+ nls "For now skipping cluster %s." "$clusterdir"
+ return
+ fi
+
+ show "Installing MySQL system tables for $MYSQL_DATA_DIR"
+ busy
+ TMP=/tmp TMPDIR=/tmp
+
+ mkdir -p "$MYSQL_DATA_DIR" > /dev/null 2>&1
+ # Using mysql:mysql for MYSQL_CLUSTER_DIR is creating SECURITY hole, root:root is proper
+ chown root:root "$MYSQL_CLUSTER_DIR"
+ chown mysql:mysql "$MYSQL_CLUSTER_DIR/mysqldb" "$MYSQL_DATA_DIR" > /dev/null 2>&1
+ chmod 751 "$MYSQL_CLUSTER_DIR" "$MYSQL_CLUSTER_DIR/mysqldb"
+
+ if [ -f /usr/share/mysql/mysqld.conf -a ! -f "$MYSQL_CLUSTER_DIR/mysqld.conf" ]; then
+ sed -e "
+ s#\(datadir.*\)=.*#\1= $MYSQL_DATA_DIR#g;
+ s#\(pid-file.*\)=.*#\1= $MYSQL_PIDFILE#g;
+ s#\(socket.*\)=.*#\1= $MYSQL_SOCKET#g;
+ s#@clusterdir@#$MYSQL_CLUSTER_DIR#g;
+ " /usr/share/mysql/mysqld.conf > "$MYSQL_CLUSTER_DIR/mysqld.conf"
+ chown root:root "$MYSQL_CLUSTER_DIR/mysqld.conf"
+ chmod 640 "$MYSQL_CLUSTER_DIR/mysqld.conf"
+ fi
+
+ if [ ! -e /var/lib/mysql/mysql.sock ] || [ -L /var/lib/mysql/mysql.sock ] && [ -z "$(readlink /var/lib/mysql/mysql.sock)" ]; then
+ sock=${MYSQL_SOCKET#/var/lib/mysql/} # make it relative if possible
+ ln -s "$sock" /var/lib/mysql/mysql.sock
+ fi
+
+ cat > $MYSQL_DATA_DIR/mysql-init.sql <<-EOF
+ CREATE DATABASE mysql;
+ use mysql;
+ $(cat /usr/share/mysql/mysql_system_tables.sql)
+ $(sed -e "/@current_hostname/d" /usr/share/mysql/mysql_system_tables_data.sql)
+EOF
+
+ ok=0
+ /usr/sbin/mysqld \
+ --defaults-file=$MYSQL_CLUSTER_DIR/mysqld.conf \
+ --bootstrap \
+ --skip-grant-tables \
+ --skip-innodb \
+ --datadir=$MYSQL_DATA_DIR \
+ --user=$MYSQL_USER \
+ --slave-load-tmpdir=$MYSQL_DATA_DIR \
+ --tmpdir=$MYSQL_DATA_DIR \
+ --log-error=$MYSQL_ERRLOG \
+ < $MYSQL_DATA_DIR/mysql-init.sql && ok=1
+ [ -f $MYSQL_DATA_DIR/mysql/host.frm ] || ok=0
+
+ if [ "$ok" = 1 ]; then
+ rm -f $MYSQL_DATA_DIR/mysql-init.sql
+ ok
+ cat << END_OF_MSG
+
+PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL USERS!
+This is done, after starting database, in the order shown,
+with:
+
+For 'mysql_sysadmin' (RELOAD and SHUTDOWN privileges):
+echo "update mysql.user set password=password('newpassword') where user='mysql_sysadmin'; FLUSH PRIVILEGES;" | mysql -u mysql -S $MYSQL_SOCKET
+
+For 'mysql' user (ALL privileges, DB admin):
+echo "update mysql.user set password=password('newpassword') where user='mysql'; FLUSH PRIVILEGES;" | mysql -u mysql -S $MYSQL_SOCKET
+
+NOTE: mysql_sysadmin password should be placed to $MYSQL_CONFIG in
+mysqladmin section. See the manual for more instructions.
+(This user is used at logs rotation and server shutdown)
+
+END_OF_MSG
+ show "Filling help tables..."
+ ok=0
+ ( echo "use mysql;"; cat /usr/share/mysql/fill_help_tables.sql ) | \
+ /usr/sbin/mysqld \
+ --defaults-file=$MYSQL_CLUSTER_DIR/mysqld.conf \
+ --bootstrap \
+ --skip-grant-tables \
+ --skip-innodb \
+ --datadir=$MYSQL_DATA_DIR \
+ --user=$MYSQL_USER \
+ --slave-load-tmpdir=$MYSQL_DATA_DIR \
+ --tmpdir=$MYSQL_DATA_DIR \
+ --log-error=$MYSQL_ERRLOG \
+ && ok=1
+ if [ "$ok" = 1 ]; then
+ ok
+ else
+ cat << END_OF_MSG
+
+WARNING: HELP FILES ARE NOT COMPLETELY INSTALLED!
+The "HELP" command might not work properly.
+
+END_OF_MSG
+ fi
+ else
+ fail
+ cat << END_OF_MSG
+Installation of grant tables FAILED!
+
+The initialization SQL script was preserved at $MYSQL_DATA_DIR/mysql-init.sql
+
+Examine the logs in /var/log/mysql for more information. You can
+also try to start the mysqld daemon with:
+
+/usr/sbin/mysqld --skip-grant &
+
+You can use the command line tool mysql to connect to the mysql
+database and look at the grant tables:
+
+shell> mysql -u mysql mysql
+mysql> show tables
+
+Try 'mysqld --help' if you have problems with paths. Setting on
+logging in $MYSQL_DATA_DIR/mysqld.conf gives you a log in /var/log/mysql/query.log that
+may be helpful. The latest information about MySQL is available on the
+web at http://www.mysql.com/.
+
+Please check PLD Linux ftp site for newer versions of this package.
+
+Please consult the MySQL manual section: 'Problems running
+mysql_install_db', and the manual section that describes problems on
+your OS. Another information source is the MySQL email archive.
+
+END_OF_MSG
+ exit 1
+ fi
+}
+
+#
+# End of useful functions.
+#
+
+start() {
+ local mysqldir
+ for mysqldir in $DB_CLUSTERS; do
+ mysqlstatus "$mysqldir" start
+ if [ "$MYSQL_STATUS" = "running" ]; then
+ msg_already_running "MySQL $mysqldir"
+ else
+ mysqlstart "$mysqldir"
+ fi
+ done
+ mysqlsubsys
+}
+
+stop() {
+ local mysqldir
+ for mysqldir in $DB_CLUSTERS; do
+ mysqlstatus "$mysqldir" stop
+ if [ "$MYSQL_STATUS" = "not running" ]; then
+ msg_not_running "MySQL $mysqldir"
+ else
+ mysqlstop "$mysqldir"
+ fi
+ done
+ mysqlsubsys
+}
+
+condrestart() {
+ if [ ! -f /var/lock/subsys/mysql ]; then
+ msg_not_running "MySQL"
+ RETVAL=$1
+ return
+ fi
+
+ stop
+ start
+}
+
+RETVAL=0
+case "$action" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart)
+ stop
+ start
+ ;;
+ try-restart)
+ condrestart 0
+ ;;
+ force-reload)
+ condrestart 7
+ ;;
+ init)
+ for mysqldir in $DB_CLUSTERS; do
+ mysqlinit "$mysqldir"
+ done
+ exit $?
+ ;;
+ flush-logs)
+ for mysqldir in $DB_CLUSTERS; do
+ mysqlgetconfig "$mysqldir"
+ # just if mysqld is really running
+ if /usr/bin/mysqladmin --defaults-file="$MYSQL_CONFIG" --socket="$MYSQL_SOCKET" ping >/dev/null 2>&1; then
+ /usr/bin/mysqladmin --defaults-file="$MYSQL_CONFIG" --socket="$MYSQL_SOCKET" flush-logs
+ fi
+ done
+ ;;
+ status)
+ for mysqldir in $DB_CLUSTERS; do
+ mysqlstatus "$mysqldir"
+ if [ "$MYSQL_STATUS" = "running" ]; then
+ addr=${MYSQL_BIND_ADDRESS:-0.0.0.0}
+ port=${MYSQL_PORT:-3306}
+ socket=${MYSQL_SOCKET:-/var/lib/mysql/mysql.sock}
+ pid=$MYSQL_PID
+ nls "MySQL cluster %s, pid %s\n" "$mysqldir" "$pid"
+ [ -z "$MYSQL_SKIP_NETWORKING" ] && nls "\ttcp:%s:%s\n" "$addr" "$port"
+ nls "\tunix:%s\n" "$socket"
+ pids="$pids/$MYSQL_PID/"
+ progress "$MYSQL_STATUS"
+ else
+ show "MySQL cluster %s" "$mysqldir"
+ progress "$MYSQL_STATUS" "$CFAIL"
+ fi
+ echo
+ done
+
+ for pid in $(/sbin/pidof mysqld); do
+ if [[ $pids != */$pid/* ]]; then
+ running="$running $pid"
+ fi
+ done
+
+ if [ $# = 1 -a "$running" ]; then
+ nls "Warning: MySQL Daemon processes not under clusters.conf control:"
+ # see if we can display their status
+ for pid in $running; do
+ datadir=$(cat /proc/$pid/cmdline | tr '\0' '\n' | fgrep -- --datadir=)
+ datadir=${datadir#--datadir=} # strip --datadir
+ mysqldir=${datadir%/mysqldb/db} # strip /mysqldb/db
+ mysqlstatus "$mysqldir"
+ if [ "$MYSQL_STATUS" = "running" ]; then
+ addr=${MYSQL_BIND_ADDRESS:-0.0.0.0}
+ port=${MYSQL_PORT:-3306}
+ socket=${MYSQL_SOCKET:-/var/lib/mysql/mysql.sock}
+ nls "MySQL cluster %s, pid %s\n" "$mysqldir" "$pid"
+ [ -z "$MYSQL_SKIP_NETWORKING" ] && nls "\ttcp:%s:%s\n" "$addr" "$port"
+ nls "\tunix:%s\n" "$socket"
+ progress "$MYSQL_STATUS"
+ else
+ show "MySQL cluster %s" "$mysqldir"
+ progress "$MYSQL_STATUS" "$CFAIL"
+ fi
+ echo
+ done
+ fi
+ ;;
+ *)
+ msg_usage "$0 {start|stop|restart|try-restart|force-reload|init|flush-logs|status}"
+ exit 3
+esac
+
+exit $RETVAL
diff --git a/percona.sh b/percona.sh
new file mode 100644
index 0000000..0b6472e
--- /dev/null
+++ b/percona.sh
@@ -0,0 +1,70 @@
+#!/bin/sh
+# updates percona patches
+# http://www.percona.com/docs/wiki/release:start
+
+version=release-5.1.53-11
+bzr_branch=lp:percona-server/$version
+branch=MYSQL_5_1
+
+filter_names() {
+ # mysql_dump_ignore_ct.patch is broken, therefore we skip
+ grep -v 'mysql_dump_ignore_ct.patch' | \
+ grep -v 'percona-support.patch' | \
+ grep -v 'mysqld_safe_syslog.patch' | \
+ grep -v 'mysql-test.diff'
+}
+
+filter_files() {
+ filterdiff -x '*/configure'
+}
+
+if [ -d $version ]; then
+ cd $version
+ bzr up
+ cd ..
+else
+ bzr branch $bzr_branch $version
+fi
+
+> .percona.spec
+> .patch.spec
+i=100
+for patch in $(cat $version/series | filter_names); do
+ file=mysql-$patch
+ cat $version/$patch | filter_files > $file
+
+ if [ -z "$(awk -vfile=$file -F/ '$2 == file{print}' CVS/Entries)" ]; then
+ cvs add $file
+ ${branch:+cvs up -r $branch $file}
+ fi
+
+ printf "Patch%d:\t%s\n" $i %{name}-$patch >> .percona.spec
+ printf "%%patch%d -p1\n" $i >> .patch.spec
+ i=$((i+1))
+done
+
+# update PatchX section
+sed -i -e '
+/^# <percona patches/,/^# <\/percona>/ {
+ /^ <\/percona>/b
+ /^# <percona patches/ {
+ p # print header
+ r .percona.spec
+ a# </percona>
+ }
+ d
+}
+' mysql.spec
+
+# update %patchX section
+sed -i -e '
+/^# <percona %patches/,/^# <\/percona>/ {
+ /^ <\/percona>/b
+ /^# <percona %patches/ {
+ p # print header
+ r .patch.spec
+ a# </percona>
+ }
+ d
+}
+' mysql.spec
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/percona-server.git/commitdiff/431f68fe79a66d5dfdd53f2655709e6c925fbc22
More information about the pld-cvs-commit
mailing list