/********************************************************************//**
Allocates a chunk of buffer frames.
@return chunk, or NULL on failure */
-@@ -1001,26 +1082,188 @@
+@@ -1001,26 +1082,190 @@
{
buf_block_t* block;
byte* frame;
+ ulint zip_hash_mem_size = 0;
+ hash_table_t* zip_hash_tmp = NULL;
ulint i;
++ ulint size_target;
+ buf_shm_info_t* shm_info = NULL;
/* Round down to a multiple of page size,
although it already should be. */
mem_size = ut_2pow_round(mem_size, UNIV_PAGE_SIZE);
++ size_target = (mem_size / UNIV_PAGE_SIZE) - 1;
+
+ srv_buffer_pool_shm_is_reused = FALSE;
+
/* Align a pointer to the first frame. Note that when
os_large_page_size is smaller than UNIV_PAGE_SIZE,
-@@ -1028,8 +1271,13 @@
+@@ -1028,8 +1273,13 @@
it is bigger, we may allocate more blocks than requested. */
frame = ut_align(chunk->mem, UNIV_PAGE_SIZE);
/* Subtract the space needed for block descriptors. */
{
-@@ -1043,6 +1291,98 @@
+@@ -1043,6 +1293,102 @@
chunk->size = size;
}
++ if (chunk->size > size_target) {
++ chunk->size = size_target;
++ }
++
+ if (shm_info && !(shm_info->is_new)) {
+ /* convert the shared memory segment for reuse */
+ ptrdiff_t phys_offset;
/* Init block structs and assign frames for them. Then we
assign the frames to the first blocks (we already mapped the
memory above). */
-@@ -1068,6 +1408,11 @@
+@@ -1068,6 +1414,11 @@
block++;
frame += UNIV_PAGE_SIZE;
}
#ifdef PFS_GROUP_BUFFER_SYNC
pfs_register_buffer_block(chunk);
-@@ -1249,6 +1594,8 @@
+@@ -1249,6 +1600,8 @@
UNIV_MEM_UNDESC(block);
}
os_mem_free_large(chunk->mem, chunk->mem_size);
}
-@@ -1289,7 +1636,7 @@
+@@ -1289,7 +1642,7 @@
ulint instance_no) /*!< in: id of the instance */
{
ulint i;
/* 1. Initialize general fields
------------------------------- */
-@@ -1335,7 +1682,10 @@
+@@ -1335,7 +1688,10 @@
buf_pool->curr_pool_size = buf_pool->curr_size * UNIV_PAGE_SIZE;
buf_pool->page_hash = hash_create(2 * buf_pool->curr_size);
buf_pool->last_printout_time = ut_time();
}
-@@ -1354,6 +1704,86 @@
+@@ -1354,6 +1710,86 @@
/* All fields are initialized by mem_zalloc(). */
mutex_exit(&buf_pool->LRU_list_mutex);
rw_lock_x_unlock(&buf_pool->page_hash_latch);
buf_pool_mutex_exit(buf_pool);
-@@ -1373,6 +1803,42 @@
+@@ -1373,6 +1809,42 @@
buf_chunk_t* chunk;
buf_chunk_t* chunks;
chunks = buf_pool->chunks;
chunk = chunks + buf_pool->n_chunks;
-@@ -1381,10 +1847,13 @@
+@@ -1381,10 +1853,13 @@
would fail at shutdown. */
os_mem_free_large(chunk->mem, chunk->mem_size);
}
}
/********************************************************************//**
-@@ -1668,6 +2137,11 @@
+@@ -1668,6 +2143,11 @@
//buf_pool_mutex_enter(buf_pool);
mutex_enter(&buf_pool->LRU_list_mutex);
shrink_again:
if (buf_pool->n_chunks <= 1) {
-@@ -1848,7 +2322,7 @@
+@@ -1848,7 +2328,7 @@
zip_hash = hash_create(2 * buf_pool->curr_size);
HASH_MIGRATE(buf_pool->zip_hash, zip_hash, buf_page_t, hash,
hash_table_free(buf_pool->zip_hash);
buf_pool->zip_hash = zip_hash;
-@@ -2130,6 +2604,11 @@
+@@ -2130,6 +2610,11 @@
ulint change_size;
ulint min_change_size = 1048576 * srv_buf_pool_instances;
static MYSQL_SYSVAR_ULONG(commit_concurrency, innobase_commit_concurrency,
PLUGIN_VAR_RQCMDARG,
"Helps in performance tuning in heavily concurrent environments.",
-@@ -11922,6 +11942,8 @@
+@@ -11939,6 +11959,8 @@
MYSQL_SYSVAR(autoextend_increment),
MYSQL_SYSVAR(buffer_pool_size),
MYSQL_SYSVAR(buffer_pool_instances),
/** @name Modes for buf_page_get_gen */
/* @{ */
-@@ -1591,9 +1592,12 @@
+@@ -1592,9 +1593,12 @@
/**********************************************************************//**
Compute the hash fold value for blocks in buf_pool->zip_hash. */
/* @{ */