关于java:binlog乱序

63次阅读

共计 745 个字符,预计需要花费 2 分钟才能阅读完成。

咱们晓得在语句执行期间 binlog 会记录到 binlog_cache_size,然而超过 binlog_cache_size 的会
放到临时文件,等到 commit 的时候写到 binlog 文件中,当然是思考 sync_binlog = 1 的状况下
对于这段在文档中也有形容:
Within an uncommitted transaction, all updates (UPDATE, DELETE, or INSERT) that change transactional
tables such as InnoDBtables are cached until a COMMITstatement is received by the server. At that point,
mysqldwrites the entire transaction to the binary log before the COMMIT is executed.
When a thread that handles the transaction starts, it allocates a buffer of binlog_cache_sizeto buffer
statements. If a statement is bigger than this, the thread opens a temporary file to store the transaction.
The temporary file is deleted when the thread ends.

MySQL 数据库在 binlog 中记录的工夫戳,在承受到命令之后,尚未执行之前,就曾经确定,其值被记录在 thd 的 start_time 字段中。因而在一个高并发的 MySQL 中,可能先提交的 SQL 后执行,从而导致 binlog 中的记录时间戳失序

https://zhuanlan.zhihu.com/p/…

正文完
 0