[MDEV-3101] LP:484120 - Upgrade from MySQL server requires extra server restart to upgrade tables properly Created: 2009-11-17 Updated: 2012-10-04 Resolved: 2012-10-04 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Kristian Nielsen | Assignee: | Kristian Nielsen |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | Launchpad | ||
| Attachments: |
|
| Description |
|
I tried today installing mariadb-server-5.1 (5.1.39-ourdelta67) on an Ubuntu 8.04 machine that previously ran the standard Ubuntu MySQL 5.0, so an upgrade scenario. After the install, I see this in the /var/log/daemon.log from the bootstrap done during postinst: Nov 17 10:40:52 odin mysqld_safe[10176]: 091117 10:40:52 [Warning] options --log-slow-admin-statements, --log-queries-not-using-indexes and --log-slow-slave-statements have no effect if --log_slow_queries is not set It seems this comes from this line in mariadb-server-5.1.postinst: echo "$replace_query" | $MYSQL_BOOTSTRAP 2>&1 | $ERR_LOGGER The problem is that my mysql.user table is missing the columns Event_priv and Trigger_priv. The postinst script tries to add them with this statement: fix_privs=`/bin/echo -e \ But this failed to create the Event_priv and Trigger_priv columns. This is not surprising, as in MySQL 5.0 the other columns are already present. So the first ALTER TABLE fails and bootstrap aborts. (I did not find any error message in the logs for failing ALTER TABLE, not sure why...) Manually adding the Event_priv and Trigger_priv columns and re-installing seems to get rid of the "Column count doesn't match value count" error. A possible solution might be to seperate this into two bootstrap statements, so that Event_priv and Trigger_priv will be created even if adding the other columns fails. |
| Comments |
| Comment by Michael Widenius [ 2009-11-18 ] |
|
Re: "ERROR: 1136 Column count doesn't match value count at row 1" when installing mariadb-server-5.1 I don't think it's correct to duplicate the work to fix the privilege tables as we then have to constantly have to keep Also the way 'fix_privs' now works, it will not be able to handle all cases that mysql_fix_privilege_tables does. |
| Comment by Kristian Nielsen [ 2009-11-25 ] |
|
Re: "ERROR: 1136 Column count doesn't match value count at row 1" when installing mariadb-server-5.1 <cmd> | $ERR_LOGGER This ignores the exit code of <cmd> by default, causing the `set -e` in I suggest to not ignore the exit codes of commands in the pipe: set -o pipefail This will make an error in a logged command immediately apparent by aborting |
| Comment by Cafuego (Inactive) [ 2009-11-26 ] |
|
Re: "ERROR: 1136 Column count doesn't match value count at row 1" when installing mariadb-server-5.1 The postinst should now fail verbosely and fall in a heap, rather than stay silent. |
| Comment by Kristian Nielsen [ 2009-12-08 ] |
|
Re: "ERROR: 1136 Column count doesn't match value count at row 1" when installing mariadb-server-5.1 I get this when installing: dpkg: error processing mariadb-server-5.1 (--configure): And in /var/lib/daemon.err I get this: Dec 8 21:06:15 vm-debian5-i386 mysqld_safe[2988]: ERROR: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ALTER TABLE user ADD column Show_view_priv enum('N','Y') CHARACTER SET utf8 NOT ' at line 1 (I merged it into a recent ourdelta version to test in buildbot, the tree is here: lp:~knielsen/ourdelta/bug484120) So not sure why I get this ... And there is another problem. In the upgrade case, the ADD COLUMN statements will definitely fail, and with the set pipefail that will also cause the installation to fail. Thus these particular statements need protection with || /bin/true or similar. The set pipefail is still good for statements that should not fail. |
| Comment by Kristian Nielsen [ 2009-12-09 ] |
|
Re: "ERROR: 1136 Column count doesn't match value count at row 1" when installing mariadb-server-5.1 I will take over this and fix, hope that is ok. |
| Comment by Kristian Nielsen [ 2009-12-09 ] |
|
Re: "ERROR: 1136 Column count doesn't match value count at row 1" when installing mariadb-server-5.1 Dec 9 16:39:30 vm-hardy-x86 /etc/mysql/debian-start[4990]: error : Table upgrade required. Please do "REPAIR TABLE `help_category`" or dump/reload to fix it! Dec 9 16:39:29 vm-hardy-x86 mysqld: 091209 16:39:29 [ERROR] Column count of mysql.db is wrong. Expected 22, found 20. Created with MySQL 50051, now running 50141. Please use mysql_upgrade to fix ATTENTION: An error has occured. More info is in the syslog! I think Monty is right that we have to solve this by properly running mysql_fix_privilege_tables... |
| Comment by Kristian Nielsen [ 2009-12-14 ] |
|
Re: "ERROR: 1136 Column count doesn't match value count at row 1" when installing mariadb-server-5.1 The above error message about multiple columns is also there when upgrading the stock MySQL 5.0 to stock MySQL 5.1 in Ubuntu Jaunty. As is the syntax error. Seems that these ADD COLUMN statements are just some old cruft that never worked, nor were needed?!? The actual upgrade of the system tables to 5.1 format is done when the /etc/init.d/mysql start script calls mysql_upgrade during startup (mysql_upgrade is the 5.1 replacement for mysql_fix_privilege_tables). This happens on every start of the mysql server. I just tested an upgrade from mysql 5.0 to mariadb 5.1.39 on Ubuntu Hardy. There was some issue with a stuck mysqld_safe which I want to investigate further, but after second restart of mysql I checked and mysql.user / mysql.db were ok and correctly upgraded by mysql_upgrade by the startup script. I suspect that the reason I saw a problem was due to other issues with my install and/or waiting for mysqlcheck to finish before the upgrade is actually done. At least also my original install seems ok now. Will double check and then if no further problems I will just remove the useless, non-functional SQL from the postinst. |
| Comment by Kristian Nielsen [ 2009-12-14 ] |
|
Re: "ERROR: 1136 Column count doesn't match value count at row 1" when installing mariadb-server-5.1 1. When upgrading from mysql-5.0 to mariadb on Ubuntu Hardy 64-bit (haven't tested other platforms), the upgrade is not done correctly on the first start of mysqld. Only after a second restart is the upgrade done, and then it is correct. 2. After installation, if the server is stopped the mysqld_safe process does not end, but loops endlessly, with strace showing infinite calls like this: wait4(4294967295, 0x7fffedde19fc, 0, NULL) = -1 ECHILD (No child processes) 3. mariadb-server-5.1.postinst contains some old junk SQL that is passed to $BOOTSTRAP during installation, but which is neither needed nor functional. |
| Comment by Kristian Nielsen [ 2009-12-15 ] |
|
Re: Upgrade from MySQL server requires extra server restart to upgrade tables properly I tested on Jaunty (amd64), it does not have the problem. But on Hardy, after I have appended logs below, note how the mysqlcheck and mysql_upgrade seems to Here is the log from /etc/mysql/debian-start from the first, unsuccessful Dec 15 10:54:17 vm-hardy-amd64 /etc/mysql/debian-start[5418]: Upgrading MySQL tables if necessary. And here is the output after server stop and restart, this time successful: Dec 15 10:24:53 vm-jaunty-amd64 /etc/mysql/debian-start[4442]: Upgrading MySQL tables if necessary. |
| Comment by Kristian Nielsen [ 2009-12-15 ] |
|
Re: Upgrade from MySQL server requires extra server restart to upgrade tables properly I have pushed a branch with a proposed fix for this, we will see what tests say. |
| Comment by Rasmus Johansson (Inactive) [ 2010-02-11 ] |
|
Launchpad bug id: 484120 |