Not long ago, Facebook announced that they were upgrading their database from MySQL5.6 to MySQL8.0. MySQL is an open source database developed by Oracle that powers Facebook’s critical, core workloads.

Although MySQL8.0 was released a few years ago, let’s first review some key MySQL8.0 enhancements:

1. SQL window functions.

2. JSON extends syntax and improves sorting.

3. GIS geographic support. SRS (Spatial reference System), as well as SRS aware of spatial data types, spatial indexes and spatial functions.

4. Reliability.

5. Observability. Significant enhancements to performance patterns, information patterns, configuration variables, and error logging.

6. Manageability Remote management, undo tablespace management, and the new instant DDL.

Security. OpenSSL improvements, decomposition of super permissions, etc.

8. Optimize for specific workloads on specific hardware.

Facebook says it took more than a year to upgrade to MySQL5.6 in their last major release, and that they developed an LSM tree storage engine, MyRocks, on top of 5.6. Building a new storage engine at the same time as upgrading to 5.7 would have slowed MyRocks down considerably, so we chose to continue using version 5.6 until MyRocks was complete and MySQL5.6 was about to complete its mission and upgrade to MySQL8.0. Changes to MySQL include client connectors, storage engines, optimizers, and replication.

However, the development process was challenging, including migrating custom functionality to new releases, ensuring copy compatibility between releases, fixing some performance degradation, and minimizing some changes required by existing applications. The 8.0 port has been years in the making so far, and many of Facebook’s InnoDB replica sets have been converted to run fully in 8.0, with most of the rest in the process.

The main issues facebook needs to address are:

1. You cannot upgrade the server directly. You need to use logical dump and restore to build a new server. For a library the size of Facebook, this process can take days and can easily be interrupted.

2. Detect API changes.

3. It is difficult to support two major versions in a replica set. Disable and remove 5.6 as soon as possible after upgrade 8.0. The replication flow between two versions may be interrupted when a user uses a new feature collation in the application.

Facebook said it chose to migrate some apps to version 8.0 earlier to take advantage of features such as document storage and new date and time support, despite the difficulties associated with the change. Facebook also mentioned in the blog post that they have been experimenting with storage engine features like real-time DDL on MyRocks.

So what do you think of Facebook’s announcement? Feel free to leave a comment in the comments section! If you want to learn about MySQL, you can also go to our website, where there are many free online courses