#At file:///MySQL/REPO/V55/merge-5.5/ based on revid:alexey.kopytov@stripped
3070 Joerg Bruehe 2010-06-21 [merge]
Automerge part of mysql-trunk-bugfixing into mysql-trunk-merge.
added:
mysql-test/include/not_parallel.inc
modified:
mysql-test/mysql-test-run.pl
mysql-test/suite/federated/federated_plugin-master.opt
mysql-test/suite/federated/federated_plugin.test
mysql-test/t/archive_plugin-master.opt
mysql-test/t/archive_plugin.test
mysql-test/t/blackhole_plugin-master.opt
mysql-test/t/blackhole_plugin.test
support-files/mysql.spec.sh
=== added file 'mysql-test/include/not_parallel.inc'
--- a/mysql-test/include/not_parallel.inc 1970-01-01 00:00:00 +0000
+++ b/mysql-test/include/not_parallel.inc 2010-06-14 09:23:49 +0000
@@ -0,0 +1,3 @@
+if (`SELECT '$MTR_PARALLEL' > 1`) {
+ --skip test requires --parallel=1
+}
=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl 2010-06-07 08:47:04 +0000
+++ b/mysql-test/mysql-test-run.pl 2010-06-21 10:52:03 +0000
@@ -362,6 +362,7 @@ sub main {
$opt_parallel= 1 if ($opt_parallel < 1);
mtr_report("Using parallel: $opt_parallel");
}
+ $ENV{MTR_PARALLEL} = $opt_parallel;
# Create server socket on any free port
my $server = new IO::Socket::INET
@@ -1826,7 +1827,7 @@ sub find_plugin($$)
mtr_file_exists(vs_config_dirs($location,$plugin_filename),
"$basedir/lib/plugin/".$plugin_filename,
"$basedir/$location/.libs/".$plugin_filename,
- "$basedir/lib/mysql/plugin/".$plugin_filename,
+ "$basedir/lib/mysql/plugin/".$plugin_filename,
);
return $lib_example_plugin;
}
@@ -1944,6 +1945,16 @@ sub environment_setup {
}
# ----------------------------------------------------
+ # Add the paths where mysqld will find archive/blackhole/federated plugins.
+ # ----------------------------------------------------
+ $ENV{'ARCHIVE_PLUGIN_DIR'} =
+ dirname(find_plugin("ha_archive", "storage/archive"));
+ $ENV{'BLACKHOLE_PLUGIN_DIR'} =
+ dirname(find_plugin("ha_blackhole", "storage/blackhole"));
+ $ENV{'FEDERATED_PLUGIN_DIR'} =
+ dirname(find_plugin("ha_federated", "storage/federated"));
+
+ # ----------------------------------------------------
# Add the path where mysqld will find mypluglib.so
# ----------------------------------------------------
=== modified file 'mysql-test/suite/federated/federated_plugin-master.opt'
--- a/mysql-test/suite/federated/federated_plugin-master.opt 2010-05-05 07:35:38 +0000
+++ b/mysql-test/suite/federated/federated_plugin-master.opt 2010-06-14 09:23:49 +0000
@@ -1,2 +1 @@
---plugin_dir=../storage/federated/.libs
-
+--plugin_dir=$FEDERATED_PLUGIN_DIR
=== modified file 'mysql-test/suite/federated/federated_plugin.test'
--- a/mysql-test/suite/federated/federated_plugin.test 2010-05-05 07:35:38 +0000
+++ b/mysql-test/suite/federated/federated_plugin.test 2010-06-14 09:23:49 +0000
@@ -1,6 +1,8 @@
--source include/not_windows.inc
--source include/have_federated_plugin.inc
+--skip federated plugin is disabled
+
CREATE TABLE t1(a int) ENGINE=FEDERATED;
DROP TABLE t1;
=== modified file 'mysql-test/t/archive_plugin-master.opt'
--- a/mysql-test/t/archive_plugin-master.opt 2010-04-26 19:39:24 +0000
+++ b/mysql-test/t/archive_plugin-master.opt 2010-06-14 09:23:49 +0000
@@ -1 +1 @@
---plugin_dir=../storage/archive/.libs
+--plugin_dir=$ARCHIVE_PLUGIN_DIR
=== modified file 'mysql-test/t/archive_plugin.test'
--- a/mysql-test/t/archive_plugin.test 2010-04-26 19:39:24 +0000
+++ b/mysql-test/t/archive_plugin.test 2010-06-14 09:23:49 +0000
@@ -1,6 +1,10 @@
--source include/not_windows.inc
--source include/have_archive_plugin.inc
+# When running in parallel we get
+# Warning 1620 Plugin is busy and will be uninstalled on shutdown
+--source include/not_parallel.inc
+
CREATE TABLE t1(a int) ENGINE=ARCHIVE;
DROP TABLE t1;
=== modified file 'mysql-test/t/blackhole_plugin-master.opt'
--- a/mysql-test/t/blackhole_plugin-master.opt 2010-04-26 18:44:10 +0000
+++ b/mysql-test/t/blackhole_plugin-master.opt 2010-06-14 09:23:49 +0000
@@ -1 +1 @@
---plugin_dir=../storage/blackhole/.libs
+--plugin_dir=$BLACKHOLE_PLUGIN_DIR
=== modified file 'mysql-test/t/blackhole_plugin.test'
--- a/mysql-test/t/blackhole_plugin.test 2010-04-26 18:44:10 +0000
+++ b/mysql-test/t/blackhole_plugin.test 2010-06-14 09:23:49 +0000
@@ -1,6 +1,10 @@
--source include/not_windows.inc
--source include/have_blackhole_plugin.inc
+# When running in parallel we get
+# Warning 1620 Plugin is busy and will be uninstalled on shutdown
+--source include/not_parallel.inc
+
CREATE TABLE t1(a int) ENGINE=BLACKHOLE;
DROP TABLE t1;
=== modified file 'support-files/mysql.spec.sh'
--- a/support-files/mysql.spec.sh 2010-06-02 10:38:13 +0000
+++ b/support-files/mysql.spec.sh 2010-06-15 20:46:29 +0000
@@ -504,6 +504,7 @@ rm -f $RBR%{_mandir}/man1/make_win_bin_d
##############################################################################
%pre -n MySQL-server%{product_suffix}
+mysql_datadir=%{mysqldatadir}
# Check if we can safely upgrade. An upgrade is only safe if it's from one
# of our RPMs in the same version family.
@@ -576,7 +577,74 @@ HERE
fi
fi
+# We assume that if there is exactly one ".pid" file,
+# it contains the valid PID of a running MySQL server.
+NR_PID_FILES=`ls $mysql_datadir/*.pid 2>/dev/null | wc -l`
+case $NR_PID_FILES in
+ 0 ) SERVER_TO_START='' ;; # No "*.pid" file == no running server
+ 1 ) SERVER_TO_START='true' ;;
+ * ) SERVER_TO_START='' # Situation not clear
+ SEVERAL_PID_FILES=true ;;
+esac
+# That logic may be debated: We might check whether it is non-empty,
+# contains exactly one number (possibly a PID), and whether "ps" finds it.
+# OTOH, if there is no such process, it means a crash without a cleanup -
+# is that a reason not to start a new server after upgrade?
+
+STATUS_FILE=$mysql_datadir/RPM_UPGRADE_MARKER
+
+if [ -f $STATUS_FILE ]; then
+ echo "Some previous upgrade was not finished:"
+ ls -ld $STATUS_FILE
+ echo "Please check its status, then do"
+ echo " rm $STATUS_FILE"
+ echo "before repeating the MySQL upgrade."
+ exit 1
+elif [ -n "$SEVERAL_PID_FILES" ] ; then
+ echo "Your MySQL directory '$mysql_datadir' has more than one PID file:"
+ ls -ld $mysql_datadir/*.pid
+ echo "Please check which one (if any) corresponds to a running server"
+ echo "and delete all others before repeating the MySQL upgrade."
+ exit 1
+fi
+
+NEW_VERSION=%{mysql_version}-%{release}
+
+# The "pre" section code is also run on a first installation,
+# when there is no data directory yet. Protect against error messages.
+if [ -d $mysql_datadir ] ; then
+ echo "MySQL RPM upgrade to version $NEW_VERSION" > $STATUS_FILE
+ echo "'pre' step running at `date`" >> $STATUS_FILE
+ echo >> $STATUS_FILE
+ echo "ERR file(s):" >> $STATUS_FILE
+ ls -ltr $mysql_datadir/*.err >> $STATUS_FILE
+ echo >> $STATUS_FILE
+ echo "Latest 'Version' line in latest file:" >> $STATUS_FILE
+ grep '^Version' `ls -tr $mysql_datadir/*.err | tail -1` | \
+ tail -1 >> $STATUS_FILE
+ echo >> $STATUS_FILE
+
+ if [ -n "$SERVER_TO_START" ] ; then
+ # There is only one PID file, race possibility ignored
+ echo "PID file:" >> $STATUS_FILE
+ ls -l $mysql_datadir/*.pid >> $STATUS_FILE
+ cat $mysql_datadir/*.pid >> $STATUS_FILE
+ echo >> $STATUS_FILE
+ echo "Server process:" >> $STATUS_FILE
+ ps -fp `cat $mysql_datadir/*.pid` >> $STATUS_FILE
+ echo >> $STATUS_FILE
+ echo "SERVER_TO_START=$SERVER_TO_START" >> $STATUS_FILE
+ else
+ # Take a note we checked it ...
+ echo "PID file:" >> $STATUS_FILE
+ ls -l $mysql_datadir/*.pid >> $STATUS_FILE 2>&1
+ fi
+fi
+
# Shut down a previously installed server first
+# Note we *could* make that depend on $SERVER_TO_START, but we rather don't,
+# so a "stop" is attempted even if there is no PID file.
+# (Maybe the "stop" doesn't work then, but we might fix that in itself.)
if [ -x %{_sysconfdir}/init.d/mysql ] ; then
%{_sysconfdir}/init.d/mysql stop > /dev/null 2>&1
echo "Giving mysqld 5 seconds to exit nicely"
@@ -585,17 +653,33 @@ fi
%post -n MySQL-server%{product_suffix}
mysql_datadir=%{mysqldatadir}
+NEW_VERSION=%{mysql_version}-%{release}
+STATUS_FILE=$mysql_datadir/RPM_UPGRADE_MARKER
# ----------------------------------------------------------------------
-# Create data directory if needed
+# Create data directory if needed, check whether upgrade or install
# ----------------------------------------------------------------------
if [ ! -d $mysql_datadir ] ; then mkdir -m 755 $mysql_datadir; fi
-if [ ! -d $mysql_datadir/mysql ] ; then mkdir $mysql_datadir/mysql; fi
+if [ -f $STATUS_FILE ] ; then
+ SERVER_TO_START=`grep '^SERVER_TO_START=' $STATUS_FILE | cut -c17-`
+else
+ SERVER_TO_START=''
+fi
+# echo "Analyzed: SERVER_TO_START=$SERVER_TO_START"
+if [ ! -d $mysql_datadir/mysql ] ; then
+ mkdir $mysql_datadir/mysql;
+ echo "MySQL RPM installation of version $NEW_VERSION" >> $STATUS_FILE
+else
+ # If the directory exists, we may assume it is an upgrade.
+ echo "MySQL RPM upgrade to version $NEW_VERSION" >> $STATUS_FILE
+fi
if [ ! -d $mysql_datadir/test ] ; then mkdir $mysql_datadir/test; fi
# ----------------------------------------------------------------------
# Make MySQL start/shutdown automatically when the machine does it.
# ----------------------------------------------------------------------
+# NOTE: This still needs to be debated. Should we check whether these links
+# for the other run levels exist(ed) before the upgrade?
# use insserv for older SuSE Linux versions
if [ -x /sbin/insserv ] ; then
/sbin/insserv %{_sysconfdir}/init.d/mysql
@@ -677,17 +761,30 @@ if [ -x sbin/restorecon ] ; then
sbin/restorecon -R var/lib/mysql
fi
-# Restart in the same way that mysqld will be started normally.
-if [ -x %{_sysconfdir}/init.d/mysql ] ; then
- %{_sysconfdir}/init.d/mysql start
- echo "Giving mysqld 2 seconds to start"
- sleep 2
+# Was the server running before the upgrade? If so, restart the new one.
+if [ "$SERVER_TO_START" = "true" ] ; then
+ # Restart in the same way that mysqld will be started normally.
+ if [ -x %{_sysconfdir}/init.d/mysql ] ; then
+ %{_sysconfdir}/init.d/mysql start
+ echo "Giving mysqld 2 seconds to start"
+ sleep 2
+ fi
+
+ # Allow mysqld_safe to start mysqld and print a message before we exit
+ sleep 2
fi
-# Allow mysqld_safe to start mysqld and print a message before we exit
-sleep 2
+# Collect an upgrade history ...
+echo "Upgrade/install finished at `date`" >> $STATUS_FILE
+echo >> $STATUS_FILE
+echo "=====" >> $STATUS_FILE
+STATUS_HISTORY=$mysql_datadir/RPM_UPGRADE_HISTORY
+cat $STATUS_FILE >> $STATUS_HISTORY
+rm $STATUS_FILE
+
%preun -n MySQL-server%{product_suffix}
+
if [ $1 = 0 ] ; then
# Stop MySQL before uninstalling it
if [ -x %{_sysconfdir}/init.d/mysql ] ; then
@@ -892,6 +989,17 @@ fi
# merging BK trees)
##############################################################################
%changelog
+* Tue Jun 15 2010 Joerg Bruehe <joerg.bruehe@stripped>
+
+- Change the behaviour on installation and upgrade:
+ On installation, do not autostart the server.
+ *Iff* the server was stopped before the upgrade is started, this is taken as a
+ sign the administrator is handling that manually, and so the new server will
+ not be started automatically at the end of the upgrade.
+ The start/stop scripts will still be installed, so the server will be started
+ on the next machine boot.
+ This is the 5.5 version of fixing bug#27072 (RPM autostarting the server).
+
* Tue Jun 1 2010 Jonathan Perkin <jonathan.perkin@stripped>
- Implement SELinux checks from distribution-specific spec file.
Attachment: [text/bzr-bundle] bzr/joerg@mysql.com-20100621105203-p7lcpcimxvhsib4p.bundle
| Thread |
|---|
| • bzr commit into mysql-trunk branch (joerg:3070) | Joerg Bruehe | 21 Jun |