12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
ADADADADAD
mysql数据库 时间:2024-11-28 13:02:48
作者:文/会员上传
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
一、问题描述为什么我的err日志里面有大量的show engine innodb status的记录,我自己并没有开启innodb_status_output参数。二、问题分析通过查看日志,发现如下输出:2019-03-21
以下为本文的正文内容,内容仅供参考!本站为公益性网站,复制本文以及下载DOC文档全部免费。
为什么我的err日志里面有大量的show engine innodb status的记录,我自己并没有开启innodb_status_output参数。
二、问题分析通过查看日志,发现如下输出:
2019-03-21T17:00:02.375231Z1230497[Warning]InnoDB:Difficulttofindfreeblocksinthebufferpool(338searchiterations)!0failedattemptstoflushapage!Considerincreasingthebufferpoolsize.ItisalsopossiblethatinyourUnixversionfsyncisveryslow,orcompletelyfrozeninsidetheOSkernel.Thenupgradingtoanewerversionofyouroperatingsystemmayhelp.Lookatthenumberoffsyncsindiagnosticinfobelow.Pendingflushes(fsync)log:0;bufferpool:0.1446962050OSfilereads,545881917OSfilewrites,376257282OSfsyncs.StartingInnoDBMonitortoprintfurtherdiagnosticstothestandardoutput.
日志也写得很清楚。应该是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()<<"Difficulttofindfreeblocksinthebufferpool""("<<n_iterations<<"searchiterations)!"<<flush_failures<<"failedattemptsto""flushapage!Considerincreasingthebufferpool""size.ItisalsopossiblethatinyourUnixversion""fsyncisveryslow,orcompletelyfrozeninside""theOSkernel.Thenupgradingtoanewerversion""ofyouroperatingsystemmayhelp.Lookatthe""numberoffsyncsindiagnosticinfobelow.""Pendingflushes(fsync)log:"<<fil_n_pending_log_flushes<<";bufferpool:"<<fil_n_pending_tablespace_flushes<<"."<<os_n_file_reads<<"OSfilereads,"<<os_n_file_writes<<"OSfilewrites,"<<os_n_fsyncs<<"OSfsyncs.StartingInnoDBMonitortoprint""furtherdiagnosticstothestandardoutput.";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 对应什么参数呢。如下:
staticMYSQL_SYSVAR_BOOL(status_output,srv_print_innodb_monitor,PLUGIN_VAR_OPCMDARG,"EnableInnoDBmonitoroutputtotheerrorlog.",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.
11-20
11-19
11-20
11-20
11-20
11-19
11-20
11-20
11-19
11-20
11-19
11-19
11-19
11-19
11-19
11-19