2016年10月27日 星期四

MariaDB : Failed Registration of InnoDB as a Storage Engine

昨晚DB顯示GG了,早上追了一下貌似自建Function沒設Read Only造成Log塞爆導致Slave DB LOG同步異常,然後自我修復重啟失敗所致。

做個MEMO囉...不經一事不長一智。
ERROR 1418 (HY000): This function has none of DETERMINISTIC, NO SQL,
or READS SQL DATA in its declaration and binary logging is enabled
(you *might* want to use the less safe log_bin_trust_function_creators
variable)
參考官方文件中的描述,在建立FUNCTION時,要增加READS SQL DATA否則在Recovery或Replicatioin時會出現unsafe的error message,這message多了就會塞爆LOG...
CREATE FUNCTION f1(i INT)
RETURNS INT
DETERMINISTIC
READS SQL DATA
BEGIN
  RETURN i;
END;

無法啟動的LOG類似以下這個...只需要把/var/lib/mysql/下的ib_logfileXX跟ibdataX搬移開來(要移除也行~不過個人習慣是下MV指另,RM下好離手就回不來了。

101003 18:37:27 [Note] Plugin 'FEDERATED' is disabled.
InnoDB: Error: log file .\ib_logfile0 is of different size 0 40894464 bytes
InnoDB: than specified in the .cnf file 0 536870912 bytes!
101003 18:37:27 [ERROR] Plugin 'InnoDB' init function returned error.
101003 18:37:27 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
101003 18:37:27 [ERROR] Unknown/unsupported table type: InnoDB
101003 18:37:27 [ERROR] Aborting

接者下service mysql start 或 systemctl start mariadb.service 啟動即可。

  • Slave DB 出現 Could not initialize master info structure 時,下reset slave; 清一下LOG
  • 出現 Error : Tablespace for table '`database`.`table-temp`' exists. Please DISCARD the tablespace before IMPORT.
    這個卡麻煩~畢竟DB不是都自己在處理的,其他人刪除Table沒下Drop指令而是使用...時,就會造成此錯誤,請將該table-temp.idb搬移出目錄即可。
  •  







沒有留言: