关于 mysql SET GLOBAL sql_slave_skip_counter = N 的一点记录

SET GLOBAL sql_slave_skip_counter = N


This statement skips the next N events from the master. This is useful for recovering from replication stops caused by a statement.

This statement is valid only when the slave threads are not running. Otherwise, it produces an error.


When using this statement, it is important to understand that the binary log is actually organized as a
sequence of groups known as event groups. Each event group consists of a sequence of events.

• For transactional tables, an event group corresponds to a transaction.
• For nontransactional tables, an event group corresponds to a single SQL statement.
Note
A single transaction can contain changes to both transactional and nontransactional tables.
When you use SET GLOBAL sql_slave_skip_counter to skip events and the result is in the
middle of a group, the slave continues to skip events until it reaches the end of the group. Execution

then starts with the next event group. 

mysql为啥这么做是为了保证事务的一致性,一个大事务中一个sql 操作异常,那么整个大事务就必须要全部回退rollback。

一个事务具备原子性,在任何情况下都无法破坏一个事务的完整性。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值