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

MDEV-22392 Race condition on SET GLOBAL innodb_buffer_pool_evict='uncompressed'

innodb_buffer_pool_evict_uncompressed(): Restart the loop when
prev_block might not enjoy mutex protection.

This is based on
mysql/mysql-server@eccaecac070b6747ecf14d6b9150791f8c3e8f6d
parent cf64d27b
/***************************************************************************** /*****************************************************************************
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2000, 2020, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, 2009 Google Inc. Copyright (c) 2008, 2009 Google Inc.
Copyright (c) 2009, Percona Inc. Copyright (c) 2009, Percona Inc.
Copyright (c) 2012, Facebook Inc. Copyright (c) 2012, Facebook Inc.
...@@ -17850,10 +17850,7 @@ static char* srv_buffer_pool_evict; ...@@ -17850,10 +17850,7 @@ static char* srv_buffer_pool_evict;
Evict all uncompressed pages of compressed tables from the buffer pool. Evict all uncompressed pages of compressed tables from the buffer pool.
Keep the compressed pages in the buffer pool. Keep the compressed pages in the buffer pool.
@return whether all uncompressed pages were evicted */ @return whether all uncompressed pages were evicted */
static MY_ATTRIBUTE((warn_unused_result)) static bool innodb_buffer_pool_evict_uncompressed()
bool
innodb_buffer_pool_evict_uncompressed(void)
/*=======================================*/
{ {
bool all_evicted = true; bool all_evicted = true;
...@@ -17874,9 +17871,13 @@ innodb_buffer_pool_evict_uncompressed(void) ...@@ -17874,9 +17871,13 @@ innodb_buffer_pool_evict_uncompressed(void)
if (!buf_LRU_free_page(&block->page, false)) { if (!buf_LRU_free_page(&block->page, false)) {
all_evicted = false; all_evicted = false;
block = prev_block;
} else {
/* Because buf_LRU_free_page() may release
and reacquire buf_pool_t::mutex, prev_block
may be invalid. */
block = UT_LIST_GET_LAST(buf_pool->unzip_LRU);
} }
block = prev_block;
} }
buf_pool_mutex_exit(buf_pool); buf_pool_mutex_exit(buf_pool);
......
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