mariadb/mysql-test/suite/innodb_zip/include/innodb_wl6501_scale.inc
Marko Mäkelä 3448ceb02a MDEV-13564: Implement innodb_unsafe_truncate=ON for compatibility
While MariaDB Server 10.2 is not really guaranteed to be compatible
with Percona XtraBackup 2.4 (for example, the MySQL 5.7 undo log format
change that could be present in XtraBackup, but was reverted from
MariaDB in MDEV-12289), we do not want to disrupt users who have
deployed xtrabackup and MariaDB Server 10.2 in their environments.

With this change, MariaDB 10.2 will continue to use the backup-unsafe
TRUNCATE TABLE code, so that neither the undo log nor the redo log
formats will change in an incompatible way.

Undo tablespace truncation will keep using the redo log only. Recovery
or backup with old code will fail to shrink the undo tablespace files,
but the contents will be recovered just fine.

In the MariaDB Server 10.2 series only, we introduce the configuration
parameter innodb_unsafe_truncate and make it ON by default. To allow
MariaDB Backup (mariabackup) to work properly with TRUNCATE TABLE
operations, use loose_innodb_unsafe_truncate=OFF.

MariaDB Server 10.3.10 and later releases will always use the
backup-safe TRUNCATE TABLE, and this parameter will not be
added there.

recv_recovery_rollback_active(): Skip row_mysql_drop_garbage_tables()
unless innodb_unsafe_truncate=OFF. It is too unsafe to drop orphan
tables if RENAME operations are not transactional within InnoDB.

LOG_HEADER_FORMAT_10_3: Replaces LOG_HEADER_FORMAT_CURRENT.

log_init(), log_group_file_header_flush(),
srv_prepare_to_delete_redo_log_files(),
innobase_start_or_create_for_mysql(): Choose the redo log format
and subformat based on the value of innodb_unsafe_truncate.
2018-10-11 08:17:04 +03:00

112 lines
2.6 KiB
PHP

#
# load tables with some significant amount of data and then truncate it.
#
#-----------------------------------------------------------------------------
#
# create test-bed
#
let $per_table = `select @@innodb_file_per_table`;
let $format = `select @@innodb_file_format`;
let $WL6501_TMP_DIR = `select @@tmpdir`;
let $WL6501_DATA_DIR = `select @@datadir`;
set innodb_strict_mode=OFF;
#-----------------------------------------------------------------------------
#
# create procedure to load data
#
delimiter |;
create procedure populate()
begin
declare i int default 1;
while (i <= 5000) do
insert into t1 values (i, 'a', 'b');
insert into t2 values (i, 'a', 'b');
insert into t3 values (i, 'a', 'b');
set i = i + 1;
end while;
end|
create procedure populate_small()
begin
declare i int default 10001;
while (i <= 12000) do
insert into t1 values (i, 'c', 'd');
insert into t2 values (i, 'a', 'b');
insert into t3 values (i, 'a', 'b');
set i = i + 1;
end while;
end|
delimiter ;|
#-----------------------------------------------------------------------------
#
# create and load the tables.
#
eval set global innodb_file_per_table = $wl6501_file_per_table;
--replace_regex /[0-9]+/NUMBER/
eval create table t1
(i int, c1 char(100), c2 char(100),
index c1_idx(c1))
engine=innodb row_format=$wl6501_row_fmt
key_block_size=$wl6501_kbs;
eval create table t2
(i int, c1 char(100), c2 char(100),
index c1_idx(c1))
engine=innodb row_format=$wl6501_row_fmt
key_block_size=$wl6501_kbs;
eval create temporary table t3
(i int, c1 char(100), c2 char(100),
index c1_idx(c1))
engine=innodb row_format=$wl6501_row_fmt
key_block_size=$wl6501_kbs;
#
select count(*) from t1;
select count(*) from t2;
select count(*) from t3;
begin;
call populate();
commit;
select count(*) from t1;
select count(*) from t2;
select count(*) from t3;
#
truncate table t1;
select count(*) from t1;
select count(*) from t2;
select count(*) from t3;
#
call populate_small();
select count(*) from t1;
select count(*) from t2;
select count(*) from t3;
#
truncate table t2;
truncate table t3;
select count(*) from t1;
select count(*) from t2;
select count(*) from t3;
#
call populate_small();
select count(*) from t1;
select count(*) from t2;
select count(*) from t3;
#
drop table t1;
drop table t2;
drop table t3;
#-----------------------------------------------------------------------------
#
# drop the procedure
#
drop procedure populate;
drop procedure populate_small;
#-----------------------------------------------------------------------------
#
# remove test-bed
#
eval set global innodb_file_format = $format;
eval set global innodb_file_per_table = $per_table;