Upgrade from MySQL server requires extra server restart to upgrade tables properly
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MariaDB |
Fix Released
|
High
|
Kristian Nielsen | ||
OurDelta |
Fix Committed
|
High
|
Kristian Nielsen |
Bug 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-
Nov 17 10:40:52 odin mysqld_safe[10176]: ERROR: 1136 Column count doesn't match value count at row 1
Nov 17 10:40:52 odin mysqld_safe[10176]: 091117 10:40:52 [ERROR] Aborting
It seems this comes from this line in mariadb-
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_
"USE mysql;\n" \
"ALTER TABLE user ADD column Create_view_priv enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N'; " \
"ALTER TABLE user ADD column Show_view_priv enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N'; " \
"ALTER TABLE user ADD column Create_routine_priv enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N'; " \
"ALTER TABLE user ADD column Alter_routine_priv enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N'; " \
"ALTER TABLE user ADD column Create_user_priv enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N'; " \
"ALTER TABLE user ADD column Event_priv enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N'; " \
"ALTER TABLE user ADD column Trigger_priv enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N'; " `
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.
Related branches
- Arjen Lentz: Approve
-
Diff: 147 lines (+20/-30)3 files modifiedbakery/debian-5.1/additions/debian-start (+4/-0)
bakery/debian-5.1/dist/Debian/mariadb-server-5.1.postinst (+8/-15)
bakery/debian-5.1/dist/Ubuntu/mariadb-server-5.1.postinst (+8/-15)
tags: | added: 5.1 |
Changed in maria: | |
status: | New → Confirmed |
importance: | Undecided → High |
tags: | added: packaging |
Changed in maria: | |
status: | In Progress → Fix Committed |
Changed in ourdelta: | |
status: | In Progress → Fix Committed |
Changed in maria: | |
status: | Fix Committed → Fix Released |
How things 'should' work is that one should start mysqld, run the privilege_ tables and then stop mysqld.
mysql_fix_
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
the scripts in sync.
Also the way 'fix_privs' now works, it will not be able to handle all cases that mysql_fix_ privilege_ tables does.