MySQL:Innodb:innodb_flush_log_at_trx_commit引數影響的位置
-
原始碼5.7.22
-
影響階段:MYSQL_BIN_LOG::ordered_commit 的flush階段
一、影響的函式
innobase_flush_logs函式,函式如下其實註釋也寫得很清楚了。binlog_group_flush 引數為1。
/** Flush InnoDB redo logs to the file system. @param[in] hton InnoDB handlerton @param[in] binlog_group_flush true if we got invoked by binlog group commit during flush stage, false in other cases. @return false */staticboolinnobase_flush_logs( handlerton* hton, bool binlog_group_flush){ DBUG_ENTER("innobase_flush_logs"); DBUG_ASSERT(hton == innodb_hton_ptr); if (srv_read_only_mode) { DBUG_RETURN(false); } /* If !binlog_group_flush, we got invoked by FLUSH LOGS or similar. Else, we got invoked by binlog group commit during flush stage. */ if (binlog_group_flush && thd_flush_log_at_trx_commit(NULL) == 0) { /* innodb_flush_log_at_trx_commit=0 (write and sync once per second). Do not flush the redo log during binlog group commit. */ DBUG_RETURN(false); } /* Flush the redo log buffer to the redo log file. Sync it to disc if we are in FLUSH LOGS, or if innodb_flush_log_at_trx_commit=1 (write and sync at each commit). */ log_buffer_flush_to_disk(!binlog_group_flush || thd_flush_log_at_trx_commit(NULL) == 1); DBUG_RETURN(false); }
二、可能的組合
-
innodb_flush_log_at_trx_commit引數為 0
binlog_group_flush && thd_flush_log_at_trx_commit(NULL) == 0 條件成立,因此直接return了,那麼這種情況下log_buffer_flush_to_disk函式不會呼叫,因此不會做redo刷盤。依賴master執行緒。 -
innodb_flush_log_at_trx_commit引數為 1
!binlog_group_flush|| thd_flush_log_at_trx_commit(NULL) == 1 返回為1即為True,因此呼叫log_buffer_flush_to_disk(True),因此需要做redo刷盤,也要做sync。 -
innodb_flush_log_at_trx_commit引數為 2
!binlog_group_flush|| thd_flush_log_at_trx_commit(NULL) == 1 返回為0即為Flase,因此呼叫
log_buffer_flush_to_disk(Flase),因此需要做redo刷盤,不做sync。依賴OS的刷盤機制。
三、呼叫棧幀
#0 innobase_flush_logs (hton=0x2e9edd0, binlog_group_flush=true) at /root/mysql5.7.14/percona-server-5.7.14-7/storage/innobase/handler/ha_innodb.cc:4385#1 0x0000000000f65893 in flush_handlerton (thd=0x0, plugin=0x7ffff01558e8, arg=0x7ffff0155944) at /root/mysql5.7.14/percona-server-5.7.14-7/sql/handler.cc:2606#2 0x00000000015d7716 in plugin_foreach_with_mask (thd=0x0, func=0xf65835 <flush_handlerton(THD*, plugin_ref, void*)>, type=1, state_mask=4294967287, arg=0x7ffff0155944) at /root/mysql5.7.14/percona-server-5.7.14-7/sql/sql_plugin.cc:2318#3 0x0000000000f658ef in ha_flush_logs (db_type=0x0, binlog_group_flush=true) at /root/mysql5.7.14/percona-server-5.7.14-7/sql/handler.cc:2617#4 0x000000000185733d in MYSQL_BIN_LOG::process_flush_stage_queue (this=0x2e01c80, total_bytes_var=0x7ffff0155a88, rotate_var=0x7ffff0155a87, out_queue_var=0x7ffff0155a78) at /root/mysql5.7.14/percona-server-5.7.14-7/sql/binlog.cc:8541#5 0x000000000185899f in MYSQL_BIN_LOG::ordered_commit (this=0x2e01c80, thd=0x7fff2c000b70, all=false, skip_commit=false) at /root/mysql5.7.14/percona-server-5.7.14-7/sql/binlog.cc:9189#6 0x000000000185700c in MYSQL_BIN_LOG::commit (this=0x2e01c80, thd=0x7fff2c000b70, all=false) at /root/mysql5.7.14/percona-server-5.7.14-7/sql/binlog.cc:8440#7 0x0000000000f63df8 in ha_commit_trans (thd=0x7fff2c000b70, all=false, ignore_global_read_lock=false) at /root/mysql5.7.14/percona-server-5.7.14-7/sql/handler.cc:1818#8 0x00000000016b3e5d in trans_commit_stmt (thd=0x7fff2c000b70) at /root/mysql5.7.14/percona-server-5.7.14-7/sql/transaction.cc:458#9 0x00000000015ac677 in mysql_execute_command (thd=0x7fff2c000b70, first_level=true) at /root/mysql5.7.14/percona-server-5.7.14-7/sql/sql_parse.cc:5239#10 0x00000000015adcd6 in mysql_parse (thd=0x7fff2c000b70, parser_state=0x7ffff0158600) at /root/mysql5.7.14/percona-server-5.7.14-7/sql/sql_parse.cc:5836#11 0x00000000015a1b95 in dispatch_command (thd=0x7fff2c000b70, com_data=0x7ffff0158d70, command=COM_QUERY) at /root/mysql5.7.14/percona-server-5.7.14-7/sql/sql_parse.cc:1447#12 0x00000000015a09c6 in do_command (thd=0x7fff2c000b70) at /root/mysql5.7.14/percona-server-5.7.14-7/sql/sql_parse.cc:1010#13 0x00000000016e29d0 in handle_connection (arg=0x3803f30) at /root/mysql5.7.14/percona-server-5.7.14-7/sql/conn_handler/connection_handler_per_thread.cc:312#14 0x0000000001d7b4b0 in pfs_spawn_thread (arg=0x3810b80) at /root/mysql5.7.14/percona-server-5.7.14-7/storage/perfschema/pfs.cc:2188#15 0x0000003f74807aa1 in start_thread () from /lib64/libpthread.so.0#16 0x0000003f740e8bcd in clone () from /lib64/libc.so.6
作者微信:gaopp_22389860
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/7728585/viewspace-2216726/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- innodb_flush_log_at_trx_commit引數的直白理解MIT
- mysql插入慢之所innodb_flush_log_at_trx_commit引數的意義MySqlMIT
- Java教程:影響MySQL效能的配置引數JavaMySql
- innodb_flush_log_at_trx_commitMIT
- 【MySQL】五、sync_binlog innodb_flush_log_at_trx_commit 淺析MySqlMIT
- MySQL:簡單記錄character_set_server影響引數MySqlServer
- MySQL:slave_skip_errors引數對MGR可用性的影響MySqlError
- MySQL:Innodb Handler_read_*引數解釋MySql
- JVM 引數調整對 sortx 的影響JVM
- MySQL資料庫innodb_fast_shutdown引數MySql資料庫AST
- MySQL 5.6 innodb_io_capacity引數效能測試MySql
- MySQL服務端innodb_buffer_pool_size配置引數MySql服務端
- TAG:廣告投放位置的影響調查
- JPEG的量化引數QP如何影響壓縮質量
- Kafka之acks引數對訊息持久化的影響Kafka持久化
- 深入理解MySQL5.7GTID系列(七)binlog_gtid_simple_recovery引數的影響總結MySql
- [20180413]bash 位置引數.txt
- 瞭解 ignore_above 引數對 Elasticsearch 中磁碟使用的影響Elasticsearch
- Python函式的位置引數、關鍵字引數精講Python函式
- 影響mysql效能的因素都有哪些MySql
- 影響MySQL效能的硬體因MySql
- 影響MySQL效能的硬體因素MySql
- MySQL 配置InnoDB配置非持久優化器統計資訊引數MySql優化
- MySQL:Innodb中數字的儲存方式MySql
- MySQL:查詢欄位數量多少對查詢效率的影響MySql
- Oracle RAC修改引數檔案位置Oracle
- MySQL自增列鎖模式 innodb_autoinc_lock_mode不同引數下效能測試MySql模式
- MySQL innodb_buffer_pool_size 變數MySql變數
- 數字化轉型的影響是什麼?數字化轉型對企業的影響?
- MySQL alter 新增列對dml影響MySql
- mysql innodb_data_file_path引數忘記設定或者重新調整辦法MySql
- python疑問5:位置引數,預設引數,可變引數,關鍵字引數,命名關鍵字引數區別Python
- MySQL影響伺服器效能的幾個方面MySql伺服器
- MySQL:一個innodb_thread_concurrency設定不當引發的故障MySqlthread
- 表資料量影響MySQL索引選擇MySql索引
- MySQL null值儲存,null效能影響MySqlNull
- MySQL truncate慢影響系統qps分析MySql
- 『忘了再學』Shell基礎 — 16、位置引數變數變數