mirror of
https://github.com/MariaDB/server.git
synced 2025-09-02 09:41:40 +03:00
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.
346 lines
7.1 KiB
Plaintext
346 lines
7.1 KiB
Plaintext
set innodb_strict_mode=OFF;
|
|
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|
|
|
set global innodb_file_per_table = 1;
|
|
create table tNUMBER
|
|
(i int, cNUMBER char(NUMBER), cNUMBER char(NUMBER),
|
|
index cNUMBER_idx(cNUMBER))
|
|
engine=innodb row_format=compact
|
|
key_block_size=NUMBER;
|
|
Warnings:
|
|
Warning NUMBER InnoDB: ignoring KEY_BLOCK_SIZE=NUMBER unless ROW_FORMAT=COMPRESSED.
|
|
create table t2
|
|
(i int, c1 char(100), c2 char(100),
|
|
index c1_idx(c1))
|
|
engine=innodb row_format=compact
|
|
key_block_size=16;
|
|
Warnings:
|
|
Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=16 unless ROW_FORMAT=COMPRESSED.
|
|
create temporary table t3
|
|
(i int, c1 char(100), c2 char(100),
|
|
index c1_idx(c1))
|
|
engine=innodb row_format=compact
|
|
key_block_size=16;
|
|
Warnings:
|
|
Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE.
|
|
Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=16.
|
|
select count(*) from t1;
|
|
count(*)
|
|
0
|
|
select count(*) from t2;
|
|
count(*)
|
|
0
|
|
select count(*) from t3;
|
|
count(*)
|
|
0
|
|
begin;
|
|
call populate();
|
|
commit;
|
|
select count(*) from t1;
|
|
count(*)
|
|
5000
|
|
select count(*) from t2;
|
|
count(*)
|
|
5000
|
|
select count(*) from t3;
|
|
count(*)
|
|
5000
|
|
truncate table t1;
|
|
select count(*) from t1;
|
|
count(*)
|
|
0
|
|
select count(*) from t2;
|
|
count(*)
|
|
5000
|
|
select count(*) from t3;
|
|
count(*)
|
|
5000
|
|
call populate_small();
|
|
select count(*) from t1;
|
|
count(*)
|
|
2000
|
|
select count(*) from t2;
|
|
count(*)
|
|
7000
|
|
select count(*) from t3;
|
|
count(*)
|
|
7000
|
|
truncate table t2;
|
|
truncate table t3;
|
|
select count(*) from t1;
|
|
count(*)
|
|
2000
|
|
select count(*) from t2;
|
|
count(*)
|
|
0
|
|
select count(*) from t3;
|
|
count(*)
|
|
0
|
|
call populate_small();
|
|
select count(*) from t1;
|
|
count(*)
|
|
4000
|
|
select count(*) from t2;
|
|
count(*)
|
|
2000
|
|
select count(*) from t3;
|
|
count(*)
|
|
2000
|
|
drop table t1;
|
|
drop table t2;
|
|
drop table t3;
|
|
drop procedure populate;
|
|
drop procedure populate_small;
|
|
set global innodb_file_format = Barracuda;
|
|
Warnings:
|
|
Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See https://mariadb.com/kb/en/library/xtradbinnodb-file-format/
|
|
set global innodb_file_per_table = 1;
|
|
set innodb_strict_mode=OFF;
|
|
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|
|
|
set global innodb_file_per_table = 1;
|
|
create table tNUMBER
|
|
(i int, cNUMBER char(NUMBER), cNUMBER char(NUMBER),
|
|
index cNUMBER_idx(cNUMBER))
|
|
engine=innodb row_format=compressed
|
|
key_block_size=NUMBER;
|
|
create table t2
|
|
(i int, c1 char(100), c2 char(100),
|
|
index c1_idx(c1))
|
|
engine=innodb row_format=compressed
|
|
key_block_size=16;
|
|
create temporary table t3
|
|
(i int, c1 char(100), c2 char(100),
|
|
index c1_idx(c1))
|
|
engine=innodb row_format=compressed
|
|
key_block_size=16;
|
|
Warnings:
|
|
Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE.
|
|
Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=16.
|
|
Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE.
|
|
Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC.
|
|
select count(*) from t1;
|
|
count(*)
|
|
0
|
|
select count(*) from t2;
|
|
count(*)
|
|
0
|
|
select count(*) from t3;
|
|
count(*)
|
|
0
|
|
begin;
|
|
call populate();
|
|
commit;
|
|
select count(*) from t1;
|
|
count(*)
|
|
5000
|
|
select count(*) from t2;
|
|
count(*)
|
|
5000
|
|
select count(*) from t3;
|
|
count(*)
|
|
5000
|
|
truncate table t1;
|
|
select count(*) from t1;
|
|
count(*)
|
|
0
|
|
select count(*) from t2;
|
|
count(*)
|
|
5000
|
|
select count(*) from t3;
|
|
count(*)
|
|
5000
|
|
call populate_small();
|
|
select count(*) from t1;
|
|
count(*)
|
|
2000
|
|
select count(*) from t2;
|
|
count(*)
|
|
7000
|
|
select count(*) from t3;
|
|
count(*)
|
|
7000
|
|
truncate table t2;
|
|
truncate table t3;
|
|
select count(*) from t1;
|
|
count(*)
|
|
2000
|
|
select count(*) from t2;
|
|
count(*)
|
|
0
|
|
select count(*) from t3;
|
|
count(*)
|
|
0
|
|
call populate_small();
|
|
select count(*) from t1;
|
|
count(*)
|
|
4000
|
|
select count(*) from t2;
|
|
count(*)
|
|
2000
|
|
select count(*) from t3;
|
|
count(*)
|
|
2000
|
|
drop table t1;
|
|
drop table t2;
|
|
drop table t3;
|
|
drop procedure populate;
|
|
drop procedure populate_small;
|
|
set global innodb_file_format = Barracuda;
|
|
Warnings:
|
|
Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See https://mariadb.com/kb/en/library/xtradbinnodb-file-format/
|
|
set global innodb_file_per_table = 1;
|
|
set innodb_strict_mode=OFF;
|
|
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|
|
|
set global innodb_file_per_table = 0;
|
|
create table tNUMBER
|
|
(i int, cNUMBER char(NUMBER), cNUMBER char(NUMBER),
|
|
index cNUMBER_idx(cNUMBER))
|
|
engine=innodb row_format=compact
|
|
key_block_size=NUMBER;
|
|
Warnings:
|
|
Warning NUMBER InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
|
|
Warning NUMBER InnoDB: ignoring KEY_BLOCK_SIZE=NUMBER.
|
|
create table t2
|
|
(i int, c1 char(100), c2 char(100),
|
|
index c1_idx(c1))
|
|
engine=innodb row_format=compact
|
|
key_block_size=16;
|
|
Warnings:
|
|
Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
|
|
Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=16.
|
|
create temporary table t3
|
|
(i int, c1 char(100), c2 char(100),
|
|
index c1_idx(c1))
|
|
engine=innodb row_format=compact
|
|
key_block_size=16;
|
|
Warnings:
|
|
Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE.
|
|
Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=16.
|
|
select count(*) from t1;
|
|
count(*)
|
|
0
|
|
select count(*) from t2;
|
|
count(*)
|
|
0
|
|
select count(*) from t3;
|
|
count(*)
|
|
0
|
|
begin;
|
|
call populate();
|
|
commit;
|
|
select count(*) from t1;
|
|
count(*)
|
|
5000
|
|
select count(*) from t2;
|
|
count(*)
|
|
5000
|
|
select count(*) from t3;
|
|
count(*)
|
|
5000
|
|
truncate table t1;
|
|
select count(*) from t1;
|
|
count(*)
|
|
0
|
|
select count(*) from t2;
|
|
count(*)
|
|
5000
|
|
select count(*) from t3;
|
|
count(*)
|
|
5000
|
|
call populate_small();
|
|
select count(*) from t1;
|
|
count(*)
|
|
2000
|
|
select count(*) from t2;
|
|
count(*)
|
|
7000
|
|
select count(*) from t3;
|
|
count(*)
|
|
7000
|
|
truncate table t2;
|
|
truncate table t3;
|
|
select count(*) from t1;
|
|
count(*)
|
|
2000
|
|
select count(*) from t2;
|
|
count(*)
|
|
0
|
|
select count(*) from t3;
|
|
count(*)
|
|
0
|
|
call populate_small();
|
|
select count(*) from t1;
|
|
count(*)
|
|
4000
|
|
select count(*) from t2;
|
|
count(*)
|
|
2000
|
|
select count(*) from t3;
|
|
count(*)
|
|
2000
|
|
drop table t1;
|
|
drop table t2;
|
|
drop table t3;
|
|
drop procedure populate;
|
|
drop procedure populate_small;
|
|
set global innodb_file_format = Barracuda;
|
|
Warnings:
|
|
Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See https://mariadb.com/kb/en/library/xtradbinnodb-file-format/
|
|
set global innodb_file_per_table = 1;
|