RocksDB Storage Engine on MacOSIn Percona Server for MySQL 8.0.29-21, we added one more patch that helps us to build server code on macOS. To be precise here, we still could do this even before this patch but only partially. Now it is possible to build RocksDB Storage Engine as well.

A word of disclaimer here, at the moment, by macOS we still understand macOS for Intel x86_64 architecture (the most recent ARM versions with Apple M1 / M2 processors are out of the scope of this blog post). Moreover, Percona does not provide official macOS packages for Percona Server for MySQL. It’s just that a lot of our developers use Macs and we care a lot about this platform. As proof, here is a link to our Azure pipelines CI scripts with the latest CI changes that accompany this patch.

Prerequisites

In order to build Percona Server for MySQL, we need to install a number of dependencies. The most important one is Xcode which can be downloaded and installed directly from the App Store. Make sure that you run it at least once after installing. You will be asked to install Xcode Command Line Tools – please answer “yes” as this is the component we are looking for.

We will also need to install a number of third-party libraries on which Percona Server for MySQL code depends and the easiest way to do this would be via the brew package manager. If you don’t already have it installed, please follow the instructions.

After that, install the following tools/libraries via brew:

Please also notice that macOS itself, Xcode Command Line Tools, and brew packages are being constantly updated and when you try to follow the provided instructions their versions may not be the same as at the time when this blog post was written and as a result, something may not go as expected. So, just in case, I am including an excerpt from the brew config output to simply give you an idea of how old those components were.

Building

The first step would be to create a workspace directory and make it default:

Second, download Percona Server for MySQL source code from the git repository. In these instructions, we will be checking out code marked with the Percona-Server-8.0.29-21 tag (just because it was the most recent release when this blog post was written) but feel free to experiment with the trunk (the head of the 8.0 branch).

Then, we create a separate directory percona-build for intermediate objects and result libraries/executables.

After that, we need to run cmake to configure the project and generate Unix Makefiles.

I am not going to describe every parameter here as there is an official MySQL Server documentation page but the most important ones are:

  • -DCMAKE_BUILD_TYPE=RelWithDebInfo – configure to build optimized binaries with Debug information
  • -DMYSQL_MAINTAINER_MODE=OFF – do not treat compiler warnings as errors
  • -DWITH_SYSTEM_LIBS=ON – use system libraries (those we installed via the brew) instead of their bundled version
  • -DWITHOUT_TOKUDB=ON – do not build TokuDB Storage Engine, it is deprecated and is incompatible with macOS
  • -DWITH_ROCKSDB=ON – build with RocksDB Storage Engine (the main reason for this blog post)

And finally, initiate the build process

Please be patient as this may take from 15 to 60 min depending on your hardware.

Testing

Just to make sure that everything has been built successfully let us run a few MySQL tests via MTR.

If you see something like this:

Congratulations, you have successfully built Percona Server for MySQL with RocksDB on macOS.

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments