Features/ReplaceMySQLwithMariaDB

From FedoraProject

< Features
Revision as of 12:16, 12 June 2013 by Hhorak (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

Replace MySQL with MariaDB

Summary

MariaDB, a community developed fork of MySQL, will be the default implementation of MySQL in Fedora 19.

Owner

Current status

  • Targeted release: Fedora 19
  • Last updated: 2013-06-02
  • Percentage of completion: 100%

Detailed Description

MariaDB is a fork of the MySQL database project that provides a drop-in replacement for MySQL. It preserves API/ABI compatibility with MySQL and adds some new features.

The original company behind MySQL, MySQL AB, were bought out by Sun which was then bought by Oracle. Recent changes made by Oracle indicate they are moving the MySQL project to be more closed. They are no longer publishing any useful information about security issues (CVEs), and they are not providing complete regression tests any more, and a very large fraction of the mysql bug database is now not public.

MariaDB, which was founded by some of the original MySQL developers, has a more open-source attitude and an active community. We have found them to be much easier to work with, especially in regards to security matters.

We would like to replace MySQL with MariaDB in early development cycle for Fedora 19. Original MySQL implementation packaged as mysql will be renamed to community-mysql and package mysql will retire as of Fedora 19. It means the name "mysql" will become only a virtual provider for compatibility reasons. MariaDB will become the default and will include Provides/Obsoletes for mysql, while community-mysql will only include Provides for functional packages (not -devel packages) in order to avoid ambiguity when choosing one from two packages providing the same symbol. The community-mysql packages will be installed after users explicitly request so. Also, we do not intend to support concurrent installation of both packages on the same machine; pick one or the other. The only packages, that will be able to be installed in parallel will be client libraries (mariadb-libs and community-mysql-libs).

Benefit to Fedora

Fedora will have a truly open-source MySQL implementation and won't depend on what Oracle decides to do with MySQL in the future. Compared to MySQL, MariaDB is faster in some cases, it includes some new engines and features, while the existing engines and features are enhanced and still compatible.

Scope

For all practical purposes, MariaDB is a binary drop-in replacement of the same MySQL version, so it's usually not necessary to do changes in packages depending on libmysqlclient.so. (We will be replacing mysql 5.5 with mariadb 5.5, so there are no cross-major-version changes to worry about.)

However, the embedded mysql library libmysqld.so has changed soname, because we had to create this library manually before, while MariaDB supports it out-of-the-box now. As a consequence, packages depending on the mysql-embedded package will have to be rebuilt (currently only amarok).

Admins shouldn't notice any change.

How To Test

We're organizing MariaDB Test Day on 2013-04-30.

We need to test switching from MySQL to MariaDB on some large production databases. We will have some larger database and MySQL will be running. At this point updating to MariaDB will be done and should process cleanly. After RPM update, database will be checked from database POV and users POV. Dump of the database should be the same and users shouldn't notice any change. We will need to test also connectors and applications using mysql client library.

User Experience

End-users:

  • There are no end-user visible changes, except the database being faster and more reliable.

Admins:

  • Packages structure and their contents are similar to MySQL and the changes are usually just some new files.

Dependencies

  • Dependencies are unchanged from MySQL.

Contingency Plan

Switching back to MySQL if necessary should be easy.

We intend to mark the mariadb packages as providing/obsoleting mysql. In event that mariadb is not accepted as default, we'd just remove these markings. It will also be necessary to adjust (or revert) anaconda's idea of the packages to install when asked for a mysql database.

Documentation

Main differences between MariaDB and MySQL are listed in https://kb.askmonty.org/en/mariadb-versus-mysql-features/

Compatibility between MariaDB and MySQL is discussed in https://kb.askmonty.org/en/mariadb-versus-mysql-compatibility/

Package Review is available in https://bugzilla.redhat.com/show_bug.cgi?id=875150

Some related discussions took place on fedora-devel-list: http://lists.fedoraproject.org/pipermail/devel/2012-December/175269.html

Steps to replace MySQL with the new MariaDB for testing purposes in Fedora 17 and 18

In Fedora 17 and 18, there are packages of MariaDB, which don't obsolete MySQL, so they won't be installed if user doesn't request them explicitly. Suppose we have the following packages installed: mysql, mysql-libs, mysql-devel, mysql-server; and we want to replace them with the same set of MariaDB packages.

Note: Structure and content of MariaDB packages are the same as MySQL packages, so you don't have to think about what packages you need, just install the same set as of packages as you have from MySQL.

1) backup your data e.g. using mysql_dump just for the case something goes wrong; usually this backup won't be needed

