Commit fce64480 authored by Annamalai Gurusami's avatar Annamalai Gurusami

Bug #16411457 MASTER THREAD CANNOT EXIT FLUSH_LOOP WHEN

INNODB_FAST_SHUTDOWN IS 2

Problem:

When innodb_fast_shutdown is set to 2 and the master thread enters
flush loop, under some circumstances it will not be able to exit it.
This may lead to a shutdown hanging.

This is happening because of the following:

1. In the flush_loop block of code, if the srv_fast_shutdown is
   equal to 2 (very fast shutdown), then we do not flush dirty
   pages in buffer pool to disk.
 
2. In the same flush_loop block of code, if the number of dirty
   pages is more than user specified limit, we go to step 1.

This results in infinite loop.

Solution:

When we are in the process of doing a very fast shutdown, don't
do step 2 above.

rb#2328 approved by Inaam.
parent d5372672
......@@ -3100,14 +3100,18 @@ background_loop:
flush_loop:
srv_main_thread_op_info = "flushing buffer pool pages";
srv_main_flush_loops++;
if (srv_fast_shutdown < 2) {
if (srv_fast_shutdown < 2 || srv_shutdown_state == SRV_SHUTDOWN_NONE) {
n_pages_flushed = buf_flush_list(
PCT_IO(100), IB_ULONGLONG_MAX);
} else {
/* In the fastest shutdown we do not flush the buffer pool
to data files: we set n_pages_flushed to 0 artificially. */
ut_ad(srv_fast_shutdown == 2);
ut_ad(srv_shutdown_state > 0);
n_pages_flushed = 0;
DBUG_PRINT("master", ("doing very fast shutdown"));
}
srv_main_thread_op_info = "reserving kernel mutex";
......@@ -3129,7 +3133,12 @@ flush_loop:
log_checkpoint(TRUE, FALSE);
if (buf_get_modified_ratio_pct() > srv_max_buf_pool_modified_pct) {
if (!(srv_fast_shutdown == 2 && srv_shutdown_state > 0)
&& (buf_get_modified_ratio_pct()
> srv_max_buf_pool_modified_pct)) {
/* If the server is doing a very fast shutdown, then
we will not come here. */
/* Try to keep the number of modified pages in the
buffer pool under the limit wished by the user */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment