Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

目标mysql 设置为autocommit=0时,执行无法成功 #66

Open
Mount565 opened this issue Mar 13, 2018 · 4 comments
Open

目标mysql 设置为autocommit=0时,执行无法成功 #66

Mount565 opened this issue Mar 13, 2018 · 4 comments

Comments

@Mount565
Copy link

当目标mysql关闭autocommit时,无法执行成功。备份服务器关闭autocommit时无法备份成功。

clipboard

inception 在备份状态挂起。我猜是没有commit, 不产生binlog, 备份功能在等待dump binlog 。

@Mount565
Copy link
Author

我猜不会有人回复。。。。

@slieer
Copy link

slieer commented Apr 30, 2018

我回答了, 但不能解决你的问题, 国内开源项目, 不好做啊! 观念和生态问题。中兴事件能不能引起大家的警醒呢?!

@hanchuanchuan
Copy link

我没有测试是否是因为autocommit的原因,如果确定是这样的话,可以按如下方式解决:
可以修改源码sql/sql_parse.cc文件,在函数mysql_check_binlog_format最后return之前添加

    sprintf(set_format,"set session autocommit=on;");
    if (mysql_real_query(mysql, set_format, strlen(set_format)))
    {
        my_message(mysql_errno(mysql), mysql_error(mysql), MYF(0));
        DBUG_RETURN(ER_NO);
    }

    DBUG_RETURN(false);

按上述方法可以添加各种操作前的set项设定,须注意set范围为session。

@Mount565
Copy link
Author

好的,有空试一下,谢谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants