跨版本導入數據導致mysqld崩潰

現象

mysqld突然崩潰,錯誤日誌
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 7fd06c41be28 thread_stack 0x40000
/opt/udb/program/mysql/mysql-5.6.20/bin/mysqld(my_print_stacktrace+0x35)[0x8e37d5]
/opt/udb/program/mysql/mysql-5.6.20/bin/mysqld(handle_fatal_signal+0x41b)[0x651d0b]
/lib64/libpthread.so.0(+0xf500)[0x7fd1c9b2d500]
/opt/udb/program/mysql/mysql-5.6.20/bin/mysqld(_Z9get_fieldP11st_mem_rootP5Field+0x43)[0x769b43]
/opt/udb/program/mysql/mysql-5.6.20/bin/mysqld[0x6768cc]
/opt/udb/program/mysql/mysql-5.6.20/bin/mysqld(_Z11mysql_grantP3THDPKcR4ListI11st_lex_userEmbb+0x4f1)[0x6785c1]
/opt/udb/program/mysql/mysql-5.6.20/bin/mysqld(_Z21mysql_execute_commandP3THD+0x4972)[0x6db4a2]
/opt/udb/program/mysql/mysql-5.6.20/bin/mysqld(_Z11mysql_parseP3THDPcjP12Parser_state+0x531)[0x6dbb71]
/opt/udb/program/mysql/mysql-5.6.20/bin/mysqld(_Z16dispatch_command19enum_server_commandP3THDPcj+0x1782)[0x6dd392]
/opt/udb/program/mysql/mysql-5.6.20/bin/mysqld(_Z24do_handle_one_connectionP3THD+0x10d)[0x6a572d]
/opt/udb/program/mysql/mysql-5.6.20/bin/mysqld(handle_one_connection+0x42)[0x6a5862]
/opt/udb/program/mysql/mysql-5.6.20/bin/mysqld(pfs_spawn_thread+0x127)[0xaf8d87]
/lib64/libpthread.so.0(+0x7851)[0x7fd1c9b25851]
/lib64/libc.so.6(clone+0x6d)[0x7fd1c8b9590d]


原因分析

通過錯誤查看到(_Z11mysql_grantP3THDPKcR4ListI11st_lex_userEmbb+0x4f1),mysql_grant函數調用導致崩潰,猜測是用戶授權時出了問題,重新登錄db發現user表結構確實有問題,下圖中1是崩潰後的表結構,2是該mysqld版本對應的user表結構




故障模擬

1 新建一個正常的db,表結構應該是上圖中的2
2 刪除user表,新建表結構1
3 執行grant語法創建一個新賬戶,這時mysqld就崩潰了

改進措施

1 任何跨版本導入數據,一定要執行mysql_upgrade

2 有些情況下mysql_upgrade還不一定夠用,需要額外再去檢查系統表有無問題,故障案例參見

http://blog.csdn.net/cug_jiang126com/article/details/51602757

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章