mysql_upgrade issue for libmysqld and amarok

Kristian Nielsen knielsen at knielsen-hq.org
Fri Mar 18 15:16:38 CET 2011


Ian Monroe <ian at monroe.nu> writes:

> On Fri, Mar 18, 2011 at 05:44, Kristian Nielsen
> <knielsen at knielsen-hq.org> wrote:

>> The issue is how to upgrade libmysqd from MySQL version 5.1 to version 5.5 (or
>> more generally any major version upgrade), in particular as relates to
>> Amarok's use of libmysqld.

>> One idea is to also build mysql_upgrade_embedded; this would be a variant of
>> mysql_upgrade linked with libmysqld, so it does not depend on the mysqld
>> server. Similarly, we would need mysqlcheck_embedded (mysqlcheck is called
>> from mysql_upgrade). These two binaries could be included in the libmysqld
>> package (they are small).
>
> wouldn't they be huge? libmysqld is a static library, so anything
> linking to them is going to be at least 50mb.

In MariaDB, we have both static and dynamic libmysqld. So we should link with
the dynamic libmysqld.so, and binaries should be small.

>> The upgrade procedure for amarok would then be to stop amarok linked with 5.1,
>> then run mysql_upgrade_embedded (from 5.5) against the amarok libmysqld data
>> directory, then start amarok linked with 5.5.
>
> There can't be any procedure that the user has to do.

Agree.

> But if there is some way for us to determine if mysql_upgrade_embedded
> needs to be run, I don't see why this would a problem. Amarok could
> run it before initializing the database.

I would suggest to write a small file in the user's data directory with the
version last upgraded to. If this is < 5.5 at startup (eg. "5.1"), then Amarok
can run the upgrade and afterwards update the file to say "5.5". This will
also allow to detect and warn about downgrading 5.5->5.1. Debian does
something similar for the main MySQL server packages.

>> The other idea that came up was to add this as extra calls in the library. So
>> that the amarok application could just call some mysql_upgrade() function
>> instead of having to run an external upgrade binary. Would this be more useful
>> for amarok?
>
> This sounds much more straightforward.

Ok, I will see if we can do this. Probably we could do both (then
mysql_upgrade_embedded will just be a stub calling into mysql_upgrade() in the
library, might be useful in other applications).

>> We could offer to implement this (either solution I think) in MariaDB (a
>> version of MariaDB that includes MySQL 5.5 is in the works). This would allow
>> to use the above to upgrade Amarok to using MariaDB 5.5. Would this work?
>
> Sounds good.

> We really could care less about maria vs. mysql, we just want
> something that works.

Ok, great :-)

> Since I talked to you last time, I've had reports of people going from
> mysql 5.1 to 5.5 without needing mysql_upgrade. mysql_upgrade seemed
> to fix things for me, but maybe it was just a coincidence.

Yes. The main issue I can think of now is that when character sets/collations
change, the indexes of affected tables may need to be rebuilt. Otherwise they
may contain incorrect ordering or indexing of affected characters. Since such
changes are rare, and tables with affected characters probably even rarer, a
missing upgrade is likely to go ok or at least unnoticed for some time.

> Either way though, relying on newer versions of mysql simply not
> needing to do any upgrade procedures seems like poor planning.

Agree, even if it works for 5.5 it will be sure to break sooner or later.

Monty said he would look into implementing this. He is quite busy, so it may
be a few weeks, but I will try to follow up with him to see if we can move
forward with it reasonably quickly.

 - Kristian.


More information about the Amarok-devel mailing list