Commit 67fa97dc authored by Marko Mäkelä's avatar Marko Mäkelä

Merge 10.3 into 10.4

parents 1bf3e8ab 6b61f1bb
......@@ -4080,9 +4080,6 @@ xtrabackup_backup_func()
goto log_fail;
}
ut_ad(log_sys.log.format == LOG_HEADER_FORMAT_10_3
|| log_sys.log.format == LOG_HEADER_FORMAT_ENC_10_4);
const byte* buf = log_sys.checkpoint_buf;
reread_log_header:
......@@ -4099,9 +4096,6 @@ xtrabackup_backup_func()
goto old_format;
}
ut_ad(log_sys.log.format == LOG_HEADER_FORMAT_10_3
|| log_sys.log.format == LOG_HEADER_FORMAT_ENC_10_4);
log_header_read(max_cp_field);
if (checkpoint_no_start != mach_read_from_8(buf + LOG_CHECKPOINT_NO)) {
......@@ -4129,6 +4123,7 @@ xtrabackup_backup_func()
byte MY_ALIGNED(OS_FILE_LOG_BLOCK_SIZE) log_hdr[OS_FILE_LOG_BLOCK_SIZE];
memset(log_hdr, 0, sizeof log_hdr);
mach_write_to_4(LOG_HEADER_FORMAT + log_hdr, log_sys.log.format);
mach_write_to_4(LOG_HEADER_SUBFORMAT + log_hdr, log_sys.log.subformat);
mach_write_to_8(LOG_HEADER_START_LSN + log_hdr, checkpoint_lsn_start);
strcpy(reinterpret_cast<char*>(LOG_HEADER_CREATOR + log_hdr),
"Backup " MYSQL_SERVER_VERSION);
......
......@@ -30,9 +30,9 @@
#define EVP_CIPHER_CTX_SIZE 176
#define EVP_MD_CTX_SIZE 48
#undef EVP_MD_CTX_init
#define EVP_MD_CTX_init(X) do { bzero((X), EVP_MD_CTX_SIZE); EVP_MD_CTX_reset(X); } while(0)
#define EVP_MD_CTX_init(X) do { memset((X), 0, EVP_MD_CTX_SIZE); EVP_MD_CTX_reset(X); } while(0)
#undef EVP_CIPHER_CTX_init
#define EVP_CIPHER_CTX_init(X) do { bzero((X), EVP_CIPHER_CTX_SIZE); EVP_CIPHER_CTX_reset(X); } while(0)
#define EVP_CIPHER_CTX_init(X) do { memset((X), 0, EVP_CIPHER_CTX_SIZE); EVP_CIPHER_CTX_reset(X); } while(0)
/*
Macros below are deprecated. OpenSSL 1.1 may define them or not,
......
Subproject commit b948553b3464d37240c4d129fae47ce147e6dabc
Subproject commit 17d0e5317604718fc059ee1ad4bd2ea36494226b
......@@ -191,22 +191,18 @@ connection default;
COMMIT;
connect truncate,localhost,root,,;
REPLACE INTO t1(pk, y) SELECT pk,y FROM t1;
SET DEBUG_SYNC='row_trunc_before_dict_lock SIGNAL commit WAIT_FOR release';
TRUNCATE TABLE t1;
connection prevent_purge;
SET DEBUG_SYNC='now WAIT_FOR commit';
COMMIT;
SET DEBUG_SYNC='now SIGNAL purge_start';
disconnect prevent_purge;
connection default;
SET DEBUG_SYNC='now WAIT_FOR purge_start';
InnoDB 2 transactions not purged
SET DEBUG_SYNC='now SIGNAL release';
InnoDB 0 transactions not purged
SET GLOBAL debug_dbug=@old_dbug;
connection truncate;
disconnect truncate;
connection default;
InnoDB 0 transactions not purged
DROP TABLE t1, t2;
set debug_sync=reset;
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
......@@ -240,21 +240,16 @@ COMMIT;
connect(truncate,localhost,root,,);
REPLACE INTO t1(pk, y) SELECT pk,y FROM t1;
SET DEBUG_SYNC='row_trunc_before_dict_lock SIGNAL commit WAIT_FOR release';
send TRUNCATE TABLE t1;
connection prevent_purge;
SET DEBUG_SYNC='now WAIT_FOR commit';
COMMIT;
SET DEBUG_SYNC='now SIGNAL purge_start';
disconnect prevent_purge;
connection default;
SET DEBUG_SYNC='now WAIT_FOR purge_start';
let $wait_all_purged=2;
--source ../../innodb/include/wait_all_purged.inc
let $wait_all_purged=0;
SET DEBUG_SYNC='now SIGNAL release';
SET GLOBAL debug_dbug=@old_dbug;
connection truncate;
......@@ -262,7 +257,6 @@ reap;
disconnect truncate;
connection default;
--source ../../innodb/include/wait_all_purged.inc
DROP TABLE t1, t2;
--source include/wait_until_count_sessions.inc
......
#
# WL#6501: make truncate table atomic
#
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/big_test.inc
# Valgrind would complain about memory leaks when we crash on purpose.
--source include/not_valgrind.inc
# Embedded server does not support crashing
--source include/not_embedded.inc
# Avoid CrashReporter popup on Mac
--source include/not_crashrep.inc
# suppress expected warnings
call mtr.add_suppression("does not exist in the InnoDB internal");
################################################################################
#
# Will test following scenarios:
# 1. Hit crash point on completing drop of all indexes before creation of index
# is commenced.
# 2. Hit crash point after data is updated to system-table and in-memory dict.
#
################################################################################
#-----------------------------------------------------------------------------
#
# create test-bed
#
let $per_table = `select @@innodb_file_per_table`;
eval set global innodb_file_per_table = on;
let $WL6501_TMP_DIR = `select @@tmpdir`;
let $WL6501_DATA_DIR = `select @@datadir`;
let SEARCH_FILE = $MYSQLTEST_VARDIR/log/my_restart.err;
#-----------------------------------------------------------------------------
#
# 1. Hit crash point on completing drop of all indexes before creation of index
# is commenced.
#
--echo "1. Hit crash point on completing drop of all indexes before creation"
--echo " of index is commenced."
eval set global innodb_file_per_table = $wl6501_file_per_table;
set innodb_strict_mode=off;
--disable_warnings
eval create $wl6501_temp table t (
i int, f float, c char,
primary key pk(i), unique findex(f), index ck(c))
engine = innodb row_format = $wl6501_row_fmt
key_block_size = $wl6501_kbs;
--enable_warnings
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
select * from t;
check table t;
#
set session debug = "+d,ib_trunc_crash_drop_reinit_done_create_to_start";
--source include/expect_crash.inc
--error 2013
truncate table t;
#
--source include/start_mysqld.inc
check table t;
#-----------------------------------------------------------------------------
#
# 2. Hit crash point after data is updated to system-table and in-memory dict.
#
--echo "2. Hit crash point after data is updated to system-table and"
--echo " in-memory dict."
eval set global innodb_file_per_table = $wl6501_file_per_table;
set innodb_strict_mode=off;
--disable_warnings
eval create $wl6501_temp table t (
i int, f float, c char,
primary key pk(i), unique findex(f), index ck(c))
engine = innodb row_format = $wl6501_row_fmt
key_block_size = $wl6501_kbs;
--enable_warnings
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
select * from t;
check table t;
#
set session debug = "+d,ib_trunc_crash_on_updating_dict_sys_info";
--source include/expect_crash.inc
--error 2013
truncate table t;
#
--source include/start_mysqld.inc
check table t;
#-----------------------------------------------------------------------------
#
# remove test-bed
#
eval set global innodb_file_per_table = $per_table;
CREATE TABLE t (a SERIAL) ENGINE=InnoDB;
connect dml,localhost,root;
select * from t;
a
connection default;
TRUNCATE TABLE t;
disconnect dml;
DROP TABLE t;
FLUSH TABLES;
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1),(2);
connect wait,localhost,root,,test;
SET DEBUG_SYNC='before_trx_state_committed_in_memory SIGNAL c WAIT_FOR ever';
TRUNCATE TABLE t1;
connection default;
SET DEBUG_SYNC='now WAIT_FOR c';
disconnect wait;
SELECT COUNT(*) FROM t1;
COUNT(*)
0
TRUNCATE TABLE t1;
DROP TABLE t1;
#
# Bug #23070734 CONCURRENT TRUNCATE TABLES CAUSE STALLS
#
SET @ahi= @@global.innodb_adaptive_hash_index;
SET GLOBAL innodb_adaptive_hash_index=OFF;
SET GLOBAL innodb_adaptive_hash_index=ON;
Test_1 :- Check if DDL operations are possible on
table being truncated. Also check if
DDL operations on other tables succeed.
create table t1 (f1 int,f2 int,key(f2),f3 int) engine=innodb row_format=redundant;
create index idx1 on t1(f3);
create table t2 (f1 int,f2 int,key(f2),f3 int) engine=innodb row_format=redundant;
create table t3 (f1 int,f2 int,key(f2)) engine=innodb row_format=redundant;
insert into t1 values (10,20,30),(30,40,50),(50,60,70);
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t2 values (10,20,30),(30,40,50),(50,60,70);
insert into t2 select * from t2;
insert into t2 select * from t2;
insert into t2 select * from t2;
insert into t3 values (10,20),(30,40),(50,50);
insert into t3 select * from t3;
insert into t3 select * from t3;
SET session lock_wait_timeout = 1;
connect con1,localhost,root,,;
SET DEBUG_SYNC= 'buffer_pool_scan SIGNAL started WAIT_FOR finish_scan';
truncate table t1;
connection default;
SET DEBUG_SYNC= 'now WAIT_FOR started';
Check Analyze table. Gives lock time out error.
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze Error Lock wait timeout exceeded; try restarting transaction
test.t1 analyze status Operation failed
Check if we can turn off auto recalculation.
alter table t1 STATS_AUTO_RECALC=0;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
Check if we can turn off persistent stats on the table
alter table t1 STATS_PERSISTENT=0;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
Check if DML is possible on table being truncated
insert into t1 values (10,89,99);
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
Check if DDL is possible on table being truncated
alter table t1 add column f4 int;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
check if table can be created with the same name
create table t1 (bd int) engine=innodb;
Got one of the listed errors
check if index can be created on table being truncated
create index idx1 on t1(f1);
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
Check if DROP of table is possible during truncate
drop table t1;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
Check if select is possible during truncate
select * from t1;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t2 where t2.f1=t1.f1;
ERROR 42S22: Unknown column 't1.f1' in 'where clause'
Check concurrent truncate operation on table;
truncate table t1;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
Check concurrent selects and inserts on the other table
insert into t3 values (10,20),(30,40),(50,50);
select * from t3 where f1=40;
f1 f2
Concurrent truncate on other tables
truncate table t2;
Concurrent alters on the other tables
alter table t2 add column f4 int;
check if index can be created on the other table
create index idx1 on t2(f3);
Check if we can turn off persistent stats off entire instance
SET GLOBAL innodb_stats_persistent=off;
connect con2,localhost,root,,;
set global innodb_adaptive_hash_index=off;
connection default;
SET DEBUG_SYNC= 'now SIGNAL finish_scan';
connection con1;
disconnect con1;
connection con2;
disconnect con2;
connection default;
SET DEBUG_SYNC= 'RESET';
SET GLOBAL innodb_adaptive_hash_index=@ahi;
drop table t1,t2,t3;
CREATE TABLE parent (a INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO parent SET a=1;
CREATE TABLE child (a INT PRIMARY KEY, FOREIGN KEY (a) REFERENCES parent(a)
ON UPDATE CASCADE)
ENGINE=InnoDB;
INSERT INTO child SET a=1;
TRUNCATE TABLE parent;
ERROR 42000: Cannot truncate a table referenced in a foreign key constraint (`test`.`child`, CONSTRAINT `child_ibfk_1` FOREIGN KEY (`a`) REFERENCES `test`.`parent` (`a`))
TRUNCATE TABLE child;
INSERT INTO child SET a=1;
UPDATE parent SET a=2;
SELECT * FROM child;
a
2
connect dml,localhost,root;
SET DEBUG_SYNC='foreign_constraint_update_cascade SIGNAL fk WAIT_FOR go';
UPDATE parent SET a=3;
connection default;
SET DEBUG_SYNC='now WAIT_FOR fk';
SET lock_wait_timeout=1;
TRUNCATE TABLE child;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
SET DEBUG_SYNC='now SIGNAL go';
connection dml;
SELECT * FROM child;
a
3
SET DEBUG_SYNC='foreign_constraint_check_for_update SIGNAL fk WAIT_FOR go';
DELETE FROM parent;
connection default;
SET DEBUG_SYNC='now WAIT_FOR fk';
TRUNCATE TABLE child;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
SET DEBUG_SYNC='now SIGNAL go';
connection dml;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `child_ibfk_1` FOREIGN KEY (`a`) REFERENCES `parent` (`a`) ON UPDATE CASCADE)
SELECT * FROM child;
a
3
INSERT INTO parent SET a=5;
SET DEBUG_SYNC='foreign_constraint_check_for_ins SIGNAL fk WAIT_FOR go';
INSERT INTO child SET a=5;
connection default;
SET DEBUG_SYNC='now WAIT_FOR fk';
SET foreign_key_checks=0;
TRUNCATE TABLE parent;
SET DEBUG_SYNC='now SIGNAL go';
connection dml;
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `child_ibfk_1` FOREIGN KEY (`a`) REFERENCES `parent` (`a`) ON UPDATE CASCADE)
SELECT * FROM parent;
a
SELECT * FROM child;
a
3
disconnect dml;
connection default;
SET DEBUG_SYNC = RESET;
DROP TABLE child, parent;
SET @save_dbug = @@SESSION.debug_dbug;
call mtr.add_suppression("InnoDB: Flagged corruption of .* in table `test`\\.`t` in TRUNCATE TABLE");
# 1. Error in assigning undo logs for truncate action
CREATE TABLE t (i int PRIMARY KEY, f float UNIQUE, c char(100), INDEX ck(c))
ENGINE = InnoDB;
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
check table t;
Table Op Msg_type Msg_text
test.t check status OK
SET debug_dbug = '+d,ib_err_trunc_assigning_undo_log';
truncate table t;
ERROR HY000: Got error 168 "Unknown (generic) error from engine" from storage engine InnoDB
SET debug_dbug = @save_dbug;
check table t;
Table Op Msg_type Msg_text
test.t check status OK
select * from t;
i f c
1 1.1 a
2 2.2 b
3 3.3 c
# 2. Error while preparing for truncate
SET debug_dbug = '+d,ib_err_trunc_preparing_for_truncate';
truncate table t;
ERROR HY000: Got error 168 "Unknown (generic) error from engine" from storage engine InnoDB
SET debug_dbug = @save_dbug;
check table t;
Table Op Msg_type Msg_text
test.t check status OK
select * from t;
i f c
1 1.1 a
2 2.2 b
3 3.3 c
# 3. Error while dropping/creating indexes
SET debug_dbug = '+d,ib_err_trunc_drop_index';
truncate table t;
ERROR HY000: Got error 168 "Unknown (generic) error from engine" from storage engine InnoDB
SET debug_dbug = @save_dbug;
check table t;
Table Op Msg_type Msg_text
test.t check Warning InnoDB: Index PRIMARY is marked as corrupted
test.t check error Corrupt
select * from t;
Got one of the listed errors
drop table t;
CREATE TABLE t (i int PRIMARY KEY, f float UNIQUE, c char(100), INDEX ck(c))
ENGINE = InnoDB;
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
check table t;
Table Op Msg_type Msg_text
test.t check status OK
SET debug_dbug = '+d,ib_err_trunc_create_index';
truncate table t;
ERROR HY000: Got error 168 "Unknown (generic) error from engine" from storage engine InnoDB
SET debug_dbug = @save_dbug;
check table t;
Table Op Msg_type Msg_text
test.t check Warning InnoDB: Index PRIMARY is marked as corrupted
test.t check error Corrupt
select * from t;
Got one of the listed errors
drop table t;
CREATE TABLE t (i int PRIMARY KEY, f float UNIQUE, c char(100), INDEX ck(c))
ENGINE = InnoDB;
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
check table t;
Table Op Msg_type Msg_text
test.t check status OK
SET debug_dbug = '+d,ib_err_trunc_temp_recreate_index';
truncate table t;
SET debug_dbug = @save_dbug;
check table t;
Table Op Msg_type Msg_text
test.t check status OK
select * from t;
i f c
drop table t;
# 4. Error while completing truncate of table involving FTS
CREATE TABLE t (i int PRIMARY KEY, f float UNIQUE, c char(100),
FULLTEXT INDEX(c)) ENGINE = InnoDB;
insert into t values (1, 1.1, 'mysql is now oracle company'),
(2, 2.2, 'innodb is part of mysql'),
(3, 3.3, 'innodb is default storage engine of mysql');
check table t;
Table Op Msg_type Msg_text
test.t check status OK
SET debug_dbug = '+d,ib_err_trunc_temp_recreate_index';
truncate table t;
SET debug_dbug = @save_dbug;
check table t;
Table Op Msg_type Msg_text
test.t check status OK
select * from t;
i f c
drop table t;
# 5. Error while updating sys-tables
CREATE TABLE t (i int PRIMARY KEY, f float UNIQUE, c char(100),
FULLTEXT INDEX(c)) ENGINE = InnoDB;
insert into t values (1, 1.1, 'mysql is now oracle company'),
(2, 2.2, 'innodb is part of mysql'),
(3, 3.3, 'innodb is default storage engine of mysql');
check table t;
Table Op Msg_type Msg_text
test.t check status OK
SET debug_dbug = '+d,ib_err_trunc_temp_recreate_index';
truncate table t;
SET debug_dbug = @save_dbug;
check table t;
Table Op Msg_type Msg_text
test.t check status OK
select * from t order by i;
i f c
drop table t;
call mtr.add_suppression("InnoDB: Operating system error number ");
call mtr.add_suppression("InnoDB: (The error means|If you are|Cannot open datafile) ");
call mtr.add_suppression("InnoDB: Ignoring tablespace for `test`\.`t`");
call mtr.add_suppression("InnoDB: Table test/t .* does not exist");
CREATE TABLE t (a SERIAL) ENGINE=InnoDB;
INSERT INTO t() VALUES();
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
`a` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
UNIQUE KEY `a` (`a`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
SELECT * FROM t;
ERROR 42S02: Table 'test.t' doesn't exist in engine
TRUNCATE TABLE t;
ERROR 42S02: Table 'test.t' doesn't exist in engine
DROP TABLE t;
#
# Bug #23070734 CONCURRENT TRUNCATE TABLES CAUSE STALLS
#
create table t1 (f1 int ,f2 int,key(f2)) engine=innodb;
begin;
insert into t1 values (10,45),(20,78),(30,88),(40,23),(50,78),(60,11),(70,56),(80,90);
delete from t1;
connect con2,localhost,root,,;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
connection default;
SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
commit;
connect con1,localhost,root,,;
SET DEBUG_SYNC= 'buffer_pool_scan SIGNAL started WAIT_FOR finish_scan';
truncate table t1;
connection con2;
SET DEBUG_SYNC= 'now WAIT_FOR started';
COMMIT;
disconnect con2;
connection default;
InnoDB 0 transactions not purged
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
SET DEBUG_SYNC = 'now SIGNAL finish_scan';
connection con1;
disconnect con1;
connection default;
SET DEBUG_SYNC = 'RESET';
drop table t1;
SET GLOBAL innodb_stats_persistent= ON;
CREATE TABLE t1 (t TEXT) ENGINE=InnoDB STATS_PERSISTENT=1;
connect con1,localhost,root,,test;
SET DEBUG_SYNC='ib_trunc_table_trunc_completing SIGNAL committed WAIT_FOR ever';
TRUNCATE TABLE t1;
connection default;
SET DEBUG_SYNC='now WAIT_FOR committed';
disconnect con1;
SELECT COUNT(*) FROM t1;
COUNT(*)
0
DROP TABLE t1;
SET GLOBAL innodb_fast_shutdown=0;
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()
......@@ -36,6 +44,7 @@ delete from t1;
connection con2;
delete from t2;
connection con1;
SET GLOBAL innodb_undo_log_truncate = 1;
commit;
disconnect con1;
connection con2;
......@@ -45,7 +54,7 @@ connection default;
drop table t1, t2;
drop PROCEDURE populate_t1;
drop PROCEDURE populate_t2;
SET GLOBAL innodb_fast_shutdown=0;
SET GLOBAL innodb_undo_log_truncate=1;
SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
FOUND 1 /Truncating UNDO tablespace 1/ in mysqld.1.err
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;
SET GLOBAL innodb_undo_logs = 4;
SET GLOBAL innodb_undo_log_truncate = 1;
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
create table t1(keyc int primary key, c char(100)) engine = innodb;
begin;
commit;
begin;
update t1 set c = 'MariaDB';
update t1 set c = 'InnoDB';
set global debug_dbug = '+d,ib_undo_trunc_before_truncate';
set global debug_dbug = '+d,ib_undo_trunc';
commit;
FOUND 1 /ib_undo_trunc_before_truncate/ in mysqld.1.err
begin;
update t1 set c = 'MariaDB';
update t1 set c = 'InnoDB';
set global debug_dbug = '+d,ib_undo_trunc_before_ddl_log_end';
commit;
FOUND 1 /ib_undo_trunc_before_ddl_log_end/ in mysqld.1.err
call mtr.add_suppression("InnoDB: The redo log transaction size ");
SET GLOBAL innodb_fast_shutdown=0;
FOUND 1 /ib_undo_trunc/ in mysqld.1.err
drop table t1;
--source include/have_innodb.inc
CREATE TABLE t (a SERIAL) ENGINE=InnoDB;
connect (dml,localhost,root);
# At the end of this statement, close_thread_tables()
# should add the open table handle to the table definition cache (tdc).
select * from t;
connection default;
# This should purge the handle from the tdc;
# otherwise ha_innobase::truncate() would hang,
# waiting for the reference count to drop to 0.
TRUNCATE TABLE t;
disconnect dml;
DROP TABLE t;
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
--source include/not_embedded.inc
SET GLOBAL innodb_stats_persistent= ON;
CREATE TABLE t1 (t TEXT) ENGINE=InnoDB STATS_PERSISTENT=1;
--connect (con1,localhost,root,,test)
SET DEBUG_SYNC='ib_trunc_table_trunc_completing SIGNAL committed WAIT_FOR ever';
--send
TRUNCATE TABLE t1;
--connection default
SET DEBUG_SYNC='now WAIT_FOR committed';
FLUSH TABLES;
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1),(2);
connect (wait,localhost,root,,test);
SET DEBUG_SYNC='before_trx_state_committed_in_memory SIGNAL c WAIT_FOR ever';
send TRUNCATE TABLE t1;
connection default;
SET DEBUG_SYNC='now WAIT_FOR c';
--let $shutdown_timeout=0
--source include/restart_mysqld.inc
--disconnect con1
disconnect wait;
--replace_result 2 0
SELECT COUNT(*) FROM t1;
TRUNCATE TABLE t1;
DROP TABLE t1;
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
--source include/count_sessions.inc
--echo #
--echo # Bug #23070734 CONCURRENT TRUNCATE TABLES CAUSE STALLS
--echo #
SET @ahi= @@global.innodb_adaptive_hash_index;
# Ensure that there is no adaptive hash index on any system tables,
# or any other tables than the ones that we are creating below.
SET GLOBAL innodb_adaptive_hash_index=OFF;
SET GLOBAL innodb_adaptive_hash_index=ON;
--echo Test_1 :- Check if DDL operations are possible on
--echo table being truncated. Also check if
--echo DDL operations on other tables succeed.
create table t1 (f1 int,f2 int,key(f2),f3 int) engine=innodb row_format=redundant;
create index idx1 on t1(f3);
create table t2 (f1 int,f2 int,key(f2),f3 int) engine=innodb row_format=redundant;
create table t3 (f1 int,f2 int,key(f2)) engine=innodb row_format=redundant;
insert into t1 values (10,20,30),(30,40,50),(50,60,70);
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t2 values (10,20,30),(30,40,50),(50,60,70);
insert into t2 select * from t2;
insert into t2 select * from t2;
insert into t2 select * from t2;
insert into t3 values (10,20),(30,40),(50,50);
insert into t3 select * from t3;
insert into t3 select * from t3;
SET session lock_wait_timeout = 1;
connect (con1,localhost,root,,);
SET DEBUG_SYNC= 'buffer_pool_scan SIGNAL started WAIT_FOR finish_scan';
send truncate table t1;
connection default;
SET DEBUG_SYNC= 'now WAIT_FOR started';
--echo Check Analyze table. Gives lock time out error.
analyze table t1;
--echo Check if we can turn off auto recalculation.
--error ER_LOCK_WAIT_TIMEOUT
alter table t1 STATS_AUTO_RECALC=0;
--echo Check if we can turn off persistent stats on the table
--error ER_LOCK_WAIT_TIMEOUT
alter table t1 STATS_PERSISTENT=0;
--echo Check if DML is possible on table being truncated
--error ER_LOCK_WAIT_TIMEOUT
insert into t1 values (10,89,99);
--echo Check if DDL is possible on table being truncated
--error ER_LOCK_WAIT_TIMEOUT
alter table t1 add column f4 int;
--echo check if table can be created with the same name
--error ER_TABLE_EXISTS_ERROR,ER_LOCK_WAIT_TIMEOUT
create table t1 (bd int) engine=innodb;
--echo check if index can be created on table being truncated
--error ER_LOCK_WAIT_TIMEOUT
create index idx1 on t1(f1);
--echo Check if DROP of table is possible during truncate
--error ER_LOCK_WAIT_TIMEOUT
drop table t1;
--echo Check if select is possible during truncate
--error ER_LOCK_WAIT_TIMEOUT
select * from t1;
--error ER_BAD_FIELD_ERROR
select * from t2 where t2.f1=t1.f1;
--echo Check concurrent truncate operation on table;
--error ER_LOCK_WAIT_TIMEOUT
truncate table t1;
--echo Check concurrent selects and inserts on the other table
insert into t3 values (10,20),(30,40),(50,50);
select * from t3 where f1=40;
--echo Concurrent truncate on other tables
truncate table t2;
--echo Concurrent alters on the other tables
alter table t2 add column f4 int;
--echo check if index can be created on the other table
create index idx1 on t2(f3);
--echo Check if we can turn off persistent stats off entire instance
SET GLOBAL innodb_stats_persistent=off;
connect (con2,localhost,root,,);
send set global innodb_adaptive_hash_index=off;
connection default;
SET DEBUG_SYNC= 'now SIGNAL finish_scan';
connection con1;
reap;
disconnect con1;
connection con2;
reap;
disconnect con2;
connection default;
SET DEBUG_SYNC= 'RESET';
SET GLOBAL innodb_adaptive_hash_index=@ahi;
drop table t1,t2,t3;
--source include/wait_until_count_sessions.inc
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
CREATE TABLE parent (a INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO parent SET a=1;
CREATE TABLE child (a INT PRIMARY KEY, FOREIGN KEY (a) REFERENCES parent(a)
ON UPDATE CASCADE)
ENGINE=InnoDB;
INSERT INTO child SET a=1;
--error ER_TRUNCATE_ILLEGAL_FK
TRUNCATE TABLE parent;
TRUNCATE TABLE child;
INSERT INTO child SET a=1;
UPDATE parent SET a=2;
SELECT * FROM child;
connect (dml,localhost,root);
SET DEBUG_SYNC='foreign_constraint_update_cascade SIGNAL fk WAIT_FOR go';
send UPDATE parent SET a=3;
connection default;
SET DEBUG_SYNC='now WAIT_FOR fk';
SET lock_wait_timeout=1;
--error ER_LOCK_WAIT_TIMEOUT
TRUNCATE TABLE child;
SET DEBUG_SYNC='now SIGNAL go';
connection dml;
reap;
SELECT * FROM child;
SET DEBUG_SYNC='foreign_constraint_check_for_update SIGNAL fk WAIT_FOR go';
send DELETE FROM parent;
connection default;
SET DEBUG_SYNC='now WAIT_FOR fk';
--error ER_LOCK_WAIT_TIMEOUT
TRUNCATE TABLE child;
SET DEBUG_SYNC='now SIGNAL go';
connection dml;
--error ER_ROW_IS_REFERENCED_2
reap;
SELECT * FROM child;
INSERT INTO parent SET a=5;
SET DEBUG_SYNC='foreign_constraint_check_for_ins SIGNAL fk WAIT_FOR go';
send INSERT INTO child SET a=5;
connection default;
SET DEBUG_SYNC='now WAIT_FOR fk';
SET foreign_key_checks=0;
TRUNCATE TABLE parent;
SET DEBUG_SYNC='now SIGNAL go';
connection dml;
--error ER_NO_REFERENCED_ROW_2
reap;
SELECT * FROM parent;
SELECT * FROM child;
disconnect dml;
connection default;
SET DEBUG_SYNC = RESET;
DROP TABLE child, parent;
# This test is based on innodb_zip.wl6501_error_1 in MySQL 5.7.
--source include/have_innodb.inc
--source include/innodb_row_format.inc
--source include/have_debug.inc
SET @save_dbug = @@SESSION.debug_dbug;
call mtr.add_suppression("InnoDB: Flagged corruption of .* in table `test`\\.`t` in TRUNCATE TABLE");
--echo # 1. Error in assigning undo logs for truncate action
CREATE TABLE t (i int PRIMARY KEY, f float UNIQUE, c char(100), INDEX ck(c))
ENGINE = InnoDB;
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
check table t;
#
SET debug_dbug = '+d,ib_err_trunc_assigning_undo_log';
--error ER_GET_ERRNO
truncate table t;
SET debug_dbug = @save_dbug;
check table t;
select * from t;
--echo # 2. Error while preparing for truncate
SET debug_dbug = '+d,ib_err_trunc_preparing_for_truncate';
--error ER_GET_ERRNO
truncate table t;
SET debug_dbug = @save_dbug;
check table t;
select * from t;
--echo # 3. Error while dropping/creating indexes
SET debug_dbug = '+d,ib_err_trunc_drop_index';
--error ER_GET_ERRNO
truncate table t;
SET debug_dbug = @save_dbug;
check table t;
--error ER_TABLE_CORRUPT,ER_GET_ERRNO
select * from t;
drop table t;
CREATE TABLE t (i int PRIMARY KEY, f float UNIQUE, c char(100), INDEX ck(c))
ENGINE = InnoDB;
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
check table t;
SET debug_dbug = '+d,ib_err_trunc_create_index';
--error ER_GET_ERRNO
truncate table t;
SET debug_dbug = @save_dbug;
check table t;
--error ER_TABLE_CORRUPT,ER_GET_ERRNO
select * from t;
drop table t;
CREATE TABLE t (i int PRIMARY KEY, f float UNIQUE, c char(100), INDEX ck(c))
ENGINE = InnoDB;
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
check table t;
SET debug_dbug = '+d,ib_err_trunc_temp_recreate_index';
truncate table t;
SET debug_dbug = @save_dbug;
check table t;
select * from t;
drop table t;
--echo # 4. Error while completing truncate of table involving FTS
CREATE TABLE t (i int PRIMARY KEY, f float UNIQUE, c char(100),
FULLTEXT INDEX(c)) ENGINE = InnoDB;
insert into t values (1, 1.1, 'mysql is now oracle company'),
(2, 2.2, 'innodb is part of mysql'),
(3, 3.3, 'innodb is default storage engine of mysql');
check table t;
SET debug_dbug = '+d,ib_err_trunc_temp_recreate_index';
truncate table t;
SET debug_dbug = @save_dbug;
check table t;
select * from t;
drop table t;
--echo # 5. Error while updating sys-tables
CREATE TABLE t (i int PRIMARY KEY, f float UNIQUE, c char(100),
FULLTEXT INDEX(c)) ENGINE = InnoDB;
insert into t values (1, 1.1, 'mysql is now oracle company'),
(2, 2.2, 'innodb is part of mysql'),
(3, 3.3, 'innodb is default storage engine of mysql');
check table t;
SET debug_dbug = '+d,ib_err_trunc_temp_recreate_index';
truncate table t;
SET debug_dbug = @save_dbug;
check table t;
select * from t order by i;
drop table t;
--source include/have_innodb.inc
--source include/not_embedded.inc
call mtr.add_suppression("InnoDB: Operating system error number ");
call mtr.add_suppression("InnoDB: (The error means|If you are|Cannot open datafile) ");
call mtr.add_suppression("InnoDB: Ignoring tablespace for `test`\.`t`");
call mtr.add_suppression("InnoDB: Table test/t .* does not exist");
CREATE TABLE t (a SERIAL) ENGINE=InnoDB;
INSERT INTO t() VALUES();
SHOW CREATE TABLE t;
let $datadir=`select @@datadir`;
--source include/shutdown_mysqld.inc
--remove_file $datadir/test/t.ibd
--source include/start_mysqld.inc
--error ER_NO_SUCH_TABLE_IN_ENGINE
SELECT * FROM t;
--error ER_NO_SUCH_TABLE_IN_ENGINE
TRUNCATE TABLE t;
DROP TABLE t;
--innodb-purge-threads=1
--innodb-purge-batch-size=1
--innodb-stats-persistent=OFF
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
--source include/count_sessions.inc
--echo #
--echo # Bug #23070734 CONCURRENT TRUNCATE TABLES CAUSE STALLS
--echo #
create table t1 (f1 int ,f2 int,key(f2)) engine=innodb;
begin;
insert into t1 values (10,45),(20,78),(30,88),(40,23),(50,78),(60,11),(70,56),(80,90);
delete from t1;
connect (con2,localhost,root,,);
# Stop the purge thread
START TRANSACTION WITH CONSISTENT SNAPSHOT;
connection default;
# Ensure that the history list length will actually be decremented by purge.
SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
commit;
connect (con1,localhost,root,,);
SET DEBUG_SYNC= 'buffer_pool_scan SIGNAL started WAIT_FOR finish_scan';
send truncate table t1;
connection con2;
SET DEBUG_SYNC= 'now WAIT_FOR started';
# Allow purge to proceed, by discarding our read view.
COMMIT;
disconnect con2;
connection default;
--source include/wait_all_purged.inc
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
SET DEBUG_SYNC = 'now SIGNAL finish_scan';
connection con1;
reap;
disconnect con1;
connection default;
SET DEBUG_SYNC = 'RESET';
drop table t1;
--source include/wait_until_count_sessions.inc
#
# WL#6965: Truncate UNDO logs.
#
--source include/have_innodb.inc
# This test is restarting the server.
--source include/not_embedded.inc
# With larger innodb_page_size, the undo log tablespaces do not grow enough.
--source include/have_innodb_max_16k.inc
# With 32k, truncation could happen on shutdown after the test,
# and the mtr.add_suppression() would not filter out the warning.
# With 64k, no truncation seems to happen.
# --source include/innodb_page_size.inc
--source include/innodb_page_size_small.inc
--source include/have_undo_tablespaces.inc
SET GLOBAL innodb_fast_shutdown=0;
--let $restart_parameters=--innodb_undo_tablespaces=2 --innodb_undo_logs=4
--source include/restart_mysqld.inc
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');
#-----------------------------------------------------------------------------
#
......@@ -44,6 +48,7 @@ END |
delimiter ;|
#
#
let DATADIR = `select @@datadir`;
connect (con1,localhost,root,,);
begin;
send call populate_t1();
......@@ -57,21 +62,65 @@ connection con2; reap; send update t2 set c = 'mysql';
connection con1; reap; send update t1 set c = 'oracle';
connection con2; reap; send update t2 set c = 'oracle';
connection con1; reap; send delete from t1;
connection con2; reap; send delete from t2;
connection con1; reap; commit; disconnect con1;
connection con2; reap; commit; disconnect con2;
connection con2; reap; delete from t2;
connection con1; reap;
let CHECKFILE = $MYSQL_TMP_DIR/check.txt;
perl;
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size1)
= stat("$ENV{DATADIR}/undo001");
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size2)
= stat("$ENV{DATADIR}/undo002");
open(OUT, ">$ENV{CHECKFILE}") || die;
print OUT "let \$size1='$size1,$size2';\n";
close(OUT);
EOF
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;
SET GLOBAL innodb_fast_shutdown=0;
SET GLOBAL innodb_undo_log_truncate=1;
SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
--source include/wait_all_purged.inc
# Truncation will normally not occur with innodb_page_size=64k,
# and occasionally not with innodb_page_size=32k,
# because the undo log will not grow enough.
if (`select @@innodb_page_size IN (4096,8192,16384)`)
{
let $wait_condition = (SELECT variable_value!=@trunc_start
FROM information_schema.global_status
WHERE variable_name = 'innodb_undo_truncations');
source include/wait_condition.inc;
}
--source $CHECKFILE
perl;
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size1)
= stat("$ENV{DATADIR}/undo001");
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size2)
= stat("$ENV{DATADIR}/undo002");
open(OUT, ">$ENV{CHECKFILE}") || die;
print OUT "let \$size2='$size1,$size2';\n";
close(OUT);
EOF
--source $CHECKFILE
--remove_file $CHECKFILE
--source include/restart_mysqld.inc
if ($size1 == $size2)
{
# This fails for innodb_page_size=64k, occasionally also for 32k.
if (`select @@innodb_page_size IN (4096,8192,16384)`)
{
echo Truncation did not happen: $size1;
}
}
let SEARCH_FILE = $MYSQLTEST_VARDIR/log/mysqld.1.err;
let SEARCH_PATTERN = Truncating UNDO tablespace 1;
--source include/search_pattern_in_file.inc
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;
......@@ -2,10 +2,10 @@
# WL#6965: Truncate UNDO logs.
#
# With larger innodb_page_size, the undo log tablespaces do not grow enough.
--source include/innodb_page_size_small.inc
--source include/have_innodb.inc
--source include/have_debug.inc
# With larger innodb_page_size, the undo log tablespaces do not grow enough.
--source include/have_innodb_max_16k.inc
--source include/have_undo_tablespaces.inc
# Valgrind would complain about memory leaks when we crash on purpose.
......@@ -15,15 +15,9 @@
# Avoid CrashReporter popup on Mac
--source include/not_crashrep.inc
--disable_query_log
# FIXME: The doublewrite buffer should not issue these warnings.
# FIXME: Maybe buf_dblwr_process() should empty the buffer at the end?
call mtr.add_suppression("InnoDB: A copy of page.*in the doublewrite buffer slot.*is not within space bounds");
FLUSH TABLES;
--enable_query_log
--let $restart_parameters=--innodb-undo-logs=4 --innodb-undo-tablespaces=2 --innodb-undo-log-truncate=1 --innodb-max-undo-log-size=10485760 --innodb-purge-rseg-truncate-frequency=1 --innodb-fast-shutdown=0
--source include/restart_mysqld.inc
SET GLOBAL innodb_undo_logs = 4;
SET GLOBAL innodb_undo_log_truncate = 1;
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
let SEARCH_FILE = $MYSQLTEST_VARDIR/log/mysqld.1.err;
......@@ -38,13 +32,19 @@ while ($i) {
--enable_query_log
commit;
let SEARCH_PATTERN = ib_undo_trunc_before_truncate;
--source include/truncate_recover.inc
let SEARCH_PATTERN = ib_undo_trunc_before_ddl_log_end;
--source include/truncate_recover.inc
let SEARCH_PATTERN = ib_undo_trunc;
begin;
update t1 set c = 'MariaDB';
update t1 set c = 'InnoDB';
eval set global debug_dbug = '+d,$SEARCH_PATTERN';
commit;
# FIXME: remove this work-around, and generate less log!
call mtr.add_suppression("InnoDB: The redo log transaction size ");
SET GLOBAL innodb_fast_shutdown=0;
--source include/shutdown_mysqld.inc
--source include/search_pattern_in_file.inc
# FIXME: remove this work-around, and generate less log!
--let $restart_parameters= --innodb-buffer-pool-size=16m
--source include/start_mysqld.inc
let SEARCH_PATTERN = ib_undo_trunc_trunc_done;
let $restart_parameters=
--source include/truncate_recover.inc
drop table t1;
#
# Bug#25053705 - INVALID I/O ON TABLE AFTER TRUNCATE
#
CREATE TABLE t1 (a INT, d INT, b VARCHAR(198), c CHAR(158), FULLTEXT fts1(c,b),
FULLTEXT fts2(c));
TRUNCATE TABLE t1;
INSERT INTO t1 (a,d,b,c) VALUES (
'79795','6',repeat('uololoaroolccaaruolraloouuoocorrcorurlu','1'),
repeat('orouculcaocuocloooolooloooaorlroclouulrrucclulalouaulrluorooaclllluuorc
cuullucocraloracurooulrooauuar','1'));
CREATE TABLE t2 (a INT, d INT, b VARCHAR(198), c CHAR(158), FULLTEXT fts1(c,b));
INSERT INTO t2 VALUES (1, 1, repeat('uololoaroolccaaruolraloouuoocorrcorurlu','1'),
repeat('orouculcaocuocloooolooloooaorlroclouulrrucclulalouaulrluorooaclllluuorccuullucocraloracurooulrooauuar','1'));
create procedure insert_t2(IN total int)
begin
declare i int default 1;
while (i <= total) DO
insert into t2 select * from t2;
set i = i + 1;
end while;
end|
CALL insert_t2(15);
SET @save_dbug = @@SESSION.DEBUG_DBUG;
SET DEBUG_DBUG = '+d,innodb_invalid_read_after_truncate';
INSERT INTO t1 (a,d,b,c) VALUES (
'7795','6',repeat('uololoaroolccaaruolraloouuoocorrcorurlu','1'),
repeat('orouculcaocuocloooolooloooaorlroclouulrrucclulalouaulrluorooaclllluuorc
cuullucocraloracurooulrooauuar','1'));
SET DEBUG_DBUG = @save_dbug;
DROP PROCEDURE insert_t2;
DROP TABLE t1,t2;
--source include/have_innodb.inc
--source include/have_debug.inc
--echo #
--echo # Bug#25053705 - INVALID I/O ON TABLE AFTER TRUNCATE
--echo #
CREATE TABLE t1 (a INT, d INT, b VARCHAR(198), c CHAR(158), FULLTEXT fts1(c,b),
FULLTEXT fts2(c));
TRUNCATE TABLE t1;
INSERT INTO t1 (a,d,b,c) VALUES (
'79795','6',repeat('uololoaroolccaaruolraloouuoocorrcorurlu','1'),
repeat('orouculcaocuocloooolooloooaorlroclouulrrucclulalouaulrluorooaclllluuorc
cuullucocraloracurooulrooauuar','1'));
# The following CREATE TABLE and INSERTs are used to remove the pages related to table t1
# from the buffer pool.
CREATE TABLE t2 (a INT, d INT, b VARCHAR(198), c CHAR(158), FULLTEXT fts1(c,b));
INSERT INTO t2 VALUES (1, 1, repeat('uololoaroolccaaruolraloouuoocorrcorurlu','1'),
repeat('orouculcaocuocloooolooloooaorlroclouulrrucclulalouaulrluorooaclllluuorccuullucocraloracurooulrooauuar','1'));
delimiter |;
create procedure insert_t2(IN total int)
begin
declare i int default 1;
while (i <= total) DO
insert into t2 select * from t2;
set i = i + 1;
end while;
end|
delimiter ;|
CALL insert_t2(15);
SET @save_dbug = @@SESSION.DEBUG_DBUG;
SET DEBUG_DBUG = '+d,innodb_invalid_read_after_truncate';
INSERT INTO t1 (a,d,b,c) VALUES (
'7795','6',repeat('uololoaroolccaaruolraloouuoocorrcorurlu','1'),
repeat('orouculcaocuocloooolooloooaorlroclouulrrucclulalouaulrluorooaclllluuorc
cuullucocraloracurooulrooauuar','1'));
SET DEBUG_DBUG = @save_dbug;
DROP PROCEDURE insert_t2;
DROP TABLE t1,t2;
begin;
update t1 set c = 'MariaDB';
update t1 set c = 'InnoDB';
eval set global debug_dbug = '+d,$SEARCH_PATTERN';
commit;
--source include/shutdown_mysqld.inc
--source include/search_pattern_in_file.inc
--source include/start_mysqld.inc
SET GLOBAL innodb_fast_shutdown=0;
create table t1(keyc int primary key, c1 char(100)) engine = innodb;
begin;
update t1 set c1 = 'mysql';
update t1 set c1 = 'oracle';
delete from t1;
commit;
drop table t1;
SET GLOBAL innodb_fast_shutdown=0;
SET GLOBAL innodb_undo_log_truncate=1;
SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
#
# WL#6965: Truncate UNDO logs.
#
--source include/have_innodb.inc
--source include/have_innodb_max_16k.inc
--source include/have_undo_tablespaces.inc
# The test is restarting the server to force undo truncation.
--source include/not_embedded.inc
SET GLOBAL innodb_fast_shutdown=0;
--let $restart_parameters=--innodb_undo_tablespaces=2 --innodb_undo_logs=4
--source include/restart_mysqld.inc
let MYSQLD_DATADIR = `select @@datadir`;
#-----------------------------------------------------------------------------
#
# 1. Perform enough DML action so that undo tablespace size grows beyond
# set threshold and then wait and see if it is being truncated.
#
create table t1(keyc int primary key, c1 char(100)) engine = innodb;
begin;
--disable_query_log
let $i=30000;
while ($i) {
eval insert into t1 values(30000-$i, '');
dec $i;
}
--enable_query_log
update t1 set c1 = 'mysql';
update t1 set c1 = 'oracle';
delete from t1;
commit;
drop table t1;
let CHECKFILE = $MYSQL_TMP_DIR/check.txt;
perl;
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size1)
= stat("$ENV{MYSQLD_DATADIR}/undo001");
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size2)
= stat("$ENV{MYSQLD_DATADIR}/undo002");
open(OUT, ">$ENV{CHECKFILE}") || die;
print OUT "let \$size1='$size1,$size2';\n";
close(OUT);
EOF
SET GLOBAL innodb_fast_shutdown=0;
SET GLOBAL innodb_undo_log_truncate=1;
SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
--source include/shutdown_mysqld.inc
--source $CHECKFILE
perl;
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size1)
= stat("$ENV{MYSQLD_DATADIR}/undo001");
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size2)
= stat("$ENV{MYSQLD_DATADIR}/undo002");
open(OUT, ">$ENV{CHECKFILE}") || die;
print OUT "let \$size2='$size1,$size2';\n";
close(OUT);
EOF
--source $CHECKFILE
--remove_file $CHECKFILE
if ($size1 == $size2)
{
echo Truncation did not happen: $size1 == $size2;
}
--let $restart_parameters=
--source include/start_mysqld.inc
#
# load tables with some significant amount of data and then truncate it.
#
#-----------------------------------------------------------------------------
#
# create test-bed
#
let $per_table = `select @@innodb_file_per_table`;
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_per_table = $per_table;
......@@ -419,12 +419,12 @@ ALTER TABLE t7_restart TRUNCATE PARTITION p1;
=== information_schema.innodb_sys_tablespaces and innodb_sys_datafiles ===
Space_Name Space_Type Page_Size Zip_Size Formats_Permitted Path
test/t4_restart Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t4_restart.ibd
test/t5_restart Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t5_restart.ibd
test/t6_restart#p#p0 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p0.ibd
test/t6_restart#p#p1 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p1.ibd
test/t6_restart#p#p2 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p2.ibd
test/t7_restart#p#p0#sp#s0 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s0.ibd
test/t7_restart#p#p0#sp#s1 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s1.ibd
test/t5_restart Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t5_restart.ibd
test/t6_restart#p#p2 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p2.ibd
test/t7_restart#p#p1#sp#s2 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s2.ibd
test/t7_restart#p#p1#sp#s3 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s3.ibd
INSERT INTO t5_restart VALUES (1000000000, 'MySQL', 'InnoDB', '2011-11-11', 'Read this after reboot');
......@@ -523,12 +523,12 @@ innodb_file_per_table ON
=== information_schema.innodb_sys_tablespaces and innodb_sys_datafiles ===
Space_Name Space_Type Page_Size Zip_Size Formats_Permitted Path
test/t4_restart Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t4_restart.ibd
test/t5_restart Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t5_restart.ibd
test/t6_restart#p#p0 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p0.ibd
test/t6_restart#p#p1 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p1.ibd
test/t6_restart#p#p2 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p2.ibd
test/t7_restart#p#p0#sp#s0 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s0.ibd
test/t7_restart#p#p0#sp#s1 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s1.ibd
test/t5_restart Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t5_restart.ibd
test/t6_restart#p#p2 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p2.ibd
test/t7_restart#p#p1#sp#s2 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s2.ibd
test/t7_restart#p#p1#sp#s3 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s3.ibd
SELECT count(*) FROM t5_restart;
......@@ -624,12 +624,12 @@ RENAME TABLE t7_restart TO t77_restart;
=== information_schema.innodb_sys_tablespaces and innodb_sys_datafiles ===
Space_Name Space_Type Page_Size Zip_Size Formats_Permitted Path
test/t4_restart Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t4_restart.ibd
test/t55_restart Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t55_restart.ibd
test/t66_restart#p#p0 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p0.ibd
test/t66_restart#p#p1 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p1.ibd
test/t66_restart#p#p2 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p2.ibd
test/t77_restart#p#p0#sp#s0 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p0#sp#s0.ibd
test/t77_restart#p#p0#sp#s1 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p0#sp#s1.ibd
test/t55_restart Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t55_restart.ibd
test/t66_restart#p#p2 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p2.ibd
test/t77_restart#p#p1#sp#s2 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p1#sp#s2.ibd
test/t77_restart#p#p1#sp#s3 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p1#sp#s3.ibd
INSERT INTO t55_restart (SELECT 0, c2, c3, c4, c5 FROM t55_restart);
......@@ -721,12 +721,12 @@ innodb_file_per_table ON
=== information_schema.innodb_sys_tablespaces and innodb_sys_datafiles ===
Space_Name Space_Type Page_Size Zip_Size Formats_Permitted Path
test/t4_restart Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t4_restart.ibd
test/t55_restart Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t55_restart.ibd
test/t66_restart#p#p0 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p0.ibd
test/t66_restart#p#p1 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p1.ibd
test/t66_restart#p#p2 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p2.ibd
test/t77_restart#p#p0#sp#s0 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p0#sp#s0.ibd
test/t77_restart#p#p0#sp#s1 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p0#sp#s1.ibd
test/t55_restart Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t55_restart.ibd
test/t66_restart#p#p2 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p2.ibd
test/t77_restart#p#p1#sp#s2 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p1#sp#s2.ibd
test/t77_restart#p#p1#sp#s3 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p1#sp#s3.ibd
INSERT INTO t55_restart (SELECT 0, c2, c3, c4, c5 FROM t55_restart);
......@@ -854,12 +854,12 @@ t77_restart#p#p1#sp#s3.ibd
=== information_schema.innodb_sys_tablespaces and innodb_sys_datafiles ===
Space_Name Space_Type Page_Size Zip_Size Formats_Permitted Path
test/t4_restart Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/new_dir/test/t4_restart.ibd
test/t55_restart Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/new_dir/test/t55_restart.ibd
test/t66_restart#p#p0 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/new_dir/test/t66_restart#p#p0.ibd
test/t66_restart#p#p1 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/new_dir/test/t66_restart#p#p1.ibd
test/t66_restart#p#p2 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/new_dir/test/t66_restart#p#p2.ibd
test/t77_restart#p#p0#sp#s0 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/new_dir/test/t77_restart#p#p0#sp#s0.ibd
test/t77_restart#p#p0#sp#s1 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/new_dir/test/t77_restart#p#p0#sp#s1.ibd
test/t55_restart Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/new_dir/test/t55_restart.ibd
test/t66_restart#p#p2 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/new_dir/test/t66_restart#p#p2.ibd
test/t77_restart#p#p1#sp#s2 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/new_dir/test/t77_restart#p#p1#sp#s2.ibd
test/t77_restart#p#p1#sp#s3 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/new_dir/test/t77_restart#p#p1#sp#s3.ibd
INSERT INTO t4_restart (SELECT 0, c2, c3, c4, c5 FROM t4_restart);
......@@ -991,12 +991,12 @@ t77_restart.par
=== information_schema.innodb_sys_tablespaces and innodb_sys_datafiles ===
Space_Name Space_Type Page_Size Zip_Size Formats_Permitted Path
test/t4_restart Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t4_restart.ibd
test/t55_restart Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t55_restart.ibd
test/t66_restart#p#p0 Single DEFAULT DEFAULT Compressed MYSQLD_DATADIR/test/t66_restart#p#p0.ibd
test/t66_restart#p#p1 Single DEFAULT DEFAULT Compressed MYSQLD_DATADIR/test/t66_restart#p#p1.ibd
test/t66_restart#p#p2 Single DEFAULT DEFAULT Compressed MYSQLD_DATADIR/test/t66_restart#p#p2.ibd
test/t77_restart#p#p0#sp#s0 Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t77_restart#p#p0#sp#s0.ibd
test/t77_restart#p#p0#sp#s1 Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t77_restart#p#p0#sp#s1.ibd
test/t55_restart Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t55_restart.ibd
test/t66_restart#p#p2 Single DEFAULT DEFAULT Compressed MYSQLD_DATADIR/test/t66_restart#p#p2.ibd
test/t77_restart#p#p1#sp#s2 Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t77_restart#p#p1#sp#s2.ibd
test/t77_restart#p#p1#sp#s3 Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t77_restart#p#p1#sp#s3.ibd
INSERT INTO t4_restart (SELECT 0, c2, c3, c4, c5 FROM t4_restart);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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_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_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_per_table = 1;
This diff is collapsed.
#
# WL#6501: make truncate table atomic
#
# TC tries to hit crash point during truncate of
# compressed non-temp table residing in single tablespace
# with page-size=16k
--source include/have_innodb.inc
--source include/have_innodb_16k.inc
--source include/have_debug.inc
--source include/big_test.inc
# Valgrind would complain about memory leaks when we crash on purpose.
--source include/not_valgrind.inc
# Embedded server does not support crashing
--source include/not_embedded.inc
# Avoid CrashReporter popup on Mac
--source include/not_crashrep.inc
let $wl6501_file_per_table = 1;
let $wl6501_row_fmt = compressed;
let $wl6501_kbs = 16;
--source suite/innodb/include/innodb_wl6501_crash.inc
#
# WL#6501: make truncate table atomic
#
# TC tries to hit crash point during truncate of
# compressed non-temp table residing in single tablespace.
# with page-size=4k
--source include/have_innodb.inc
--source include/have_innodb_4k.inc
--source include/have_debug.inc
--source include/big_test.inc
# Valgrind would complain about memory leaks when we crash on purpose.
--source include/not_valgrind.inc
# Embedded server does not support crashing
--source include/not_embedded.inc
# Avoid CrashReporter popup on Mac
--source include/not_crashrep.inc
let $wl6501_file_per_table = 1;
let $wl6501_row_fmt = compressed;
let $wl6501_kbs = 4;
--source suite/innodb/include/innodb_wl6501_crash.inc
let $wl6501_temp = temporary;
--source suite/innodb/include/innodb_wl6501_crash_temp.inc
This diff is collapsed.
This diff is collapsed.
......@@ -7,7 +7,6 @@ CREATE TABLE t1 ENGINE=InnoDB SELECT 1;
--let after_load_tablespaces=TRUNCATE test.t1
--disable_result_log
--error 1
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir --dbug=+d,mariabackup_events;
--enable_result_log
......
This diff is collapsed.
......@@ -403,6 +403,8 @@ rpl_slave_state::truncate_state_table(THD *thd)
tlist.init_one_table(&MYSQL_SCHEMA_NAME, &rpl_gtid_slave_state_table_name, NULL, TL_WRITE);
if (!(err= open_and_lock_tables(thd, &tlist, FALSE, 0)))
{
tdc_remove_table(thd, TDC_RT_REMOVE_UNUSED, "mysql",
rpl_gtid_slave_state_table_name.str, false);
err= tlist.table->file->ha_truncate();
if (err)
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment