# should be done or reviewed by the maintainer!
--- a/storage/innobase/btr/btr0cur.c
+++ b/storage/innobase/btr/btr0cur.c
-@@ -4091,7 +4091,8 @@
+@@ -4070,7 +4070,8 @@
mtr_commit(mtr);
mutex_enter(&block->mutex);
/* Only free the block if it is still allocated to
-@@ -4102,16 +4103,21 @@
+@@ -4081,16 +4082,21 @@
&& buf_block_get_space(block) == space
&& buf_block_get_page_no(block) == page_no) {
--- a/storage/innobase/btr/btr0sea.c
+++ b/storage/innobase/btr/btr0sea.c
-@@ -1944,7 +1944,7 @@
+@@ -1972,7 +1972,7 @@
rec_offs_init(offsets_);
rw_lock_x_lock(&btr_search_latch);
cell_count = hash_get_n_cells(btr_search_sys->hash_index);
-@@ -1952,11 +1952,11 @@
+@@ -1980,11 +1980,11 @@
/* We release btr_search_latch every once in a while to
give other queries a chance to run. */
if ((i != 0) && ((i % chunk_size) == 0)) {
}
node = hash_get_nth_cell(btr_search_sys->hash_index, i)->node;
-@@ -2067,11 +2067,11 @@
+@@ -2093,11 +2093,11 @@
/* We release btr_search_latch every once in a while to
give other queries a chance to run. */
if (i != 0) {
}
if (!ha_validate(btr_search_sys->hash_index, i, end_index)) {
-@@ -2079,7 +2079,7 @@
+@@ -2105,7 +2105,7 @@
}
}
UNIV_INTERN mysql_pfs_key_t flush_list_mutex_key;
#endif /* UNIV_PFS_MUTEX */
-@@ -882,9 +887,13 @@
+@@ -890,9 +895,13 @@
block->page.in_zip_hash = FALSE;
block->page.in_flush_list = FALSE;
block->page.in_free_list = FALSE;
#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
block->n_pointers = 0;
#endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
-@@ -982,9 +991,11 @@
+@@ -997,9 +1006,11 @@
memset(block->frame, '\0', UNIV_PAGE_SIZE);
#endif
/* Add the block to the free list */
ut_ad(buf_pool_from_block(block) == buf_pool);
block++;
-@@ -1039,7 +1050,8 @@
+@@ -1054,7 +1065,8 @@
buf_chunk_t* chunk = buf_pool->chunks;
ut_ad(buf_pool);
for (n = buf_pool->n_chunks; n--; chunk++) {
buf_block_t* block = buf_chunk_contains_zip(chunk, data);
-@@ -1145,9 +1157,21 @@
+@@ -1160,9 +1172,21 @@
------------------------------- */
mutex_create(buf_pool_mutex_key,
&buf_pool->mutex, SYNC_BUF_POOL);
buf_pool_mutex_enter(buf_pool);
if (buf_pool_size > 0) {
-@@ -1160,6 +1184,8 @@
+@@ -1175,6 +1199,8 @@
mem_free(chunk);
mem_free(buf_pool);
buf_pool_mutex_exit(buf_pool);
return(DB_ERROR);
-@@ -1190,6 +1216,8 @@
+@@ -1205,6 +1231,8 @@
/* All fields are initialized by mem_zalloc(). */
buf_pool_mutex_exit(buf_pool);
return(DB_SUCCESS);
-@@ -1402,7 +1430,11 @@
+@@ -1374,7 +1402,11 @@
ulint fold;
buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
ut_ad(mutex_own(buf_page_get_mutex(bpage)));
ut_a(buf_page_get_io_fix(bpage) == BUF_IO_NONE);
ut_a(bpage->buf_fix_count == 0);
-@@ -1513,21 +1545,32 @@
+@@ -1485,21 +1517,32 @@
buf_page_t* bpage;
ulint i;
buf_pool_t* buf_pool = buf_pool_get(space, offset);
for (i = 0; i < BUF_POOL_WATCH_SIZE; i++) {
bpage = &buf_pool->watch[i];
-@@ -1551,10 +1594,12 @@
+@@ -1523,10 +1566,12 @@
bpage->space = space;
bpage->offset = offset;
bpage->buf_fix_count = 1;
return(NULL);
case BUF_BLOCK_ZIP_PAGE:
ut_ad(bpage->in_page_hash);
-@@ -1572,6 +1617,8 @@
+@@ -1544,6 +1589,8 @@
ut_error;
/* Fix compiler warning */
return(NULL);
}
-@@ -1589,7 +1636,11 @@
+@@ -1561,7 +1608,11 @@
space, offset) */
buf_page_t* watch) /*!< in/out: sentinel for watch */
{
HASH_DELETE(buf_page_t, hash, buf_pool->page_hash, fold, watch);
ut_d(watch->in_page_hash = FALSE);
-@@ -1611,28 +1662,31 @@
+@@ -1583,28 +1634,31 @@
buf_pool_t* buf_pool = buf_pool_get(space, offset);
ulint fold = buf_page_address_fold(space, offset);
}
/****************************************************************//**
-@@ -1652,14 +1706,16 @@
+@@ -1624,14 +1678,16 @@
buf_pool_t* buf_pool = buf_pool_get(space, offset);
ulint fold = buf_page_address_fold(space, offset);
return(ret);
}
-@@ -1676,13 +1732,15 @@
+@@ -1648,13 +1704,15 @@
{
buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
}
/********************************************************************//**
-@@ -1706,14 +1764,20 @@
+@@ -1678,14 +1736,20 @@
ut_a(buf_page_in_file(bpage));
if (buf_page_peek_if_too_old(bpage)) {
}
}
-@@ -1730,7 +1794,8 @@
+@@ -1702,7 +1766,8 @@
buf_block_t* block;
buf_pool_t* buf_pool = buf_pool_get(space, offset);
block = (buf_block_t*) buf_page_hash_get(buf_pool, space, offset);
-@@ -1739,7 +1804,8 @@
+@@ -1711,7 +1776,8 @@
block->check_index_page_at_flush = FALSE;
}
+ rw_lock_s_unlock(&buf_pool->page_hash_latch);
}
- /********************************************************************//**
-@@ -1758,7 +1824,8 @@
- ibool is_hashed;
- buf_pool_t* buf_pool = buf_pool_get(space, offset);
-
-- buf_pool_mutex_enter(buf_pool);
-+ //buf_pool_mutex_enter(buf_pool);
-+ rw_lock_s_lock(&buf_pool->page_hash_latch);
-
- block = (buf_block_t*) buf_page_hash_get(buf_pool, space, offset);
-
-@@ -1769,7 +1836,8 @@
- is_hashed = block->is_hashed;
- }
-
-- buf_pool_mutex_exit(buf_pool);
-+ //buf_pool_mutex_exit(buf_pool);
-+ rw_lock_s_unlock(&buf_pool->page_hash_latch);
-
- return(is_hashed);
- }
-@@ -1791,7 +1859,8 @@
+ #if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
+@@ -1731,7 +1797,8 @@
buf_page_t* bpage;
buf_pool_t* buf_pool = buf_pool_get(space, offset);
bpage = buf_page_hash_get(buf_pool, space, offset);
-@@ -1802,7 +1871,8 @@
+@@ -1742,7 +1809,8 @@
bpage->file_page_was_freed = TRUE;
}
return(bpage);
}
-@@ -1823,7 +1893,8 @@
+@@ -1763,7 +1831,8 @@
buf_page_t* bpage;
buf_pool_t* buf_pool = buf_pool_get(space, offset);
bpage = buf_page_hash_get(buf_pool, space, offset);
-@@ -1832,7 +1903,8 @@
+@@ -1772,7 +1841,8 @@
bpage->file_page_was_freed = FALSE;
}
return(bpage);
}
-@@ -1864,8 +1936,9 @@
+@@ -1804,8 +1874,9 @@
buf_pool->stat.n_page_gets++;
for (;;) {
bpage = buf_page_hash_get(buf_pool, space, offset);
if (bpage) {
ut_ad(!buf_pool_watch_is_sentinel(buf_pool, bpage));
-@@ -1874,7 +1947,8 @@
+@@ -1814,7 +1885,8 @@
/* Page not in buf_pool: needs to be read from file */
buf_read_page(space, zip_size, offset);
-@@ -1886,10 +1960,15 @@
+@@ -1826,10 +1898,15 @@
if (UNIV_UNLIKELY(!bpage->zip.data)) {
/* There is no compressed page. */
err_exit:
ut_ad(!buf_pool_watch_is_sentinel(buf_pool, bpage));
switch (buf_page_get_state(bpage)) {
-@@ -1898,24 +1977,43 @@
+@@ -1838,24 +1915,43 @@
case BUF_BLOCK_MEMORY:
case BUF_BLOCK_REMOVE_HASH:
case BUF_BLOCK_ZIP_FREE:
buf_block_buf_fix_inc((buf_block_t*) bpage,
__FILE__, __LINE__);
goto got_block;
-@@ -1928,7 +2026,7 @@
+@@ -1868,7 +1964,7 @@
must_read = buf_page_get_io_fix(bpage) == BUF_IO_READ;
access_time = buf_page_is_accessed(bpage);
mutex_exit(block_mutex);
-@@ -2240,7 +2338,7 @@
+@@ -2179,7 +2275,7 @@
const buf_block_t* block) /*!< in: pointer to block,
not dereferenced */
{
if (UNIV_UNLIKELY((((ulint) block) % sizeof *block) != 0)) {
/* The pointer should be aligned. */
-@@ -2276,6 +2374,7 @@
+@@ -2215,6 +2311,7 @@
ulint fix_type;
ibool must_read;
ulint retries = 0;
buf_pool_t* buf_pool = buf_pool_get(space, offset);
ut_ad(mtr);
-@@ -2309,18 +2408,24 @@
+@@ -2248,18 +2345,24 @@
fold = buf_page_address_fold(space, offset);
loop:
block = guess;
block = guess = NULL;
} else {
ut_ad(!block->page.in_zip_hash);
-@@ -2329,12 +2434,19 @@
+@@ -2268,12 +2371,19 @@
}
if (block == NULL) {
block = NULL;
}
-@@ -2346,12 +2458,14 @@
+@@ -2285,12 +2395,14 @@
space, offset, fold);
if (UNIV_LIKELY_NULL(block)) {
if (mode == BUF_GET_IF_IN_POOL
|| mode == BUF_PEEK_IF_IN_POOL
-@@ -2404,7 +2518,8 @@
+@@ -2343,7 +2455,8 @@
/* The page is being read to buffer pool,
but we cannot wait around for the read to
complete. */
return(NULL);
}
-@@ -2414,38 +2529,49 @@
+@@ -2353,38 +2466,49 @@
ibool success;
case BUF_BLOCK_FILE_PAGE:
{
buf_page_t* hash_bpage;
-@@ -2458,35 +2584,47 @@
+@@ -2397,35 +2521,47 @@
while buf_pool->mutex was released.
Free the block that was allocated. */
buf_block_init_low(block);
block->lock_hash_val = lock_rec_hash(space, offset);
-@@ -2496,7 +2634,7 @@
+@@ -2435,7 +2571,7 @@
if (buf_page_get_state(&block->page)
== BUF_BLOCK_ZIP_PAGE) {
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
&block->page);
#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
ut_ad(!block->page.in_flush_list);
-@@ -2514,18 +2652,23 @@
+@@ -2453,18 +2589,23 @@
/* Insert at the front of unzip_LRU list */
buf_unzip_LRU_add_block(block, FALSE);
buf_page_free_descriptor(bpage);
/* Decompress the page and apply buffered operations
-@@ -2539,12 +2682,15 @@
+@@ -2478,12 +2619,15 @@
}
/* Unfix and unlatch the block. */
rw_lock_x_unlock(&block->lock);
break;
-@@ -2560,7 +2706,7 @@
+@@ -2499,7 +2643,7 @@
ut_ad(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
#if UNIV_WORD_SIZE == 4
/* On 32-bit systems, there is no padding in buf_page_t. On
other systems, Valgrind could complain about uninitialized pad
-@@ -2573,8 +2719,8 @@
+@@ -2512,8 +2656,8 @@
/* Try to evict the block from the buffer pool, to use the
insert buffer (change buffer) as much as possible. */
if (mode == BUF_GET_IF_IN_POOL_OR_WATCH) {
/* Set the watch, as it would have
been set if the page were not in the
-@@ -2583,6 +2729,9 @@
+@@ -2522,6 +2666,9 @@
space, offset, fold);
if (UNIV_LIKELY_NULL(block)) {
/* The page entered the buffer
pool for some reason. Try to
-@@ -2590,7 +2739,7 @@
+@@ -2529,7 +2676,7 @@
goto got_block;
}
}
fprintf(stderr,
"innodb_change_buffering_debug evict %u %u\n",
(unsigned) space, (unsigned) offset);
-@@ -2612,13 +2761,14 @@
+@@ -2551,13 +2698,14 @@
ut_a(mode == BUF_GET_POSSIBLY_FREED
|| !block->page.file_page_was_freed);
#endif
if (UNIV_LIKELY(mode != BUF_PEEK_IF_IN_POOL)) {
buf_page_set_accessed_make_young(&block->page, access_time);
-@@ -2851,9 +3001,11 @@
+@@ -2790,9 +2938,11 @@
buf_pool = buf_pool_from_block(block);
if (mode == BUF_MAKE_YOUNG && buf_page_peek_if_too_old(&block->page)) {
} else if (!buf_page_is_accessed(&block->page)) {
/* Above, we do a dirty read on purpose, to avoid
mutex contention. The field buf_page_t::access_time
-@@ -2861,9 +3013,11 @@
+@@ -2800,9 +2950,11 @@
field must be protected by mutex, however. */
ulint time_ms = ut_time_ms();
}
ut_ad(!ibuf_inside(mtr) || mode == BUF_KEEP_OLD);
-@@ -2930,18 +3084,21 @@
+@@ -2869,18 +3021,21 @@
ut_ad(mtr);
ut_ad(mtr->state == MTR_ACTIVE);
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
ut_a(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
-@@ -3031,7 +3188,10 @@
+@@ -2970,7 +3125,10 @@
buf_page_t* hash_page;
ut_ad(buf_pool == buf_pool_get(space, offset));
ut_ad(mutex_own(&(block->mutex)));
ut_a(buf_block_get_state(block) != BUF_BLOCK_FILE_PAGE);
-@@ -3060,11 +3220,14 @@
+@@ -2999,11 +3157,14 @@
if (UNIV_LIKELY(!hash_page)) {
} else if (buf_pool_watch_is_sentinel(buf_pool, hash_page)) {
/* Preserve the reference count. */
} else {
fprintf(stderr,
"InnoDB: Error: page %lu %lu already found"
-@@ -3074,7 +3237,8 @@
+@@ -3013,7 +3174,8 @@
(const void*) hash_page, (const void*) block);
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
mutex_exit(&block->mutex);
buf_print();
buf_LRU_print();
buf_validate();
-@@ -3157,7 +3321,9 @@
+@@ -3096,7 +3258,9 @@
fold = buf_page_address_fold(space, offset);
watch_page = buf_page_hash_get_low(buf_pool, space, offset, fold);
if (watch_page && !buf_pool_watch_is_sentinel(buf_pool, watch_page)) {
-@@ -3166,9 +3332,15 @@
+@@ -3105,9 +3269,15 @@
err_exit:
if (block) {
mutex_enter(&block->mutex);
bpage = NULL;
goto func_exit;
-@@ -3191,6 +3363,8 @@
+@@ -3130,6 +3300,8 @@
buf_page_init(buf_pool, space, offset, fold, block);
/* The block must be put to the LRU list, to the old blocks */
buf_LRU_add_block(bpage, TRUE/* to old blocks */);
-@@ -3218,7 +3392,7 @@
+@@ -3157,7 +3329,7 @@
been added to buf_pool->LRU and
buf_pool->page_hash. */
mutex_exit(&block->mutex);
mutex_enter(&block->mutex);
block->page.zip.data = data;
-@@ -3231,13 +3405,14 @@
+@@ -3170,13 +3342,14 @@
buf_unzip_LRU_add_block(block, TRUE);
}
/* If buf_buddy_alloc() allocated storage from the LRU list,
it released and reacquired buf_pool->mutex. Thus, we must
-@@ -3253,7 +3428,10 @@
+@@ -3192,7 +3365,10 @@
/* The block was added by some other thread. */
watch_page = NULL;
bpage = NULL;
goto func_exit;
-@@ -3301,20 +3479,26 @@
+@@ -3240,20 +3416,26 @@
HASH_INSERT(buf_page_t, hash, buf_pool->page_hash, fold,
bpage);
if (mode == BUF_READ_IBUF_PAGES_ONLY) {
-@@ -3356,7 +3540,9 @@
+@@ -3295,7 +3477,9 @@
fold = buf_page_address_fold(space, offset);
block = (buf_block_t*) buf_page_hash_get_low(
buf_pool, space, offset, fold);
-@@ -3372,7 +3558,9 @@
+@@ -3311,7 +3495,9 @@
#endif /* UNIV_DEBUG_FILE_ACCESSES || UNIV_DEBUG */
/* Page can be found in buf_pool */
buf_block_free(free_block);
-@@ -3394,6 +3582,7 @@
+@@ -3333,6 +3519,7 @@
mutex_enter(&block->mutex);
buf_page_init(buf_pool, space, offset, fold, block);
/* The block must be put to the LRU list */
buf_LRU_add_block(&block->page, FALSE);
-@@ -3420,7 +3609,7 @@
+@@ -3359,7 +3546,7 @@
the reacquisition of buf_pool->mutex. We also must
defer this operation until after the block descriptor
has been added to buf_pool->LRU and buf_pool->page_hash. */
mutex_enter(&block->mutex);
block->page.zip.data = data;
-@@ -3438,7 +3627,8 @@
+@@ -3377,7 +3564,8 @@
buf_page_set_accessed(&block->page, time_ms);
mtr_memo_push(mtr, block, MTR_MEMO_BUF_FIX);
-@@ -3493,7 +3683,9 @@
+@@ -3432,7 +3620,9 @@
ibool ret = TRUE;
/* First unfix and release lock on the bpage */
mutex_enter(buf_page_get_mutex(bpage));
ut_ad(buf_page_get_io_fix(bpage) == BUF_IO_READ);
ut_ad(bpage->buf_fix_count == 0);
-@@ -3514,11 +3706,15 @@
+@@ -3453,11 +3643,15 @@
ret = FALSE;
}
return(ret);
}
-@@ -3536,6 +3732,8 @@
+@@ -3475,6 +3669,8 @@
buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
const ibool uncompressed = (buf_page_get_state(bpage)
== BUF_BLOCK_FILE_PAGE);
ut_a(buf_page_in_file(bpage));
-@@ -3678,8 +3876,26 @@
+@@ -3617,8 +3813,26 @@
}
}
#ifdef UNIV_IBUF_COUNT_DEBUG
if (io_type == BUF_IO_WRITE || uncompressed) {
-@@ -3702,6 +3918,7 @@
+@@ -3641,6 +3855,7 @@
the x-latch to this OS thread: do not let this confuse you in
debugging! */
ut_ad(buf_pool->n_pend_reads > 0);
buf_pool->n_pend_reads--;
buf_pool->stat.n_pages_read++;
-@@ -3719,6 +3936,9 @@
+@@ -3658,6 +3873,9 @@
buf_flush_write_complete(bpage);
if (uncompressed) {
rw_lock_s_unlock_gen(&((buf_block_t*) bpage)->lock,
BUF_IO_WRITE);
-@@ -3741,8 +3961,8 @@
+@@ -3680,8 +3898,8 @@
}
#endif /* UNIV_DEBUG */
}
/*********************************************************************//**
-@@ -3759,7 +3979,9 @@
+@@ -3698,7 +3916,9 @@
ut_ad(buf_pool);
chunk = buf_pool->chunks;
-@@ -3776,7 +3998,9 @@
+@@ -3715,7 +3935,9 @@
}
}
return(TRUE);
}
-@@ -3824,7 +4048,8 @@
+@@ -3763,7 +3985,8 @@
freed = buf_LRU_search_and_free_block(buf_pool, 100);
}
ut_ad(UT_LIST_GET_LEN(buf_pool->LRU) == 0);
ut_ad(UT_LIST_GET_LEN(buf_pool->unzip_LRU) == 0);
-@@ -3837,7 +4062,8 @@
+@@ -3776,7 +3999,8 @@
memset(&buf_pool->stat, 0x00, sizeof(buf_pool->stat));
buf_refresh_io_stats(buf_pool);
}
/*********************************************************************//**
-@@ -3879,7 +4105,10 @@
+@@ -3818,7 +4042,10 @@
ut_ad(buf_pool);
chunk = buf_pool->chunks;
-@@ -3974,7 +4203,7 @@
+@@ -3913,7 +4140,7 @@
/* Check clean compressed-only blocks. */
for (b = UT_LIST_GET_FIRST(buf_pool->zip_clean); b;
ut_a(buf_page_get_state(b) == BUF_BLOCK_ZIP_PAGE);
switch (buf_page_get_io_fix(b)) {
case BUF_IO_NONE:
-@@ -4005,7 +4234,7 @@
+@@ -3944,7 +4171,7 @@
buf_flush_list_mutex_enter(buf_pool);
for (b = UT_LIST_GET_FIRST(buf_pool->flush_list); b;
ut_ad(b->in_flush_list);
ut_a(b->oldest_modification);
n_flush++;
-@@ -4064,6 +4293,8 @@
+@@ -4003,6 +4230,8 @@
}
ut_a(UT_LIST_GET_LEN(buf_pool->LRU) == n_lru);
if (UT_LIST_GET_LEN(buf_pool->free) != n_free) {
fprintf(stderr, "Free list len %lu, free blocks %lu\n",
(ulong) UT_LIST_GET_LEN(buf_pool->free),
-@@ -4074,8 +4305,11 @@
+@@ -4013,8 +4242,11 @@
ut_a(buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE] == n_single_flush);
ut_a(buf_pool->n_flush[BUF_FLUSH_LIST] == n_list_flush);
ut_a(buf_pool->n_flush[BUF_FLUSH_LRU] == n_lru_flush);
ut_a(buf_LRU_validate());
ut_a(buf_flush_validate(buf_pool));
-@@ -4131,7 +4365,9 @@
+@@ -4070,7 +4302,9 @@
index_ids = mem_alloc(size * sizeof *index_ids);
counts = mem_alloc(sizeof(ulint) * size);
buf_flush_list_mutex_enter(buf_pool);
fprintf(stderr,
-@@ -4200,7 +4436,9 @@
+@@ -4139,7 +4373,9 @@
}
}
for (i = 0; i < n_found; i++) {
index = dict_index_get_if_in_cache(index_ids[i]);
-@@ -4257,7 +4495,7 @@
+@@ -4196,7 +4432,7 @@
buf_chunk_t* chunk;
ulint fixed_pages_number = 0;
chunk = buf_pool->chunks;
-@@ -4291,7 +4529,7 @@
+@@ -4230,7 +4466,7 @@
/* Traverse the lists of clean and dirty compressed-only blocks. */
for (b = UT_LIST_GET_FIRST(buf_pool->zip_clean); b;
ut_a(buf_page_get_state(b) == BUF_BLOCK_ZIP_PAGE);
ut_a(buf_page_get_io_fix(b) != BUF_IO_WRITE);
-@@ -4303,7 +4541,7 @@
+@@ -4242,7 +4478,7 @@
buf_flush_list_mutex_enter(buf_pool);
for (b = UT_LIST_GET_FIRST(buf_pool->flush_list); b;
ut_ad(b->in_flush_list);
switch (buf_page_get_state(b)) {
-@@ -4329,7 +4567,7 @@
+@@ -4268,7 +4504,7 @@
buf_flush_list_mutex_exit(buf_pool);
mutex_exit(&buf_pool->zip_mutex);
return(fixed_pages_number);
}
-@@ -4487,6 +4725,8 @@
+@@ -4426,6 +4662,8 @@
/* Find appropriate pool_info to store stats for this buffer pool */
pool_info = &all_pool_info[pool_id];
buf_pool_mutex_enter(buf_pool);
buf_flush_list_mutex_enter(buf_pool);
-@@ -4602,6 +4842,8 @@
+@@ -4541,6 +4779,8 @@
pool_info->unzip_cur = buf_LRU_stat_cur.unzip;
buf_refresh_io_stats(buf_pool);
buf_pool_mutex_exit(buf_pool);
}
-@@ -4846,11 +5088,13 @@
+@@ -4785,11 +5025,13 @@
{
ulint len;
ut_ad(buf_flush_ready_for_flush(bpage, flush_type));
buf_page_set_io_fix(bpage, BUF_IO_WRITE);
-@@ -1429,14 +1439,16 @@
+@@ -1457,14 +1467,16 @@
buf_pool = buf_pool_get(space, i);
- buf_pool_mutex_exit(buf_pool);
+ //buf_pool_mutex_exit(buf_pool);
+ rw_lock_s_unlock(&buf_pool->page_hash_latch);
- continue;
- }
+ if (srv_flush_neighbor_pages == 2) {
-@@ -1448,11 +1460,9 @@
+ /* This is contiguous neighbor page flush and
+@@ -1482,11 +1494,9 @@
if (flush_type != BUF_FLUSH_LRU
|| i == offset
|| buf_page_is_old(bpage)) {
&& (i == offset || !bpage->buf_fix_count)) {
/* We only try to flush those
neighbors != offset where the buf fix
-@@ -1468,11 +1478,12 @@
+@@ -1502,11 +1512,12 @@
ut_ad(!buf_pool_mutex_own(buf_pool));
count++;
continue;
- buf_pool_mutex_exit(buf_pool);
+ //buf_pool_mutex_exit(buf_pool);
+ rw_lock_s_unlock(&buf_pool->page_hash_latch);
- }
- return(count);
-@@ -1505,21 +1516,25 @@
+ if (srv_flush_neigbor_pages == 2) {
+
+@@ -1555,21 +1566,25 @@
buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
#endif /* UNIV_DEBUG */
/* These fields are protected by both the
buffer pool mutex and block mutex. */
-@@ -1535,13 +1550,18 @@
+@@ -1585,13 +1600,18 @@
*count,
n_to_flush);
return(flushed);
}
-@@ -1562,7 +1582,8 @@
+@@ -1612,7 +1632,8 @@
buf_page_t* bpage;
ulint count = 0;
do {
/* Start from the end of the list looking for a
-@@ -1584,7 +1605,8 @@
+@@ -1634,7 +1655,8 @@
should be flushed, we factor in this value. */
buf_lru_flush_page_count += count;
return(count);
}
-@@ -1612,9 +1634,10 @@
+@@ -1662,9 +1684,10 @@
{
ulint len;
buf_page_t* bpage;
/* If we have flushed enough, leave the loop */
do {
-@@ -1633,6 +1656,7 @@
+@@ -1683,6 +1706,7 @@
if (bpage) {
ut_a(bpage->oldest_modification > 0);
}
if (!bpage || bpage->oldest_modification >= lsn_limit) {
-@@ -1674,9 +1698,17 @@
+@@ -1724,9 +1748,17 @@
break;
}
buf_flush_list_mutex_exit(buf_pool);
-@@ -1685,7 +1717,7 @@
+@@ -1735,7 +1767,7 @@
} while (count < min_n && bpage != NULL && len > 0);
return(count);
}
-@@ -1724,13 +1756,15 @@
+@@ -1774,13 +1806,15 @@
|| sync_thread_levels_empty_except_dict());
#endif /* UNIV_SYNC_DEBUG */
break;
case BUF_FLUSH_LIST:
count = buf_flush_flush_list_batch(buf_pool, min_n, lsn_limit);
-@@ -1739,7 +1773,7 @@
+@@ -1789,7 +1823,7 @@
ut_error;
}
buf_flush_buffered_writes();
-@@ -1995,7 +2029,7 @@
+@@ -2045,7 +2079,7 @@
retry:
//buf_pool_mutex_enter(buf_pool);
if (have_LRU_mutex)
n_replaceable = UT_LIST_GET_LEN(buf_pool->free);
-@@ -2012,15 +2046,15 @@
+@@ -2062,15 +2096,15 @@
bpage = UT_LIST_GET_LAST(buf_pool->LRU);
continue;
}
distance++;
-@@ -2029,7 +2063,7 @@
+@@ -2079,7 +2113,7 @@
//buf_pool_mutex_exit(buf_pool);
if (have_LRU_mutex)
if (n_replaceable >= BUF_FLUSH_FREE_BLOCK_MARGIN(buf_pool)) {
-@@ -2228,7 +2262,7 @@
+@@ -2278,7 +2312,7 @@
ut_ad(buf_flush_list_mutex_own(buf_pool));
ut_ad(ut_list_node_313->in_flush_list));
bpage = UT_LIST_GET_FIRST(buf_pool->flush_list);
-@@ -2268,7 +2302,7 @@
+@@ -2318,7 +2352,7 @@
rnode = rbt_next(buf_pool->flush_rbt, rnode);
}
- mutex_enter(&((buf_block_t*) bpage)->mutex);
+ //mutex_enter(&((buf_block_t*) bpage)->mutex);
is_fixed = bpage->buf_fix_count > 0
- || !((buf_block_t*) bpage)->is_hashed;
+ || !((buf_block_t*) bpage)->index;
- mutex_exit(&((buf_block_t*) bpage)->mutex);
+ //mutex_exit(&((buf_block_t*) bpage)->mutex);
break;
--- a/storage/innobase/ibuf/ibuf0ibuf.c
+++ b/storage/innobase/ibuf/ibuf0ibuf.c
-@@ -3821,9 +3821,11 @@
+@@ -3760,9 +3760,11 @@
ulint fold = buf_page_address_fold(space, page_no);
buf_pool_t* buf_pool = buf_pool_get(space, page_no);
Creates the buffer pool.
@return own: buf_pool object, NULL if not enough memory or error */
UNIV_INTERN
-@@ -864,6 +878,15 @@
+@@ -851,6 +865,15 @@
const buf_page_t* bpage) /*!< in: pointer to control block */
__attribute__((pure));
/*********************************************************************//**
Get the flush type of a page.
@return flush type */
-@@ -1345,7 +1368,7 @@
+@@ -1332,7 +1355,7 @@
All these are protected by buf_pool->mutex. */
/* @{ */
/*!< based on state, this is a
list node, protected either by
buf_pool->mutex or by
-@@ -1373,6 +1396,10 @@
+@@ -1360,6 +1383,10 @@
BUF_BLOCK_REMOVE_HASH or
BUF_BLOCK_READY_IN_USE. */
#ifdef UNIV_DEBUG
ibool in_flush_list; /*!< TRUE if in buf_pool->flush_list;
when buf_pool->flush_list_mutex is
-@@ -1465,11 +1492,11 @@
+@@ -1452,11 +1479,11 @@
a block is in the unzip_LRU list
if page.state == BUF_BLOCK_FILE_PAGE
and page.zip.data != NULL */
mutex_t mutex; /*!< mutex protecting this block:
state (also protected by the buffer
pool mutex), io_fix, buf_fix_count,
-@@ -1646,6 +1673,11 @@
+@@ -1636,6 +1663,11 @@
pool instance, protects compressed
only pages (of type buf_page_t, not
buf_block_t */
ulint instance_no; /*!< Array index of this buffer
pool instance */
ulint old_pool_size; /*!< Old pool size in bytes */
-@@ -1799,8 +1831,8 @@
+@@ -1789,8 +1821,8 @@
/** Test if a buffer pool mutex is owned. */
#define buf_pool_mutex_own(b) mutex_own(&b->mutex)
/** Acquire a buffer pool mutex. */
+#define SYNC_LOG_FLUSH_ORDER 156
#define SYNC_RECV 168
#define SYNC_WORK_QUEUE 162
- #define SYNC_SEARCH_SYS_CONF 161 /* for assigning btr_search_enabled */
-@@ -677,8 +681,13 @@
+ #define SYNC_SEARCH_SYS 160 /* NOTE that if we have a memory
+@@ -676,8 +680,13 @@
SYNC_SEARCH_SYS, as memory allocation
can call routines there! Otherwise
the level is SYNC_MEM_HASH. */
#define SYNC_BUF_FLUSH_LIST 145 /* Buffer flush list mutex */
#define SYNC_DOUBLEWRITE 140
#define SYNC_ANY_LATCH 135
-@@ -709,7 +718,7 @@
+@@ -708,7 +717,7 @@
os_fast_mutex; /*!< We use this OS mutex in place of lock_word
when atomic operations are not enabled */
#endif
}
/******************************************************************//**
-@@ -1234,7 +1244,12 @@
+@@ -1233,7 +1243,12 @@
ut_error;
}
break;
case SYNC_BUF_POOL:
/* We can have multiple mutexes of this type therefore we
can only check whether the greater than condition holds. */
-@@ -1252,7 +1267,8 @@
+@@ -1251,7 +1266,8 @@
buffer block (block->mutex or buf_pool->zip_mutex). */
if (!sync_thread_levels_g(array, level, FALSE)) {
ut_a(sync_thread_levels_g(array, level - 1, TRUE));