[groonga-dev,03297] Re: Mroonga 5.03 ストレージモードで MySQL 5.6 のレプリケーションが切断される

Back to archive index

yoku ts. yoku0****@gmail*****
2015年 6月 15日 (月) 19:35:40 JST


こんばんは、yoku0825です。

私の手元でも再現できたので、ステップ実行でがんばってみました。


https://github.com/mysql/mysql-server/blob/5.6/sql/sql_insert.cc#L1127-L1182

* binlogがオープンされているかされていないかで処理が分岐しています。
  * binlogがオープンされている場合はthd->clear_error() が呼ばれて、
    STRICT_TRANS_TABLESによってワーニングがエラーにエスカレーションされた後にまたワーニングに戻ります。
  * binlogがオープンされていない場合はthd->clear_error() が呼ばれないので、
    STRICT_TRANS_TABLESによってエラーにエスカレーションされたワーニングがそのままエラーとしてSQLスレッドに戻ります。


どうあるべきか論は置いておくとして、うすうす感づかれているかも知れませんが、
* sql_modeからSTRICT_TRANS_TABLESを外す
* binlogを吐かせる
あたりがワークアラウンドですかね。
(スレーブ側にもlog-binを設定したら通るようになりました)


yoku0825,





2015年6月11日 23:47 Kouhei Sutou <kou****@clear*****>:
> 須藤です。
>
> 手順、ありがとうございます!
>
> たしかに手順通りやったら(Vagrantでやりましたが)再現しまし
> た。しかし、自分でビルドしたデバッグ版のMySQL 5.6.25だと再現
> しません。。。
>
> 設定ファイルを同じにして、sql_modeもmysql-community-serverと
> 同じようにNO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLESにしても
> 再現しません。再現したときのMySQLをmasterにしてslaveだけをデ
> バッグビルド版にしても再現しません。。。
>
> なにが違うんだろう。。。
>
> In <20150****@domai*****>
>   "[groonga-dev,03294] Mroonga 5.03 ストレージモードで MySQL 5.6 のレプリケーションが切断される" on Thu, 11 Jun 2015 13:37:27 +0900,
>   各務 洋 <kagam****@outwa*****> wrote:
>
>> お世話になります、各務です。
>>
>> Mroonga のストレージモードでレプリケーションが切断される件の再現手順を
>> まとめてみました。
>>
>>
>> ----------------------------------------------------------------------
>> 現象:
>>
>> Mroonga のストレージモードでレプリケーションが切断される。
>> 発生頻度は毎回。
>>
>>
>> ----------------------------------------------------------------------
>> 環境:
>>
>> CentOS 6.5
>> http://vault.centos.org/6.5/isos/x86_64/CentOS-6.5-x86_64-minimal.iso
>>
>> groonga-libs.x86_64  5.0.4-1.el6 @groonga
>> groonga-normalizer-mysql.x86_64  1.1.0-1.el6 @groonga
>> groonga-release.noarch  1.1.0-1 @/groonga-release-1.1.0-1.noarch
>> mysql-community-mroonga.x86_64  5.03-2.el6 @groonga
>> mysql-community-server.x86_64  5.6.25-2.el6 @mysql56-community
>> ストレージモード
>> マスター/スレーブの2台構成(但し仮想環境)です。
>> (Mroonga 5.02でも発生しています)
>>
>>
>> ----------------------------------------------------------------------
>> 再現手順:
>>
>> # Master 側 IP Address
>> # 192.168.xx.131
>> # Slave 側 IP Address
>> # 192.168.xx.132
>>
>> # 下記全て root で実行
>>
>> ## 前準備
>> vi /etc/resolv.conf
>> vi /etc/selinux/config
>>  SELINUX=disabled
>> vi /etc/sysconfig/network-scripts/ifcfg-eth0
>> vi /etc/sysconfig/network-scripts/ifcfg-eth1
>> chkconfig iptables off
>> chkconfig ip6tables off
>> shutdown -r now
>> ## 前準備終わり
>>
>> yum install -y http://packages.groonga.org/centos/groonga-release-1.1.0-1.noarch.rpm
>> yum install -y http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm
>> yum makecache
>> yum install -y mysql-community-server
>> /etc/rc.d/init.d/mysqld start
>> yum install -y mysql-community-mroonga
>> /etc/rc.d/init.d/mysqld stop
>>
>> # Master 側 サーバー [mysqld] セクションに下記を追加
>> vi /etc/my.cnf
>> + transaction_isolation = READ-COMMITTED
>> + mroonga_lock_timeout = 30000
>> + innodb_lock_wait_timeout = 50
>> + expire_logs_days = 5
>> + max_allowed_packet = 32M
>> +
>> + # Master
>> + log-bin = mysql-bin
>> + binlog_format = mixed
>> + server-id = 1
>>
>> # Slave 側 サーバー [mysqld] セクションに下記を追加
>> vi /etc/my.cnf
>> + transaction_isolation = READ-COMMITTED
>> + mroonga_lock_timeout = 30000
>> + innodb_lock_wait_timeout = 50
>> + expire_logs_days = 5
>> + max_allowed_packet = 32M
>> +
>> + # Slave
>> + server-id = 2
>>
>> /etc/rc.d/init.d/mysqld start
>>
>> # Master / Slave 共に
>> mysql -uroot
>> GRANT REPLICATION SLAVE ON *.* TO mysql****@192***** IDENTIFIED BY 'hogehoge';
>> GRANT REPLICATION SLAVE ON *.* TO mysql****@192***** IDENTIFIED BY 'hogehoge';
>>
>> # Master 側で
>> SHOW MASTER STATUS;
>>
>> # Slave 側で
>> CHANGE MASTER TO MASTER_HOST='192.168.xx.131', MASTER_USER='mysqlrepl', MASTER_PASSWORD='hogehoge', MASTER_LOG_FILE='mysql-bin.000001', MASTER_LOG_POS=120;
>> START SLAVE;
>>
>> # Master 側で
>> CREATE DATABASE db_test;
>> USE db_test;
>>
>> CREATE TABLE `tbl_test_pat_0001` (
>>       `id` BIGINT(20) NOT NULL AUTO_INCREMENT,
>>       `t_key` VARCHAR(255) NOT NULL,
>>       `t_date` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
>>       PRIMARY KEY (`id`),
>>       UNIQUE KEY `uidx_tbl_test_t_key_t_date` (`t_key`,`t_date`)
>> ) ENGINE=mroonga DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
>>
>> INSERT INTO tbl_test_pat_0001 (t_key, t_date) VALUES ('test1', '0000-00-00');
>> -- ↑ここで Replication が切れる
>>
>> # Slave 側で
>> SELECT * FROM tbl_test_pat_0001;
>> -- ↑ 値は入っている。
>>
>>
>> ----------------------------------------------------------------------
>> 期待する動作:
>>
>> レプリケーション状態を続行して欲しい。
>>
>>
>> ----------------------------------------------------------------------
>> 確認した事項:
>>
>> INSERT の際は Warning が発生する。
>> mysql> SHOW WARNINGS;
>> +-------+------+---------------------------------------------+
>> | Level | Code | Message                                     |
>> +-------+------+---------------------------------------------+
>> | Error | 1265 | Data truncated for column 't_date' at row 1 |
>> +-------+------+---------------------------------------------+
>>
>> ENGINE が innodb, またはラッパーモードだと Warning も Replication の切
>> 断も発生しない。
>>
>>
>> ----
>> 各務
>> kagam****@outwa*****
>>
>> _______________________________________________
>> groonga-dev mailing list
>> groon****@lists*****
>> http://lists.osdn.me/mailman/listinfo/groonga-dev
>
> _______________________________________________
> groonga-dev mailing list
> groon****@lists*****
> http://lists.osdn.me/mailman/listinfo/groonga-dev



groonga-dev メーリングリストの案内
Back to archive index