mirror of
https://github.com/MariaDB/server.git
synced 2025-01-31 02:51:44 +01:00
5a1868b58d
This is a merge from 10.2, but the 10.2 version of this will not be pushed into 10.2 yet, because the 10.2 version would include backports of MDEV-14717 and MDEV-14585, which would introduce a crash recovery regression: Tables could be lost on table-rebuilding DDL operations, such as ALTER TABLE, OPTIMIZE TABLE or this new backup-friendly TRUNCATE TABLE. The test innodb.truncate_crash occasionally loses the table due to the following bug: MDEV-17158 log_write_up_to() sometimes fails
60 lines
1.6 KiB
Text
60 lines
1.6 KiB
Text
SET @save_undo_logs = @@GLOBAL.innodb_undo_logs;
|
|
SET @save_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
|
|
SET @save_truncate = @@GLOBAL.innodb_undo_log_truncate;
|
|
SET GLOBAL innodb_undo_log_truncate = 0;
|
|
SET GLOBAL innodb_undo_logs = 4;
|
|
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
|
|
SET @trunc_start=
|
|
(SELECT variable_value FROM information_schema.global_status
|
|
WHERE variable_name = 'innodb_undo_truncations');
|
|
create table t1(keyc int primary key, c char(100)) engine = innodb;
|
|
create table t2(keyc int primary key, c char(100)) engine = innodb;
|
|
CREATE PROCEDURE populate_t1()
|
|
BEGIN
|
|
DECLARE i INT DEFAULT 1;
|
|
while (i <= 20000) DO
|
|
insert into t1 values (i, 'a');
|
|
SET i = i + 1;
|
|
END WHILE;
|
|
END |
|
|
CREATE PROCEDURE populate_t2()
|
|
BEGIN
|
|
DECLARE i INT DEFAULT 1;
|
|
while (i <= 20000) DO
|
|
insert into t2 values (i, 'a');
|
|
SET i = i + 1;
|
|
END WHILE;
|
|
END |
|
|
connect con1,localhost,root,,;
|
|
begin;
|
|
call populate_t1();
|
|
connect con2,localhost,root,,;
|
|
begin;
|
|
call populate_t2();
|
|
connection con1;
|
|
update t1 set c = 'mysql';
|
|
connection con2;
|
|
update t2 set c = 'mysql';
|
|
connection con1;
|
|
update t1 set c = 'oracle';
|
|
connection con2;
|
|
update t2 set c = 'oracle';
|
|
connection con1;
|
|
delete from t1;
|
|
connection con2;
|
|
delete from t2;
|
|
connection con1;
|
|
SET GLOBAL innodb_undo_log_truncate = 1;
|
|
commit;
|
|
disconnect con1;
|
|
connection con2;
|
|
commit;
|
|
disconnect con2;
|
|
connection default;
|
|
drop table t1, t2;
|
|
drop PROCEDURE populate_t1;
|
|
drop PROCEDURE populate_t2;
|
|
InnoDB 0 transactions not purged
|
|
SET GLOBAL innodb_undo_logs = @save_undo_logs;
|
|
SET GLOBAL innodb_purge_rseg_truncate_frequency = @save_frequency;
|
|
SET GLOBAL innodb_undo_log_truncate = @save_truncate;
|