zoukankan      html  css  js  c++  java
  • mysql源码系列~innodb_flush_log_at_trx_commit在底层实现

    核心函数:trx_flush_log_if_needed_low
    具体逻辑:
    static void trx_flush_log_if_needed_low( lsn_t lsn) {
    {
    switch (srv_flush_log_at_trx_commit) {
    case 0:
    /* Do nothing */ 这里是由master线程的每1秒和每10秒算法进行日志的刷新,也就是master thread 每秒写到redo file中,然后由系统自行刷新到硬盘
    break;
    case 1:
    /* Write the log and optionally flush it to disk */
    log_write_up_to(lsn, LOG_WAIT_ONE_GROUP,
    srv_unix_file_flush_method != SRV_UNIX_NOSYNC);
    SRV_UNIX_NOSYNC, /*< do not flush after writing */ (可见这里刷新文件的方法不是这种模式 只写并不刷新)
    SRV_UNIX_LITTLESYNC, /*(这里是调用方法)< do not call os_file_flush(when writing data files, but do flush after writing to log files */
    break;
    case 2:
    /* Write the log but do not flush it to disk */
    log_write_up_to(lsn, LOG_WAIT_ONE_GROUP, FALSE);
    //在这里 srv_unix_file_flush_method=SRV_UNIX_NOSYNC

    break;
    default:
    ut_error;
    }
    }
    }
    总结: mysql使用了枚举类型定义了不同的动作种类,然后通过switch case进行判断执行某些动作,核心变量 srv_unix_file_flush_method
    文章源码来源参考: https://blog.csdn.net/innobase/article/details/51302145

  • 相关阅读:
    <c:forEach 的常用整理
    <div>
    HTML <td> 标签的 rowspan 属性
    ap-client.xml要配
    @Autowired
    hasResultError
    使用 EclEmma 进行覆盖测试
    IE调试网页之三:使用 F12 工具控制台查看错误和状态 (Windows)
    different between<A Href> and <jsp: forward>
    <button>与<input type="button">的区别
  • 原文地址:https://www.cnblogs.com/danhuangpai/p/13322339.html
Copyright © 2011-2022 走看看