diff options
| author | Lars Tangvald <lars.tangvald@oracle.com> | 2016-05-11 06:57:22 (GMT) |
|---|---|---|
| committer | Robie Basak <robie.basak@canonical.com> | 2016-05-24 14:34:46 (GMT) |
| commit | f12dd3fb5387113585a981e2b8d234e81c6a630d (patch) | |
| tree | 654861c82a87cfaf7e7d55ed455da23d9475e69a | |
| parent | 3729592ed5d1e428ba8a215829e2d18c7f669822 (diff) | |
Change d/additions/debian-start to no-op
The script was being run during upgrades in various situations. Since it runs
mysql_upgrade, which is also run by d/postinst in 5.7, it was causing various
errors. All its functionality is also covered by d/postinst, so it's no longer
needed.
* Changed debian-start to just exit 0
* Removed debian-start.inc.sh, which was only used by debian-start
LP: #1577712
| -rw-r--r-- | debian/additions/debian-start | 32 | ||||
| -rw-r--r-- | debian/additions/debian-start.inc.sh | 72 |
2 files changed, 2 insertions, 102 deletions
diff --git a/debian/additions/debian-start b/debian/additions/debian-start index 2ffac87..8be72ea 100644 --- a/debian/additions/debian-start +++ b/debian/additions/debian-start @@ -1,33 +1,5 @@ #!/bin/bash -# -# This script is executed by "/etc/init.d/mysql" on every (re)start. -# -# Changes to this file will be preserved when updating the Debian package. -# - -source /usr/share/mysql/debian-start.inc.sh - -MYSQL="/usr/bin/mysql --defaults-file=/etc/mysql/debian.cnf" -MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf" -MYUPGRADE="/usr/bin/mysql_upgrade --defaults-extra-file=/etc/mysql/debian.cnf" -MYCHECK="/usr/bin/mysqlcheck --defaults-file=/etc/mysql/debian.cnf" -MYCHECK_SUBJECT="WARNING: mysqlcheck has found corrupt tables" -MYCHECK_PARAMS="--all-databases --fast --silent" -MYCHECK_RCPT="root" - -## Checking for corrupt, not cleanly closed and upgrade needing tables. - -# The following commands should be run when the server is up but in background -# where they do not block the server start and in one shell instance so that -# they run sequentially. They are supposed not to echo anything to stdout. -# If you want to disable the check for crashed tables comment -# "check_for_crashed_tables" out. -# (There may be no output to stdout inside the background process!) - -( - upgrade_system_tables_if_necessary; - check_root_accounts; - check_for_crashed_tables; -) >&2 & +# Change to no-op as detailed in +# https://bugs.launchpad.net/ubuntu/+source/mysql-5.7/+bug/1577712 exit 0 diff --git a/debian/additions/debian-start.inc.sh b/debian/additions/debian-start.inc.sh deleted file mode 100644 index f507128..0000000 --- a/debian/additions/debian-start.inc.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/bash -# -# This file is included by /etc/mysql/debian-start -# - -## Check all unclosed tables. -# - Requires the server to be up. -# - Is supposed to run silently in background. -function check_for_crashed_tables() { - set -e - set -u - - # But do it in the background to not stall the boot process. - logger -p daemon.info -i -t$0 "Triggering myisam-recover for all MyISAM tables" - - # Checking for $? is unreliable so the size of the output is checked. - # Some table handlers like HEAP do not support CHECK TABLE. - tempfile=`tempfile` - # We have to use xargs in this case, because a for loop barfs on the - # spaces in the thing to be looped over. - LC_ALL=C $MYSQL --skip-column-names --batch -e ' - select concat('\''select count(*) into @discard from `'\'', - TABLE_SCHEMA, '\''`.`'\'', TABLE_NAME, '\''`'\'') - from information_schema.TABLES where ENGINE='\''MyISAM'\' | \ - xargs -i $MYSQL --skip-column-names --silent --batch \ - --force -e "{}" >$tempfile - if [ -s $tempfile ]; then - ( - /bin/echo -e "\n" \ - "Improperly closed tables are also reported if clients are accessing\n" \ - "the tables *now*. A list of current connections is below.\n"; - $MYADMIN processlist status - ) >> $tempfile - # Check for presence as a dependency on mailx would require an MTA. - if [ -x /usr/bin/mailx ]; then - mailx -e -s"$MYCHECK_SUBJECT" $MYCHECK_RCPT < $tempfile - fi - (echo "$MYCHECK_SUBJECT"; cat $tempfile) | logger -p daemon.warn -i -t$0 - fi - rm $tempfile -} - -## Check for tables needing an upgrade. -# - Requires the server to be up. -# - Is supposed to run silently in background. -function upgrade_system_tables_if_necessary() { - set -e - set -u - - logger -p daemon.info -i -t$0 "Upgrading MySQL tables if necessary." - - # Filter all "duplicate column", "duplicate key" and "unknown column" - # errors as the script is designed to be idempotent. - LC_ALL=C $MYUPGRADE \ - 2>&1 \ - | egrep -v '^(1|@had|ERROR (1054|1060|1061))' \ - | logger -p daemon.warn -i -t$0 -} - -## Check for the presence of both, root accounts with and without password. -# This might have been caused by a bug related to mysql_install_db (#418672). -function check_root_accounts() { - set -e - set -u - - logger -p daemon.info -i -t$0 "Checking for insecure root accounts." - - ret=$( echo "SELECT count(*) FROM mysql.user WHERE user='root' and password='';" | $MYSQL --skip-column-names ) - if [ "$ret" -ne "0" ]; then - logger -p daemon.warn -i -t$0 "WARNING: mysql.user contains $ret root accounts without password!" - fi -} |
