久久精品人人爽,华人av在线,亚洲性视频网站,欧美专区一二三

Innodb怎么自動開啟打印show engine status到err日志

152次閱讀
沒有評論

共計 2726 個字符,預計需要花費 7 分鐘才能閱讀完成。

本篇內容介紹了“Innodb 怎么自動開啟打印 show engine status 到 err 日志”的有關知識,在實際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓丸趣 TV 小編帶領大家學習一下如何處理這些情況吧!希望大家仔細閱讀,能夠學有所成!

一、問題描述

為什么我的 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 日志”的內容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業相關的知識可以關注丸趣 TV 網站,丸趣 TV 小編將為大家輸出更多高質量的實用文章!

正文完
 
丸趣
版權聲明:本站原創文章,由 丸趣 2023-07-28發表,共計2726字。
轉載說明:除特殊說明外本站除技術相關以外文章皆由網絡搜集發布,轉載請注明出處。
評論(沒有評論)
主站蜘蛛池模板: 高清| 文昌市| 五指山市| 射洪县| 东方市| 榆社县| 曲水县| 本溪市| 松溪县| 中方县| 饶平县| 额尔古纳市| 奉贤区| 英德市| 衡阳市| 海盐县| 长丰县| 遵义县| 栾川县| 广州市| 綦江县| 隆德县| 法库县| 轮台县| 蒲城县| 芮城县| 孟州市| 双牌县| 巴南区| 兴隆县| 绵阳市| 罗定市| 竹北市| 胶州市| 湘潭县| 瓦房店市| 汉寿县| 诸城市| 启东市| 彭山县| 杭锦后旗|