您好,登錄后才能下訂單哦!
本篇內(nèi)容介紹了“Innodb怎么自動(dòng)開啟打印show engine status到err日志”的有關(guān)知識,在實(shí)際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓小編帶領(lǐng)大家學(xué)習(xí)一下如何處理這些情況吧!希望大家仔細(xì)閱讀,能夠?qū)W有所成!
為什么我的err日志里面有大量的show engine innodb status的記錄,我自己并沒有開啟innodb_status_output參數(shù)。
通過查看日志,發(fā)現(xiàn)如下輸出:
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.
日志也寫得很清楚。應(yīng)該是free block不夠了Innodb自動(dòng)開啟了。但是我們需要源碼驗(yàn)證一下。
在源碼的buf_LRU_handle_lack_of_free_blocks函數(shù)中我們看到如下:
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);
這里不僅打印出了日志同時(shí)設(shè)置了參數(shù)srv_print_innodb_monitor = true; 并且開始o(jì)s_event_set(srv_monitor_event);開啟了monitor打印線程。那我們看看srv_print_innodb_monitor 對應(yīng)什么參數(shù)呢。如下:
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);
實(shí)際上就是innodb_status_output被自動(dòng)開了。當(dāng)然如果查看調(diào)用可以在上層函數(shù)buf_LRU_get_free_block中查看到調(diào)用,實(shí)際上就是在free list找不到空閑的block的時(shí)候會做輸出。buf_LRU_get_free_block還包含了一個(gè)塊的分配流程大約如下,可自行參考:
If there is a block in the free list, take it .如果這里找不到就會自動(dòng)開啟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怎么自動(dòng)開啟打印show engine status到err日志”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識可以關(guān)注億速云網(wǎng)站,小編將為大家輸出更多高質(zhì)量的實(shí)用文章!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。