咱们晓得在语句执行期间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/...