Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-15384

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

    XMLWordPrintable

Details

    • 10.2.14

    Description

      The flush_counters_t that were introduced in MDEV-6936 were broken in the merge of InnoDB from MySQL 5.7.9 to MariaDB 10.2.2. After that change, the function buf_flush_LRU_list_batch() initializes all counts to 0 and will not update them.

      I would fix this as follows. I still need to figure out how to add a regression test for this.

      diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc
      index e938c27cfec..17f915a9d12 100644
      --- a/storage/innobase/buf/buf0flu.cc
      +++ b/storage/innobase/buf/buf0flu.cc
      @@ -1654,8 +1654,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;
      @@ -1671,7 +1669,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,
      @@ -1689,7 +1687,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
      @@ -1697,7 +1695,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. */
      @@ -1721,12 +1719,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) {
      @@ -2182,17 +2180,16 @@ buf_flush_lists(
       			help in the retry which will follow the
       			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);
      

      Attachments

        Issue Links

          Activity

            People

              thiru Thirunarayanan Balathandayuthapani
              marko Marko Mäkelä
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.