mariadbでエラーがでてる。
センサーのデータを蓄積しているデータベースのレプリケーションを観察していたら、以下のエラーを見つけた。
Jul 07 18:20:04 raspberrypi4b-gamma mariadbd[918]: 2024-07-07 18:20:04 6 [ERROR] Incorrect definition of table mysql.column_stats: expected column 'hist_type' at position 9 to have type enum('SINGLE_PREC_HB','DOUBLE_PREC_HB','JSON_HB'), found type enum('SINGLE_PREC_HB','DOUBLE_PREC_HB').
Jul 07 18:20:04 raspberrypi4b-gamma mariadbd[918]: 2024-07-07 18:20:04 6 [ERROR] Incorrect definition of table mysql.column_stats: expected column 'histogram' at position 10 to have type longblob, found type varbinary(255).
Jul 07 18:20:04 raspberrypi4b-gamma mariadbd[918]: 2024-07-07 18:20:04 6 [ERROR] Incorrect definition of table mysql.column_stats: expected column 'hist_type' at position 9 to have type enum('SINGLE_PREC_HB','DOUBLE_PREC_HB','JSON_HB'), found type enum('SINGLE_PREC_HB','DOUBLE_PREC_HB').
Jul 07 18:20:04 raspberrypi4b-gamma mariadbd[918]: 2024-07-07 18:20:04 6 [ERROR] Incorrect definition of table mysql.column_stats: expected column 'histogram' at position 10 to have type longblob, found type varbinary(255)mysqlのcolumn_statsテーブルの 'hist_type'と'histogramの型違いのエラー…
mysql.column_stats テーブルの hist_type 列の型が enum('SINGLE_PREC_HB','DOUBLE_PREC_HB','JSON_HB') であるべきなのに、実際には enum('SINGLE_PREC_HB','DOUBLE_PREC_HB') になっている。mysql.column_stats テーブルの histogram 列の型が longblob であるべきなのに、実際には varbinary(255) になっている。
mariadbにログイン
mysql -u root -p
mysqlを使用
USE mysql;
hist_type 列の型を修正
ALTER TABLE column_stats MODIFY hist_type ENUM('SINGLE_PREC_HB', 'DOUBLE_PREC_HB', 'JSON_HB');
histogram 列の型を修正
ALTER TABLE column_stats MODIFY histogram LONGBLOB;
システムテーブルのアップグレードとmariadbを念の為再起動
sudo mysql_upgrade
sudo systemctl restart mariadb
変更されていることをphpmyadminで確認してみた。

レプリケーション側でも同様に変更されたことを確認した。


