您好,登錄后才能下訂單哦!
本篇內容介紹了“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.
“Innodb怎么自動開啟打印show engine status到err日志”的內容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業相關的知識可以關注億速云網站,小編將為大家輸出更多高質量的實用文章!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。