summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancesco Riosa <vivo@gentoo.org>2006-01-31 00:59:05 +0000
committerFrancesco Riosa <vivo@gentoo.org>2006-01-31 00:59:05 +0000
commitf035de94cb635f94d93afef5c84414bfe3332160 (patch)
tree0b4b636d6fdf0e9cc43cc60b8036679c3f68e2d9 /dev-db/mysql
parentsee dev-db/mysql ChangeLog (diff)
downloadhistorical-f035de94cb635f94d93afef5c84414bfe3332160.tar.gz
historical-f035de94cb635f94d93afef5c84414bfe3332160.tar.bz2
historical-f035de94cb635f94d93afef5c84414bfe3332160.zip
- pointer to http://www.gentoo.org/doc/en/mysql-upgrade-slotted.xml added
- workarounds for test baselayout, also again starting also slotted MySQL > from only one file /etc/init.d/mysql Package-Manager: portage-2.1_pre3-r1
Diffstat (limited to 'dev-db/mysql')
-rw-r--r--dev-db/mysql/ChangeLog9
-rw-r--r--dev-db/mysql/Manifest13
-rw-r--r--dev-db/mysql/files/mysql-slot.conf.d-r127
-rw-r--r--dev-db/mysql/files/mysql-slot.conf.d-r287
-rw-r--r--[-rwxr-xr-x]dev-db/mysql/files/mysql-slot.rc6-r3 (renamed from dev-db/mysql/files/mysql-slot.rc6-r2)189
5 files changed, 165 insertions, 160 deletions
diff --git a/dev-db/mysql/ChangeLog b/dev-db/mysql/ChangeLog
index 0d9a7e1d4abc..b6c91629e007 100644
--- a/dev-db/mysql/ChangeLog
+++ b/dev-db/mysql/ChangeLog
@@ -1,6 +1,13 @@
# ChangeLog for dev-db/mysql
# Copyright 2002-2006 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/dev-db/mysql/ChangeLog,v 1.294 2006/01/24 19:25:57 vivo Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-db/mysql/ChangeLog,v 1.295 2006/01/31 00:59:05 vivo Exp $
+
+ 31 Jan 2006; Francesco Riosa <vivo@gentoo.org> files/mysql-slot.conf.d-r1,
+ -files/mysql-slot.conf.d-r2, -files/mysql-slot.rc6-r2,
+ +files/mysql-slot.rc6-r3:
+ - pointer to http://www.gentoo.org/doc/en/mysql-upgrade-slotted.xml added
+ - workarounds for test baselayout, also again starting also slotted MySQL
+ > from only one file /etc/init.d/mysql
24 Jan 2006; Francesco Riosa <vivo@gentoo.org> +files/my.cnf-4.1-r1,
+files/logrotate-slot.mysql, files/mysql-slot.rc6-r2,
diff --git a/dev-db/mysql/Manifest b/dev-db/mysql/Manifest
index 4417707e9503..64ae85cfd974 100644
--- a/dev-db/mysql/Manifest
+++ b/dev-db/mysql/Manifest
@@ -1,7 +1,7 @@
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
-MD5 84ebd6a4f165a427c434e430088dde23 ChangeLog 59702
+MD5 2f23d9450b8f8f616678fecfd113de8a ChangeLog 60058
MD5 c6fcd70c34bed04e59808ec71c5bedfb files/digest-mysql-3.23.58-r1 140
MD5 0feb3b501c47708ea13707c8e4cdde9c files/digest-mysql-4.0.25-r2 139
MD5 201c8b31cd9eb58eec712e37d6f0c328 files/digest-mysql-4.0.26 139
@@ -23,11 +23,10 @@ MD5 625b4007f035e3da9a4f1eeee1db6b9c files/mysql-4.0.15.rc6 1187
MD5 d0fbdf4e41f2b52210eef6cb3a53e128 files/mysql-4.0.24-r1.rc6 1662
MD5 356c1b4211a0b3d229bcb09c7c8742a7 files/mysql-4.0.24-r2.rc6 2151
MD5 c8a9f17eb53cb46bd7ec6b3105cd8d23 files/mysql-slot.conf.d 3218
-MD5 624541a36c1aae85e3999078d2468215 files/mysql-slot.conf.d-r1 2999
-MD5 7855af91fd7c2253e5da6b6a0e245375 files/mysql-slot.conf.d-r2 3817
+MD5 9e2fe99528ea29fb4b4da6b7c564c90c files/mysql-slot.conf.d-r1 3693
MD5 2e915001528cb4b44591d907168b6a51 files/mysql-slot.rc6 8691
MD5 8158f25fbd80fba48f0d01b0889ea0b3 files/mysql-slot.rc6-r1 9016
-MD5 e498f5d3b097ab0ab2db0e46b2a8e9a0 files/mysql-slot.rc6-r2 7883
+MD5 c3f14442c46fb9f2941aa9ff37b9b199 files/mysql-slot.rc6-r3 10061
MD5 73be6460f548f6f73c70246a4cfd13a0 files/mysql.init 886
MD5 9ff84042930f67b14f418a9dcf78d860 files/mysqlmanager-slot.conf.d 1021
MD5 69488d8c4aca1adf37e4c24b39305487 files/mysqlmanager-slot.rc6 6614
@@ -45,7 +44,7 @@ MD5 51a06a62df32804d95eb0865d5117f07 mysql-5.1.4_alpha-r30.ebuild 1980
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
-iD8DBQFD1n9fKolR564NvWYRAvJLAKCL29ZHRrEqLQecCU3RcNoFMaVcrACfXK8a
-KLovDnpK/aHzmeh43IFJmFE=
-=u3z+
+iD8DBQFD3rZqKolR564NvWYRAl8LAKCKtUC1hH+Gne8W3mllc+AAhDT6hgCgw57l
+AMJElS9ZNOsipkkk2VCxIFU=
+=yx5B
-----END PGP SIGNATURE-----
diff --git a/dev-db/mysql/files/mysql-slot.conf.d-r1 b/dev-db/mysql/files/mysql-slot.conf.d-r1
index fae38f271506..faac4ad9031d 100644
--- a/dev-db/mysql/files/mysql-slot.conf.d-r1
+++ b/dev-db/mysql/files/mysql-slot.conf.d-r1
@@ -16,8 +16,8 @@
# mycnf : string [full path to my.cnf]
# : specify the path to my.cnf file to be used
# ----------------+-----------------------------------------------------------
-# startup_timeout : integer [seconds] default 5
-# : time to wait for mysqld up and running, after this it's
+# startup_timeout : integer [seconds] default 15
+# : time to wait for mysqld up and running, after this it's
# : marked as failed
# ----------------+-----------------------------------------------------------
#
@@ -44,21 +44,34 @@
# Be more verbose accept values from 1 to 4
#DEBUG=4
#
-# The default location for the "master" pid file
-#MYSQL_GLOB_PID_FILE="/var/run/svc-started-mysqld"
+# The default location for the "master" pid file
+# MYSQL_GLOB_PID_FILE="/var/run/svc-started-mysqld"
#
# The timeout for a failed attempt to stop a server
# STOPTIMEOUT=120
#
-## Examples:
+## The parameters are passed in a bash array variable,
+# the variable name is mysql_slot_[server-ver]_[server-num]
+# Where "server-ver" and "server-num" are optional.
+# in case are defined "server-num" MUST be of three digits.
+# The first digit is the mayor version, the following two the minor
+# i.e. having installed mysql-5.1.x "server-num" will be "501"
+# "server-num" it's an optional number used mainly to start more servers
+# of the same version.
+#
+# The /etc/init.d/mysql-* script will choose the parameters analyzing it's own name
+# i.e. /etc/init.d/mysql-501 will look for mysql_slot_501
+# side note the script could be called "mysql-501_1" or "mysql.501.1" with the same result
+#
+# Examples:
#
# start a default server with default options:
#mysql_slot_0=()
#
# start MySQL 7.5.x reniced, overriding some start parameters
#mysql_slot_705=(
-# "nice=-5"
+# "nice=-5"
# "server-id=123"
# "log-bin="myhost"
# "port=3307"
@@ -66,7 +79,7 @@
#
# start another server, same version, different my.cnf
#mysql_slot_705_1=(
-# "mycnf=/home/test/my.cnf"
+# "mycnf=/home/test/my.cnf"
# "server-id=124"
#)
#
diff --git a/dev-db/mysql/files/mysql-slot.conf.d-r2 b/dev-db/mysql/files/mysql-slot.conf.d-r2
deleted file mode 100644
index 62c1320d59f8..000000000000
--- a/dev-db/mysql/files/mysql-slot.conf.d-r2
+++ /dev/null
@@ -1,87 +0,0 @@
-# here is where to define which server start.
-#> Additional parameters to be passed to mysqld at startup may be added here,
-#> these one will override the ones in "my.cnf".
-#
-# Each /etc/init.d/mysql-* script read it's own here, see at the end for
-#> a deeper explanation
-#
-# Below are described some suggested parameters to use
-# The parameters not recognized will be passed through to the mysqld daemon
-# To avoid starting a server just comment it's definition
-# Last but not least, spaces are NOT allowed inside the parameters
-#
-# Parameter : description
-# ----------------+-----------------------------------------------------------
-# nice : integer [-20 .. 19 ] default 0
-# : change the priority of the server -20 (high) to 19 (low)
-# : see "man nice 1" for description
-# ----------------+-----------------------------------------------------------
-# mycnf : string [full path to my.cnf]
-# : specify the path to my.cnf file to be used
-# ----------------+-----------------------------------------------------------
-# startup_timeout : integer [seconds] default 15
-# : time to wait for mysqld up and running, after this it's
-# : marked as failed
-# ----------------+-----------------------------------------------------------
-# stop_timeout : integer [seconds] default 120
-# : time to wait for a clean mysql shutdown
-# ----------------+-----------------------------------------------------------
-#
-# Additional parameters
-# Parameter : description
-# ----------------+-----------------------------------------------------------
-# server-id : integer [1 .. 255]
-# : Uniquely identifies the server instance in the community
-# : of replication partners.
-# ----------------+-----------------------------------------------------------
-# port : integer [1025 .. 65535] default 3306
-# : Port number to use for connection.
-# : loose any meaning if skip-networking is set.
-# ----------------+-----------------------------------------------------------
-# skip-networking : NULL, Don't allow connection with TCP/IP.
-# log-bin : string [name of the binlog files]
-# : Log update queries in binary format. Optional (but
-# : strongly recommended to avoid replication problems if
-# : server's hostname changes) argument should be the chosen
-# : location for the binary log files.
-# ----------------+-----------------------------------------------------------
-# Additionally the following variables are recognized:
-#
-# Be more verbose accept values from 1 to 4
-#DEBUG=4
-#
-
-## The parameters are passed in a bash array variable,
-# the variable name is mysql_slot_[server-ver]_[server-num]
-# Where "server-ver" and "server-num" are optional.
-# in case are defined "server-num" MUST be of three digits.
-# The first digit is the mayor version, the following two the minor
-# i.e. having installed mysql-5.1.x "server-num" will be "501"
-# "server-num" it's an optional number used mainly to start more servers
-# of the same version.
-#
-# The /etc/init.d/mysql-* script will choose the parameters analyzing it's own name
-# i.e. /etc/init.d/mysql-501 will look for mysql_slot_501
-# side note the script could be called "mysql-501_1" or "mysql.501.1" with the same result
-#
-# Examples:
-#
-# start a default server with default options:
-#mysql_slot=( )
-# or
-#mysql_slot_0=( )
-#
-# start MySQL 7.5.x reniced, overriding some start parameters
-#mysql_slot_705=(
-# "nice=-5"
-# "server-id=123"
-# "log-bin="myhost"
-# "port=3307"
-#)
-#
-# start another server, same version, different my.cnf
-#mysql_slot_705_1=(
-# "mycnf=/home/test/my.cnf"
-# "server-id=124"
-#)
-#
diff --git a/dev-db/mysql/files/mysql-slot.rc6-r2 b/dev-db/mysql/files/mysql-slot.rc6-r3
index c54d0906e9a0..f3c3ce8286a9 100755..100644
--- a/dev-db/mysql/files/mysql-slot.rc6-r2
+++ b/dev-db/mysql/files/mysql-slot.rc6-r3
@@ -1,12 +1,18 @@
#!/sbin/runscript
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/dev-db/mysql/files/mysql-slot.rc6-r2,v 1.4 2006/01/24 19:25:57 vivo Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-db/mysql/files/mysql-slot.rc6-r3,v 1.1 2006/01/31 00:59:05 vivo Exp $
# external binaryes used: which, sed, tac
-depend() {
- use dns net localmount netmount nfsmount
+# int in_list(char * elem, char * list)
+function in_list() {
+ local elem=${1:-"none"}
+ local list=${2:-","}
+
+ [[ "${list}" == "${list/,${elem},/}" ]] \
+ && return 1 \
+ || return 0
}
function wdebug() {
@@ -16,43 +22,38 @@ function wdebug() {
fi
}
+depend() {
+ use dns net localmount netmount nfsmount
+}
+
do_escape() {
# Ihatethisreallyverymuch
#echo "$1" | sed -e "s|'| |" -e "s|=|='|" -e "s|$|'|"
echo "$1"
}
-# int get_slot_config()
+# int get_slot_config(srv_slot=0, srv_num)
get_slot_config() {
-
wdebug 4 ">>> get_slot_config()"
- # servers options are (also) defined in /etc/conf.d/mysql
- [[ -f /etc/conf.d/mysql ]] && source /etc/conf.d/mysql
-
- # myservice={mysql,mysql-500,mysql-500_1} => {,-500,-500_1,-500.1}
- local srv="${myservice#mysql}"
- # srv={,-500,-500_1,-500.1} => {,500,500_1,500.1}
- srv="${srv:1}"
+ local srv srv_slot srv_num
+ srv_slot="${1:-"0"}"
+ srv_num="${2}"
+ MY_SUFFIX="-${srv_slot}"
# srv=array(0 => [srv_slot], 1 => [srv_num] )
- srv=( ${srv//[_.-]/" "} )
- local srv_slot=${srv[0]} srv_num=${srv[1]}
- # defined in /etc/conf.d/mysql mysql_slot_{0,500,500_1}
+ srv=( ${srv_slot} ${srv_num} )
+
local tmp_eval="mysql_slot_${srv_slot}${srv_num:+"_"}${srv_num}[@]"
local conf_d_parameters="${!tmp_eval}"
- MY_SUFFIX="-${srv_slot}"
- if [[ -z "${srv_slot}" ]] ; then
- srv_slot="0"
+ if [[ "${srv_slot}" == "0" ]] ; then
MY_SUFFIX=''
# try some other default for the default server
- [[ -z "${conf_d_parameters[@]}" ]] && conf_d_parameters=${mysql_slot_0[@]}
[[ -z "${conf_d_parameters[@]}" ]] && conf_d_parameters=${mysql_slot[@]}
fi
[[ -z "${conf_d_parameters[@]}" ]] && conf_d_parameters=( )
basedir="" datadir="" pidfile="" socket=""
CHROOT="" NICE="" STARTUPTIMEOUT=5 STOPTIMEOUT=120
- wdebug 3 "myservice ${myservice}"
wdebug 3 "srv ${srv[@]}"
wdebug 3 "srv_slot ${srv_slot}"
wdebug 3 "srv_num ${srv_num}"
@@ -82,8 +83,6 @@ get_slot_config() {
mycnf=*) MY_CNF="${my_default#mycnf=}" ;;
startup_timeout=*)
STARTUPTIMEOUT="${my_default#startup_timeout=}" ;;
- stop_timeout=*)
- STOPTIMEOUT="${my_default#stop_timeout=}" ;;
basedir=*) basedir="${my_default#basedir=}" ;;
datadir=*) datadir="${my_default#datadir=}" ;;
pid-file=*) pidfile="${my_default#pid-file=}" ;;
@@ -193,35 +192,87 @@ checkconfig() {
start() {
wdebug 4 ">>> start()"
- local retstatus=0
+ MYSQL_GLOB_PID_FILE=${MYSQL_GLOB_PID_FILE:-"/var/run/svc-started-mysqld"}
+ # servers are defined in /etc/conf.d/mysql
+ local serverlist=${!mysql_slot_*}
+ # provide default for empty conf.d/mysql
+ if [[ -z "${serverlist}" ]] ; then
+ serverlist=0
+ export mysql_slot_0=( )
+ fi
+ local retstatus timeout
+ local globretstatus=1
+ local srv_slot srv_num
+ # server MUST NOT share same location for these
+ local pidfilelist=',' datadirlist=',' socketlist=','
+ local ssd_thing=1
+ local mysqld_thing
ebegin
- get_slot_config || return 1
+ # try to start each server
+ for srv in ${serverlist[*]} ; do
+
+ srv_slot="${srv#mysql_slot_}"
+ if [[ "${srv_slot}" == "${srv_slot#*_}" ]] ; then
+ srv_num=''
+ else
+ srv_num="${srv_slot#*_}"
+ fi
+ srv_slot="${srv_slot%%_*}"
+
+ retstatus=0
+ get_slot_config "${srv_slot}" "${srv_num}" || retstatus=1
if [[ -f ${pidfile} ]] || [[ -S ${socket} ]] ; then
echo "\"${pidfile}\" and/or \"${socket}\" are still present."
echo "Please check that no server is running and remove them."
- return 1
+ retstatus=1 ; continue
+ fi
+
+ # pre_run checks
+ [[ "$retstatus" -eq 0 ]] && checkconfig "${datadir}" || retstatus=2
+ if [[ "$retstatus" -eq 0 ]] ; then
+ if in_list "${pidfile}" "${pidfilelist}" ; then
+ eerror "Sorry, won't start with same pid-file: ${pidfile}"
+ retstatus=3 ; continue
+ fi
+ if in_list "${datadir}" "${datadirlist}" ; then
+ eerror "Sorry, won't start with same datadir: ${datadir}"
+ retstatus=4 ; continue
+ fi
+ if in_list "${socket}" "${socketlist}" ; then
+ eerror "Sorry, won't start with same socket: ${socket}"
+ retstatus=5 ; continue
+ fi
fi
- checkconfig "${datadir}" || return 2
+ if ! checkconfig "${datadir}" ; then
+ retstatus=6 ; continue
+ fi
einfo "Starting ${myservice} (${MY_CNF})"
+
+ mysqld_thing="${MY_CNF:+"--defaults-file="}${MY_CNF}"
+ mysqld_thing="${mysqld_thing} ${unmanagedparams}"
+ mysqld_thing="${mysqld_thing} --basedir=${basedir}"
+ mysqld_thing="${mysqld_thing} --datadir=${datadir}"
+ mysqld_thing="${mysqld_thing} --pid-file=${pidfile}"
+ mysqld_thing="${mysqld_thing} --socket=${socket}"
+
+ wdebug 2 "starting mysqld with: ${mysqld_thing}"
+
+ if [[ ${ssd_thing} -eq 1 ]] ; then
+ start-stop-daemon --quiet ${DEBUG/*/"--verbose"} --start \
+ --background ${NICE:+"--nicelevel "}${NICE} \
+ --exec ${basedir}/sbin/mysqld${MY_SUFFIX} -- ${mysqld_thing}
+ retstatus=$?
+ else
+ ${basedir}/sbin/mysqld${MY_SUFFIX} ${mysqld_thing} &
+ retstatus=0
+ fi
- wdebug 2 "starting mysqld with: ${MY_CNF:+"--defaults-file="}${MY_CNF} ${unmanagedparams} --basedir=${basedir} --datadir=${datadir} --pid-file=${pidfile} --socket=${socket}"
-
- start-stop-daemon --quiet ${DEBUG/*/"--verbose"} --start --background \
- ${NICE:+"--nicelevel "}${NICE} \
- --exec ${basedir}/sbin/mysqld${MY_SUFFIX} \
- -- \
- ${MY_CNF:+"--defaults-file="}${MY_CNF} \
- ${unmanagedparams} \
- --basedir=${basedir} \
- --datadir=${datadir} \
- --pid-file=${pidfile} \
- --socket=${socket}
-
- retstatus=$?
+ # only the first run is done by start-stop-daemon
+ ssd_thing=""
# wait for socket creation
wdebug 1
@@ -230,34 +281,56 @@ start() {
[[ ${DEBUG} -ge 1 ]] && echo -n "${STARTUPTIMEOUT},"
sleep ${TIMEUNIT}
done
- wdebug 1 ""
+ wdebug 1 ""
if [[ ! -S "${socket}" ]] ; then
eerror "MySQL${MY_SUFFIX} NOT started (${retstatus})"
retstatus=1
+ else
+ globretstatus=0
+ pidfilelist="${pidfilelist}${pidfile},"
+ datadirlist="${datadirlist}${datadir},"
+ socketlist="${socketlist}${socket},"
+ echo "${srv_slot}${srv_num:+"_"}${srv_num}=${pidfile}" >> "${MYSQL_GLOB_PID_FILE}"
fi
-
+ done
+ # successfull if at least one mysqld started
wdebug 4 "<<< start()"
- eend $retstatus
+ eend $globretstatus
}
stop() {
- get_slot_config
- local retstatus=0 PID
- local timeout=${STOPTIMEOUT:-"120"}
+ get_slot_config &> /dev/null
+ MYSQL_GLOB_PID_FILE=${MYSQL_GLOB_PID_FILE:-"/var/run/svc-started-mysqld"}
+ local runwhat pidfile shutdown_elem
+ local PID cnt timeout=${STOPTIMEOUT:-"120"}
+ local retstatus=0
+ local shutdown_list="$(tac "${MYSQL_GLOB_PID_FILE}")"
- PID=$(< "${pidfile}")
ebegin "Stopping ${myservice} (pid=${PID})"
-
- start-stop-daemon --quiet ${DEBUG/*/"--verbose"} --stop --pidfile "${pidfile}"
- wdebug 1 ""
- while [[ -n "$PID" ]] \
- && $( kill -15 $PID 2>/dev/null ) \
- && [[ "${timeout}" -ge 1 ]]
- do
- timeout=$(($timeout - 1))
- [[ ${DEBUG} -ge 1 ]] && echo -n "$(( $STOPTIMEOUT - $timeout )),"
- sleep ${TIMEUNIT}
+ for shutdown_elem in $shutdown_list; do
+ runwhat=${shutdown_elem%%=*}
+ pidfile=${shutdown_elem#*=}
+ timeout=${STOPTIMEOUT:-"120"}
+ PID=$(< "${pidfile}" )
+ wdebug 3 "runwhat ${runwhat}"
+ wdebug 3 "pidfile ${pidfile}"
+ wdebug 3 "timeout ${timeout}"
+ wdebug 3 "PID ${PID}"
+
+ einfo "Stopping mysqld (${runwhat})"
+
+ start-stop-daemon --quiet ${DEBUG/*/"--verbose"} --stop --pidfile "${pidfile}" &
+ wdebug 1 ""
+ while [[ -n "$PID" ]] \
+ && $( kill -15 $PID 2>/dev/null ) \
+ && [[ "${timeout}" -ge 1 ]]
+ do
+ timeout=$(($timeout - 1))
+ [[ ${DEBUG} -ge 1 ]] && echo -n "$(( $STOPTIMEOUT - $timeout )),"
+ sleep ${TIMEUNIT}
+ done
+ [[ "${timeout}" -lt 1 ]] && retstatus=1
done
- [[ "${timeout}" -lt 1 ]] && retstatus=1
+ [[ "$retstatus" -eq 0 ]] && rm -f "$MYSQL_GLOB_PID_FILE"
eend ${retstatus}
}