18
18
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
20
20
You should have received a copy of the GNU General Public License along with
21
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
22
Place, Suite 330, Boston, MA 02111-1307 USA
21
this program; if not, write to the Free Software Foundation, Inc.,
22
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24
24
*****************************************************************************/
2409
/* Buffer-fix the block so that it cannot be evicted
2410
or relocated while we are attempting to allocate an
2411
uncompressed page. */
2412
bpage->buf_fix_count++;
2410
2414
/* Allocate an uncompressed page. */
2411
2415
buf_pool_mutex_exit(buf_pool);
2412
2416
mutex_exit(&buf_pool->zip_mutex);
2417
2421
buf_pool_mutex_enter(buf_pool);
2418
2422
mutex_enter(&block->mutex);
2421
buf_page_t* hash_bpage;
2423
hash_bpage = buf_page_hash_get_low(
2424
buf_pool, space, offset, fold);
2426
if (UNIV_UNLIKELY(bpage != hash_bpage)) {
2427
/* The buf_pool->page_hash was modified
2428
while buf_pool->mutex was released.
2429
Free the block that was allocated. */
2431
buf_LRU_block_free_non_file_page(block);
2432
mutex_exit(&block->mutex);
2434
block = (buf_block_t*) hash_bpage;
2440
(bpage->buf_fix_count
2441
|| buf_page_get_io_fix(bpage) != BUF_IO_NONE)) {
2443
/* The block was buffer-fixed or I/O-fixed
2444
while buf_pool->mutex was not held by this thread.
2445
Free the block that was allocated and try again.
2446
This should be extremely unlikely. */
2423
mutex_enter(&buf_pool->zip_mutex);
2424
/* Buffer-fixing prevents the page_hash from changing. */
2425
ut_ad(bpage == buf_page_hash_get_low(buf_pool,
2426
space, offset, fold));
2428
if (--bpage->buf_fix_count
2429
|| buf_page_get_io_fix(bpage) != BUF_IO_NONE) {
2431
mutex_exit(&buf_pool->zip_mutex);
2432
/* The block was buffer-fixed or I/O-fixed while
2433
buf_pool->mutex was not held by this thread.
2434
Free the block that was allocated and retry.
2435
This should be extremely unlikely, for example,
2436
if buf_page_get_zip() was invoked. */
2448
2438
buf_LRU_block_free_non_file_page(block);
2449
2439
mutex_exit(&block->mutex);
2454
2444
/* Move the compressed page from bpage to block,
2455
2445
and uncompress it. */
2457
mutex_enter(&buf_pool->zip_mutex);
2459
2447
buf_relocate(bpage, &block->page);
2460
2448
buf_block_init_low(block);
2461
2449
block->lock_hash_val = lock_rec_hash(space, offset);