Innodb: 自動開啟列印show engine status到err日誌
這個問題是一個朋友問我的@劉加奇
一、問題描述
為什麼我的err日誌裡面有大量的show engine innodb status的記錄,我自己並沒有開啟innodb_status_output引數。
二、問題分析
透過檢視日誌,發現如下輸出:
2019-03-21T17:00:02.375231Z 1230497 [Warning] InnoDB: Difficult to find free blocks in the buffer pool (338 search iterations)! 0 failed attempts to flush a page! Consider increasing the buffer pool size. It is also possible that in your Unix version fsync is very slow, or completely frozen inside the OS kernel. Then upgrading to a newer version of your operating system may help. Look at the number of fsyncs in diagnostic info below. Pending flushes (fsync) log: 0; buffer pool: 0. 1446962050 OS file reads, 545881917 OS file writes, 376257282 OS fsyncs. Starting InnoDB Monitor to print further diagnostics to the standard output.
日誌也寫得很清楚。應該是free block不夠了Innodb自動開啟了。但是我們需要原始碼驗證一下。
三、原始碼驗證
在原始碼的buf_LRU_handle_lack_of_free_blocks函式中我們看到如下:
if ((current_ms > started_ms + 2000) && (current_ms > last_printout_ms + 2000) && srv_buf_pool_old_size == srv_buf_pool_size) { ib::warn() << "Difficult to find free blocks in the buffer pool" " (" << n_iterations << " search iterations)! " << flush_failures << " failed attempts to" " flush a page! Consider increasing the buffer pool" " size. It is also possible that in your Unix version" " fsync is very slow, or completely frozen inside" " the OS kernel. Then upgrading to a newer version" " of your operating system may help. Look at the" " number of fsyncs in diagnostic info below." " Pending flushes (fsync) log: " << fil_n_pending_log_flushes << "; buffer pool: " << fil_n_pending_tablespace_flushes << ". " << os_n_file_reads << " OS file reads, " << os_n_file_writes << " OS file writes, " << os_n_fsyncs << " OS fsyncs. Starting InnoDB Monitor to print" " further diagnostics to the standard output."; last_printout_ms = current_ms; *mon_value_was = srv_print_innodb_monitor; *started_monitor = true; srv_print_innodb_monitor = true; os_event_set(srv_monitor_event);
這裡不僅列印出了日誌同時設定了引數srv_print_innodb_monitor = true; 並且開始os_event_set(srv_monitor_event);開啟了monitor列印執行緒。那我們看看srv_print_innodb_monitor 對應什麼引數呢。如下:
static MYSQL_SYSVAR_BOOL(status_output, srv_print_innodb_monitor, PLUGIN_VAR_OPCMDARG, "Enable InnoDB monitor output to the error log.", NULL, innodb_status_output_update, FALSE);
實際上就是innodb_status_output被自動開了。當然如果檢視呼叫可以在上層函式buf_LRU_get_free_block中檢視到呼叫,實際上就是在free list找不到空閒的block的時候會做輸出。buf_LRU_get_free_block還包含了一個塊的分配流程大約如下,可自行參考:
- If there is a block in the free list, take it .如果這裡找不到就會自動開啟innodb_status_output
- If no block was in the free list, search from the end of the LRU list and try to free a block there.
- No free block was found: try to flush the LRU list.
作者微信:gp_22389860
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/7728585/viewspace-2640101/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- MySQL的show engine innodb statusMySql
- show engine innodb status 詳解
- MySQL show engine innodb status 詳解MySql
- SHOW ENGINE INNODB STATUS資訊詳解
- 【Mysql】show engine innodb status詳解MySql
- show engine innodb status操作解析之一
- MySQL:5.6 大事務show engine innodb status故障一例MySql
- 使用show engine innodb status 檢視記憶體使用情況記憶體
- 技術分享 | show engine innodb status中Pages flushed up to 的含義
- Percona 8.0.30中"show engine innodb status"導致coredump排查及分析
- 日誌列印
- 【Spring】日誌列印sql,日誌配置列印sqlSpringSQL
- Linux動態列印kernel日誌Linux
- 解決Kafka消費者啟動時頻繁列印日誌Kafka
- iOS列印日誌到遠端伺服器iOS伺服器
- Mysql---show table statusMySql
- SHOW SLAVE STATUS 詳解
- Innodb:為什麼lock in share mode在show engine看不到行鎖資訊
- EDP .Net開發框架--自動化日誌框架
- Unity——日誌列印工具Unity
- 日誌--列印規範
- Log 工具列印日誌
- show master logs 和 show master status 區別AST
- nginx 加入到開機自動啟動Nginx
- MySQL show status 命令詳解MySql
- MySQL SHOW STATUS命令介紹MySql
- 微服務開發系列:如何列印好日誌微服務
- mysql開啟慢日誌MySql
- 39,日誌列印sql 配置SQL
- MySQL列印死鎖日誌MySql
- 日誌到底該如何列印?
- mybatis列印sql日誌配置MyBatisSQL
- SecureCRT自動記錄日誌Securecrt
- MySQL InnoDB日誌檔案配置MySql
- Ubuntu 下開啟 crontab日誌Ubuntu
- mysql開啟日誌記錄MySql
- RAC 開啟歸檔日誌
- postgresql開啟歸檔日誌SQL