Commit fbe662a5 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-15058: Remove buf_pool_get_dirty_pages_count()

Starting with commit 1a6f708e
the function buf_pool_get_dirty_pages_count() is only used
in a debug check. It was dead code for non-debug builds.

buf_flush_dirty_pages(): Perform the debug check inline,
and replace the assertion
	ut_ad(first || buf_pool_get_dirty_pages_count(id) == 0);
with another one that is executed while holding the mutexes:
	ut_ad(id != bpage->id.space());
parent 2bbcf9a1
......@@ -3228,34 +3228,3 @@ void buf_flush_validate()
}
#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
/** Determine the number of dirty pages in a tablespace.
@param[in] id tablespace identifier
@return number of dirty pages */
ulint buf_pool_get_dirty_pages_count(ulint id)
{
ulint count = 0;
mutex_enter(&buf_pool->mutex);
mutex_enter(&buf_pool->flush_list_mutex);
buf_page_t* bpage;
for (bpage = UT_LIST_GET_FIRST(buf_pool->flush_list);
bpage != 0;
bpage = UT_LIST_GET_NEXT(list, bpage)) {
ut_ad(buf_page_in_file(bpage));
ut_ad(bpage->in_flush_list);
ut_ad(bpage->oldest_modification > 0);
if (id == bpage->id.space()) {
++count;
}
}
mutex_exit(&buf_pool->flush_list_mutex);
mutex_exit(&buf_pool->mutex);
return(count);
}
......@@ -604,22 +604,34 @@ as they age and move towards the tail of the LRU list.
@param[in] first first page to be flushed or evicted */
static void buf_flush_dirty_pages(ulint id, bool flush, ulint first)
{
for (;;) {
mutex_enter(&buf_pool->mutex);
bool freed = buf_flush_or_remove_pages(id, flush, first);
while (!buf_flush_or_remove_pages(id, flush, first))
{
mutex_exit(&buf_pool->mutex);
ut_d(buf_flush_validate());
os_thread_sleep(2000);
mutex_enter(&buf_pool->mutex);
}
if (freed) {
break;
#ifdef UNIV_DEBUG
if (!first)
{
mutex_enter(&buf_pool->flush_list_mutex);
for (buf_page_t *bpage= UT_LIST_GET_FIRST(buf_pool->flush_list); bpage;
bpage= UT_LIST_GET_NEXT(list, bpage))
{
ut_ad(buf_page_in_file(bpage));
ut_ad(bpage->in_flush_list);
ut_ad(bpage->oldest_modification > 0);
ut_ad(id != bpage->id.space());
}
os_thread_sleep(2000);
ut_d(buf_flush_validate());
mutex_exit(&buf_pool->flush_list_mutex);
}
#endif
ut_ad(first || buf_pool_get_dirty_pages_count(id) == 0);
mutex_exit(&buf_pool->mutex);
}
/** Empty the flush list for all pages belonging to a tablespace.
......
......@@ -221,11 +221,6 @@ buf_flush_ready_for_flush(
buf_flush_t flush_type)/*!< in: type of flush */
MY_ATTRIBUTE((warn_unused_result));
/** Determine the number of dirty pages in a tablespace.
@param[in] id tablespace identifier
@return number of dirty pages */
ulint buf_pool_get_dirty_pages_count(ulint id);
/** Synchronously flush dirty blocks.
NOTE: The calling thread is not allowed to hold any buffer page latches! */
void buf_flush_sync();
......
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