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操作解析之一
- show engine innodb status 輸出結果解讀
- MySQL:5.6 大事務show engine innodb status故障一例MySql
- 使用show engine innodb status 檢視記憶體使用情況記憶體
- Percona 8.0.30中"show engine innodb status"導致coredump排查及分析
- 技術分享 | show engine innodb status中Pages flushed up to 的含義
- 【Spring】日誌列印sql,日誌配置列印sqlSpringSQL
- Linux動態列印kernel日誌Linux
- 日誌列印
- 解決Kafka消費者啟動時頻繁列印日誌Kafka
- MySQL show status 命令詳解MySql
- Innodb:為什麼lock in share mode在show engine看不到行鎖資訊
- 日誌--列印規範
- Log 工具列印日誌
- Unity——日誌列印工具Unity
- EDP .Net開發框架--自動化日誌框架
- MySQL InnoDB日誌檔案配置MySql
- 微服務開發系列:如何列印好日誌微服務
- 39,日誌列印sql 配置SQL
- feign配置日誌不列印
- MySQL列印死鎖日誌MySql
- 日誌到底該如何列印?
- mysql開啟慢日誌MySql
- [原創] How to show chinese character in Git StatusGit
- nginx 加入到開機自動啟動Nginx
- 設定mybatis 是否列印日誌MyBatis
- java日誌列印使用指南Java
- Ubuntu 下開啟 crontab日誌Ubuntu
- Rust中獲得CPU核數與列印日誌到控制檯?Rust
- [Java/日誌] 日誌框架列印應用程式日誌程式碼的執行情況Java框架
- changelog 日誌自動生成外掛
- [MySQL進階之路][No.0002] SHOW SLAVE STATUSMySql
- Logtail從入門到精通(二):開啟日誌採集之旅AI
- log4j日誌列印級別動態調整
- Flutter - 列印好用的Debug日誌Flutter
- 【工具】方法日誌列印+任務切片
- 使用log4j列印異常堆疊到日誌檔案