mirror of
https://github.com/MariaDB/server.git
synced 2025-07-17 16:58:27 +02:00

Added option 'aria-pagecache-segments', default 1. For values > 1, this split the aria-pagecache-buffer into the given number of segments, each independent from each other. Having multiple pagecaches improve performance when multiple connections runs queries concurrently using different tables. Each pagecache will use aria-pageache-buffer/segments amount of memory, however at least 128K. Each opened table has its index and data file use the segments in a a round-robin fashion. Internal changes: - All programs allocating the maria pagecache themselves should now call multi_init_pagecache() instead of init_pagecache(). - pagecache statistics is now stored in 'pagecache_stats' instead of maria_pagecache. One must call multi_update_pagecache_stats() to update the statistics. - Added into PAGECACHE_FILE a pointer to files pagecache. This was done to ensure that index and data file are using the same pagecache and simplified the checkpoint code. I kept pagecache in TABLE_SHARE to minimize the changes. - really_execute_checkpoint() was update to handle a dynamic number of pagecaches. - pagecache_collect_changed_blocks_with_lsn() was slight changed to allow it to be called for each pagecache. - undefined not used functions maria_assign_pagecache() and maria_change_pagecache() - ma_pagecaches.c is totally rewritten. It now contains all multi_pagecache functions. Errors found be QA that are fixed: MDEV-36872 UBSAN errors in ma_checkpoint.c MDEV-36874 Behavior upon too small aria_pagecache_buffer_size in case of multiple segments is not very user-friendly MDEV-36914 ma_checkpoint.c(285,9): conversion from '__int64' to 'uint' treated as an error MDEV-36912 sys_vars.sysvars_server_embedded and sys_vars.sysvars_server_notembedded fail on x86
81 lines
3 KiB
Text
81 lines
3 KiB
Text
# Tests of Aria's recovery of the bitmap pages
|
|
|
|
--source include/not_embedded.inc
|
|
# Don't test this under valgrind, memory leaks will occur as we crash
|
|
--source include/not_valgrind.inc
|
|
# Binary must be compiled with debug for crash to occur
|
|
--source include/have_debug.inc
|
|
--source include/have_maria.inc
|
|
|
|
--disable_warnings
|
|
drop database if exists mysqltest;
|
|
--enable_warnings
|
|
create database mysqltest;
|
|
let $mms_tname=t;
|
|
|
|
# Include scripts can perform SQL. For it to not influence the main test
|
|
# they use a separate connection. This way if they use a DDL it would
|
|
# not autocommit in the main test.
|
|
connect (admin, localhost, root,,mysqltest,,);
|
|
--enable_reconnect
|
|
|
|
connection default;
|
|
use mysqltest;
|
|
--enable_reconnect
|
|
|
|
-- source include/maria_empty_logs.inc
|
|
let $mms_tables=1;
|
|
create table t1 (a varchar(10000)) engine=aria;
|
|
|
|
# we want recovery to use the tables as they were at time of crash
|
|
let $mvr_restore_old_snapshot=0;
|
|
# UNDO phase prevents physical comparison, normally,
|
|
# so we'll only use checksums to compare.
|
|
let $mms_compare_physically=0;
|
|
let $mvr_crash_statement= set global aria_checkpoint_interval=1;
|
|
|
|
--echo * TEST of over-allocated bitmap not flushed by checkpoint
|
|
let $mvr_debug_option="+d,maria_crash";
|
|
insert into t1 values ("bbbbbbb");
|
|
-- source include/maria_make_snapshot_for_comparison.inc
|
|
# make_snapshot_for_comparison closed the table, which lost its id.
|
|
# So we make a null operation just to give a short id to the table so
|
|
# that checkpoint includes table in checkpoint (otherwise nothing to
|
|
# test).
|
|
insert into t1 values ("bbbbbbb");
|
|
delete from t1 limit 1;
|
|
# Use a separate connection here. The reason is that we leave a dangling
|
|
# --send on the connection during aria_verify_recovery.inc, which makes that
|
|
# script fail if it were to try to use that connection before --reap.
|
|
connect (extra, localhost, root,,mysqltest,,);
|
|
set session debug_dbug="+d,info,enter,exit,maria_over_alloc_bitmap";
|
|
send insert into t1 values ("aaaaaaaaa");
|
|
connection admin;
|
|
# Leave time for INSERT to block after modifying bitmap;
|
|
# in the future we should not use sleep but something like
|
|
# debug_sync_point().
|
|
sleep 5;
|
|
# force a checkpoint, which could, if buggy, flush over-allocated
|
|
# bitmap page; as REDO-UNDO was not written, bitmap and data page
|
|
# would be inconsistent. Correct checkpoint will wait until UNDO is
|
|
# written.
|
|
set global aria_checkpoint_interval=1;
|
|
-- source include/maria_verify_recovery.inc
|
|
connection default;
|
|
|
|
--echo * TEST of bitmap flushed without REDO-UNDO in the log (WAL violation)
|
|
# before crashing we'll flush the bitmap page
|
|
let $mvr_debug_option="+d,maria_flush_bitmap,maria_crash";
|
|
-- source include/maria_make_snapshot_for_comparison.inc
|
|
lock tables t1 write;
|
|
insert into t1 values (REPEAT('a', 6000));
|
|
# bitmap of after-INSERT will be on disk, but data pages will not; if
|
|
# log is not flushed the bitmap is inconsistent with the data.
|
|
-- source include/maria_verify_recovery.inc
|
|
drop table t1;
|
|
|
|
# clean up everything
|
|
flush global status;
|
|
let $mms_purpose=comparison;
|
|
eval drop database mysqltest_for_$mms_purpose;
|
|
drop database mysqltest;
|