5.7打补丁—编译和官方一致的Linux_Generic包
需求来源
某客户现场业务系统出现了查询丢失数据问题(数据库为MySQL 5.7.21,使用Linux-Generic包部署)。
已查明:丢数据问题是触发了MySQL 5.7的一个bug,该bug在5.7的后继版本已修复。
客户不想升级数据库版本,希望将fix的代码打到5.7.21重新编译后替换二进制。
编译步骤
准备包、源码和编译OS
从MySQL 5.7.19到MySQL 5.7.44,官方发布的Linux-Generic包一直使用的是glibc-2.12。
本文中,使用MySQL 5.7.21进行编译,对应的官方release包如下:
MySQL 5.7.21二进制包下载地址:https://downloads.mysql.com/archives/get/p/23/file/mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz
MySQL 5.7.21源码仓库github地址:GitHub - mysql/mysql-server at mysql-5.7.21
MySQL 5.7的手册中"根据源码安装MySQL:https://dev.mysql.com/doc/refman/5.7/en/source-installation.html"
章节中有如下内容,可参考"docs/INFO_BIN"文件中的内容获取官方编译时的环境信息:
If you are interested in building MySQL from a source distribution using build options the same as or similar to those use by Oracle to produce binary distributions on your platform, obtain a binary distribution, unpack it, and look in the docs/INFO_BIN file, which contains information about how that MySQL distribution was configured and compiled.
解压安装包查看"docs/INFO_BIN"文件,可看到一系列的编译相关信息,其中kernel和cmake版本信息如下:
Build was done on Linux-3.8.13-16.2.