mirror of
https://github.com/MariaDB/server.git
synced 2025-07-19 09:48:14 +02:00

We deprecate and ignore the parameter innodb_buffer_pool_chunk_size and let the buffer pool size to be changed in arbitrary 1-megabyte increments, all the way up to innodb_buffer_pool_size_max, which must be specified at startup. If innodb_buffer_pool_size_max is not specified, it will default to twice the specified innodb_buffer_pool_size. The buffer pool will be mapped in a contiguous memory area that will be aligned and partitioned into extents of 8 MiB on 64-bit systems and 2 MiB on 32-bit systems. Within an extent, the first few innodb_page_size blocks contain buf_block_t objects that will cover the page frames in the rest of the extent. In this way, there is a trivial mapping between page frames and block descriptors and we do not need any lookup tables like buf_pool.zip_hash or buf_pool_t::chunk_t::map. We will always allocate the same number of block descriptors for an extent, even if we do not need all the buf_block_t in the last extent in case the innodb_buffer_pool_size is not an integer multiple of the of extents size. The minimum innodb_buffer_pool_size is 256*5/4 pages. At the default innodb_page_size=16k this corresponds to 5 MiB. However, now that the innodb_buffer_pool_size includes the memory allocated for the block descriptors, the minimum would be innodb_buffer_pool_size=6m. Innodb_buffer_pool_resize_status: Remove. We will execute buf_pool_t::resize() synchronously in the thread that is executing SET GLOBAL innodb_buffer_pool_size. That operation will run until it completes, or until a KILL statement is executed, the client is disconnected, the buf_flush_page_cleaner() thread notices that we are running out of memory, or the server is shut down. my_large_virtual_alloc(): A new function, similar to my_large_malloc(). FIXME: On Microsoft Windows, let the caller know if large page allocation was used. In that case, we must disallow buffer pool resizing. buf_pool_t::create(), buf_pool_t::chunk_t::create(): Only initialize the first page descriptor of each chunk. buf_pool_t::lazy_allocate(): Lazily initialize a previously allocated page descriptor and increase buf_pool.n_blocks, which must be below buf_pool.n_blocks_alloc. buf_pool_t::allocate(): Renamed from buf_LRU_get_free_only(). buf_pool_t::LRU_warned: Changed to Atomic_relaxed<bool>, only to be modified by the buf_flush_page_cleaner() thread. buf_pool_t::LRU_shrink(): Check if buffer pool shrinking needs to process a buffer page. buf_pool_t::resize(): Always zero out b->page.zip.data. Failure to do so would cause crashes or corruption in the test innodb.innodb_buffer_pool_resize due to duplicated allocation in the buddy system. Before tarting to shrink the buffer pool, run one batch of buf_flush_page_cleaner() in order to prevent LRU_warn(). Abort shrinking if the buf_flush_page_cleaner() has LRU_warned. buf_pool_t::first_to_withdraw: The first block descriptor that is out of the bounds of the shrunk buffer pool. buf_pool_t::withdrawn: The list of withdrawn blocks. If buf_pool_t::resize() is aborted, we must be able to resurrect the withdrawn blocks in the free list. buf_pool_t::contains_zip(): Added a parameter for the number of least significant pointer bits to disregard, so that we can find any pointers to within a block that is supposed to be free. buf_pool_t::get_info(): Replaces buf_stats_get_pool_info(). innodb_init_param(): Refactored. We must first compute srv_page_size_shift and then determine the valid bounds of innodb_buffer_pool_size. buf_buddy_shrink(): Replaces buf_buddy_realloc(). Part of the work is deferred to buf_buddy_condense_free(), which is being executed when we are not holding any buf_pool.page_hash latch. buf_buddy_condense_free(): Do not relocate blocks. buf_buddy_free_low(): Do not care about buffer pool shrinking. This will be handled by buf_buddy_shrink() and buf_buddy_condense_free(). buf_buddy_alloc_zip(): Assert !buf_pool.contains_zip() when we are allocating from the binary buddy system. Previously we were asserting this on multiple recursion levels. buf_buddy_block_free(), buf_buddy_free_low(): Assert !buf_pool.contains_zip(). buf_buddy_alloc_from(): Remove the redundant parameter j. buf_flush_LRU_list_batch(): Add the parameter shrinking. If we are shrinking, invoke buf_pool_t::LRU_shrink() to see if we must keep going. buf_do_LRU_batch(): Skip buf_free_from_unzip_LRU_list_batch() if we are shrinking the buffer pool. In that case, we want to minimize the page relocations and just finish as quickly as possible. trx_purge_attach_undo_recs(): Limit purge_sys.n_pages_handled() in every iteration, in case the buffer pool is being shrunk in the middle of a purge batch.
91 lines
3.5 KiB
Text
91 lines
3.5 KiB
Text
--source include/have_innodb.inc
|
|
--source include/big_test.inc
|
|
--source include/not_embedded.inc
|
|
call mtr.add_suppression("InnoDB: The change buffer is corrupted");
|
|
call mtr.add_suppression("InnoDB: Tablespace size stored in header is 768 pages, but the sum of data file sizes is 384 pages");
|
|
call mtr.add_suppression("InnoDB: adjusting FSP_SPACE_FLAGS of file");
|
|
--source include/shutdown_mysqld.inc
|
|
let bugdir= $MYSQLTEST_VARDIR/tmp/log_upgrade;
|
|
--mkdir $bugdir
|
|
--let SEARCH_FILE = $MYSQLTEST_VARDIR/log/mysqld.1.err
|
|
--let $dirs= --innodb-data-home-dir=$bugdir --innodb-log-group-home-dir=$bugdir
|
|
|
|
# Test case similar to log_upgrade.test
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/../innodb/include/crc32.pl";
|
|
my $polynomial = 0x82f63b78; # CRC-32C
|
|
|
|
die unless open OUT, ">", "$ENV{bugdir}/ibdata1";
|
|
binmode OUT;
|
|
|
|
my $head = pack("Nx[18]", 0);
|
|
# Add FSP_SPACE_FLAGS as 49152 (10.1.0...10.1.20), page_size = 32k
|
|
my $body = pack("x[8]Nx[4]Nx[2]Nx[32696]", 768, 49152, 97937874);
|
|
my $ck = mycrc32($head, 0, $polynomial) ^ mycrc32($body, 0, $polynomial);
|
|
print OUT pack("N",$ck).$head.pack("x[12]").$body.pack("Nx[4]",$ck);
|
|
# Dummy pages 1..6.
|
|
print OUT chr(0) x (6 * 32768);
|
|
# Dictionary header page (page 7).
|
|
$head = pack("Nx[18]", 7);
|
|
$body = pack("x[32]Nx[8]Nx[32674]", 8, 9);
|
|
$ck = mycrc32($head, 0, $polynomial) ^ mycrc32($body, 0, $polynomial);
|
|
print OUT pack("N",$ck).$head.pack("x[12]").$body.pack("Nx[4]",$ck);
|
|
|
|
# Empty SYS_TABLES page (page 8).
|
|
$head = pack("NNNx[8]n", 8, ~0, ~0, 17855);
|
|
$body = pack("nnx[31]Cx[20]", 2, 124, 1);
|
|
$body .= pack("nxnn", 0x801, 3, 116) . "infimum";
|
|
$body .= pack("xnxnxx", 0x901, 0x803) . "supremum";
|
|
$body .= pack("x[32632]nn", 116, 101);
|
|
$ck = mycrc32($head, 0, $polynomial) ^ mycrc32($body, 0, $polynomial);
|
|
print OUT pack("N",$ck).$head.pack("x[12]").$body.pack("Nx[4]",$ck);
|
|
|
|
# Empty SYS_INDEXES page (page 9).
|
|
$head = pack("NNNx[8]n", 9, ~0, ~0, 17855);
|
|
$body = pack("nnx[31]Cx[20]", 2, 124, 3);
|
|
$body .= pack("nxnn", 0x801, 3, 116) . "infimum";
|
|
$body .= pack("xnxnxx", 0x901, 0x803) . "supremum";
|
|
$body .= pack("x[32632]nn", 116, 101);
|
|
$ck = mycrc32($head, 0, $polynomial) ^ mycrc32($body, 0, $polynomial);
|
|
print OUT pack("N",$ck).$head.pack("x[12]").$body.pack("Nx[4]",$ck);
|
|
|
|
die unless seek(OUT, 768 * 16384 - 1, 0);
|
|
print OUT chr(0);
|
|
close OUT or die;
|
|
|
|
die unless open OUT, ">", "$ENV{bugdir}/ib_logfile0";
|
|
binmode OUT;
|
|
$_= pack("Nx[5]nx[5]", 1, 0x1286) . "BogoDB 4.3.2.1" . chr(0) x 478;
|
|
print OUT $_, pack("N", mycrc32($_, 0, $polynomial));
|
|
# checkpoint page 1 and all-zero checkpoint 2
|
|
$_= pack("x[13]nCNNx[484]", 0x1286, 12, 2, 0x80c);
|
|
print OUT $_, pack("N", mycrc32($_, 0, $polynomial));
|
|
die unless seek(OUT, 0x1FFFFFFFF, 0);
|
|
print OUT chr(0);
|
|
close OUT or die;
|
|
die unless open OUT, ">", "$ENV{bugdir}/ib_logfile1";
|
|
binmode OUT;
|
|
die unless seek(OUT, 0x800, 0); # the first 2048 bytes are unused!
|
|
$_= pack("Nnnx[500]", 0x80000944, 12, 12);
|
|
print OUT $_, pack("N", mycrc32($_, 0, $polynomial));
|
|
die unless seek(OUT, 0x1FFFFFFFF, 0);
|
|
print OUT chr(0);
|
|
close OUT or die;
|
|
EOF
|
|
|
|
--let $restart_parameters= $dirs --innodb-force-recovery=5 --innodb-log-file-size=4m --innodb_page_size=32k --innodb_buffer_pool_size=11M
|
|
--source include/start_mysqld.inc
|
|
SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES
|
|
WHERE engine = 'innodb'
|
|
AND support IN ('YES', 'DEFAULT', 'ENABLED');
|
|
--source include/shutdown_mysqld.inc
|
|
--let SEARCH_PATTERN= InnoDB: Upgrading redo log:
|
|
--source include/search_pattern_in_file.inc
|
|
--let $restart_parameters= $dirs
|
|
|
|
--remove_files_wildcard $bugdir
|
|
--rmdir $bugdir
|
|
--let $restart_parameters=
|
|
--source include/start_mysqld.inc
|
|
|
|
--echo # End of 10.5 tests
|