Date Node参数 TimeBetweenLocalCheckpoints,默认值为 2000,范围是:20-32000
When a transaction is committed, it is committed in main memory in all nodes on which the data is mirrored. However, transaction log records are not flushed to disk as part of the commit. The reasoning behind this behavior is that having the transaction safely committed on at least two autonomous host machines should meet reasonable standards for durability.
It is also important to ensure that even the worst of cases—a complete crash of the cluster—is handled properly. To guarantee that this happens, all transactions taking place within a given interval are put into a global checkpoint, which can be thought of as a set of committed transactions that has been flushed to disk. In other words, as part of the commit process, a transaction is placed in a global checkpoint group. Later, this group's log records are flushed to disk, and then the entire group of transactions is safely committed to disk on all computers in the cluster.
说到这里,我们有必要去回顾一下MySQL的 redo 和 undo。
MySQL-Cluster存储引擎 NDB 支持事务,每次做数据变更时,将数据和索引都放在内存缓冲池中,而不是直接更新到磁盘上,这样大大避免了I/O请求,也避免了磁头不断的重新定位所花费的时间,这样大大提高了读写速度。所以每当NDB处理完一个事务之后就添加一条日志LOG,其它线程负责读取日志文件并指更新到磁盘,达到最高效的磁盘写入。
在数据恢复的时候,会将已经提交的事务标记并放入redo队列(正向扫描),未完成的事务放入undo队列(反射扫描),用redo和undo这两个日志文件来记录相关信息。我们在每次事务提交的时候会将更改操作记录到redo log。
本文详细阐述了MySQL Cluster存储引擎NDB如何通过内存缓冲池高效处理事务,以及其确保数据持久性的机制——事务检查点。重点讨论了在事务提交阶段,MySQL不会立即刷写日志到磁盘,而是等到一定时间间隔内多个事务完成后才进行全局检查点,将这些事务持久化到磁盘,以确保即使集群崩溃也能恢复数据。
2061

被折叠的 条评论
为什么被折叠?



