mysql-logo
MySQL 5.6 มี bug ที่ควรระวัง คือการรันคำสั่ง GRANT privileges บน PhpMyAdmin อาจทำให้เกิด slave หยุด replicate ข้อมูลได้ (bug report: http://bugs.mysql.com/bug.php?id=68892)

หลังจากได้ใช้งาน MySQL 5.6 (version 5.6.14-1) แบบ replication ก็พบปัญหาการใช้งานเมื่อทำการ GRANT สิทธิให้กับ user บน PhpMyAdmin ก็พบว่า slave หยุดการ replicate ข้อมูล และมี error log ดังนี้

Last_SQL_Errno: 1590
Last_SQL_Error: The incident LOST_EVENTS occured on the master. Message: error writing to the binary log


หลังจากพบ error log ดังกล่าวจึงได้ไปตรวจสอบ binary log ที่ master ก็พบว่าเกิด LOST_EVENTS ขึ้นใน binary log ที่เครื่อง master จริงซึ่งปัญหาน่าจะเกิดที่การเขียน binary log บนเครื่อง master

#131030 15:59:50 server id 100 end_log_pos 1777150 CRC32 0x2aa22c31
# Incident: LOST_EVENTS
RELOAD DATABASE; # Shall generate syntax error

จากข้อมูลที่ตรวจสอบก็ทำให้คิดว่าปัญหาน่าจะเกิดจาก bug ของ MySQL ดังนั้นจึงได้ไปตรวจสอบก็พบว่ามี bug #68892 Invalid use of GRANT command breaks replication ซึ่งอธิบายรายละเอียดดังนี้

Fixed in 5.6+. Documented fix in the 5.6.15 and 5.7.3 changelogs, as follows:

Issuing a GRANT statement with invalid parameters caused the
master to write LOST_EVENTS events into its binary logs, causing
replication to stop. Now such cases, if one or more grants or
revocations of privileges are successful, an incident is written
to the log; otherwise, only a warning is logged.

ดังนั้นหากต้องทำการ GRANT สิทธิให้กับ user ควรทำด้วยความระมัดระวังก็จะไม่พบปัญหานี้ครับ