72 lines
1.8 KiB
Plaintext
72 lines
1.8 KiB
Plaintext
#
|
|
# WL#6965: Truncate UNDO logs.
|
|
#
|
|
SHOW VARIABLES LIKE 'innodb_rollback_segments';
|
|
Variable_name Value
|
|
innodb_rollback_segments 1
|
|
SELECT NAME, SPACE_TYPE, STATE FROM INFORMATION_SCHEMA.INNODB_TABLESPACES
|
|
WHERE SPACE_TYPE = 'Undo' ORDER BY NAME;
|
|
NAME SPACE_TYPE STATE
|
|
innodb_undo_001 Undo active
|
|
innodb_undo_002 Undo active
|
|
SET GLOBAL innodb_purge_stop_now=ON;
|
|
create table t1(
|
|
keyc int,
|
|
c1 char(255),
|
|
c2 char(255),
|
|
c3 char(255),
|
|
c4 char(255),
|
|
c5 char(255),
|
|
c6 char(255),
|
|
primary key(keyc)) engine = innodb;
|
|
CREATE PROCEDURE populate_t1()
|
|
BEGIN
|
|
DECLARE i INT DEFAULT 1;
|
|
while (i <= 20000) DO
|
|
insert into t1 values (i, 'a', 'b', 'c', 'd', 'e', 'f' );
|
|
SET i = i + 1;
|
|
END WHILE;
|
|
END |
|
|
call populate_t1();
|
|
delete from t1 where keyc < 10000;
|
|
update t1 set c1 = 'mysql' where keyc > 10000;
|
|
update t1 set c2 = 'mysql' where keyc > 10000;
|
|
update t1 set c3= 'mysql' where keyc > 10000;
|
|
update t1 set c4= 'mysql' where keyc > 10000;
|
|
update t1 set c5= 'mysql' where keyc > 10000;
|
|
update t1 set c6= 'mysql' where keyc > 10000;
|
|
create table t2 (
|
|
keyc int,
|
|
c1 char(255),
|
|
c2 char(255),
|
|
c3 char(255),
|
|
c4 char(255),
|
|
c5 char(255),
|
|
c6 char(255),
|
|
primary key(keyc)) engine = innodb;
|
|
CREATE PROCEDURE populate_t2()
|
|
BEGIN
|
|
DECLARE i INT DEFAULT 1;
|
|
while (i <= 20000) DO
|
|
insert into t2 values (i, 'a', 'b', 'c', 'd', 'e', 'f' );
|
|
SET i = i + 1;
|
|
END WHILE;
|
|
END |
|
|
call populate_t2();
|
|
delete from t2 where keyc < 10000;
|
|
update t2 set c1 = 'mysql' where keyc > 10000;
|
|
update t2 set c2 = 'mysql' where keyc > 10000;
|
|
update t2 set c3= 'mysql' where keyc > 10000;
|
|
update t2 set c4= 'mysql' where keyc > 10000;
|
|
update t2 set c5= 'mysql' where keyc > 10000;
|
|
update t2 set c6= 'mysql' where keyc > 10000;
|
|
drop PROCEDURE populate_t1;
|
|
drop PROCEDURE populate_t2;
|
|
drop table t1, t2;
|
|
SET GLOBAL innodb_purge_run_now=ON;
|
|
SET GLOBAL innodb_fast_shutdown=0;
|
|
#
|
|
# Cleanup
|
|
#
|
|
# restart
|