Home > Database > Mysql Tutorial > body text

主从故障处理--session 级别参数复制错误

WBOY
Release: 2016-06-07 17:41:43
Original
1020 people have browsed it

接受新项目,主从数据库复制同步错误,ErrorCode1292(invaliddatatype)报错SQL:updatewavesetIS_WAVED=0,LEVEL=1,SOURCE_TB_NAME=null,SOURCE_ID=null,UPDATE

    接受新项目,主从数据库复制同步错误,Error Code  1292 (invalid datatype)

    报错SQL:update wave set IS_WAVED = 0,LEVEL = 1,SOURCE_TB_NAME = null,SOURCE_ID = null,UPDATE_TIME = '2013-03-10 02:13:36.0' where PLAYER_ID = 80406 and TYPE = 0;

    时间格式肯定不对,

    查看服务器SQL_MODE 发现为空。这就奇怪啦,默认情况下MySQL会将其转换为正确格式;

    查看master该条记录情况,没有发生变化,香港服务器租用,由于Myisam存储引擎的原因,在该SQL执行错误时没有进行回滚删除binlog内容,(以后还是用Innodb吧!!)

    mysqlbinlog解析binlog

mysqlbinlog --start-datetime="2013-04-11 08:37:56" --stop-datetime="2013-04-11 08:45:56" localhost-bin.001882 > /tmp/1.txt

    发现该类似的语句全部执行成功,香港服务器租用,为什么唯独这个错误的 时间格式没有转换呢?

    在binlog中发现以下线索:

SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.sql_mode=2097152/*!*/;

    可以确定的错以上是由某工具或框架设定的。

    下面我们看看这个session中 sql_mode的值;

    set sql_mode=2097152;

    mysql> show variables like '%sql_mode%';
+---------------+---------------------+
| Variable_name | Value               |
+---------------+---------------------+
| sql_mode      | STRICT_TRANS_TABLES |
+---------------+---------------------+

    在session中 sql_mode 被设置为 STRICT_TRANS_TABLES (具体解释可参考:)

    这个时候就可以让slave 跳过这些session设置就可以啦。

    治本的办法是改动程序,但对于一个已经三年的项目,且没有固定人员负责的项目,DBA该如何权衡呢?

本文出自 “技术成就梦想” 博客,网站空间,请务必保留此出处

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!