国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

innodb_flush_log_at_trx_commit 參數

2019-11-09 13:39:39
字體:
來源:轉載
供稿:網友

innodb_flush_log_at_trx_commit 三種取值 0 、1、2 對性能有很大影響,現在從源碼瞧瞧是如何實現定義。涉及的文件以及函數調用如下:

innobase/srv/srv0srv.c中srv_master_thread()

innodbase/trx/trx0trx.c 中 trx_commit_off_kernel() ( 查看log_write_up_to()函數調用)

關鍵代碼

/* Depending on the my.cnf options, we may now write the log        buffer to the log files, making the transaction durable if        the OS does not crash. We may also flush the log files to        disk, making the transaction durable also at an OS crash or a        power outage.        The idea in InnoDB's group commit is that a group of        transactions gather behind a trx doing a physical disk write        to log files, and when that physical write has been completed,        one of those transactions does a write which commits the whole        group. Note that this group commit will only bring benefit if        there are > 2 users in the database. Then at least 2 users can        gather behind one doing the physical log write to disk.        If we are calling trx_commit() under PRepare_commit_mutex, we        will delay possible log write and flush to a separate function        trx_commit_complete_for_MySQL(), which is only called when the        thread has released the mutex. This is to make the        group commit algorithm to work. Otherwise, the prepare_commit        mutex would serialize all commits and prevent a group of        transactions from gathering. */        if (trx->flush_log_later) {            /* Do nothing yet */            trx->must_flush_log_later = TRUE;        } else if (srv_flush_log_at_trx_commit == 0) {            /* Do nothing */        } else if (srv_flush_log_at_trx_commit == 1) {            if (srv_unix_file_flush_method == SRV_UNIX_NOSYNC) {                /* Write the log but do not flush it to disk */                log_write_up_to(lsn, LOG_WAIT_ONE_GROUP,                        FALSE);            } else {                /* Write the log to the log files AND flush                them to disk */                log_write_up_to(lsn, LOG_WAIT_ONE_GROUP, TRUE);            }        } else if (srv_flush_log_at_trx_commit == 2) {            /* Write the log but do not flush it to disk */            log_write_up_to(lsn, LOG_WAIT_ONE_GROUP, FALSE);        } else {            ut_error;        }        trx->commit_lsn = lsn;  log_write_up_to定義在innobase/include/log0log.h中

/******************************************************//**This function is called, e.g., when a transaction wants to commit. It checksthat the log has been written to the log file up to the last log entry writtenby the transaction. If there is a flush running, it waits and checks if theflush flushed enough. If not, starts a new flush. */UNIV_INTERNvoidlog_write_up_to(/*============*/    ib_uint64_t    lsn,    /*!< in: log sequence number up to which                the log should be written,                IB_ULONGLONG_MAX if not specified */    ulint        wait,    /*!< in: LOG_NO_WAIT, LOG_WAIT_ONE_GROUP,                or LOG_WAIT_ALL_GROUPS */    ibool        flush_to_disk);                /*!< in: TRUE if we want the written log                also to be flushed to disk *//****************************************************************//**

wait 參數三種變量值:

log_no_wait:不等待  

log_wait_one_group:等待刷新到一個日志組

log_wait_all_group:等待刷新到所有日志組

 實現 innobase/log/log0log.c中


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 莱西市| 开封市| 秦皇岛市| 阿图什市| 澄城县| 多伦县| 娱乐| 滦南县| 扎鲁特旗| 民乐县| 鄂温| 永城市| 房产| 温宿县| 房产| 土默特右旗| 汉中市| 岚皋县| 吴江市| 射阳县| 和平区| 新巴尔虎右旗| 梓潼县| 即墨市| 广灵县| 临夏市| 家居| 西吉县| 五河县| 乐安县| 泰和县| 云霄县| 卫辉市| 湾仔区| 和田县| 新化县| 大田县| 越西县| 尼勒克县| 尼勒克县| 三都|