2) remove MySQL packages and install MariaDB packages in one transaction:

# yum shell
> remove mysql mysql-libs mysql-devel mysql-server
> install mariadb mariadb-libs mariadb-devel mariadb-server
> run
^D

If you'll need to go back to MySQL again in the future, just repeat the steps above with swapping MySQL packages with MariaDB and vise versa.

Steps to replace MariaDB with the original MySQL in Fedora 19 (rawhide)

In Fedora 19, MariaDB packages obsolete mysql packages and original mysql component was renamed to community-mysql. That means that all mysql packages installed at a time of upgrading to F19 will be automatically replaced by corresponding MariaDB pacakges.

In order to allow to use Oracle's MySQL (community-mysql) packages, a new component community-mysql was included into F19. These packages include server and client part, but the -devel packages don't provide mysql symbols. The client library from community-mysql-libs also has adjusted soname version number, so it means that packages requiring libmysqlclient.so.18 (provided by MariaDB) won't be able to link against library from community-mysql packages (if not built against community-mysql-devel explicitly). This is mainly caused by the fact, that RPM doesn't provide any apparatus to choose between two packages providing the same object. Thus, a typical use case of using MySQL packages would be using community-mysql-server together with mariadb client package (mariadb-libs).

The steps bellow describe procedure to get back to original MySQL (community) server.

Suppose the following packages are installed: mariadb, mariadb-libs, mariadb-devel, mariadb-server; and we want to replace the server with Oracle's MySQL package.

1) backup your data e.g. using mysql_dump just for the case something goes wrong; usually this backup won't be needed

2) un-install mariadb-server and mariadb but leave mariadb-libs package installed:

yum remove mariadb-server mariadb

3) then install MySQL server instead:

yum install community-mysql community-mysql-server

If you really need to install community-mysql client library and/or devel files (packaged as community-mysql-libs, community-mysql-devel) instead of mariadb packages, note that you will have to keep mariadb-libs (which is the only package that doesn't conflict with community-mysql) to be able to use packages depending on mariadb client packages. If you are OK with that, replace the client packages as follows:

1) un-install mariadb and all it's dependencies:

yum remove mariadb mariadb-devel

2) then install community-mysql-libs, community-mysql-devel and community-mysql utilities instead:

yum install community-mysql-libs community-mysql-devel community-mysql

Steps to keep original MySQL installed during F18 -> F19 upgrade

As already mentioned, original MySQL package (Oracle as upstream) was renamed to community-mysql and mysql has become only virtual provider since F19. The following steps ensure that no MariaDB server will be installed during F18 -> F19 upgrade. Follow these steps only if you really want to stay with original MySQL implementation. The only MariaDB package, which needs to be installed, is mariadb-libs, which is required by some packages as dependency.

We have basically two ways how to ensure that community-mysql packages will be installed instead of MariaDB during upgrade. Choose the way that fits your needs better. You can also upgrade without doing anything, let yum to install MariaDB packages and install community-mysql after then, as described above.

A. Disabling MariaDB packages temporarily

1) Before upgrading, configure yum, so it will not update MariaDB packages:

# echo "exclude=mariadb*" >> /etc/yum.conf

2) Now you can proceed with F18 -> F19 upgrade, while mysql packages from F18 will be kept

3) Remove the "exclude=mariadb*" line from /etc/yum.conf

4) Install community-mysql packages instead:

# yum shell
> remove mysql*
> install community-mysql community-mysql-libs community-mysql-server mariadb-libs
> run

B. Install community-mysql before upgrading

1) Download packages from Koji or set-up a yum repository for F19

2) Replace mysql packages by community-mysql (we use shell to not loose dependencies)

# yum shell --enable fedora19
> remove mysql mysql-server
> install community-mysql community-mysql-server
> run

Notice: since community-mysql packages require newer glibc, yum will update that package as well. It actually shouldn't do any harm, since we are going to upgrade anyway.

3) Proceed with upgrade and community-mysql packages will stay installed

Release Notes

MariaDB, an improved and more open fork of the MySQL database project, has replaced original MySQL as the default mysql-compatible database. This change should be transparent to almost all MySQL users. However, if you encounter difficulties, you can replace MariaDB with the original mysql packages. (See Documentation above)

Comments and Discussion