MDEV-15384 buf_flush_LRU_list_batch() always reports n->flushed=0, n->evicted=0

- buf_flush_LRU_list_batch() initializes the count to zero and updates them
correctly.
This commit is contained in:
Thirunarayanan Balathandayuthapani 2018-03-13 15:20:00 +05:30
parent ff909acfa4
commit 76ae6e725d
4 changed files with 41 additions and 12 deletions

View file

@ -123,6 +123,10 @@ LENGTH(l)
11197
INSERT INTO t1 (a) SELECT NULL FROM t1;
INSERT INTO t1 (a) SELECT NULL FROM t1;
INSERT INTO t1 (a) SELECT NULL FROM t1;
INSERT INTO t1 (a) SELECT NULL FROM t1;
INSERT INTO t1 (a) SELECT NULL FROM t1;
INSERT INTO t1 (a) SELECT NULL FROM t1;
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
@ -139,6 +143,18 @@ SELECT OTHER_INDEX_SIZE FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE NAME='test/t1';
OTHER_INDEX_SIZE
1
SELECT NAME, SUBSYSTEM FROM INFORMATION_SCHEMA.INNODB_METRICS
WHERE NAME="buffer_LRU_batch_evict_total_pages" AND COUNT > 0;
NAME SUBSYSTEM
buffer_LRU_batch_evict_total_pages buffer
SELECT NAME, SUBSYSTEM FROM INFORMATION_SCHEMA.INNODB_METRICS
WHERE NAME="buffer_LRU_batch_flush_total_pages" AND COUNT > 0;
NAME SUBSYSTEM
buffer_LRU_batch_flush_total_pages buffer
SELECT (variable_value > 0) FROM information_schema.global_status
WHERE LOWER(variable_name) LIKE 'INNODB_BUFFER_POOL_PAGES_FLUSHED';
(variable_value > 0)
1
# Note: The OTHER_INDEX_SIZE does not cover any SPATIAL INDEX.
# To test that all indexes were emptied, replace DROP TABLE
# with the following, and examine the root pages in t1.ibd:

View file

@ -1 +1,3 @@
--innodb-sys-tablestats
--innodb_buffer_pool_size=5M
--innodb_monitor_enable=module_buffer

View file

@ -109,6 +109,10 @@ INSERT INTO t1 () VALUES (),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),();
SELECT LENGTH(l) FROM t1;
INSERT INTO t1 (a) SELECT NULL FROM t1;
INSERT INTO t1 (a) SELECT NULL FROM t1;
INSERT INTO t1 (a) SELECT NULL FROM t1;
INSERT INTO t1 (a) SELECT NULL FROM t1;
INSERT INTO t1 (a) SELECT NULL FROM t1;
INSERT INTO t1 (a) SELECT NULL FROM t1;
CHECK TABLE t1;
UPDATE t1 SET c=true, l=ST_linefromtext('linestring(0 0,1 1,2 2)');
DELETE FROM t1;
@ -120,6 +124,15 @@ ANALYZE TABLE t1;
SELECT OTHER_INDEX_SIZE FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE NAME='test/t1';
SELECT NAME, SUBSYSTEM FROM INFORMATION_SCHEMA.INNODB_METRICS
WHERE NAME="buffer_LRU_batch_evict_total_pages" AND COUNT > 0;
SELECT NAME, SUBSYSTEM FROM INFORMATION_SCHEMA.INNODB_METRICS
WHERE NAME="buffer_LRU_batch_flush_total_pages" AND COUNT > 0;
SELECT (variable_value > 0) FROM information_schema.global_status
WHERE LOWER(variable_name) LIKE 'INNODB_BUFFER_POOL_PAGES_FLUSHED';
--echo # Note: The OTHER_INDEX_SIZE does not cover any SPATIAL INDEX.
--echo # To test that all indexes were emptied, replace DROP TABLE
--echo # with the following, and examine the root pages in t1.ibd:

View file

@ -1631,8 +1631,6 @@ buf_flush_LRU_list_batch(
{
buf_page_t* bpage;
ulint scanned = 0;
ulint evict_count = 0;
ulint count = 0;
ulint free_len = UT_LIST_GET_LEN(buf_pool->free);
ulint lru_len = UT_LIST_GET_LEN(buf_pool->LRU);
ulint withdraw_depth = 0;
@ -1648,7 +1646,7 @@ buf_flush_LRU_list_batch(
}
for (bpage = UT_LIST_GET_LAST(buf_pool->LRU);
bpage != NULL && count + evict_count < max
bpage != NULL && n->flushed + n->evicted < max
&& free_len < srv_LRU_scan_depth + withdraw_depth
&& lru_len > BUF_LRU_MIN_LEN;
++scanned,
@ -1666,7 +1664,7 @@ buf_flush_LRU_list_batch(
clean and is not IO-fixed or buffer fixed. */
mutex_exit(block_mutex);
if (buf_LRU_free_page(bpage, true)) {
++evict_count;
++n->evicted;
}
} else if (buf_flush_ready_for_flush(bpage, BUF_FLUSH_LRU)) {
/* Block is ready for flush. Dispatch an IO
@ -1674,7 +1672,7 @@ buf_flush_LRU_list_batch(
free list in IO completion routine. */
mutex_exit(block_mutex);
buf_flush_page_and_try_neighbors(
bpage, BUF_FLUSH_LRU, max, &count);
bpage, BUF_FLUSH_LRU, max, &n->flushed);
} else {
/* Can't evict or dispatch this block. Go to
previous. */
@ -1698,12 +1696,12 @@ buf_flush_LRU_list_batch(
ut_ad(buf_pool_mutex_own(buf_pool));
if (evict_count) {
if (n->evicted) {
MONITOR_INC_VALUE_CUMULATIVE(
MONITOR_LRU_BATCH_EVICT_TOTAL_PAGE,
MONITOR_LRU_BATCH_EVICT_COUNT,
MONITOR_LRU_BATCH_EVICT_PAGES,
evict_count);
n->evicted);
}
if (scanned) {
@ -2160,16 +2158,16 @@ buf_flush_lists(
failure. */
success = false;
continue;
}
n_flushed += n.flushed;
}
if (n_flushed) {
buf_flush_stats(n_flushed, 0);
}
if (n_processed) {
*n_processed = n_flushed;
if (n_processed) {
*n_processed = n_flushed;
}
}
return(success);