mysql rpl_MySQL增强半同步参数rpl_semi_sync_master_wait_point值AFTER_SYNC和AFTER_COMMIT

本文介绍了MySQL增强半同步复制的参数rpl_semi_sync_master_wait_point的两种值——AFTER_SYNC和AFTER_COMMIT的含义与区别。AFTER_SYNC确保在事务被复制到从库并同步到磁盘后,主库才提交事务,而AFTER_COMMIT则在存储引擎提交后等待从库确认,可能导致其他会话在确认前看到事务。这种行为变化影响数据一致性与容灾恢复,且不同版本间存在兼容性问题。
摘要由CSDN通过智能技术生成

MySQL 5.7.22

启用增强半同步复制

MySQL对该参数值的描述

b10b83099aa5d0efab9363349df9866a.gif

Semisync can wait for slave ACKs at one of two points,

AFTER_SYNC or AFTER_COMMIT. AFTER_SYNC is the default value.

AFTER_SYNC means that semisynchronous replication waits just after the

binary log file is flushed, but before the engine commits, and so

guarantees that no other sessions can see the data before replicated to

slave. AFTER_COMMIT means that semisynchronous replication waits just

after the engine commits. Other sessions may see the data before it is replicated, even though the current session is still waiting for the commit

to end successfully.

b10b83099aa5d0efab9363349df9866a.gif

From: Source Code mysql-5.7.22\plugin\semisync\semisync_master_plugin.cc

Replication: Semisynchronous replication master servers now use a different wait point by default in communicating wih slaves. This is the point at which the master waits for acknowledgment of transaction receipt by a slave before returning a status to the client that committed the transaction. The wait point is controlled by the new rpl_semi_sync_master_wait_point system variable. These values are permitted:

AFTER_SYNC (the default): The master writes each transaction to its binary log and the slave, and syncs the binary log to disk. The master waits for slave acknowledgment of transaction receipt after the sync. Upon receiving acknowledgment, the master commits the transaction to the storage engine and returns a result to the client, which then can proceed.

AFTER_COMMIT: The master writes each transaction to its binary log and the slave, syncs the binary log, and commits the transaction to the storage engine. The master waits for slave acknowledgment of transaction receipt after the commit. Upon receiving acknowledgment, the master returns a result to the client, which then can proceed.

For older versions of MySQL, semisynchronous master behavior is equivalent to a setting of AFTER_COMMIT.

The

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值