mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
MDEV-13564 Mariabackup does not work with TRUNCATE
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
This commit is contained in:
@@ -4081,9 +4081,6 @@ old_format:
|
||||
goto log_fail;
|
||||
}
|
||||
|
||||
ut_ad(!((log_sys.log.format ^ LOG_HEADER_FORMAT_CURRENT)
|
||||
& ~LOG_HEADER_FORMAT_ENCRYPTED));
|
||||
|
||||
const byte* buf = log_sys.checkpoint_buf;
|
||||
|
||||
reread_log_header:
|
||||
@@ -4100,9 +4097,6 @@ reread_log_header:
|
||||
goto old_format;
|
||||
}
|
||||
|
||||
ut_ad(!((log_sys.log.format ^ LOG_HEADER_FORMAT_CURRENT)
|
||||
& ~LOG_HEADER_FORMAT_ENCRYPTED));
|
||||
|
||||
log_header_read(max_cp_field);
|
||||
|
||||
if (checkpoint_no_start != mach_read_from_8(buf + LOG_CHECKPOINT_NO)) {
|
||||
@@ -4130,6 +4124,7 @@ reread_log_header:
|
||||
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);
|
||||
|
||||
@@ -125,13 +125,13 @@ WHERE engine = 'innodb'
|
||||
AND support IN ('YES', 'DEFAULT', 'ENABLED');
|
||||
COUNT(*)
|
||||
1
|
||||
FOUND 2 /InnoDB: Upgrading redo log:/ in mysqld.1.err
|
||||
FOUND 3 /InnoDB: Upgrading redo log:/ in mysqld.1.err
|
||||
# Minimal MariaDB 10.1.21 encrypted redo log
|
||||
SELECT COUNT(*) `1` FROM INFORMATION_SCHEMA.ENGINES WHERE engine='innodb'
|
||||
AND support IN ('YES', 'DEFAULT', 'ENABLED');
|
||||
1
|
||||
1
|
||||
FOUND 2 /InnoDB: Encrypting redo log/ in mysqld.1.err
|
||||
FOUND 1 /InnoDB: Encrypting redo log/ in mysqld.1.err
|
||||
ib_buffer_pool
|
||||
ib_logfile0
|
||||
ib_logfile1
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,416 +0,0 @@
|
||||
#
|
||||
# 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("The file '.*' already exists though the corresponding table did not exist in the InnoDB data dictionary");
|
||||
call mtr.add_suppression("Cannot create file '.*'");
|
||||
call mtr.add_suppression("InnoDB: Error number 17 means 'File exists'");
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Will test following scenarios:
|
||||
# 1. Hit crash point while writing redo log.
|
||||
# 2. Hit crash point on completion of redo log write.
|
||||
# 3. Hit crash point while dropping indexes.
|
||||
# 4. Hit crash point on completing drop of all indexes before creation of index
|
||||
# is commenced.
|
||||
# 5. Hit crash point while creating indexes.
|
||||
# 6. Hit crash point after data is updated to system-table and in-memory dict.
|
||||
# 7. Hit crash point before/after log checkpoint is done.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
#
|
||||
# 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 while writing redo log.
|
||||
#
|
||||
--echo "1. Hit crash point while writing redo log."
|
||||
use test;
|
||||
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_while_writing_redo_log";
|
||||
--source include/expect_crash.inc
|
||||
--error 2013
|
||||
truncate table t;
|
||||
#
|
||||
--source include/start_mysqld.inc
|
||||
check table t;
|
||||
select * from t;
|
||||
select * from t where f < 2.5;
|
||||
drop table t;
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
#
|
||||
# 2. Hit crash point on completion of redo log write.
|
||||
#
|
||||
--echo "2. Hit crash point on completion of redo log write."
|
||||
use test;
|
||||
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_after_redo_log_write_complete";
|
||||
--source include/expect_crash.inc
|
||||
--error 2013
|
||||
truncate table t;
|
||||
#
|
||||
--source include/start_mysqld.inc
|
||||
check table t;
|
||||
select * from t;
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
select * from t where f < 2.5;
|
||||
drop table t;
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
#
|
||||
# 3. Hit crash point while dropping indexes.
|
||||
#
|
||||
--echo "3. Hit crash point while dropping indexes."
|
||||
use test;
|
||||
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_drop_of_clust_index";
|
||||
--source include/expect_crash.inc
|
||||
--error 2013
|
||||
truncate table t;
|
||||
#
|
||||
--source include/start_mysqld.inc
|
||||
check table t;
|
||||
select * from t;
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
select * from t where f < 2.5;
|
||||
drop table t;
|
||||
#
|
||||
#
|
||||
use test;
|
||||
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))
|
||||
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_drop_of_uniq_index";
|
||||
--source include/expect_crash.inc
|
||||
--error 2013
|
||||
truncate table t;
|
||||
#
|
||||
--source include/start_mysqld.inc
|
||||
#
|
||||
check table t;
|
||||
select * from t;
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
select * from t where f < 2.5;
|
||||
drop table t;
|
||||
#
|
||||
#
|
||||
use test;
|
||||
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), 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_drop_of_sec_index";
|
||||
--source include/expect_crash.inc
|
||||
--error 2013
|
||||
truncate table t;
|
||||
#
|
||||
--source include/start_mysqld.inc
|
||||
check table t;
|
||||
select * from t;
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
select * from t where f < 2.5;
|
||||
drop table t;
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
#
|
||||
# 4. Hit crash point on completing drop of all indexes before creation of index
|
||||
# is commenced.
|
||||
#
|
||||
--echo "4. Hit crash point on completing drop of all indexes before creation"
|
||||
--echo " of index is commenced."
|
||||
use test;
|
||||
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;
|
||||
select * from t;
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
select * from t where f < 2.5;
|
||||
drop table t;
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
#
|
||||
# 5. Hit crash point while creating indexes.
|
||||
#
|
||||
--echo "5. Hit crash point while creating indexes."
|
||||
use test;
|
||||
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_create_of_clust_index";
|
||||
--source include/expect_crash.inc
|
||||
--error 2013
|
||||
truncate table t;
|
||||
#
|
||||
--source include/start_mysqld.inc
|
||||
check table t;
|
||||
select * from t;
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
select * from t where f < 2.5;
|
||||
drop table t;
|
||||
#
|
||||
#
|
||||
use test;
|
||||
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))
|
||||
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_create_of_uniq_index";
|
||||
--source include/expect_crash.inc
|
||||
--error 2013
|
||||
truncate table t;
|
||||
#
|
||||
--source include/start_mysqld.inc
|
||||
check table t;
|
||||
select * from t;
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
select * from t where f < 2.5;
|
||||
drop table t;
|
||||
#
|
||||
#
|
||||
use test;
|
||||
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), 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_create_of_sec_index";
|
||||
--source include/expect_crash.inc
|
||||
--error 2013
|
||||
truncate table t;
|
||||
#
|
||||
--source include/start_mysqld.inc
|
||||
check table t;
|
||||
select * from t;
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
select * from t where f < 2.5;
|
||||
drop table t;
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
#
|
||||
# 6. Hit crash point after data is updated to system-table and in-memory dict.
|
||||
#
|
||||
--echo "6. Hit crash point after data is updated to system-table and"
|
||||
--echo " in-memory dict."
|
||||
use test;
|
||||
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;
|
||||
select * from t;
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
select * from t where f < 2.5;
|
||||
drop table t;
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
#
|
||||
# 7. Hit crash point before/after log checkpoint is done.
|
||||
#
|
||||
--echo "7. Hit crash point before/after log checkpoint is done."
|
||||
use test;
|
||||
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_before_log_removal";
|
||||
--source include/expect_crash.inc
|
||||
--error 2013
|
||||
truncate table t;
|
||||
#
|
||||
--source include/start_mysqld.inc
|
||||
check table t;
|
||||
select * from t;
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t where f < 2.5;
|
||||
drop table t;
|
||||
#
|
||||
#
|
||||
use test;
|
||||
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_after_truncate_done";
|
||||
--source include/expect_crash.inc
|
||||
--error 2013
|
||||
truncate table t;
|
||||
#
|
||||
--source include/start_mysqld.inc
|
||||
check table t;
|
||||
select * from t;
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
select * from t where f < 2.5;
|
||||
drop table t;
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
#
|
||||
# remove test-bed
|
||||
#
|
||||
eval set global innodb_file_per_table = $per_table;
|
||||
@@ -1,98 +0,0 @@
|
||||
#
|
||||
# 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;
|
||||
@@ -125,7 +125,7 @@ WHERE engine = 'innodb'
|
||||
AND support IN ('YES', 'DEFAULT', 'ENABLED');
|
||||
COUNT(*)
|
||||
1
|
||||
FOUND 2 /InnoDB: Upgrading redo log:/ in mysqld.1.err
|
||||
FOUND 3 /InnoDB: Upgrading redo log:/ in mysqld.1.err
|
||||
# Minimal MariaDB 10.1.21 encrypted redo log
|
||||
SELECT * FROM INFORMATION_SCHEMA.ENGINES
|
||||
WHERE engine = 'innodb'
|
||||
|
||||
8
mysql-test/suite/innodb/r/truncate.result
Normal file
8
mysql-test/suite/innodb/r/truncate.result
Normal file
@@ -0,0 +1,8 @@
|
||||
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;
|
||||
14
mysql-test/suite/innodb/r/truncate_crash.result
Normal file
14
mysql-test/suite/innodb/r/truncate_crash.result
Normal file
@@ -0,0 +1,14 @@
|
||||
FLUSH TABLES;
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
|
||||
INSERT INTO t1 SET a=1;
|
||||
connect wait,localhost,root,,test;
|
||||
SET DEBUG_SYNC='after_trx_committed_in_memory SIGNAL c WAIT_FOR ever';
|
||||
TRUNCATE TABLE t1;
|
||||
connection default;
|
||||
SET DEBUG_SYNC='now WAIT_FOR c';
|
||||
disconnect wait;
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
1
|
||||
TRUNCATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
@@ -1,88 +0,0 @@
|
||||
#
|
||||
# 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;
|
||||
58
mysql-test/suite/innodb/r/truncate_foreign.result
Normal file
58
mysql-test/suite/innodb/r/truncate_foreign.result
Normal file
@@ -0,0 +1,58 @@
|
||||
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;
|
||||
@@ -1,114 +0,0 @@
|
||||
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;
|
||||
17
mysql-test/suite/innodb/r/truncate_missing.result
Normal file
17
mysql-test/suite/innodb/r/truncate_missing.result
Normal file
@@ -0,0 +1,17 @@
|
||||
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;
|
||||
@@ -1,29 +0,0 @@
|
||||
#
|
||||
# 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;
|
||||
@@ -1,12 +0,0 @@
|
||||
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;
|
||||
@@ -1,4 +1,12 @@
|
||||
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;
|
||||
15
mysql-test/suite/innodb/r/undo_truncate_recover.result
Normal file
15
mysql-test/suite/innodb/r/undo_truncate_recover.result
Normal file
@@ -0,0 +1,15 @@
|
||||
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';
|
||||
commit;
|
||||
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;
|
||||
17
mysql-test/suite/innodb/t/truncate.test
Normal file
17
mysql-test/suite/innodb/t/truncate.test
Normal file
@@ -0,0 +1,17 @@
|
||||
--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;
|
||||
22
mysql-test/suite/innodb/t/truncate_crash.test
Normal file
22
mysql-test/suite/innodb/t/truncate_crash.test
Normal file
@@ -0,0 +1,22 @@
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_debug.inc
|
||||
--source include/have_debug_sync.inc
|
||||
--source include/not_embedded.inc
|
||||
|
||||
FLUSH TABLES;
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
|
||||
INSERT INTO t1 SET a=1;
|
||||
|
||||
connect (wait,localhost,root,,test);
|
||||
SET DEBUG_SYNC='after_trx_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 wait;
|
||||
|
||||
SELECT * FROM t1;
|
||||
TRUNCATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
@@ -1,128 +0,0 @@
|
||||
--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
|
||||
68
mysql-test/suite/innodb/t/truncate_foreign.test
Normal file
68
mysql-test/suite/innodb/t/truncate_foreign.test
Normal file
@@ -0,0 +1,68 @@
|
||||
--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;
|
||||
@@ -1,97 +0,0 @@
|
||||
# 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;
|
||||
22
mysql-test/suite/innodb/t/truncate_missing.test
Normal file
22
mysql-test/suite/innodb/t/truncate_missing.test
Normal file
@@ -0,0 +1,22 @@
|
||||
--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;
|
||||
@@ -1,3 +0,0 @@
|
||||
--innodb-purge-threads=1
|
||||
--innodb-purge-batch-size=1
|
||||
--innodb-stats-persistent=OFF
|
||||
@@ -1,49 +0,0 @@
|
||||
--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
|
||||
@@ -1,16 +0,0 @@
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_debug.inc
|
||||
--source include/have_debug_sync.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';
|
||||
--source include/restart_mysqld.inc
|
||||
--disconnect con1
|
||||
SELECT COUNT(*) FROM t1;
|
||||
DROP TABLE t1;
|
||||
1
mysql-test/suite/innodb/t/undo_truncate.opt
Normal file
1
mysql-test/suite/innodb/t/undo_truncate.opt
Normal file
@@ -0,0 +1 @@
|
||||
--innodb-log-buffer-size=2m
|
||||
126
mysql-test/suite/innodb/t/undo_truncate.test
Normal file
126
mysql-test/suite/innodb/t/undo_truncate.test
Normal file
@@ -0,0 +1,126 @@
|
||||
--source include/have_innodb.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 @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');
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
#
|
||||
# Perform DML action using multiple clients and multiple undo tablespace.
|
||||
#
|
||||
#
|
||||
create table t1(keyc int primary key, c char(100)) engine = innodb;
|
||||
create table t2(keyc int primary key, c char(100)) engine = innodb;
|
||||
#
|
||||
delimiter |;
|
||||
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 |
|
||||
delimiter ;|
|
||||
#
|
||||
delimiter |;
|
||||
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 |
|
||||
delimiter ;|
|
||||
#
|
||||
#
|
||||
let DATADIR = `select @@datadir`;
|
||||
connect (con1,localhost,root,,);
|
||||
begin;
|
||||
send call populate_t1();
|
||||
|
||||
connect (con2,localhost,root,,);
|
||||
begin;
|
||||
send call populate_t2();
|
||||
|
||||
connection con1; reap; send update t1 set c = 'mysql';
|
||||
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; 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;
|
||||
|
||||
--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
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
50
mysql-test/suite/innodb/t/undo_truncate_recover.test
Normal file
50
mysql-test/suite/innodb/t/undo_truncate_recover.test
Normal file
@@ -0,0 +1,50 @@
|
||||
#
|
||||
# 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
|
||||
--source include/have_undo_tablespaces.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
|
||||
|
||||
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;
|
||||
|
||||
create table t1(keyc int primary key, c 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
|
||||
commit;
|
||||
|
||||
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
|
||||
|
||||
drop table t1;
|
||||
@@ -1,31 +0,0 @@
|
||||
#
|
||||
# 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;
|
||||
@@ -1 +0,0 @@
|
||||
--innodb-random-read-ahead=1
|
||||
@@ -1,50 +0,0 @@
|
||||
--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;
|
||||
@@ -1,8 +0,0 @@
|
||||
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
|
||||
@@ -1,11 +0,0 @@
|
||||
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;
|
||||
@@ -1,15 +0,0 @@
|
||||
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';
|
||||
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
|
||||
@@ -1,72 +0,0 @@
|
||||
#
|
||||
# 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
|
||||
@@ -1,77 +0,0 @@
|
||||
#
|
||||
# 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
|
||||
--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
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
#
|
||||
# Perform DML action using multiple clients and multiple undo tablespace.
|
||||
#
|
||||
#
|
||||
create table t1(keyc int primary key, c char(100)) engine = innodb;
|
||||
create table t2(keyc int primary key, c char(100)) engine = innodb;
|
||||
#
|
||||
delimiter |;
|
||||
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 |
|
||||
delimiter ;|
|
||||
#
|
||||
delimiter |;
|
||||
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 |
|
||||
delimiter ;|
|
||||
#
|
||||
#
|
||||
connect (con1,localhost,root,,);
|
||||
begin;
|
||||
send call populate_t1();
|
||||
|
||||
connect (con2,localhost,root,,);
|
||||
begin;
|
||||
send call populate_t2();
|
||||
|
||||
connection con1; reap; send update t1 set c = 'mysql';
|
||||
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 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/restart_mysqld.inc
|
||||
|
||||
let SEARCH_FILE = $MYSQLTEST_VARDIR/log/mysqld.1.err;
|
||||
let SEARCH_PATTERN = Truncating UNDO tablespace 1;
|
||||
--source include/search_pattern_in_file.inc
|
||||
@@ -1,50 +0,0 @@
|
||||
#
|
||||
# WL#6965: Truncate UNDO logs.
|
||||
#
|
||||
|
||||
--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.
|
||||
--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
|
||||
|
||||
--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
|
||||
|
||||
let SEARCH_FILE = $MYSQLTEST_VARDIR/log/mysqld.1.err;
|
||||
|
||||
create table t1(keyc int primary key, c 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
|
||||
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_trunc_done;
|
||||
let $restart_parameters=
|
||||
--source include/truncate_recover.inc
|
||||
drop table t1;
|
||||
@@ -1,110 +0,0 @@
|
||||
#
|
||||
# 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);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,462 +0,0 @@
|
||||
call mtr.add_suppression("The file '.*' already exists though the corresponding table did not exist in the InnoDB data dictionary");
|
||||
call mtr.add_suppression("Cannot create file '.*'");
|
||||
call mtr.add_suppression("InnoDB: Error number 17 means 'File exists'");
|
||||
set global innodb_file_per_table = on;
|
||||
"1. Hit crash point while writing redo log."
|
||||
use test;
|
||||
set global innodb_file_per_table = 1;
|
||||
SET innodb_strict_mode=OFF;
|
||||
create table t (
|
||||
i int, f float, c char,
|
||||
primary key pk(i), unique findex(f), index ck(c))
|
||||
engine=innodb row_format=compressed
|
||||
key_block_size=16;
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
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 session debug = "+d,ib_trunc_crash_while_writing_redo_log";
|
||||
Warnings:
|
||||
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
|
||||
truncate table t;
|
||||
ERROR HY000: Lost connection to MySQL server during query
|
||||
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
|
||||
select * from t where f < 2.5;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
drop table t;
|
||||
"2. Hit crash point on completion of redo log write."
|
||||
use test;
|
||||
set global innodb_file_per_table = 1;
|
||||
SET innodb_strict_mode=OFF;
|
||||
create table t (
|
||||
i int, f float, c char,
|
||||
primary key pk(i), unique findex(f), index ck(c))
|
||||
engine = innodb row_format = compressed
|
||||
key_block_size = 16;
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
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 session debug = "+d,ib_trunc_crash_after_redo_log_write_complete";
|
||||
Warnings:
|
||||
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
|
||||
truncate table t;
|
||||
ERROR HY000: Lost connection to MySQL server during query
|
||||
check table t;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t check status OK
|
||||
select * from t;
|
||||
i f c
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
3 3.3 c
|
||||
select * from t where f < 2.5;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
drop table t;
|
||||
"3. Hit crash point while dropping indexes."
|
||||
use test;
|
||||
set global innodb_file_per_table = 1;
|
||||
SET innodb_strict_mode=OFF;
|
||||
create table t (
|
||||
i int, f float, c char,
|
||||
primary key pk(i), unique findex(f), index ck(c))
|
||||
engine = innodb row_format = compressed
|
||||
key_block_size = 16;
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
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 session debug = "+d,ib_trunc_crash_on_drop_of_clust_index";
|
||||
Warnings:
|
||||
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
|
||||
truncate table t;
|
||||
ERROR HY000: Lost connection to MySQL server during query
|
||||
check table t;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t check status OK
|
||||
select * from t;
|
||||
i f c
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
3 3.3 c
|
||||
select * from t where f < 2.5;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
drop table t;
|
||||
use test;
|
||||
set global innodb_file_per_table = 1;
|
||||
SET innodb_strict_mode=OFF;
|
||||
create table t (
|
||||
i int, f float, c char,
|
||||
primary key pk(i), unique findex(f))
|
||||
engine = innodb row_format = compressed
|
||||
key_block_size = 16;
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
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 session debug = "+d,ib_trunc_crash_on_drop_of_uniq_index";
|
||||
Warnings:
|
||||
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
|
||||
truncate table t;
|
||||
ERROR HY000: Lost connection to MySQL server during query
|
||||
check table t;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t check status OK
|
||||
select * from t;
|
||||
i f c
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
3 3.3 c
|
||||
select * from t where f < 2.5;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
drop table t;
|
||||
use test;
|
||||
set global innodb_file_per_table = 1;
|
||||
SET innodb_strict_mode=OFF;
|
||||
create table t (
|
||||
i int, f float, c char,
|
||||
primary key pk(i), index ck(c))
|
||||
engine = innodb row_format = compressed
|
||||
key_block_size = 16;
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
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 session debug = "+d,ib_trunc_crash_on_drop_of_sec_index";
|
||||
Warnings:
|
||||
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
|
||||
truncate table t;
|
||||
ERROR HY000: Lost connection to MySQL server during query
|
||||
check table t;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t check status OK
|
||||
select * from t;
|
||||
i f c
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
3 3.3 c
|
||||
select * from t where f < 2.5;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
drop table t;
|
||||
"4. Hit crash point on completing drop of all indexes before creation"
|
||||
" of index is commenced."
|
||||
use test;
|
||||
set global innodb_file_per_table = 1;
|
||||
SET innodb_strict_mode=OFF;
|
||||
create table t (
|
||||
i int, f float, c char,
|
||||
primary key pk(i), unique findex(f), index ck(c))
|
||||
engine = innodb row_format = compressed
|
||||
key_block_size = 16;
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
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 session debug = "+d,ib_trunc_crash_drop_reinit_done_create_to_start";
|
||||
Warnings:
|
||||
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
|
||||
truncate table t;
|
||||
ERROR HY000: Lost connection to MySQL server during query
|
||||
check table t;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t check status OK
|
||||
select * from t;
|
||||
i f c
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
3 3.3 c
|
||||
select * from t where f < 2.5;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
drop table t;
|
||||
"5. Hit crash point while creating indexes."
|
||||
use test;
|
||||
set global innodb_file_per_table = 1;
|
||||
SET innodb_strict_mode=OFF;
|
||||
create table t (
|
||||
i int, f float, c char,
|
||||
primary key pk(i), unique findex(f), index ck(c))
|
||||
engine = innodb row_format = compressed
|
||||
key_block_size = 16;
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
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 session debug = "+d,ib_trunc_crash_on_create_of_clust_index";
|
||||
Warnings:
|
||||
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
|
||||
truncate table t;
|
||||
ERROR HY000: Lost connection to MySQL server during query
|
||||
check table t;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t check status OK
|
||||
select * from t;
|
||||
i f c
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
3 3.3 c
|
||||
select * from t where f < 2.5;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
drop table t;
|
||||
use test;
|
||||
set global innodb_file_per_table = 1;
|
||||
SET innodb_strict_mode=OFF;
|
||||
create table t (
|
||||
i int, f float, c char,
|
||||
primary key pk(i), unique findex(f))
|
||||
engine = innodb row_format = compressed
|
||||
key_block_size = 16;
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
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 session debug = "+d,ib_trunc_crash_on_create_of_uniq_index";
|
||||
Warnings:
|
||||
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
|
||||
truncate table t;
|
||||
ERROR HY000: Lost connection to MySQL server during query
|
||||
check table t;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t check status OK
|
||||
select * from t;
|
||||
i f c
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
3 3.3 c
|
||||
select * from t where f < 2.5;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
drop table t;
|
||||
use test;
|
||||
set global innodb_file_per_table = 1;
|
||||
SET innodb_strict_mode=OFF;
|
||||
create table t (
|
||||
i int, f float, c char,
|
||||
primary key pk(i), index ck(c))
|
||||
engine = innodb row_format = compressed
|
||||
key_block_size = 16;
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
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 session debug = "+d,ib_trunc_crash_on_create_of_sec_index";
|
||||
Warnings:
|
||||
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
|
||||
truncate table t;
|
||||
ERROR HY000: Lost connection to MySQL server during query
|
||||
check table t;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t check status OK
|
||||
select * from t;
|
||||
i f c
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
3 3.3 c
|
||||
select * from t where f < 2.5;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
drop table t;
|
||||
"6. Hit crash point after data is updated to system-table and"
|
||||
" in-memory dict."
|
||||
use test;
|
||||
set global innodb_file_per_table = 1;
|
||||
SET innodb_strict_mode=OFF;
|
||||
create table t (
|
||||
i int, f float, c char,
|
||||
primary key pk(i), unique findex(f), index ck(c))
|
||||
engine = innodb row_format = compressed
|
||||
key_block_size = 16;
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
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 session debug = "+d,ib_trunc_crash_on_updating_dict_sys_info";
|
||||
Warnings:
|
||||
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
|
||||
truncate table t;
|
||||
ERROR HY000: Lost connection to MySQL server during query
|
||||
check table t;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t check status OK
|
||||
select * from t;
|
||||
i f c
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
3 3.3 c
|
||||
select * from t where f < 2.5;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
drop table t;
|
||||
"7. Hit crash point before/after log checkpoint is done."
|
||||
use test;
|
||||
set global innodb_file_per_table = 1;
|
||||
SET innodb_strict_mode=OFF;
|
||||
create table t (
|
||||
i int, f float, c char,
|
||||
primary key pk(i), unique findex(f), index ck(c))
|
||||
engine = innodb row_format = compressed
|
||||
key_block_size = 16;
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
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 session debug = "+d,ib_trunc_crash_before_log_removal";
|
||||
Warnings:
|
||||
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
|
||||
truncate table t;
|
||||
ERROR HY000: Lost connection to MySQL server during query
|
||||
check table t;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t check status OK
|
||||
select * from t;
|
||||
i f c
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t where f < 2.5;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
drop table t;
|
||||
use test;
|
||||
set global innodb_file_per_table = 1;
|
||||
SET innodb_strict_mode=OFF;
|
||||
create table t (
|
||||
i int, f float, c char,
|
||||
primary key pk(i), unique findex(f), index ck(c))
|
||||
engine = innodb row_format = compressed
|
||||
key_block_size = 16;
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
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 session debug = "+d,ib_trunc_crash_after_truncate_done";
|
||||
Warnings:
|
||||
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
|
||||
truncate table t;
|
||||
ERROR HY000: Lost connection to MySQL server during query
|
||||
check table t;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t check status OK
|
||||
select * from t;
|
||||
i f c
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
3 3.3 c
|
||||
select * from t where f < 2.5;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
drop table t;
|
||||
set global innodb_file_per_table = 1;
|
||||
@@ -1,519 +0,0 @@
|
||||
call mtr.add_suppression("The file '.*' already exists though the corresponding table did not exist in the InnoDB data dictionary");
|
||||
call mtr.add_suppression("Cannot create file '.*'");
|
||||
call mtr.add_suppression("InnoDB: Error number 17 means 'File exists'");
|
||||
set global innodb_file_per_table = on;
|
||||
"1. Hit crash point while writing redo log."
|
||||
use test;
|
||||
set global innodb_file_per_table = 1;
|
||||
SET innodb_strict_mode=OFF;
|
||||
create table t (
|
||||
i int, f float, c char,
|
||||
primary key pk(i), unique findex(f), index ck(c))
|
||||
engine=innodb row_format=compressed
|
||||
key_block_size=4;
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
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 session debug = "+d,ib_trunc_crash_while_writing_redo_log";
|
||||
Warnings:
|
||||
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
|
||||
truncate table t;
|
||||
ERROR HY000: Lost connection to MySQL server during query
|
||||
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
|
||||
select * from t where f < 2.5;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
drop table t;
|
||||
"2. Hit crash point on completion of redo log write."
|
||||
use test;
|
||||
set global innodb_file_per_table = 1;
|
||||
SET innodb_strict_mode=OFF;
|
||||
create table t (
|
||||
i int, f float, c char,
|
||||
primary key pk(i), unique findex(f), index ck(c))
|
||||
engine = innodb row_format = compressed
|
||||
key_block_size = 4;
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
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 session debug = "+d,ib_trunc_crash_after_redo_log_write_complete";
|
||||
Warnings:
|
||||
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
|
||||
truncate table t;
|
||||
ERROR HY000: Lost connection to MySQL server during query
|
||||
check table t;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t check status OK
|
||||
select * from t;
|
||||
i f c
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
3 3.3 c
|
||||
select * from t where f < 2.5;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
drop table t;
|
||||
"3. Hit crash point while dropping indexes."
|
||||
use test;
|
||||
set global innodb_file_per_table = 1;
|
||||
SET innodb_strict_mode=OFF;
|
||||
create table t (
|
||||
i int, f float, c char,
|
||||
primary key pk(i), unique findex(f), index ck(c))
|
||||
engine = innodb row_format = compressed
|
||||
key_block_size = 4;
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
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 session debug = "+d,ib_trunc_crash_on_drop_of_clust_index";
|
||||
Warnings:
|
||||
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
|
||||
truncate table t;
|
||||
ERROR HY000: Lost connection to MySQL server during query
|
||||
check table t;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t check status OK
|
||||
select * from t;
|
||||
i f c
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
3 3.3 c
|
||||
select * from t where f < 2.5;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
drop table t;
|
||||
use test;
|
||||
set global innodb_file_per_table = 1;
|
||||
SET innodb_strict_mode=OFF;
|
||||
create table t (
|
||||
i int, f float, c char,
|
||||
primary key pk(i), unique findex(f))
|
||||
engine = innodb row_format = compressed
|
||||
key_block_size = 4;
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
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 session debug = "+d,ib_trunc_crash_on_drop_of_uniq_index";
|
||||
Warnings:
|
||||
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
|
||||
truncate table t;
|
||||
ERROR HY000: Lost connection to MySQL server during query
|
||||
check table t;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t check status OK
|
||||
select * from t;
|
||||
i f c
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
3 3.3 c
|
||||
select * from t where f < 2.5;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
drop table t;
|
||||
use test;
|
||||
set global innodb_file_per_table = 1;
|
||||
SET innodb_strict_mode=OFF;
|
||||
create table t (
|
||||
i int, f float, c char,
|
||||
primary key pk(i), index ck(c))
|
||||
engine = innodb row_format = compressed
|
||||
key_block_size = 4;
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
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 session debug = "+d,ib_trunc_crash_on_drop_of_sec_index";
|
||||
Warnings:
|
||||
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
|
||||
truncate table t;
|
||||
ERROR HY000: Lost connection to MySQL server during query
|
||||
check table t;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t check status OK
|
||||
select * from t;
|
||||
i f c
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
3 3.3 c
|
||||
select * from t where f < 2.5;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
drop table t;
|
||||
"4. Hit crash point on completing drop of all indexes before creation"
|
||||
" of index is commenced."
|
||||
use test;
|
||||
set global innodb_file_per_table = 1;
|
||||
SET innodb_strict_mode=OFF;
|
||||
create table t (
|
||||
i int, f float, c char,
|
||||
primary key pk(i), unique findex(f), index ck(c))
|
||||
engine = innodb row_format = compressed
|
||||
key_block_size = 4;
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
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 session debug = "+d,ib_trunc_crash_drop_reinit_done_create_to_start";
|
||||
Warnings:
|
||||
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
|
||||
truncate table t;
|
||||
ERROR HY000: Lost connection to MySQL server during query
|
||||
check table t;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t check status OK
|
||||
select * from t;
|
||||
i f c
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
3 3.3 c
|
||||
select * from t where f < 2.5;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
drop table t;
|
||||
"5. Hit crash point while creating indexes."
|
||||
use test;
|
||||
set global innodb_file_per_table = 1;
|
||||
SET innodb_strict_mode=OFF;
|
||||
create table t (
|
||||
i int, f float, c char,
|
||||
primary key pk(i), unique findex(f), index ck(c))
|
||||
engine = innodb row_format = compressed
|
||||
key_block_size = 4;
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
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 session debug = "+d,ib_trunc_crash_on_create_of_clust_index";
|
||||
Warnings:
|
||||
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
|
||||
truncate table t;
|
||||
ERROR HY000: Lost connection to MySQL server during query
|
||||
check table t;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t check status OK
|
||||
select * from t;
|
||||
i f c
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
3 3.3 c
|
||||
select * from t where f < 2.5;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
drop table t;
|
||||
use test;
|
||||
set global innodb_file_per_table = 1;
|
||||
SET innodb_strict_mode=OFF;
|
||||
create table t (
|
||||
i int, f float, c char,
|
||||
primary key pk(i), unique findex(f))
|
||||
engine = innodb row_format = compressed
|
||||
key_block_size = 4;
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
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 session debug = "+d,ib_trunc_crash_on_create_of_uniq_index";
|
||||
Warnings:
|
||||
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
|
||||
truncate table t;
|
||||
ERROR HY000: Lost connection to MySQL server during query
|
||||
check table t;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t check status OK
|
||||
select * from t;
|
||||
i f c
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
3 3.3 c
|
||||
select * from t where f < 2.5;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
drop table t;
|
||||
use test;
|
||||
set global innodb_file_per_table = 1;
|
||||
SET innodb_strict_mode=OFF;
|
||||
create table t (
|
||||
i int, f float, c char,
|
||||
primary key pk(i), index ck(c))
|
||||
engine = innodb row_format = compressed
|
||||
key_block_size = 4;
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
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 session debug = "+d,ib_trunc_crash_on_create_of_sec_index";
|
||||
Warnings:
|
||||
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
|
||||
truncate table t;
|
||||
ERROR HY000: Lost connection to MySQL server during query
|
||||
check table t;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t check status OK
|
||||
select * from t;
|
||||
i f c
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
3 3.3 c
|
||||
select * from t where f < 2.5;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
drop table t;
|
||||
"6. Hit crash point after data is updated to system-table and"
|
||||
" in-memory dict."
|
||||
use test;
|
||||
set global innodb_file_per_table = 1;
|
||||
SET innodb_strict_mode=OFF;
|
||||
create table t (
|
||||
i int, f float, c char,
|
||||
primary key pk(i), unique findex(f), index ck(c))
|
||||
engine = innodb row_format = compressed
|
||||
key_block_size = 4;
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
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 session debug = "+d,ib_trunc_crash_on_updating_dict_sys_info";
|
||||
Warnings:
|
||||
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
|
||||
truncate table t;
|
||||
ERROR HY000: Lost connection to MySQL server during query
|
||||
check table t;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t check status OK
|
||||
select * from t;
|
||||
i f c
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
3 3.3 c
|
||||
select * from t where f < 2.5;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
drop table t;
|
||||
"7. Hit crash point before/after log checkpoint is done."
|
||||
use test;
|
||||
set global innodb_file_per_table = 1;
|
||||
SET innodb_strict_mode=OFF;
|
||||
create table t (
|
||||
i int, f float, c char,
|
||||
primary key pk(i), unique findex(f), index ck(c))
|
||||
engine = innodb row_format = compressed
|
||||
key_block_size = 4;
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
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 session debug = "+d,ib_trunc_crash_before_log_removal";
|
||||
Warnings:
|
||||
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
|
||||
truncate table t;
|
||||
ERROR HY000: Lost connection to MySQL server during query
|
||||
check table t;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t check status OK
|
||||
select * from t;
|
||||
i f c
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t where f < 2.5;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
drop table t;
|
||||
use test;
|
||||
set global innodb_file_per_table = 1;
|
||||
SET innodb_strict_mode=OFF;
|
||||
create table t (
|
||||
i int, f float, c char,
|
||||
primary key pk(i), unique findex(f), index ck(c))
|
||||
engine = innodb row_format = compressed
|
||||
key_block_size = 4;
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
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 session debug = "+d,ib_trunc_crash_after_truncate_done";
|
||||
Warnings:
|
||||
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
|
||||
truncate table t;
|
||||
ERROR HY000: Lost connection to MySQL server during query
|
||||
check table t;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t check status OK
|
||||
select * from t;
|
||||
i f c
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
3 3.3 c
|
||||
select * from t where f < 2.5;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
drop table t;
|
||||
set global innodb_file_per_table = 1;
|
||||
call mtr.add_suppression("does not exist in the InnoDB internal");
|
||||
set global innodb_file_per_table = on;
|
||||
"1. Hit crash point on completing drop of all indexes before creation"
|
||||
" of index is commenced."
|
||||
set global innodb_file_per_table = 1;
|
||||
set innodb_strict_mode=off;
|
||||
create temporary table t (
|
||||
i int, f float, c char,
|
||||
primary key pk(i), unique findex(f), index ck(c))
|
||||
engine = innodb row_format = compressed
|
||||
key_block_size = 4;
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
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 session debug = "+d,ib_trunc_crash_drop_reinit_done_create_to_start";
|
||||
Warnings:
|
||||
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
|
||||
truncate table t;
|
||||
ERROR HY000: Lost connection to MySQL server during query
|
||||
check table t;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t check Error Table 'test.t' doesn't exist
|
||||
test.t check status Operation failed
|
||||
"2. Hit crash point after data is updated to system-table and"
|
||||
" in-memory dict."
|
||||
set global innodb_file_per_table = 1;
|
||||
set innodb_strict_mode=off;
|
||||
create temporary table t (
|
||||
i int, f float, c char,
|
||||
primary key pk(i), unique findex(f), index ck(c))
|
||||
engine = innodb row_format = compressed
|
||||
key_block_size = 4;
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
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 session debug = "+d,ib_trunc_crash_on_updating_dict_sys_info";
|
||||
Warnings:
|
||||
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
|
||||
truncate table t;
|
||||
ERROR HY000: Lost connection to MySQL server during query
|
||||
check table t;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t check Error Table 'test.t' doesn't exist
|
||||
test.t check status Operation failed
|
||||
set global innodb_file_per_table = 1;
|
||||
@@ -1,462 +0,0 @@
|
||||
call mtr.add_suppression("The file '.*' already exists though the corresponding table did not exist in the InnoDB data dictionary");
|
||||
call mtr.add_suppression("Cannot create file '.*'");
|
||||
call mtr.add_suppression("InnoDB: Error number 17 means 'File exists'");
|
||||
set global innodb_file_per_table = on;
|
||||
"1. Hit crash point while writing redo log."
|
||||
use test;
|
||||
set global innodb_file_per_table = 1;
|
||||
SET innodb_strict_mode=OFF;
|
||||
create table t (
|
||||
i int, f float, c char,
|
||||
primary key pk(i), unique findex(f), index ck(c))
|
||||
engine=innodb row_format=compressed
|
||||
key_block_size=8;
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
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 session debug = "+d,ib_trunc_crash_while_writing_redo_log";
|
||||
Warnings:
|
||||
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
|
||||
truncate table t;
|
||||
ERROR HY000: Lost connection to MySQL server during query
|
||||
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
|
||||
select * from t where f < 2.5;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
drop table t;
|
||||
"2. Hit crash point on completion of redo log write."
|
||||
use test;
|
||||
set global innodb_file_per_table = 1;
|
||||
SET innodb_strict_mode=OFF;
|
||||
create table t (
|
||||
i int, f float, c char,
|
||||
primary key pk(i), unique findex(f), index ck(c))
|
||||
engine = innodb row_format = compressed
|
||||
key_block_size = 8;
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
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 session debug = "+d,ib_trunc_crash_after_redo_log_write_complete";
|
||||
Warnings:
|
||||
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
|
||||
truncate table t;
|
||||
ERROR HY000: Lost connection to MySQL server during query
|
||||
check table t;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t check status OK
|
||||
select * from t;
|
||||
i f c
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
3 3.3 c
|
||||
select * from t where f < 2.5;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
drop table t;
|
||||
"3. Hit crash point while dropping indexes."
|
||||
use test;
|
||||
set global innodb_file_per_table = 1;
|
||||
SET innodb_strict_mode=OFF;
|
||||
create table t (
|
||||
i int, f float, c char,
|
||||
primary key pk(i), unique findex(f), index ck(c))
|
||||
engine = innodb row_format = compressed
|
||||
key_block_size = 8;
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
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 session debug = "+d,ib_trunc_crash_on_drop_of_clust_index";
|
||||
Warnings:
|
||||
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
|
||||
truncate table t;
|
||||
ERROR HY000: Lost connection to MySQL server during query
|
||||
check table t;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t check status OK
|
||||
select * from t;
|
||||
i f c
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
3 3.3 c
|
||||
select * from t where f < 2.5;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
drop table t;
|
||||
use test;
|
||||
set global innodb_file_per_table = 1;
|
||||
SET innodb_strict_mode=OFF;
|
||||
create table t (
|
||||
i int, f float, c char,
|
||||
primary key pk(i), unique findex(f))
|
||||
engine = innodb row_format = compressed
|
||||
key_block_size = 8;
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
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 session debug = "+d,ib_trunc_crash_on_drop_of_uniq_index";
|
||||
Warnings:
|
||||
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
|
||||
truncate table t;
|
||||
ERROR HY000: Lost connection to MySQL server during query
|
||||
check table t;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t check status OK
|
||||
select * from t;
|
||||
i f c
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
3 3.3 c
|
||||
select * from t where f < 2.5;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
drop table t;
|
||||
use test;
|
||||
set global innodb_file_per_table = 1;
|
||||
SET innodb_strict_mode=OFF;
|
||||
create table t (
|
||||
i int, f float, c char,
|
||||
primary key pk(i), index ck(c))
|
||||
engine = innodb row_format = compressed
|
||||
key_block_size = 8;
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
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 session debug = "+d,ib_trunc_crash_on_drop_of_sec_index";
|
||||
Warnings:
|
||||
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
|
||||
truncate table t;
|
||||
ERROR HY000: Lost connection to MySQL server during query
|
||||
check table t;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t check status OK
|
||||
select * from t;
|
||||
i f c
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
3 3.3 c
|
||||
select * from t where f < 2.5;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
drop table t;
|
||||
"4. Hit crash point on completing drop of all indexes before creation"
|
||||
" of index is commenced."
|
||||
use test;
|
||||
set global innodb_file_per_table = 1;
|
||||
SET innodb_strict_mode=OFF;
|
||||
create table t (
|
||||
i int, f float, c char,
|
||||
primary key pk(i), unique findex(f), index ck(c))
|
||||
engine = innodb row_format = compressed
|
||||
key_block_size = 8;
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
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 session debug = "+d,ib_trunc_crash_drop_reinit_done_create_to_start";
|
||||
Warnings:
|
||||
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
|
||||
truncate table t;
|
||||
ERROR HY000: Lost connection to MySQL server during query
|
||||
check table t;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t check status OK
|
||||
select * from t;
|
||||
i f c
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
3 3.3 c
|
||||
select * from t where f < 2.5;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
drop table t;
|
||||
"5. Hit crash point while creating indexes."
|
||||
use test;
|
||||
set global innodb_file_per_table = 1;
|
||||
SET innodb_strict_mode=OFF;
|
||||
create table t (
|
||||
i int, f float, c char,
|
||||
primary key pk(i), unique findex(f), index ck(c))
|
||||
engine = innodb row_format = compressed
|
||||
key_block_size = 8;
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
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 session debug = "+d,ib_trunc_crash_on_create_of_clust_index";
|
||||
Warnings:
|
||||
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
|
||||
truncate table t;
|
||||
ERROR HY000: Lost connection to MySQL server during query
|
||||
check table t;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t check status OK
|
||||
select * from t;
|
||||
i f c
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
3 3.3 c
|
||||
select * from t where f < 2.5;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
drop table t;
|
||||
use test;
|
||||
set global innodb_file_per_table = 1;
|
||||
SET innodb_strict_mode=OFF;
|
||||
create table t (
|
||||
i int, f float, c char,
|
||||
primary key pk(i), unique findex(f))
|
||||
engine = innodb row_format = compressed
|
||||
key_block_size = 8;
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
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 session debug = "+d,ib_trunc_crash_on_create_of_uniq_index";
|
||||
Warnings:
|
||||
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
|
||||
truncate table t;
|
||||
ERROR HY000: Lost connection to MySQL server during query
|
||||
check table t;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t check status OK
|
||||
select * from t;
|
||||
i f c
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
3 3.3 c
|
||||
select * from t where f < 2.5;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
drop table t;
|
||||
use test;
|
||||
set global innodb_file_per_table = 1;
|
||||
SET innodb_strict_mode=OFF;
|
||||
create table t (
|
||||
i int, f float, c char,
|
||||
primary key pk(i), index ck(c))
|
||||
engine = innodb row_format = compressed
|
||||
key_block_size = 8;
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
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 session debug = "+d,ib_trunc_crash_on_create_of_sec_index";
|
||||
Warnings:
|
||||
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
|
||||
truncate table t;
|
||||
ERROR HY000: Lost connection to MySQL server during query
|
||||
check table t;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t check status OK
|
||||
select * from t;
|
||||
i f c
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
3 3.3 c
|
||||
select * from t where f < 2.5;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
drop table t;
|
||||
"6. Hit crash point after data is updated to system-table and"
|
||||
" in-memory dict."
|
||||
use test;
|
||||
set global innodb_file_per_table = 1;
|
||||
SET innodb_strict_mode=OFF;
|
||||
create table t (
|
||||
i int, f float, c char,
|
||||
primary key pk(i), unique findex(f), index ck(c))
|
||||
engine = innodb row_format = compressed
|
||||
key_block_size = 8;
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
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 session debug = "+d,ib_trunc_crash_on_updating_dict_sys_info";
|
||||
Warnings:
|
||||
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
|
||||
truncate table t;
|
||||
ERROR HY000: Lost connection to MySQL server during query
|
||||
check table t;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t check status OK
|
||||
select * from t;
|
||||
i f c
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
3 3.3 c
|
||||
select * from t where f < 2.5;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
drop table t;
|
||||
"7. Hit crash point before/after log checkpoint is done."
|
||||
use test;
|
||||
set global innodb_file_per_table = 1;
|
||||
SET innodb_strict_mode=OFF;
|
||||
create table t (
|
||||
i int, f float, c char,
|
||||
primary key pk(i), unique findex(f), index ck(c))
|
||||
engine = innodb row_format = compressed
|
||||
key_block_size = 8;
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
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 session debug = "+d,ib_trunc_crash_before_log_removal";
|
||||
Warnings:
|
||||
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
|
||||
truncate table t;
|
||||
ERROR HY000: Lost connection to MySQL server during query
|
||||
check table t;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t check status OK
|
||||
select * from t;
|
||||
i f c
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t where f < 2.5;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
drop table t;
|
||||
use test;
|
||||
set global innodb_file_per_table = 1;
|
||||
SET innodb_strict_mode=OFF;
|
||||
create table t (
|
||||
i int, f float, c char,
|
||||
primary key pk(i), unique findex(f), index ck(c))
|
||||
engine = innodb row_format = compressed
|
||||
key_block_size = 8;
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
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 session debug = "+d,ib_trunc_crash_after_truncate_done";
|
||||
Warnings:
|
||||
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
|
||||
truncate table t;
|
||||
ERROR HY000: Lost connection to MySQL server during query
|
||||
check table t;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t check status OK
|
||||
select * from t;
|
||||
i f c
|
||||
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
|
||||
select * from t;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
3 3.3 c
|
||||
select * from t where f < 2.5;
|
||||
i f c
|
||||
1 1.1 a
|
||||
2 2.2 b
|
||||
drop table t;
|
||||
set global innodb_file_per_table = 1;
|
||||
@@ -1,336 +0,0 @@
|
||||
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;
|
||||
@@ -1,451 +0,0 @@
|
||||
|
||||
####################################################################
|
||||
# TC to check truncate table statement atomicity for single #
|
||||
# tablespace #
|
||||
# Sceanrio covered: #
|
||||
# 1. Debug points added for worklog #
|
||||
# 2. Table with differnt row types #
|
||||
# 3. Transactional statement. #
|
||||
####################################################################
|
||||
|
||||
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_debug.inc
|
||||
--source include/big_test.inc
|
||||
--source include/have_innodb_16k.inc
|
||||
|
||||
# Valgrind would result in a "long semaphore wait" inside InnoDB
|
||||
--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
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
--disable_query_log
|
||||
let $MYSQL_DATA_DIR= `select @@datadir`;
|
||||
let $data_directory = data directory='$MYSQL_TMP_DIR/alt_dir';
|
||||
let $innodb_file_per_table_orig=`select @@innodb_file_per_table`;
|
||||
|
||||
call mtr.add_suppression("InnoDB.*table did not exist in the InnoDB data dictionary.*");
|
||||
call mtr.add_suppression("InnoDB: A page in the doublewrite buffer is not within space bounds.*");
|
||||
call mtr.add_suppression("InnoDB: Cannot create file.*");
|
||||
call mtr.add_suppression("InnoDB: Error number 17 means 'File exists'.*");
|
||||
call mtr.add_suppression("InnoDB: A page in the doublewrite buffer is not within space bounds");
|
||||
call mtr.add_suppression("InnoDB: Error: table .* does not exist in the InnoDB internal");
|
||||
--enable_query_log
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
set global innodb_file_per_table=on;
|
||||
--echo # Verify that 'TRUNCATE TABLE' statement works fine and the size
|
||||
--echo # of .ibd file is equal to the initial size after truncation.
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
drop table if exists t1,t2,t3,t4,t6;
|
||||
let $cnt = 6;
|
||||
while ($cnt) {
|
||||
|
||||
# table with basic data type + primary ,secondary,composite,prefix index
|
||||
create table t1(c1 int not null,
|
||||
c2 int not null,
|
||||
c3 char(255) not null,
|
||||
c4 text(500) not null,
|
||||
c5 blob(500) not null,
|
||||
c6 varchar(500) not null,
|
||||
c7 varchar(500) not null,
|
||||
c8 datetime,
|
||||
c9 decimal(5,3),
|
||||
primary key (c1),
|
||||
index (c3,c4(50),c5(50)),
|
||||
index (c2))
|
||||
engine=innodb row_format=redundant;
|
||||
|
||||
|
||||
create table t2(c1 int not null,
|
||||
c2 int not null,
|
||||
c3 char(255) not null,
|
||||
c4 text(500) not null,
|
||||
c5 blob(500) not null,
|
||||
c6 varchar(500) not null,
|
||||
c7 varchar(500) not null,
|
||||
c8 datetime,
|
||||
c9 decimal(5,3),
|
||||
primary key (c1),
|
||||
index (c3,c4(50),c5(50)),
|
||||
index (c2))
|
||||
engine=innodb row_format=compact;
|
||||
|
||||
|
||||
# with row type , key block size = 4K
|
||||
create table t3(c1 int not null,
|
||||
c2 int not null,
|
||||
c3 char(255) not null,
|
||||
c4 text(500) not null,
|
||||
c5 blob(500) not null,
|
||||
c6 varchar(500) not null,
|
||||
c7 varchar(500) not null,
|
||||
c8 datetime,
|
||||
c9 decimal(5,3),
|
||||
primary key (c1),
|
||||
index (c3,c4(50),c5(50)),
|
||||
index (c2))
|
||||
engine=innodb row_format=compressed key_block_size=4;
|
||||
|
||||
|
||||
create table t4(c1 int not null,
|
||||
c2 int not null,
|
||||
c3 char(255) not null,
|
||||
c4 text(500) not null,
|
||||
c5 blob(500) not null,
|
||||
c6 varchar(500) not null,
|
||||
c7 varchar(500) not null,
|
||||
c8 datetime,
|
||||
c9 decimal(5,3),
|
||||
primary key (c1),
|
||||
index (c3,c4(50),c5(50)),
|
||||
index (c2))
|
||||
engine=innodb row_format=dynamic;
|
||||
|
||||
|
||||
create temporary table t5(c1 int not null,
|
||||
c2 int not null,
|
||||
c3 char(255) not null,
|
||||
c4 text(500) not null,
|
||||
c5 blob(500) not null,
|
||||
c6 varchar(500) not null,
|
||||
c7 varchar(500) not null,
|
||||
c8 datetime,
|
||||
c9 decimal(5,3),
|
||||
primary key (c1),
|
||||
index (c3,c4(50),c5(50)),
|
||||
index (c2))
|
||||
engine=innodb;
|
||||
|
||||
create table t6 ( a int ) engine = innodb;
|
||||
insert into t6 values (50),(100),(150);
|
||||
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
let $n=5;
|
||||
|
||||
# load created tables.
|
||||
while ($n)
|
||||
{
|
||||
start transaction;
|
||||
|
||||
eval insert ignore into t1 values(
|
||||
$n, $n,
|
||||
repeat(concat(' tc3_',$n), 42),
|
||||
repeat(concat(' tc4_',$n), 300),
|
||||
repeat(concat(' tc5_',$n), 300),
|
||||
repeat(concat(' tc6_',$n), 300),
|
||||
repeat(concat(' tc7_',$n), 300),
|
||||
now(), (100.55+$n));
|
||||
|
||||
eval insert ignore into t2 values(
|
||||
$n, $n,
|
||||
repeat(concat(' tc3_',$n), 42),
|
||||
repeat(concat(' tc4_',$n), 300),
|
||||
repeat(concat(' tc5_',$n), 300),
|
||||
repeat(concat(' tc6_',$n), 300),
|
||||
repeat(concat(' tc7_',$n), 300),
|
||||
now(), (100.55+$n));
|
||||
|
||||
eval insert ignore into t3 values(
|
||||
$n, $n,
|
||||
repeat(concat(' tc3_',$n), 42),
|
||||
repeat(concat(' tc4_',$n), 300),
|
||||
repeat(concat(' tc5_',$n), 300),
|
||||
repeat(concat(' tc6_',$n), 300),
|
||||
repeat(concat(' tc7_',$n), 300),
|
||||
now(), (100.55+$n));
|
||||
|
||||
eval insert ignore into t4 values(
|
||||
$n, $n,
|
||||
repeat(concat(' tc3_',$n), 42),
|
||||
repeat(concat(' tc4_',$n), 300),
|
||||
repeat(concat(' tc5_',$n), 300),
|
||||
repeat(concat(' tc6_',$n), 300),
|
||||
repeat(concat(' tc7_',$n), 300),
|
||||
now(), (100.55+$n));
|
||||
|
||||
eval insert ignore into t5 values(
|
||||
$n, $n,
|
||||
repeat(concat(' tc3_',$n), 42),
|
||||
repeat(concat(' tc4_',$n), 300),
|
||||
repeat(concat(' tc5_',$n), 300),
|
||||
repeat(concat(' tc6_',$n), 300),
|
||||
repeat(concat(' tc7_',$n), 300),
|
||||
now(), (100.55+$n));
|
||||
|
||||
if ($n <= 3)
|
||||
{
|
||||
commit;
|
||||
}
|
||||
|
||||
if ($n > 3)
|
||||
{
|
||||
rollback;
|
||||
}
|
||||
|
||||
dec $n;
|
||||
}
|
||||
|
||||
# validate loading of the tables.
|
||||
--enable_result_log
|
||||
--enable_query_log
|
||||
select count(*) from t1;
|
||||
select count(*) from t2;
|
||||
select count(*) from t3;
|
||||
select count(*) from t4;
|
||||
select count(*) from t5;
|
||||
select count(*) from t6;
|
||||
|
||||
# set the debug crash point and exercise them.
|
||||
if ($cnt == 6)
|
||||
{
|
||||
set session debug="+d,ib_trunc_crash_during_drop_index_temp_table";
|
||||
--echo "---debug ib_trunc_crash_during_drop_index_temp_table point---"
|
||||
}
|
||||
if ($cnt == 5)
|
||||
{
|
||||
set session debug="+d,ib_trunc_crash_drop_reinit_done_create_to_start";
|
||||
--echo "---debug ib_trunc_crash_drop_reinit_done_create_to_start---"
|
||||
}
|
||||
|
||||
if ($cnt >= 5) {
|
||||
--echo # Write file to make mysql-test-run.pl expect crash and restart
|
||||
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
||||
--echo # Run the crashing query
|
||||
--error 2013
|
||||
truncate table t5;
|
||||
--source include/wait_until_disconnected.inc
|
||||
--enable_reconnect
|
||||
--echo # Restart the MySQL server
|
||||
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
||||
--source include/wait_until_connected_again.inc
|
||||
--disable_reconnect
|
||||
select count(*) from t1;
|
||||
select count(*) from t2;
|
||||
select count(*) from t3;
|
||||
select count(*) from t4;
|
||||
--error ER_NO_SUCH_TABLE
|
||||
select count(*) from t5;
|
||||
select count(*) from t6;
|
||||
}
|
||||
|
||||
# set the debug crash point and exercise them.
|
||||
if ($cnt == 6)
|
||||
{
|
||||
set session debug="+d,ib_trunc_crash_on_drop_of_sec_index";
|
||||
--echo "---debug ib_trunc_crash_on_drop_of_sec_index point---"
|
||||
}
|
||||
if ($cnt == 5)
|
||||
{
|
||||
set session debug="+d,ib_trunc_crash_on_create_of_sec_index";
|
||||
--echo "---debug ib_trunc_crash_on_create_of_sec_index---"
|
||||
}
|
||||
if ($cnt == 4)
|
||||
{
|
||||
set session debug="+d,ib_trunc_crash_before_log_removal";
|
||||
--echo "---debug ib_trunc_crash_before_log_removal point---"
|
||||
}
|
||||
if ($cnt == 3)
|
||||
{
|
||||
set session debug="+d,ib_trunc_crash_after_truncate_done";
|
||||
--echo "---debug ib_trunc_crash_after_truncate_done point---"
|
||||
}
|
||||
if ($cnt == 2)
|
||||
{
|
||||
set session debug="+d,ib_trunc_crash_after_truncate_done";
|
||||
--echo "---debug ib_trunc_crash_after_truncate_done point---"
|
||||
}
|
||||
if ($cnt == 1)
|
||||
{
|
||||
set session debug="+d,ib_trunc_crash_after_redo_log_write_complete";
|
||||
--echo "---debug ib_trunc_crash_after_redo_log_write_complete point---"
|
||||
}
|
||||
|
||||
--echo # Write file to make mysql-test-run.pl expect crash and restart
|
||||
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
||||
--echo # Run the crashing query
|
||||
--error 2013
|
||||
truncate table t1;
|
||||
--source include/wait_until_disconnected.inc
|
||||
--enable_reconnect
|
||||
--echo # Restart the MySQL server
|
||||
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
||||
--source include/wait_until_connected_again.inc
|
||||
--disable_reconnect
|
||||
select count(*) from t1;
|
||||
select count(*) from t2;
|
||||
select count(*) from t3;
|
||||
select count(*) from t4;
|
||||
--error ER_NO_SUCH_TABLE
|
||||
select count(*) from t5;
|
||||
select count(*) from t6;
|
||||
|
||||
if ($cnt == 6)
|
||||
{
|
||||
set session debug="+d,ib_trunc_crash_on_drop_of_sec_index";
|
||||
--echo "---debug ib_trunc_crash_on_drop_of_sec_index point---"
|
||||
}
|
||||
if ($cnt == 5)
|
||||
{
|
||||
set session debug="+d,ib_trunc_crash_on_create_of_sec_index";
|
||||
--echo "---debug ib_trunc_crash_on_create_of_sec_index---"
|
||||
}
|
||||
if ($cnt == 4)
|
||||
{
|
||||
set session debug="+d,ib_trunc_crash_before_log_removal";
|
||||
--echo "---debug ib_trunc_crash_before_log_removal point---"
|
||||
}
|
||||
if ($cnt == 3)
|
||||
{
|
||||
set session debug="+d,ib_trunc_crash_after_truncate_done";
|
||||
--echo "---debug ib_trunc_crash_after_truncate_done point---"
|
||||
}
|
||||
if ($cnt == 2)
|
||||
{
|
||||
set session debug="+d,ib_trunc_crash_after_truncate_done";
|
||||
--echo "---debug ib_trunc_crash_after_truncate_done point---"
|
||||
}
|
||||
if ($cnt == 1)
|
||||
{
|
||||
set session debug="+d,ib_trunc_crash_after_redo_log_write_complete";
|
||||
--echo "---debug ib_trunc_crash_after_redo_log_write_complete point---"
|
||||
}
|
||||
|
||||
|
||||
--echo # Write file to make mysql-test-run.pl expect crash and restart
|
||||
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
||||
--echo # Run the crashing query
|
||||
--error 2013
|
||||
truncate table t2;
|
||||
--source include/wait_until_disconnected.inc
|
||||
--enable_reconnect
|
||||
--echo # Restart the MySQL server
|
||||
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
||||
--source include/wait_until_connected_again.inc
|
||||
--disable_reconnect
|
||||
select count(*) from t1;
|
||||
select count(*) from t2;
|
||||
select count(*) from t3;
|
||||
select count(*) from t4;
|
||||
--error ER_NO_SUCH_TABLE
|
||||
select count(*) from t5;
|
||||
select count(*) from t6;
|
||||
|
||||
if ($cnt == 6)
|
||||
{
|
||||
set session debug="+d,ib_trunc_crash_on_drop_of_sec_index";
|
||||
--echo "---debug ib_trunc_crash_on_drop_of_sec_index point---"
|
||||
}
|
||||
if ($cnt == 5)
|
||||
{
|
||||
set session debug="+d,ib_trunc_crash_on_create_of_sec_index";
|
||||
--echo "---debug ib_trunc_crash_on_create_of_sec_index---"
|
||||
}
|
||||
if ($cnt == 4)
|
||||
{
|
||||
set session debug="+d,ib_trunc_crash_before_log_removal";
|
||||
--echo "---debug ib_trunc_crash_before_log_removal point---"
|
||||
}
|
||||
if ($cnt == 3)
|
||||
{
|
||||
set session debug="+d,ib_trunc_crash_after_truncate_done";
|
||||
--echo "---debug ib_trunc_crash_after_truncate_done point---"
|
||||
}
|
||||
if ($cnt == 2)
|
||||
{
|
||||
set session debug="+d,ib_trunc_crash_after_truncate_done";
|
||||
--echo "---debug ib_trunc_crash_after_truncate_done point---"
|
||||
}
|
||||
if ($cnt == 1)
|
||||
{
|
||||
set session debug="+d,ib_trunc_crash_after_redo_log_write_complete";
|
||||
--echo "---debug ib_trunc_crash_after_redo_log_write_complete point---"
|
||||
}
|
||||
|
||||
|
||||
--echo # Write file to make mysql-test-run.pl expect crash and restart
|
||||
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
||||
--echo # Run the crashing query
|
||||
--error 2013
|
||||
truncate table t3;
|
||||
--source include/wait_until_disconnected.inc
|
||||
--enable_reconnect
|
||||
--echo # Restart the MySQL server
|
||||
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
||||
--source include/wait_until_connected_again.inc
|
||||
--disable_reconnect
|
||||
select count(*) from t1;
|
||||
select count(*) from t2;
|
||||
select count(*) from t3;
|
||||
select count(*) from t4;
|
||||
--error ER_NO_SUCH_TABLE
|
||||
select count(*) from t5;
|
||||
select count(*) from t6;
|
||||
|
||||
|
||||
if ($cnt == 6)
|
||||
{
|
||||
set session debug="+d,ib_trunc_crash_on_drop_of_sec_index";
|
||||
--echo "---debug ib_trunc_crash_on_drop_of_sec_index point---"
|
||||
}
|
||||
if ($cnt == 5)
|
||||
{
|
||||
set session debug="+d,ib_trunc_crash_on_create_of_sec_index";
|
||||
--echo "---debug ib_trunc_crash_on_create_of_sec_index---"
|
||||
}
|
||||
if ($cnt == 4)
|
||||
{
|
||||
set session debug="+d,ib_trunc_crash_before_log_removal";
|
||||
--echo "---debug ib_trunc_crash_before_log_removal point---"
|
||||
}
|
||||
if ($cnt == 3)
|
||||
{
|
||||
set session debug="+d,ib_trunc_crash_after_truncate_done";
|
||||
--echo "---debug ib_trunc_crash_after_truncate_done point---"
|
||||
}
|
||||
if ($cnt == 2)
|
||||
{
|
||||
set session debug="+d,ib_trunc_crash_after_truncate_done";
|
||||
--echo "---debug ib_trunc_crash_after_truncate_done point---"
|
||||
}
|
||||
if ($cnt == 1)
|
||||
{
|
||||
set session debug="+d,ib_trunc_crash_after_redo_log_write_complete";
|
||||
--echo "---debug ib_trunc_crash_after_redo_log_write_complete point---"
|
||||
}
|
||||
|
||||
--echo # Write file to make mysql-test-run.pl expect crash and restart
|
||||
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
||||
--echo # Run the crashing query
|
||||
--error 2013
|
||||
truncate table t4;
|
||||
--source include/wait_until_disconnected.inc
|
||||
--enable_reconnect
|
||||
--echo # Restart the MySQL server
|
||||
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
||||
--source include/wait_until_connected_again.inc
|
||||
--disable_reconnect
|
||||
select count(*) from t1;
|
||||
select count(*) from t2;
|
||||
select count(*) from t3;
|
||||
select count(*) from t4;
|
||||
--error ER_NO_SUCH_TABLE
|
||||
select count(*) from t5;
|
||||
select count(*) from t6;
|
||||
|
||||
drop table t1, t2, t3, t4, t6;
|
||||
|
||||
dec $cnt;
|
||||
|
||||
--disable_query_log
|
||||
eval set global innodb_file_per_table=$innodb_file_per_table_orig;
|
||||
--enable_query_log
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
#
|
||||
# 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
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
#
|
||||
# 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
|
||||
@@ -1,25 +0,0 @@
|
||||
#
|
||||
# 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=8k
|
||||
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_innodb_8k.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 = 8;
|
||||
--source suite/innodb/include/innodb_wl6501_crash.inc
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
#
|
||||
# WL#6501: make truncate table atomic
|
||||
#
|
||||
|
||||
# load table with some significiant amount of data
|
||||
# and then try truncate
|
||||
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_debug.inc
|
||||
--source include/big_test.inc
|
||||
--source include/have_innodb_16k.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
|
||||
|
||||
|
||||
# Single-Tablespace/Non-Compressed
|
||||
let $wl6501_file_per_table = 1;
|
||||
let $wl6501_row_fmt = compact;
|
||||
let $wl6501_kbs = 16;
|
||||
--source suite/innodb_zip/include/innodb_wl6501_scale.inc
|
||||
|
||||
# Single-Tablespace/Compressed
|
||||
let $wl6501_file_per_table = 1;
|
||||
let $wl6501_row_fmt = compressed;
|
||||
let $wl6501_kbs = 16;
|
||||
--source suite/innodb_zip/include/innodb_wl6501_scale.inc
|
||||
|
||||
# System-Tablespace/Non-Compressed
|
||||
let $wl6501_file_per_table = 0;
|
||||
let $wl6501_row_fmt = compact;
|
||||
let $wl6501_kbs = 16;
|
||||
--source suite/innodb_zip/include/innodb_wl6501_scale.inc
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -560,7 +560,8 @@ buf_dblwr_process()
|
||||
is scheduled for truncation or was truncated
|
||||
and we have parsed an MLOG_TRUNCATE record. */
|
||||
if (!srv_is_tablespace_truncated(space_id)
|
||||
&& !srv_was_tablespace_truncated(space)) {
|
||||
&& !srv_was_tablespace_truncated(space)
|
||||
&& !srv_is_undo_tablespace(space_id)) {
|
||||
ib::warn() << "A copy of page " << page_id
|
||||
<< " in the doublewrite buffer slot "
|
||||
<< page_no_dblwr
|
||||
|
||||
@@ -557,13 +557,15 @@ the list as they age towards the tail of the LRU.
|
||||
@param[in] id tablespace identifier
|
||||
@param[in] observer flush observer (to check for interrupt),
|
||||
or NULL if the files should not be written to
|
||||
@return whether all dirty pages were freed */
|
||||
@param[in] first first page to be flushed or evicted
|
||||
@return whether all matching dirty pages were removed */
|
||||
static MY_ATTRIBUTE((warn_unused_result))
|
||||
bool
|
||||
buf_flush_or_remove_pages(
|
||||
buf_pool_t* buf_pool,
|
||||
ulint id,
|
||||
FlushObserver* observer)
|
||||
FlushObserver* observer,
|
||||
ulint first)
|
||||
{
|
||||
buf_page_t* prev;
|
||||
buf_page_t* bpage;
|
||||
@@ -604,6 +606,8 @@ rescan:
|
||||
} else if (id != bpage->id.space()) {
|
||||
/* Skip this block, because it is for a
|
||||
different tablespace. */
|
||||
} else if (bpage->id.page_no() < first) {
|
||||
/* Skip this block, because it is below the limit. */
|
||||
} else if (!buf_flush_or_remove_page(
|
||||
buf_pool, bpage, observer != NULL)) {
|
||||
|
||||
@@ -667,18 +671,20 @@ the tail of the LRU list.
|
||||
@param[in] id tablespace identifier
|
||||
@param[in] observer flush observer,
|
||||
or NULL if the files should not be written to
|
||||
*/
|
||||
@param[in] first first page to be flushed or evicted */
|
||||
static
|
||||
void
|
||||
buf_flush_dirty_pages(
|
||||
buf_pool_t* buf_pool,
|
||||
ulint id,
|
||||
FlushObserver* observer)
|
||||
FlushObserver* observer,
|
||||
ulint first)
|
||||
{
|
||||
for (;;) {
|
||||
buf_pool_mutex_enter(buf_pool);
|
||||
|
||||
bool freed = buf_flush_or_remove_pages(buf_pool, id, observer);
|
||||
bool freed = buf_flush_or_remove_pages(buf_pool, id, observer,
|
||||
first);
|
||||
|
||||
buf_pool_mutex_exit(buf_pool);
|
||||
|
||||
@@ -693,20 +699,24 @@ buf_flush_dirty_pages(
|
||||
}
|
||||
|
||||
ut_ad((observer && observer->is_interrupted())
|
||||
|| first
|
||||
|| buf_pool_get_dirty_pages_count(buf_pool, id, observer) == 0);
|
||||
}
|
||||
|
||||
/** Empty the flush list for all pages belonging to a tablespace.
|
||||
@param[in] id tablespace identifier
|
||||
@param[in] observer flush observer,
|
||||
or NULL if nothing is to be written */
|
||||
void buf_LRU_flush_or_remove_pages(ulint id, FlushObserver* observer)
|
||||
or NULL if nothing is to be written
|
||||
@param[in] first first page to be flushed or evicted */
|
||||
void buf_LRU_flush_or_remove_pages(ulint id, FlushObserver* observer,
|
||||
ulint first)
|
||||
{
|
||||
/* Pages in the system tablespace must never be discarded. */
|
||||
ut_ad(id || observer);
|
||||
|
||||
for (ulint i = 0; i < srv_buf_pool_instances; i++) {
|
||||
buf_flush_dirty_pages(buf_pool_from_array(i), id, observer);
|
||||
buf_flush_dirty_pages(buf_pool_from_array(i), id, observer,
|
||||
first);
|
||||
}
|
||||
|
||||
if (observer && !observer->is_interrupted()) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2015, 2017, MariaDB Corporation.
|
||||
Copyright (c) 2015, 2018, MariaDB Corporation.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
@@ -176,17 +176,6 @@ buf_read_page_low(
|
||||
dst = ((buf_block_t*) bpage)->frame;
|
||||
}
|
||||
|
||||
DBUG_EXECUTE_IF(
|
||||
"innodb_invalid_read_after_truncate",
|
||||
if (fil_space_t* space = fil_space_acquire(page_id.space())) {
|
||||
if (!strcmp(space->name, "test/t1")
|
||||
&& page_id.page_no() == space->size - 1) {
|
||||
type = 0;
|
||||
sync = true;
|
||||
}
|
||||
space->release();
|
||||
});
|
||||
|
||||
IORequest request(type | IORequest::READ);
|
||||
|
||||
*err = fil_io(
|
||||
@@ -332,19 +321,6 @@ buf_read_ahead_random(
|
||||
that is, reside near the start of the LRU list. */
|
||||
|
||||
for (i = low; i < high; i++) {
|
||||
DBUG_EXECUTE_IF(
|
||||
"innodb_invalid_read_after_truncate",
|
||||
if (fil_space_t* space = fil_space_acquire(
|
||||
page_id.space())) {
|
||||
bool skip = !strcmp(space->name, "test/t1");
|
||||
space->release();
|
||||
if (skip) {
|
||||
high = space->size;
|
||||
buf_pool_mutex_exit(buf_pool);
|
||||
goto read_ahead;
|
||||
}
|
||||
});
|
||||
|
||||
const buf_page_t* bpage = buf_page_hash_get(
|
||||
buf_pool, page_id_t(page_id.space(), i));
|
||||
|
||||
|
||||
@@ -1510,16 +1510,11 @@ dict_create_or_check_foreign_constraint_tables(void)
|
||||
/* Check which incomplete table definition to drop. */
|
||||
|
||||
if (sys_foreign_err == DB_CORRUPTION) {
|
||||
ib::warn() << "Dropping incompletely created"
|
||||
" SYS_FOREIGN table.";
|
||||
row_drop_table_for_mysql("SYS_FOREIGN", trx, TRUE, TRUE);
|
||||
row_drop_table_after_create_fail("SYS_FOREIGN", trx);
|
||||
}
|
||||
|
||||
if (sys_foreign_cols_err == DB_CORRUPTION) {
|
||||
ib::warn() << "Dropping incompletely created"
|
||||
" SYS_FOREIGN_COLS table.";
|
||||
|
||||
row_drop_table_for_mysql("SYS_FOREIGN_COLS", trx, TRUE, TRUE);
|
||||
row_drop_table_after_create_fail("SYS_FOREIGN_COLS", trx);
|
||||
}
|
||||
|
||||
ib::info() << "Creating foreign key constraint system tables.";
|
||||
@@ -1571,8 +1566,8 @@ dict_create_or_check_foreign_constraint_tables(void)
|
||||
ut_ad(err == DB_OUT_OF_FILE_SPACE
|
||||
|| err == DB_TOO_MANY_CONCURRENT_TRXS);
|
||||
|
||||
row_drop_table_for_mysql("SYS_FOREIGN", trx, TRUE, TRUE);
|
||||
row_drop_table_for_mysql("SYS_FOREIGN_COLS", trx, TRUE, TRUE);
|
||||
row_drop_table_after_create_fail("SYS_FOREIGN", trx);
|
||||
row_drop_table_after_create_fail("SYS_FOREIGN_COLS", trx);
|
||||
|
||||
if (err == DB_OUT_OF_FILE_SPACE) {
|
||||
err = DB_MUST_GET_MORE_FILE_SPACE;
|
||||
@@ -1640,9 +1635,7 @@ dict_create_or_check_sys_virtual()
|
||||
/* Check which incomplete table definition to drop. */
|
||||
|
||||
if (err == DB_CORRUPTION) {
|
||||
ib::warn() << "Dropping incompletely created"
|
||||
" SYS_VIRTUAL table.";
|
||||
row_drop_table_for_mysql("SYS_VIRTUAL", trx, false, TRUE);
|
||||
row_drop_table_after_create_fail("SYS_VIRTUAL", trx);
|
||||
}
|
||||
|
||||
ib::info() << "Creating sys_virtual system tables.";
|
||||
@@ -1676,7 +1669,7 @@ dict_create_or_check_sys_virtual()
|
||||
ut_ad(err == DB_OUT_OF_FILE_SPACE
|
||||
|| err == DB_TOO_MANY_CONCURRENT_TRXS);
|
||||
|
||||
row_drop_table_for_mysql("SYS_VIRTUAL", trx, false, TRUE);
|
||||
row_drop_table_after_create_fail("SYS_VIRTUAL", trx);
|
||||
|
||||
if (err == DB_OUT_OF_FILE_SPACE) {
|
||||
err = DB_MUST_GET_MORE_FILE_SPACE;
|
||||
@@ -2296,16 +2289,11 @@ dict_create_or_check_sys_tablespace(void)
|
||||
/* Check which incomplete table definition to drop. */
|
||||
|
||||
if (sys_tablespaces_err == DB_CORRUPTION) {
|
||||
ib::warn() << "Dropping incompletely created"
|
||||
" SYS_TABLESPACES table.";
|
||||
row_drop_table_for_mysql("SYS_TABLESPACES", trx, TRUE, TRUE);
|
||||
row_drop_table_after_create_fail("SYS_TABLESPACES", trx);
|
||||
}
|
||||
|
||||
if (sys_datafiles_err == DB_CORRUPTION) {
|
||||
ib::warn() << "Dropping incompletely created"
|
||||
" SYS_DATAFILES table.";
|
||||
|
||||
row_drop_table_for_mysql("SYS_DATAFILES", trx, TRUE, TRUE);
|
||||
row_drop_table_after_create_fail("SYS_DATAFILES", trx);
|
||||
}
|
||||
|
||||
ib::info() << "Creating tablespace and datafile system tables.";
|
||||
@@ -2340,8 +2328,8 @@ dict_create_or_check_sys_tablespace(void)
|
||||
|| err == DB_DUPLICATE_KEY
|
||||
|| err == DB_TOO_MANY_CONCURRENT_TRXS);
|
||||
|
||||
row_drop_table_for_mysql("SYS_TABLESPACES", trx, TRUE, TRUE);
|
||||
row_drop_table_for_mysql("SYS_DATAFILES", trx, TRUE, TRUE);
|
||||
row_drop_table_after_create_fail("SYS_TABLESPACES", trx);
|
||||
row_drop_table_after_create_fail("SYS_DATAFILES", trx);
|
||||
|
||||
if (err == DB_OUT_OF_FILE_SPACE) {
|
||||
err = DB_MUST_GET_MORE_FILE_SPACE;
|
||||
|
||||
@@ -942,8 +942,8 @@ fil_crypt_read_crypt_data(fil_space_t* space)
|
||||
/* The encryption metadata has already been read, or
|
||||
the tablespace is not encrypted and the file has been
|
||||
opened already, or the file cannot be accessed,
|
||||
likely due to a concurrent TRUNCATE or
|
||||
RENAME or DROP (possibly as part of ALTER TABLE).
|
||||
likely due to a concurrent DROP
|
||||
(possibly as part of TRUNCATE or ALTER TABLE).
|
||||
FIXME: The file can become unaccessible any time
|
||||
after this check! We should really remove this
|
||||
function and instead make crypt_data an integral
|
||||
@@ -1627,7 +1627,7 @@ fil_crypt_get_page_throttle_func(
|
||||
ut_ad(space->referenced());
|
||||
|
||||
/* Before reading from tablespace we need to make sure that
|
||||
the tablespace is not about to be dropped or truncated. */
|
||||
the tablespace is not about to be dropped. */
|
||||
if (space->is_stopping()) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -2131,13 +2131,14 @@ fil_op_write_log(
|
||||
byte* log_ptr;
|
||||
ulint len;
|
||||
|
||||
ut_ad(first_page_no == 0);
|
||||
ut_ad(first_page_no == 0 || type == MLOG_FILE_CREATE2);
|
||||
ut_ad(fsp_flags_is_valid(flags, space_id));
|
||||
|
||||
/* fil_name_parse() requires that there be at least one path
|
||||
separator and that the file path end with ".ibd". */
|
||||
ut_ad(strchr(path, OS_PATH_SEPARATOR) != NULL);
|
||||
ut_ad(strcmp(&path[strlen(path) - strlen(DOT_IBD)], DOT_IBD) == 0);
|
||||
ut_ad(first_page_no /* trimming an undo tablespace */
|
||||
|| !strcmp(&path[strlen(path) - strlen(DOT_IBD)], DOT_IBD));
|
||||
|
||||
log_ptr = mlog_open(mtr, 11 + 4 + 2 + 1);
|
||||
|
||||
@@ -2351,7 +2352,7 @@ fil_op_replay_rename(
|
||||
enum fil_operation_t {
|
||||
FIL_OPERATION_DELETE, /*!< delete a single-table tablespace */
|
||||
FIL_OPERATION_CLOSE, /*!< close a single-table tablespace */
|
||||
FIL_OPERATION_TRUNCATE /*!< truncate a single-table tablespace */
|
||||
FIL_OPERATION_TRUNCATE /*!< truncate an undo tablespace */
|
||||
};
|
||||
|
||||
/** Check for pending operations.
|
||||
@@ -2484,8 +2485,6 @@ fil_check_pending_operations(
|
||||
|
||||
/* Check for pending IO. */
|
||||
|
||||
*path = 0;
|
||||
|
||||
for (;;) {
|
||||
sp = fil_space_get_by_id(id);
|
||||
|
||||
@@ -2498,7 +2497,7 @@ fil_check_pending_operations(
|
||||
|
||||
count = fil_check_pending_io(operation, sp, &node, count);
|
||||
|
||||
if (count == 0) {
|
||||
if (count == 0 && path) {
|
||||
*path = mem_strdup(node->name);
|
||||
}
|
||||
|
||||
@@ -2586,7 +2585,8 @@ fil_close_tablespace(
|
||||
not (necessarily) protected by meta-data locks.
|
||||
(Rollback would generally be protected, but rollback of
|
||||
FOREIGN KEY CASCADE/SET NULL is not protected by meta-data locks
|
||||
but only by InnoDB table locks, which may be broken by TRUNCATE TABLE.)
|
||||
but only by InnoDB table locks, which may be broken by
|
||||
lock_remove_all_on_table().)
|
||||
@param[in] table persistent table
|
||||
checked @return whether the table is accessible */
|
||||
bool
|
||||
@@ -2728,85 +2728,33 @@ fil_delete_tablespace(
|
||||
return(err);
|
||||
}
|
||||
|
||||
/** Truncate the tablespace to needed size.
|
||||
@param[in,out] space tablespace truncate
|
||||
@param[in] size_in_pages truncate size.
|
||||
@return true if truncate was successful. */
|
||||
bool fil_truncate_tablespace(fil_space_t* space, ulint size_in_pages)
|
||||
/** Prepare to truncate an undo tablespace.
|
||||
@param[in] space_id undo tablespace id
|
||||
@return the tablespace
|
||||
@retval NULL if tablespace not found */
|
||||
fil_space_t* fil_truncate_prepare(ulint space_id)
|
||||
{
|
||||
/* Step-1: Prepare tablespace for truncate. This involves
|
||||
stopping all the new operations + IO on that tablespace
|
||||
and ensuring that related pages are flushed to disk. */
|
||||
if (fil_prepare_for_truncate(space->id) != DB_SUCCESS) {
|
||||
return(false);
|
||||
/* Stop all I/O on the tablespace and ensure that related
|
||||
pages are flushed to disk. */
|
||||
fil_space_t* space;
|
||||
if (fil_check_pending_operations(space_id, FIL_OPERATION_TRUNCATE,
|
||||
&space, NULL) != DB_SUCCESS) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Step-2: Invalidate buffer pool pages belonging to the tablespace
|
||||
to re-create. Remove all insert buffer entries for the tablespace */
|
||||
buf_LRU_flush_or_remove_pages(space->id, NULL);
|
||||
|
||||
/* Step-3: Truncate the tablespace and accordingly update
|
||||
the fil_space_t handler that is used to access this tablespace. */
|
||||
mutex_enter(&fil_system.mutex);
|
||||
|
||||
/* The following code must change when InnoDB supports
|
||||
multiple datafiles per tablespace. */
|
||||
ut_a(UT_LIST_GET_LEN(space->chain) == 1);
|
||||
|
||||
fil_node_t* node = UT_LIST_GET_FIRST(space->chain);
|
||||
|
||||
ut_ad(node->is_open());
|
||||
|
||||
space->size = node->size = size_in_pages;
|
||||
|
||||
bool success = os_file_truncate(node->name, node->handle, 0);
|
||||
if (success) {
|
||||
|
||||
os_offset_t size = os_offset_t(size_in_pages)
|
||||
<< srv_page_size_shift;
|
||||
|
||||
success = os_file_set_size(
|
||||
node->name, node->handle, size,
|
||||
FSP_FLAGS_HAS_PAGE_COMPRESSION(space->flags));
|
||||
|
||||
if (success) {
|
||||
space->stop_new_ops = false;
|
||||
space->is_being_truncated = false;
|
||||
}
|
||||
}
|
||||
|
||||
mutex_exit(&fil_system.mutex);
|
||||
|
||||
return(success);
|
||||
ut_ad(space != NULL);
|
||||
return space;
|
||||
}
|
||||
|
||||
/*******************************************************************//**
|
||||
Prepare for truncating a single-table tablespace.
|
||||
1) Check pending operations on a tablespace;
|
||||
2) Remove all insert buffer entries for the tablespace;
|
||||
@return DB_SUCCESS or error */
|
||||
dberr_t
|
||||
fil_prepare_for_truncate(
|
||||
/*=====================*/
|
||||
ulint id) /*!< in: space id */
|
||||
/** Write log about an undo tablespace truncate operation. */
|
||||
void fil_truncate_log(fil_space_t* space, ulint size, mtr_t* mtr)
|
||||
{
|
||||
char* path = 0;
|
||||
fil_space_t* space = 0;
|
||||
|
||||
ut_a(!is_system_tablespace(id));
|
||||
|
||||
dberr_t err = fil_check_pending_operations(
|
||||
id, FIL_OPERATION_TRUNCATE, &space, &path);
|
||||
|
||||
ut_free(path);
|
||||
|
||||
if (err == DB_TABLESPACE_NOT_FOUND) {
|
||||
ib::error() << "Cannot truncate tablespace " << id
|
||||
<< " because it is not found in the tablespace"
|
||||
" memory cache.";
|
||||
}
|
||||
|
||||
return(err);
|
||||
/* Write a MLOG_FILE_CREATE2 record with the new size, so that
|
||||
recovery and backup will ignore any preceding redo log records
|
||||
for writing pages that are after the new end of the tablespace. */
|
||||
ut_ad(UT_LIST_GET_LEN(space->chain) == 1);
|
||||
const fil_node_t* file = UT_LIST_GET_FIRST(space->chain);
|
||||
fil_op_write_log(MLOG_FILE_CREATE2, space->id, size, file->name,
|
||||
NULL, space->flags & ~FSP_FLAGS_MEM_MASK, mtr);
|
||||
}
|
||||
|
||||
/*******************************************************************//**
|
||||
@@ -4392,7 +4340,6 @@ fil_io(
|
||||
if (space->id != TRX_SYS_SPACE
|
||||
&& UT_LIST_GET_LEN(space->chain) == 1
|
||||
&& (srv_is_tablespace_truncated(space->id)
|
||||
|| space->is_being_truncated
|
||||
|| srv_was_tablespace_truncated(space))
|
||||
&& req_type.is_read()) {
|
||||
|
||||
@@ -5004,7 +4951,7 @@ fil_space_validate_for_mtr_commit(
|
||||
fil_space_t::release() after mtr_commit(). This is why
|
||||
n_pending_ops should not be zero if stop_new_ops is set. */
|
||||
ut_ad(!space->stop_new_ops
|
||||
|| space->is_being_truncated /* TRUNCATE sets stop_new_ops */
|
||||
|| space->is_being_truncated /* fil_truncate_prepare() */
|
||||
|| space->referenced());
|
||||
}
|
||||
#endif /* UNIV_DEBUG */
|
||||
@@ -5230,7 +5177,6 @@ truncate_t::truncate(
|
||||
}
|
||||
|
||||
space->stop_new_ops = false;
|
||||
space->is_being_truncated = false;
|
||||
|
||||
/* If we opened the file in this function, close it. */
|
||||
if (!already_open) {
|
||||
@@ -5405,7 +5351,7 @@ fil_space_keyrotate_next(
|
||||
}
|
||||
|
||||
/* Skip spaces that are being created by fil_ibd_create(),
|
||||
or dropped or truncated. Note that rotation_list contains only
|
||||
or dropped. Note that rotation_list contains only
|
||||
space->purpose == FIL_TYPE_TABLESPACE. */
|
||||
while (space != NULL
|
||||
&& (UT_LIST_GET_LEN(space->chain) == 0
|
||||
|
||||
@@ -625,7 +625,6 @@ fsp_space_modify_check(
|
||||
ut_ad(space->purpose == FIL_TYPE_TEMPORARY
|
||||
|| space->purpose == FIL_TYPE_IMPORT
|
||||
|| my_atomic_loadlint(&space->redo_skipped_count)
|
||||
|| space->is_being_truncated
|
||||
|| srv_is_tablespace_truncated(space->id));
|
||||
return;
|
||||
case MTR_LOG_ALL:
|
||||
|
||||
@@ -1469,7 +1469,8 @@ fts_drop_table(
|
||||
/* Pass nonatomic=false (dont allow data dict unlock),
|
||||
because the transaction may hold locks on SYS_* tables from
|
||||
previous calls to fts_drop_table(). */
|
||||
error = row_drop_table_for_mysql(table_name, trx, true, false, false);
|
||||
error = row_drop_table_for_mysql(table_name, trx,
|
||||
SQLCOM_DROP_DB, false, false);
|
||||
|
||||
if (error != DB_SUCCESS) {
|
||||
ib::error() << "Unable to drop FTS index aux table "
|
||||
@@ -1943,8 +1944,8 @@ func_exit:
|
||||
if (error != DB_SUCCESS) {
|
||||
for (it = common_tables.begin(); it != common_tables.end();
|
||||
++it) {
|
||||
row_drop_table_for_mysql(
|
||||
(*it)->name.m_name, trx, true, FALSE);
|
||||
row_drop_table_for_mysql((*it)->name.m_name, trx,
|
||||
SQLCOM_DROP_DB);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2113,8 +2114,8 @@ fts_create_index_tables(trx_t* trx, const dict_index_t* index, table_id_t id)
|
||||
|
||||
for (it = aux_idx_tables.begin(); it != aux_idx_tables.end();
|
||||
++it) {
|
||||
row_drop_table_for_mysql(
|
||||
(*it)->name.m_name, trx, true, FALSE);
|
||||
row_drop_table_for_mysql((*it)->name.m_name, trx,
|
||||
SQLCOM_DROP_DB);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6689,7 +6690,8 @@ fts_drop_obsolete_aux_table_from_vector(
|
||||
trx_start_for_ddl(trx_drop, TRX_DICT_OP_TABLE);
|
||||
|
||||
err = row_drop_table_for_mysql(
|
||||
aux_drop_table->name, trx_drop, false, true);
|
||||
aux_drop_table->name, trx_drop,
|
||||
SQLCOM_DROP_TABLE, true);
|
||||
|
||||
trx_drop->dict_operation_lock_mode = 0;
|
||||
|
||||
|
||||
@@ -1068,6 +1068,8 @@ static SHOW_VAR innodb_status_variables[]= {
|
||||
(char*) &export_vars.innodb_truncated_status_writes, SHOW_LONG},
|
||||
{"available_undo_logs",
|
||||
(char*) &export_vars.innodb_available_undo_logs, SHOW_LONG},
|
||||
{"undo_truncations",
|
||||
(char*) &export_vars.innodb_undo_truncations, SHOW_LONG},
|
||||
|
||||
/* Status variables for page compression */
|
||||
{"page_compression_saved",
|
||||
@@ -12372,7 +12374,8 @@ create_table_info_t::create_table()
|
||||
trx_rollback_to_savepoint(m_trx, NULL);
|
||||
m_trx->error_state = DB_SUCCESS;
|
||||
|
||||
row_drop_table_for_mysql(m_table_name, m_trx, true, FALSE);
|
||||
row_drop_table_for_mysql(m_table_name, m_trx,
|
||||
SQLCOM_DROP_DB);
|
||||
|
||||
m_trx->error_state = DB_SUCCESS;
|
||||
DBUG_RETURN(error);
|
||||
@@ -12548,17 +12551,21 @@ create_table_info_t::allocate_trx()
|
||||
@param[in] name Table name, format: "db/table_name".
|
||||
@param[in] form Table format; columns and index information.
|
||||
@param[in] create_info Create info (including create statement string).
|
||||
@param[in] file_per_table whether to create .ibd file
|
||||
@param[in,out] trx dictionary transaction, or NULL to create new
|
||||
@return 0 if success else error number. */
|
||||
int
|
||||
inline int
|
||||
ha_innobase::create(
|
||||
const char* name,
|
||||
TABLE* form,
|
||||
HA_CREATE_INFO* create_info)
|
||||
HA_CREATE_INFO* create_info,
|
||||
bool file_per_table,
|
||||
trx_t* trx)
|
||||
{
|
||||
int error;
|
||||
char norm_name[FN_REFLEN]; /* {database}/{tablename} */
|
||||
char remote_path[FN_REFLEN]; /* Absolute path of table */
|
||||
trx_t* trx;
|
||||
|
||||
DBUG_ENTER("ha_innobase::create");
|
||||
|
||||
DBUG_ASSERT(form->s == table_share);
|
||||
@@ -12569,7 +12576,8 @@ ha_innobase::create(
|
||||
form,
|
||||
create_info,
|
||||
norm_name,
|
||||
remote_path);
|
||||
remote_path,
|
||||
file_per_table, trx);
|
||||
|
||||
/* Initialize the object. */
|
||||
if ((error = info.initialize())) {
|
||||
@@ -12581,9 +12589,11 @@ ha_innobase::create(
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
|
||||
info.allocate_trx();
|
||||
|
||||
trx = info.trx();
|
||||
bool own_trx = !trx;
|
||||
if (own_trx) {
|
||||
info.allocate_trx();
|
||||
trx = info.trx();
|
||||
}
|
||||
|
||||
/* Latch the InnoDB data dictionary exclusively so that no deadlocks
|
||||
or lock waits can happen in it during a table create operation.
|
||||
@@ -12591,10 +12601,16 @@ ha_innobase::create(
|
||||
row_mysql_lock_data_dictionary(trx);
|
||||
|
||||
if ((error = info.create_table())) {
|
||||
goto cleanup;
|
||||
if (own_trx) {
|
||||
trx_rollback_for_mysql(trx);
|
||||
}
|
||||
row_mysql_unlock_data_dictionary(trx);
|
||||
goto func_exit;
|
||||
}
|
||||
|
||||
innobase_commit_low(trx);
|
||||
if (own_trx) {
|
||||
innobase_commit_low(trx);
|
||||
}
|
||||
|
||||
ut_ad(!srv_read_only_mode);
|
||||
row_mysql_unlock_data_dictionary(trx);
|
||||
@@ -12609,17 +12625,26 @@ ha_innobase::create(
|
||||
utility threads: */
|
||||
|
||||
srv_active_wake_master_thread();
|
||||
|
||||
trx_free(trx);
|
||||
func_exit:
|
||||
if (own_trx) {
|
||||
trx_free(trx);
|
||||
}
|
||||
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
|
||||
cleanup:
|
||||
trx_rollback_for_mysql(trx);
|
||||
row_mysql_unlock_data_dictionary(trx);
|
||||
trx_free(trx);
|
||||
|
||||
DBUG_RETURN(error);
|
||||
/** Create a new table to an InnoDB database.
|
||||
@param[in] name Table name, format: "db/table_name".
|
||||
@param[in] form Table format; columns and index information.
|
||||
@param[in] create_info Create info (including create statement string).
|
||||
@return 0 if success else error number. */
|
||||
int
|
||||
ha_innobase::create(
|
||||
const char* name,
|
||||
TABLE* form,
|
||||
HA_CREATE_INFO* create_info)
|
||||
{
|
||||
return create(name, form, create_info, srv_file_per_table);
|
||||
}
|
||||
|
||||
/*****************************************************************//**
|
||||
@@ -12742,74 +12767,16 @@ ha_innobase::discard_or_import_tablespace(
|
||||
DBUG_RETURN(convert_error_code_to_mysql(err, dict_table->flags, NULL));
|
||||
}
|
||||
|
||||
/*****************************************************************//**
|
||||
Deletes all rows of an InnoDB table.
|
||||
@return error number */
|
||||
|
||||
int
|
||||
ha_innobase::truncate()
|
||||
/*===================*/
|
||||
{
|
||||
DBUG_ENTER("ha_innobase::truncate");
|
||||
|
||||
if (high_level_read_only) {
|
||||
DBUG_RETURN(HA_ERR_TABLE_READONLY);
|
||||
}
|
||||
|
||||
/* Get the transaction associated with the current thd, or create one
|
||||
if not yet created, and update m_prebuilt->trx */
|
||||
|
||||
update_thd(ha_thd());
|
||||
|
||||
m_prebuilt->trx->ddl = true;
|
||||
trx_start_if_not_started(m_prebuilt->trx, true);
|
||||
|
||||
dberr_t err = row_mysql_lock_table(m_prebuilt->trx, m_prebuilt->table,
|
||||
LOCK_X, "truncate table");
|
||||
if (err == DB_SUCCESS) {
|
||||
err = row_truncate_table_for_mysql(m_prebuilt->table,
|
||||
m_prebuilt->trx);
|
||||
}
|
||||
|
||||
switch (err) {
|
||||
case DB_FORCED_ABORT:
|
||||
case DB_DEADLOCK:
|
||||
thd_mark_transaction_to_rollback(m_user_thd, 1);
|
||||
DBUG_RETURN(HA_ERR_LOCK_DEADLOCK);
|
||||
case DB_LOCK_TABLE_FULL:
|
||||
thd_mark_transaction_to_rollback(m_user_thd, 1);
|
||||
DBUG_RETURN(HA_ERR_LOCK_TABLE_FULL);
|
||||
case DB_LOCK_WAIT_TIMEOUT:
|
||||
DBUG_RETURN(HA_ERR_LOCK_WAIT_TIMEOUT);
|
||||
case DB_TABLESPACE_DELETED:
|
||||
case DB_TABLESPACE_NOT_FOUND:
|
||||
ib_senderrf(
|
||||
m_prebuilt->trx->mysql_thd, IB_LOG_LEVEL_ERROR,
|
||||
(err == DB_TABLESPACE_DELETED ?
|
||||
ER_TABLESPACE_DISCARDED : ER_TABLESPACE_MISSING),
|
||||
table->s->table_name.str);
|
||||
table->status = STATUS_NOT_FOUND;
|
||||
DBUG_RETURN(HA_ERR_TABLESPACE_MISSING);
|
||||
default:
|
||||
table->status = STATUS_NOT_FOUND;
|
||||
DBUG_RETURN(convert_error_code_to_mysql(
|
||||
err, m_prebuilt->table->flags,
|
||||
m_user_thd));
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************//**
|
||||
/**
|
||||
Drops a table from an InnoDB database. Before calling this function,
|
||||
MySQL calls innobase_commit to commit the transaction of the current user.
|
||||
Then the current user cannot have locks set on the table. Drop table
|
||||
operation inside InnoDB will remove all locks any user has on the table
|
||||
inside InnoDB.
|
||||
@param[in] name table name
|
||||
@param[in] sqlcom SQLCOM_DROP_DB, SQLCOM_TRUNCATE, ...
|
||||
@return error number */
|
||||
|
||||
int
|
||||
ha_innobase::delete_table(
|
||||
/*======================*/
|
||||
const char* name) /*!< in: table name */
|
||||
inline int ha_innobase::delete_table(const char* name, enum_sql_command sqlcom)
|
||||
{
|
||||
dberr_t err;
|
||||
THD* thd = ha_thd();
|
||||
@@ -12873,9 +12840,7 @@ ha_innobase::delete_table(
|
||||
|
||||
/* Drop the table in InnoDB */
|
||||
|
||||
err = row_drop_table_for_mysql(
|
||||
norm_name, trx, thd_sql_command(thd) == SQLCOM_DROP_DB,
|
||||
false);
|
||||
err = row_drop_table_for_mysql(norm_name, trx, sqlcom);
|
||||
|
||||
if (err == DB_TABLE_NOT_FOUND
|
||||
&& innobase_get_lower_case_table_names() == 1) {
|
||||
@@ -12899,9 +12864,7 @@ ha_innobase::delete_table(
|
||||
par_case_name, name, FALSE);
|
||||
#endif
|
||||
err = row_drop_table_for_mysql(
|
||||
par_case_name, trx,
|
||||
thd_sql_command(thd) == SQLCOM_DROP_DB,
|
||||
FALSE);
|
||||
par_case_name, trx, sqlcom);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12964,9 +12927,7 @@ ha_innobase::delete_table(
|
||||
par_case_name, name, FALSE);
|
||||
#endif /* _WIN32 */
|
||||
err = row_drop_table_for_mysql(
|
||||
par_case_name, trx,
|
||||
thd_sql_command(thd) == SQLCOM_DROP_DB,
|
||||
true);
|
||||
par_case_name, trx, sqlcom, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12984,6 +12945,24 @@ ha_innobase::delete_table(
|
||||
DBUG_RETURN(convert_error_code_to_mysql(err, 0, NULL));
|
||||
}
|
||||
|
||||
/** Drop an InnoDB table.
|
||||
@param[in] name table name
|
||||
@return error number */
|
||||
int ha_innobase::delete_table(const char* name)
|
||||
{
|
||||
enum_sql_command sqlcom = enum_sql_command(thd_sql_command(ha_thd()));
|
||||
|
||||
if (sqlcom == SQLCOM_TRUNCATE
|
||||
&& thd_killed(ha_thd())
|
||||
&& (m_prebuilt == NULL || m_prebuilt->table->is_temporary())) {
|
||||
sqlcom = SQLCOM_DROP_TABLE;
|
||||
}
|
||||
|
||||
/* SQLCOM_TRUNCATE will be passed via ha_innobase::truncate() only. */
|
||||
DBUG_ASSERT(sqlcom != SQLCOM_TRUNCATE);
|
||||
return delete_table(name, sqlcom);
|
||||
}
|
||||
|
||||
/** Remove all tables in the named database inside InnoDB.
|
||||
@param[in] hton handlerton from InnoDB
|
||||
@param[in] path Database path; Inside InnoDB the name of the last
|
||||
@@ -13058,7 +13037,7 @@ innobase_drop_database(
|
||||
/*********************************************************************//**
|
||||
Renames an InnoDB table.
|
||||
@return DB_SUCCESS or error code */
|
||||
inline MY_ATTRIBUTE((warn_unused_result))
|
||||
inline
|
||||
dberr_t
|
||||
innobase_rename_table(
|
||||
/*==================*/
|
||||
@@ -13071,7 +13050,8 @@ innobase_rename_table(
|
||||
char norm_from[FN_REFLEN];
|
||||
|
||||
DBUG_ENTER("innobase_rename_table");
|
||||
DBUG_ASSERT(trx_get_dict_operation(trx) == TRX_DICT_OP_INDEX);
|
||||
DBUG_ASSERT(trx_get_dict_operation(trx) == TRX_DICT_OP_INDEX
|
||||
|| trx_get_dict_operation(trx) == TRX_DICT_OP_TABLE);
|
||||
|
||||
ut_ad(!srv_read_only_mode);
|
||||
|
||||
@@ -13178,6 +13158,79 @@ innobase_rename_table(
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
|
||||
/** TRUNCATE TABLE
|
||||
@return error code
|
||||
@retval 0 on success */
|
||||
int ha_innobase::truncate()
|
||||
{
|
||||
DBUG_ENTER("ha_innobase::truncate");
|
||||
|
||||
if (high_level_read_only) {
|
||||
DBUG_RETURN(HA_ERR_TABLE_READONLY);
|
||||
}
|
||||
|
||||
update_thd();
|
||||
|
||||
HA_CREATE_INFO info;
|
||||
mem_heap_t* heap = mem_heap_create(1000);
|
||||
dict_table_t* ib_table = m_prebuilt->table;
|
||||
const time_t update_time = ib_table->update_time;
|
||||
const ulint stored_lock = m_prebuilt->stored_select_lock_type;
|
||||
memset(&info, 0, sizeof info);
|
||||
update_create_info_from_table(&info, table);
|
||||
|
||||
if (ib_table->is_temporary()) {
|
||||
info.options|= HA_LEX_CREATE_TMP_TABLE;
|
||||
} else {
|
||||
dict_get_and_save_data_dir_path(ib_table, false);
|
||||
}
|
||||
|
||||
char* data_file_name = ib_table->data_dir_path;
|
||||
|
||||
if (data_file_name) {
|
||||
info.data_file_name = data_file_name
|
||||
= mem_heap_strdup(heap, data_file_name);
|
||||
}
|
||||
|
||||
const char* temp_name = dict_mem_create_temporary_tablename(
|
||||
heap, ib_table->name.m_name, ib_table->id);
|
||||
const char* name = mem_heap_strdup(heap, ib_table->name.m_name);
|
||||
trx_t* trx = innobase_trx_allocate(m_user_thd);
|
||||
|
||||
++trx->will_lock;
|
||||
trx_set_dict_operation(trx, TRX_DICT_OP_TABLE);
|
||||
int err = convert_error_code_to_mysql(
|
||||
innobase_rename_table(trx, ib_table->name.m_name, temp_name),
|
||||
ib_table->flags, m_user_thd);
|
||||
if (!err) {
|
||||
err = create(name, table, &info,
|
||||
dict_table_is_file_per_table(ib_table), trx);
|
||||
}
|
||||
|
||||
if (err) {
|
||||
innobase_rename_table(trx, temp_name, name);
|
||||
trx_rollback_to_savepoint(trx, NULL);
|
||||
}
|
||||
|
||||
innobase_commit_low(trx);
|
||||
trx_free(trx);
|
||||
|
||||
if (!err) {
|
||||
/* Reopen the newly created table, and drop the
|
||||
original table that was renamed to temp_name. */
|
||||
close();
|
||||
err = open(name, 0, 0);
|
||||
if (!err) {
|
||||
m_prebuilt->stored_select_lock_type = stored_lock;
|
||||
m_prebuilt->table->update_time = update_time;
|
||||
delete_table(temp_name, SQLCOM_TRUNCATE);
|
||||
}
|
||||
}
|
||||
|
||||
mem_heap_free(heap);
|
||||
DBUG_RETURN(err);
|
||||
}
|
||||
|
||||
/*********************************************************************//**
|
||||
Renames an InnoDB table.
|
||||
@return 0 or error code */
|
||||
|
||||
@@ -26,6 +26,9 @@ extern const char innobase_index_reserve_name[];
|
||||
/** Prebuilt structures in an InnoDB table handle used within MySQL */
|
||||
struct row_prebuilt_t;
|
||||
|
||||
/** InnoDB transaction */
|
||||
struct trx_t;
|
||||
|
||||
/** Engine specific table options are defined using this struct */
|
||||
struct ha_table_option_struct
|
||||
{
|
||||
@@ -188,6 +191,13 @@ public:
|
||||
|
||||
void update_create_info(HA_CREATE_INFO* create_info);
|
||||
|
||||
inline int create(
|
||||
const char* name,
|
||||
TABLE* form,
|
||||
HA_CREATE_INFO* create_info,
|
||||
bool file_per_table,
|
||||
trx_t* trx = NULL);
|
||||
|
||||
int create(
|
||||
const char* name,
|
||||
TABLE* form,
|
||||
@@ -196,6 +206,8 @@ public:
|
||||
const char* check_table_options(THD *thd, TABLE* table,
|
||||
HA_CREATE_INFO* create_info, const bool use_tablespace, const ulint file_format);
|
||||
|
||||
inline int delete_table(const char* name, enum_sql_command sqlcom);
|
||||
|
||||
int truncate();
|
||||
|
||||
int delete_table(const char *name);
|
||||
@@ -645,13 +657,16 @@ public:
|
||||
TABLE* form,
|
||||
HA_CREATE_INFO* create_info,
|
||||
char* table_name,
|
||||
char* remote_path)
|
||||
char* remote_path,
|
||||
bool file_per_table,
|
||||
trx_t* trx = NULL)
|
||||
:m_thd(thd),
|
||||
m_trx(trx),
|
||||
m_form(form),
|
||||
m_create_info(create_info),
|
||||
m_table_name(table_name), m_table(NULL),
|
||||
m_remote_path(remote_path),
|
||||
m_innodb_file_per_table(srv_file_per_table)
|
||||
m_innodb_file_per_table(file_per_table)
|
||||
{}
|
||||
|
||||
/** Initialize the object. */
|
||||
|
||||
@@ -6285,7 +6285,8 @@ ha_innobase::prepare_inplace_alter_table(
|
||||
altered_table,
|
||||
ha_alter_info->create_info,
|
||||
NULL,
|
||||
NULL);
|
||||
NULL,
|
||||
srv_file_per_table);
|
||||
|
||||
info.set_tablespace_type(indexed_table->space != fil_system.sys_space);
|
||||
|
||||
|
||||
@@ -4779,7 +4779,7 @@ reset_bit:
|
||||
|
||||
/*********************************************************************//**
|
||||
Deletes all entries in the insert buffer for a given space id. This is used
|
||||
in DISCARD TABLESPACE, IMPORT TABLESPACE and TRUNCATE TABLESPACE.
|
||||
in DISCARD TABLESPACE, IMPORT TABLESPACE, and 5.7 TRUNCATE TABLE recovery.
|
||||
NOTE: this does not update the page free bitmaps in the space. The space will
|
||||
become CORRUPT when you call this function! */
|
||||
void
|
||||
|
||||
@@ -65,8 +65,10 @@ bool buf_LRU_drop_page_hash_for_tablespace(dict_table_t* table)
|
||||
/** Empty the flush list for all pages belonging to a tablespace.
|
||||
@param[in] id tablespace identifier
|
||||
@param[in,out] observer flush observer,
|
||||
or NULL if nothing is to be written */
|
||||
void buf_LRU_flush_or_remove_pages(ulint id, FlushObserver* observer);
|
||||
or NULL if nothing is to be written
|
||||
@param[in] first first page to be flushed or evicted */
|
||||
void buf_LRU_flush_or_remove_pages(ulint id, FlushObserver* observer,
|
||||
ulint first = 0);
|
||||
|
||||
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
|
||||
/********************************************************************//**
|
||||
|
||||
@@ -97,10 +97,8 @@ struct fil_space_t {
|
||||
new write operations because we don't
|
||||
check this flag when doing flush
|
||||
batches. */
|
||||
/** whether undo tablespace truncation is in progress */
|
||||
bool is_being_truncated;
|
||||
/*!< this is set to true when we prepare to
|
||||
truncate a single-table tablespace and its
|
||||
.ibd file */
|
||||
#ifdef UNIV_DEBUG
|
||||
ulint redo_skipped_count;
|
||||
/*!< reference count for operations who want
|
||||
@@ -181,12 +179,8 @@ struct fil_space_t {
|
||||
|
||||
ulint magic_n;/*!< FIL_SPACE_MAGIC_N */
|
||||
|
||||
/** @return whether the tablespace is about to be dropped or
|
||||
truncated */
|
||||
bool is_stopping() const
|
||||
{
|
||||
return stop_new_ops || is_being_truncated;
|
||||
}
|
||||
/** @return whether the tablespace is about to be dropped */
|
||||
bool is_stopping() const { return stop_new_ops; }
|
||||
|
||||
/** @return whether doublewrite buffering is needed */
|
||||
bool use_doublewrite() const
|
||||
@@ -881,7 +875,8 @@ fil_op_replay_rename(
|
||||
not (necessarily) protected by meta-data locks.
|
||||
(Rollback would generally be protected, but rollback of
|
||||
FOREIGN KEY CASCADE/SET NULL is not protected by meta-data locks
|
||||
but only by InnoDB table locks, which may be broken by TRUNCATE TABLE.)
|
||||
but only by InnoDB table locks, which may be broken by
|
||||
lock_remove_all_on_table().)
|
||||
@param[in] table persistent table
|
||||
checked @return whether the table is accessible */
|
||||
bool
|
||||
@@ -899,22 +894,15 @@ fil_delete_tablespace(
|
||||
#endif /* BTR_CUR_HASH_ADAPT */
|
||||
);
|
||||
|
||||
/** Truncate the tablespace to needed size.
|
||||
@param[in,out] space tablespace truncate
|
||||
@param[in] size_in_pages truncate size.
|
||||
@return true if truncate was successful. */
|
||||
bool fil_truncate_tablespace(fil_space_t* space, ulint size_in_pages);
|
||||
/** Prepare to truncate an undo tablespace.
|
||||
@param[in] space_id undo tablespace id
|
||||
@return the tablespace
|
||||
@retval NULL if the tablespace does not exist */
|
||||
fil_space_t* fil_truncate_prepare(ulint space_id);
|
||||
|
||||
/*******************************************************************//**
|
||||
Prepare for truncating a single-table tablespace. The tablespace
|
||||
must be cached in the memory cache.
|
||||
1) Check pending operations on a tablespace;
|
||||
2) Remove all insert buffer entries for the tablespace;
|
||||
@return DB_SUCCESS or error */
|
||||
dberr_t
|
||||
fil_prepare_for_truncate(
|
||||
/*=====================*/
|
||||
ulint id); /*!< in: space id */
|
||||
/** Write log about an undo tablespace truncate operation. */
|
||||
void fil_truncate_log(fil_space_t* space, ulint size, mtr_t* mtr)
|
||||
MY_ATTRIBUTE((nonnull));
|
||||
|
||||
/*******************************************************************//**
|
||||
Closes a single-table tablespace. The tablespace must be cached in the
|
||||
|
||||
@@ -450,10 +450,12 @@ to this checkpoint, or 0 if the information has not been written */
|
||||
This used to be called LOG_GROUP_ID and always written as 0,
|
||||
because InnoDB never supported more than one copy of the redo log. */
|
||||
#define LOG_HEADER_FORMAT 0
|
||||
/** 4 unused (zero-initialized) bytes. In format version 0, the
|
||||
/** Redo log subformat (originally 0). In format version 0, the
|
||||
LOG_FILE_START_LSN started here, 4 bytes earlier than LOG_HEADER_START_LSN,
|
||||
which the LOG_FILE_START_LSN was renamed to. */
|
||||
#define LOG_HEADER_PAD1 4
|
||||
which the LOG_FILE_START_LSN was renamed to.
|
||||
Subformat 1 is for the fully redo-logged TRUNCATE
|
||||
(no MLOG_TRUNCATE records or extra log checkpoints or log files) */
|
||||
#define LOG_HEADER_SUBFORMAT 4
|
||||
/** LSN of the start of data in this log file (with format version 1;
|
||||
in format version 0, it was called LOG_FILE_START_LSN and at offset 4). */
|
||||
#define LOG_HEADER_START_LSN 8
|
||||
@@ -474,11 +476,18 @@ or the MySQL version that created the redo log file. */
|
||||
#define LOG_HEADER_FORMAT_3_23 0
|
||||
/** The MySQL 5.7.9/MariaDB 10.2.2 log format */
|
||||
#define LOG_HEADER_FORMAT_10_2 1
|
||||
/** The MariaDB 10.3.2 log format */
|
||||
/** The MariaDB 10.3.2 log format.
|
||||
To prevent crash-downgrade to earlier 10.2 due to the inability to
|
||||
roll back a retroactively introduced TRX_UNDO_RENAME_TABLE undo log record,
|
||||
MariaDB 10.2.18 and later will use the 10.3 format, but LOG_HEADER_SUBFORMAT
|
||||
1 instead of 0. MariaDB 10.3 will use subformat 0 (5.7-style TRUNCATE) or 2
|
||||
(MDEV-13564 backup-friendly TRUNCATE). */
|
||||
#define LOG_HEADER_FORMAT_10_3 103
|
||||
/** The redo log format identifier corresponding to the current format version.
|
||||
Stored in LOG_HEADER_FORMAT. */
|
||||
#define LOG_HEADER_FORMAT_CURRENT LOG_HEADER_FORMAT_10_3
|
||||
/** Future MariaDB 10.4 log format */
|
||||
#define LOG_HEADER_FORMAT_10_4 104
|
||||
/** Encrypted MariaDB redo log */
|
||||
#define LOG_HEADER_FORMAT_ENCRYPTED (1U<<31)
|
||||
|
||||
@@ -549,7 +558,10 @@ struct log_t{
|
||||
/** number of files */
|
||||
ulint n_files;
|
||||
/** format of the redo log: e.g., LOG_HEADER_FORMAT_CURRENT */
|
||||
ulint format;
|
||||
uint32_t format;
|
||||
/** redo log subformat: 0 with separately logged TRUNCATE,
|
||||
2 with fully redo-logged TRUNCATE (1 in MariaDB 10.2) */
|
||||
uint32_t subformat;
|
||||
/** individual log file size in bytes, including the header */
|
||||
lsn_t file_size;
|
||||
/** lsn used to fix coordinates within the log group */
|
||||
|
||||
@@ -267,6 +267,15 @@ struct recv_sys_t{
|
||||
ulint n_addrs;/*!< number of not processed hashed file
|
||||
addresses in the hash table */
|
||||
|
||||
/** Undo tablespaces for which truncate has been logged
|
||||
(indexed by id - srv_undo_space_id_start) */
|
||||
struct trunc {
|
||||
/** log sequence number of MLOG_FILE_CREATE2, or 0 if none */
|
||||
lsn_t lsn;
|
||||
/** truncated size of the tablespace, or 0 if not truncated */
|
||||
unsigned pages;
|
||||
} truncated_undo_spaces[127];
|
||||
|
||||
recv_dblwr_t dblwr;
|
||||
|
||||
/** Lastly added LSN to the hash table of log records. */
|
||||
|
||||
@@ -1241,17 +1241,18 @@ bool
|
||||
os_file_set_eof(
|
||||
FILE* file); /*!< in: file to be truncated */
|
||||
|
||||
/** Truncates a file to a specified size in bytes. Do nothing if the size
|
||||
preserved is smaller or equal than current size of file.
|
||||
/** Truncate a file to a specified size in bytes.
|
||||
@param[in] pathname file path
|
||||
@param[in] file file to be truncated
|
||||
@param[in] size size preserved in bytes
|
||||
@param[in] allow_shrink whether to allow the file to become smaller
|
||||
@return true if success */
|
||||
bool
|
||||
os_file_truncate(
|
||||
const char* pathname,
|
||||
os_file_t file,
|
||||
os_offset_t size);
|
||||
os_offset_t size,
|
||||
bool allow_shrink = false);
|
||||
|
||||
/** NOTE! Use the corresponding macro os_file_flush(), not directly this
|
||||
function!
|
||||
|
||||
@@ -29,6 +29,8 @@ Created 9/17/2000 Heikki Tuuri
|
||||
#define row0mysql_h
|
||||
|
||||
#include "ha_prototypes.h"
|
||||
#include "sql_list.h"
|
||||
#include "sql_cmd.h"
|
||||
|
||||
#include "data0data.h"
|
||||
#include "que0types.h"
|
||||
@@ -451,32 +453,28 @@ row_mysql_lock_table(
|
||||
const char* op_info) /*!< in: string for trx->op_info */
|
||||
MY_ATTRIBUTE((nonnull, warn_unused_result));
|
||||
|
||||
/*********************************************************************//**
|
||||
Truncates a table for MySQL.
|
||||
@return error code or DB_SUCCESS */
|
||||
dberr_t
|
||||
row_truncate_table_for_mysql(
|
||||
/*=========================*/
|
||||
dict_table_t* table, /*!< in: table handle */
|
||||
trx_t* trx) /*!< in: transaction handle */
|
||||
MY_ATTRIBUTE((nonnull, warn_unused_result));
|
||||
/*********************************************************************//**
|
||||
Drops a table for MySQL. If the data dictionary was not already locked
|
||||
by the transaction, the transaction will be committed. Otherwise, the
|
||||
data dictionary will remain locked.
|
||||
@return error code or DB_SUCCESS */
|
||||
/** Drop a table.
|
||||
If the data dictionary was not already locked by the transaction,
|
||||
the transaction will be committed. Otherwise, the data dictionary
|
||||
will remain locked.
|
||||
@param[in] name Table name
|
||||
@param[in,out] trx Transaction handle
|
||||
@param[in] sqlcom type of SQL operation
|
||||
@param[in] create_failed true=create table failed
|
||||
because e.g. foreign key column
|
||||
@param[in] nonatomic Whether it is permitted to release
|
||||
and reacquire dict_operation_lock
|
||||
@return error code */
|
||||
dberr_t
|
||||
row_drop_table_for_mysql(
|
||||
/*=====================*/
|
||||
const char* name, /*!< in: table name */
|
||||
trx_t* trx, /*!< in: dictionary transaction handle */
|
||||
bool drop_db,/*!< in: true=dropping whole database */
|
||||
ibool create_failed,/*!<in: TRUE=create table failed
|
||||
because e.g. foreign key column
|
||||
type mismatch. */
|
||||
bool nonatomic = true);
|
||||
/*!< in: whether it is permitted
|
||||
to release and reacquire dict_operation_lock */
|
||||
const char* name,
|
||||
trx_t* trx,
|
||||
enum_sql_command sqlcom,
|
||||
bool create_failed = false,
|
||||
bool nonatomic = true);
|
||||
|
||||
/** Drop a table after failed CREATE TABLE. */
|
||||
dberr_t row_drop_table_after_create_fail(const char* name, trx_t* trx);
|
||||
|
||||
/*********************************************************************//**
|
||||
Discards the tablespace of a table which stored in an .ibd file. Discarding
|
||||
|
||||
@@ -414,14 +414,4 @@ private:
|
||||
const char* log_file_name);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
Truncates a table for MySQL.
|
||||
@param table table being truncated
|
||||
@param trx transaction covering the truncate
|
||||
@return error code or DB_SUCCESS */
|
||||
dberr_t
|
||||
row_truncate_table_for_mysql(dict_table_t* table, trx_t* trx);
|
||||
|
||||
#endif /* row0trunc_h */
|
||||
|
||||
|
||||
@@ -997,6 +997,8 @@ struct export_var_t{
|
||||
ulint innodb_truncated_status_writes; /*!< srv_truncated_status_writes */
|
||||
ulint innodb_available_undo_logs; /*!< srv_available_undo_logs
|
||||
*/
|
||||
/** Number of undo tablespace truncation operations */
|
||||
ulong innodb_undo_truncations;
|
||||
ulint innodb_defragment_compression_failures; /*!< Number of
|
||||
defragment re-compression
|
||||
failures */
|
||||
|
||||
@@ -140,27 +140,6 @@ namespace undo {
|
||||
typedef std::vector<ulint> undo_spaces_t;
|
||||
typedef std::vector<trx_rseg_t*> rseg_for_trunc_t;
|
||||
|
||||
/** Magic Number to indicate truncate action is complete. */
|
||||
const ib_uint32_t s_magic = 76845412;
|
||||
|
||||
/** Truncate Log file Prefix. */
|
||||
const char* const s_log_prefix = "undo_";
|
||||
|
||||
/** Truncate Log file Extension. */
|
||||
const char* const s_log_ext = "trunc.log";
|
||||
|
||||
/** Populate log file name based on space_id
|
||||
@param[in] space_id id of the undo tablespace.
|
||||
@return DB_SUCCESS or error code */
|
||||
dberr_t populate_log_file_name(
|
||||
ulint space_id,
|
||||
char*& log_file_name);
|
||||
|
||||
/** Create the truncate log file.
|
||||
@param[in] space_id id of the undo tablespace to truncate.
|
||||
@return DB_SUCCESS or error code. */
|
||||
dberr_t init(ulint space_id);
|
||||
|
||||
/** Mark completion of undo truncate action by writing magic number to
|
||||
the log file and then removing it from the disk.
|
||||
If we are going to remove it from disk then why write magic number ?
|
||||
@@ -322,23 +301,6 @@ namespace undo {
|
||||
return(m_purge_rseg_truncate_frequency);
|
||||
}
|
||||
|
||||
/* Start writing log information to a special file.
|
||||
On successfull completion, file is removed.
|
||||
On crash, file is used to complete the truncate action.
|
||||
@param space_id space id of undo tablespace
|
||||
@return DB_SUCCESS or error code. */
|
||||
dberr_t start_logging(ulint space_id)
|
||||
{
|
||||
return(init(space_id));
|
||||
}
|
||||
|
||||
/* Mark completion of logging./
|
||||
@param space_id space id of undo tablespace */
|
||||
void done_logging(ulint space_id)
|
||||
{
|
||||
return(done(space_id));
|
||||
}
|
||||
|
||||
private:
|
||||
/** UNDO tablespace is mark for truncate. */
|
||||
ulint m_undo_for_trunc;
|
||||
|
||||
@@ -260,18 +260,6 @@ trx_undo_commit_cleanup(trx_undo_t* undo, bool is_temp);
|
||||
void
|
||||
trx_undo_free_at_shutdown(trx_t *trx);
|
||||
|
||||
/* Forward declaration. */
|
||||
namespace undo {
|
||||
class Truncate;
|
||||
};
|
||||
|
||||
/** Truncate UNDO tablespace, reinitialize header and rseg.
|
||||
@param[in] undo_trunc UNDO tablespace handler
|
||||
@return true if success else false. */
|
||||
bool
|
||||
trx_undo_truncate_tablespace(
|
||||
undo::Truncate* undo_trunc);
|
||||
|
||||
/** Parse MLOG_UNDO_INIT.
|
||||
@param[in] ptr log record
|
||||
@param[in] end_ptr end of log record buffer
|
||||
|
||||
@@ -670,6 +670,7 @@ void log_t::files::create(ulint n_files)
|
||||
format= srv_encrypt_log
|
||||
? LOG_HEADER_FORMAT_CURRENT | LOG_HEADER_FORMAT_ENCRYPTED
|
||||
: LOG_HEADER_FORMAT_CURRENT;
|
||||
subformat= 2;
|
||||
file_size= srv_log_file_size;
|
||||
lsn= LOG_START_LSN;
|
||||
lsn_offset= LOG_FILE_HDR_SIZE;
|
||||
@@ -708,6 +709,7 @@ log_file_header_flush(
|
||||
|
||||
memset(buf, 0, OS_FILE_LOG_BLOCK_SIZE);
|
||||
mach_write_to_4(buf + LOG_HEADER_FORMAT, log_sys.log.format);
|
||||
mach_write_to_4(buf + LOG_HEADER_SUBFORMAT, log_sys.log.subformat);
|
||||
mach_write_to_8(buf + LOG_HEADER_START_LSN, start_lsn);
|
||||
strcpy(reinterpret_cast<char*>(buf) + LOG_HEADER_CREATOR,
|
||||
LOG_HEADER_CREATOR_CURRENT);
|
||||
|
||||
@@ -131,8 +131,7 @@ bool recv_writer_thread_active;
|
||||
/** Return string name of the redo log record type.
|
||||
@param[in] type record log record enum
|
||||
@return string name of record log record */
|
||||
const char*
|
||||
get_mlog_string(mlog_id_t type);
|
||||
static const char* get_mlog_string(mlog_id_t type);
|
||||
#endif /* !DBUG_OFF */
|
||||
|
||||
/** Tablespace item during recovery */
|
||||
@@ -219,6 +218,75 @@ void (*log_file_op)(ulint space_id, const byte* flags,
|
||||
const byte* name, ulint len,
|
||||
const byte* new_name, ulint new_len);
|
||||
|
||||
/** Process a MLOG_CREATE2 record that indicates that a tablespace
|
||||
is being shrunk in size.
|
||||
@param[in] space_id tablespace identifier
|
||||
@param[in] pages trimmed size of the file, in pages
|
||||
@param[in] lsn log sequence number of the operation */
|
||||
static void recv_addr_trim(ulint space_id, unsigned pages, lsn_t lsn)
|
||||
{
|
||||
DBUG_ENTER("recv_addr_trim");
|
||||
DBUG_LOG("ib_log",
|
||||
"discarding log beyond end of tablespace "
|
||||
<< page_id_t(space_id, pages) << " before LSN " << lsn);
|
||||
ut_ad(mutex_own(&recv_sys->mutex));
|
||||
for (ulint i = recv_sys->addr_hash->n_cells; i--; ) {
|
||||
hash_cell_t* const cell = hash_get_nth_cell(
|
||||
recv_sys->addr_hash, i);
|
||||
for (recv_addr_t* addr = static_cast<recv_addr_t*>(cell->node),
|
||||
*prev = NULL, *next;
|
||||
addr;
|
||||
prev = addr, addr = next) {
|
||||
next = static_cast<recv_addr_t*>(addr->addr_hash);
|
||||
|
||||
if (addr->space != space_id || addr->page_no < pages) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (recv_t* recv = UT_LIST_GET_FIRST(addr->rec_list);
|
||||
recv; ) {
|
||||
recv_t* n = UT_LIST_GET_NEXT(rec_list, recv);
|
||||
if (recv->start_lsn < lsn) {
|
||||
DBUG_PRINT("ib_log",
|
||||
("Discarding %s for"
|
||||
" page %u:%u at " LSN_PF,
|
||||
get_mlog_string(
|
||||
recv->type),
|
||||
addr->space, addr->page_no,
|
||||
recv->start_lsn));
|
||||
UT_LIST_REMOVE(addr->rec_list, recv);
|
||||
}
|
||||
recv = n;
|
||||
}
|
||||
|
||||
if (UT_LIST_GET_LEN(addr->rec_list)) {
|
||||
DBUG_PRINT("ib_log",
|
||||
("preserving " ULINTPF
|
||||
" records for page %u:%u",
|
||||
UT_LIST_GET_LEN(addr->rec_list),
|
||||
addr->space, addr->page_no));
|
||||
} else {
|
||||
ut_ad(recv_sys->n_addrs);
|
||||
--recv_sys->n_addrs;
|
||||
if (addr == cell->node) {
|
||||
cell->node = next;
|
||||
} else {
|
||||
prev->addr_hash = next;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (fil_space_t* space = fil_space_get(space_id)) {
|
||||
ut_ad(UT_LIST_GET_LEN(space->chain) == 1);
|
||||
fil_node_t* file = UT_LIST_GET_FIRST(space->chain);
|
||||
ut_ad(file->is_open());
|
||||
os_file_truncate(file->name, file->handle,
|
||||
os_offset_t(pages) << srv_page_size_shift,
|
||||
true);
|
||||
}
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
/** Process a file name from a MLOG_FILE_* record.
|
||||
@param[in,out] name file name
|
||||
@param[in] len length of the file name
|
||||
@@ -391,9 +459,8 @@ fil_name_parse(
|
||||
user-created tablespaces. The name must be long enough
|
||||
and end in .ibd. */
|
||||
bool corrupt = is_predefined_tablespace(space_id)
|
||||
|| first_page_no != 0 // TODO: multi-file user tablespaces
|
||||
|| len < sizeof "/a.ibd\0"
|
||||
|| memcmp(ptr + len - 5, DOT_IBD, 5) != 0
|
||||
|| (!first_page_no != !memcmp(ptr + len - 5, DOT_IBD, 5))
|
||||
|| memchr(ptr, OS_PATH_SEPARATOR, len) == NULL;
|
||||
|
||||
byte* end_ptr = ptr + len;
|
||||
@@ -422,7 +489,18 @@ fil_name_parse(
|
||||
reinterpret_cast<char*>(ptr), len, space_id, true);
|
||||
/* fall through */
|
||||
case MLOG_FILE_CREATE2:
|
||||
if (log_file_op) {
|
||||
if (first_page_no) {
|
||||
ut_ad(first_page_no
|
||||
== SRV_UNDO_TABLESPACE_SIZE_IN_PAGES);
|
||||
ut_a(srv_is_undo_tablespace(space_id));
|
||||
compile_time_assert(
|
||||
UT_ARR_SIZE(recv_sys->truncated_undo_spaces)
|
||||
== TRX_SYS_MAX_UNDO_SPACES);
|
||||
recv_sys_t::trunc& t = recv_sys->truncated_undo_spaces[
|
||||
space_id - srv_undo_space_id_start];
|
||||
t.lsn = recv_sys->recovered_lsn;
|
||||
t.pages = uint32_t(first_page_no);
|
||||
} else if (log_file_op) {
|
||||
log_file_op(space_id,
|
||||
type == MLOG_FILE_CREATE2 ? ptr - 4 : NULL,
|
||||
ptr, len, NULL, 0);
|
||||
@@ -969,6 +1047,54 @@ static dberr_t recv_log_format_0_recover(lsn_t lsn, bool crypt)
|
||||
return(DB_SUCCESS);
|
||||
}
|
||||
|
||||
/** Determine if a redo log from MariaDB 10.4 is clean.
|
||||
@return error code
|
||||
@retval DB_SUCCESS if the redo log is clean
|
||||
@retval DB_CORRUPTION if the redo log is corrupted
|
||||
@retval DB_ERROR if the redo log is not empty */
|
||||
static dberr_t recv_log_recover_10_4()
|
||||
{
|
||||
ut_ad(!log_sys.is_encrypted());
|
||||
const lsn_t lsn = log_sys.log.lsn;
|
||||
log_mutex_enter();
|
||||
const lsn_t source_offset = log_sys.log.calc_lsn_offset(lsn);
|
||||
log_mutex_exit();
|
||||
const ulint page_no
|
||||
= (ulint) (source_offset / univ_page_size.physical());
|
||||
byte* buf = log_sys.buf;
|
||||
|
||||
fil_io(IORequestLogRead, true,
|
||||
page_id_t(SRV_LOG_SPACE_FIRST_ID, page_no),
|
||||
univ_page_size,
|
||||
(ulint) ((source_offset & ~(OS_FILE_LOG_BLOCK_SIZE - 1))
|
||||
% univ_page_size.physical()),
|
||||
OS_FILE_LOG_BLOCK_SIZE, buf, NULL);
|
||||
|
||||
if (log_block_calc_checksum(buf) != log_block_get_checksum(buf)) {
|
||||
return DB_CORRUPTION;
|
||||
}
|
||||
|
||||
/* On a clean shutdown, the redo log will be logically empty
|
||||
after the checkpoint lsn. */
|
||||
|
||||
if (log_block_get_data_len(buf)
|
||||
!= (source_offset & (OS_FILE_LOG_BLOCK_SIZE - 1))) {
|
||||
return DB_ERROR;
|
||||
}
|
||||
|
||||
/* Mark the redo log for downgrading. */
|
||||
srv_log_file_size = 0;
|
||||
recv_sys->parse_start_lsn = recv_sys->recovered_lsn
|
||||
= recv_sys->scanned_lsn
|
||||
= recv_sys->mlog_checkpoint_lsn = lsn;
|
||||
log_sys.last_checkpoint_lsn = log_sys.next_checkpoint_lsn
|
||||
= log_sys.lsn = log_sys.write_lsn
|
||||
= log_sys.current_flush_lsn = log_sys.flushed_to_disk_lsn
|
||||
= lsn;
|
||||
log_sys.next_checkpoint_no = 0;
|
||||
return DB_SUCCESS;
|
||||
}
|
||||
|
||||
/** Find the latest checkpoint in the log header.
|
||||
@param[out] max_field LOG_CHECKPOINT_1 or LOG_CHECKPOINT_2
|
||||
@return error code or DB_SUCCESS */
|
||||
@@ -989,6 +1115,9 @@ recv_find_max_checkpoint(ulint* max_field)
|
||||
/* Check the header page checksum. There was no
|
||||
checksum in the first redo log format (version 0). */
|
||||
log_sys.log.format = mach_read_from_4(buf + LOG_HEADER_FORMAT);
|
||||
log_sys.log.subformat = log_sys.log.format != LOG_HEADER_FORMAT_3_23
|
||||
? mach_read_from_4(buf + LOG_HEADER_SUBFORMAT)
|
||||
: 0;
|
||||
if (log_sys.log.format != LOG_HEADER_FORMAT_3_23
|
||||
&& !recv_check_log_header_checksum(buf)) {
|
||||
ib::error() << "Invalid redo log header checksum.";
|
||||
@@ -1008,6 +1137,9 @@ recv_find_max_checkpoint(ulint* max_field)
|
||||
case LOG_HEADER_FORMAT_10_2 | LOG_HEADER_FORMAT_ENCRYPTED:
|
||||
case LOG_HEADER_FORMAT_CURRENT:
|
||||
case LOG_HEADER_FORMAT_CURRENT | LOG_HEADER_FORMAT_ENCRYPTED:
|
||||
case LOG_HEADER_FORMAT_10_4:
|
||||
/* We can only parse the unencrypted LOG_HEADER_FORMAT_10_4.
|
||||
The encrypted format uses a larger redo log block trailer. */
|
||||
break;
|
||||
default:
|
||||
ib::error() << "Unsupported redo log format."
|
||||
@@ -1072,7 +1204,19 @@ recv_find_max_checkpoint(ulint* max_field)
|
||||
return(DB_ERROR);
|
||||
}
|
||||
|
||||
return(DB_SUCCESS);
|
||||
if (log_sys.log.format == LOG_HEADER_FORMAT_10_4) {
|
||||
dberr_t err = recv_log_recover_10_4();
|
||||
if (err != DB_SUCCESS) {
|
||||
ib::error()
|
||||
<< "Downgrade after a crash is not supported."
|
||||
" The redo log was created with " << creator
|
||||
<< (err == DB_ERROR
|
||||
? "." : ", and it appears corrupted.");
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
return DB_SUCCESS;
|
||||
}
|
||||
|
||||
/** Try to parse a single log record body and also applies it if
|
||||
@@ -2020,6 +2164,14 @@ recv_apply_hashed_log_recs(bool last_batch)
|
||||
recv_sys->apply_log_recs = TRUE;
|
||||
recv_sys->apply_batch_on = TRUE;
|
||||
|
||||
for (ulint id = srv_undo_tablespaces_open; id--; ) {
|
||||
recv_sys_t::trunc& t = recv_sys->truncated_undo_spaces[id];
|
||||
if (t.lsn) {
|
||||
recv_addr_trim(id + srv_undo_space_id_start, t.pages,
|
||||
t.lsn);
|
||||
}
|
||||
}
|
||||
|
||||
for (ulint i = 0; i < hash_get_n_cells(recv_sys->addr_hash); i++) {
|
||||
for (recv_addr_t* recv_addr = static_cast<recv_addr_t*>(
|
||||
HASH_GET_FIRST(recv_sys->addr_hash, i));
|
||||
@@ -3638,8 +3790,7 @@ recv_dblwr_t::find_page(ulint space_id, ulint page_no)
|
||||
/** Return string name of the redo log record type.
|
||||
@param[in] type record log record enum
|
||||
@return string name of record log record */
|
||||
const char*
|
||||
get_mlog_string(mlog_id_t type)
|
||||
static const char* get_mlog_string(mlog_id_t type)
|
||||
{
|
||||
switch (type) {
|
||||
case MLOG_SINGLE_REC_FLAG:
|
||||
|
||||
@@ -5407,25 +5407,27 @@ fallback:
|
||||
return(current_size >= size && os_file_flush(file));
|
||||
}
|
||||
|
||||
/** Truncates a file to a specified size in bytes.
|
||||
Do nothing if the size to preserve is greater or equal to the current
|
||||
size of the file.
|
||||
/** Truncate a file to a specified size in bytes.
|
||||
@param[in] pathname file path
|
||||
@param[in] file file to be truncated
|
||||
@param[in] size size to preserve in bytes
|
||||
@param[in] size size preserved in bytes
|
||||
@param[in] allow_shrink whether to allow the file to become smaller
|
||||
@return true if success */
|
||||
bool
|
||||
os_file_truncate(
|
||||
const char* pathname,
|
||||
os_file_t file,
|
||||
os_offset_t size)
|
||||
os_offset_t size,
|
||||
bool allow_shrink)
|
||||
{
|
||||
/* Do nothing if the size preserved is larger than or equal to the
|
||||
current size of file */
|
||||
os_offset_t size_bytes = os_file_get_size(file);
|
||||
if (!allow_shrink) {
|
||||
/* Do nothing if the size preserved is larger than or
|
||||
equal to the current size of file */
|
||||
os_offset_t size_bytes = os_file_get_size(file);
|
||||
|
||||
if (size >= size_bytes) {
|
||||
return(true);
|
||||
if (size >= size_bytes) {
|
||||
return(true);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
@@ -1660,8 +1660,7 @@ row_ins_check_foreign_constraint(
|
||||
|
||||
if (check_table == NULL
|
||||
|| !check_table->is_readable()
|
||||
|| check_index == NULL
|
||||
|| check_table->space->is_being_truncated) {
|
||||
|| check_index == NULL) {
|
||||
|
||||
if (!srv_read_only_mode && check_ref) {
|
||||
FILE* ef = dict_foreign_err_file;
|
||||
|
||||
@@ -4516,7 +4516,7 @@ row_merge_drop_table(
|
||||
ut_a(table->get_ref_count() == 0);
|
||||
|
||||
return(row_drop_table_for_mysql(table->name.m_name,
|
||||
trx, false, false, false));
|
||||
trx, SQLCOM_DROP_TABLE, false, false));
|
||||
}
|
||||
|
||||
/** Write an MLOG_INDEX_LOAD record to indicate in the redo-log
|
||||
|
||||
@@ -2608,7 +2608,8 @@ error_handling:
|
||||
trx_rollback_to_savepoint(trx, NULL);
|
||||
}
|
||||
|
||||
row_drop_table_for_mysql(table->name.m_name, trx, FALSE, true);
|
||||
row_drop_table_for_mysql(table->name.m_name, trx,
|
||||
SQLCOM_DROP_TABLE, true);
|
||||
|
||||
if (trx_is_started(trx)) {
|
||||
|
||||
@@ -2691,7 +2692,7 @@ row_table_add_foreign_constraints(
|
||||
trx_rollback_to_savepoint(trx, NULL);
|
||||
}
|
||||
|
||||
row_drop_table_for_mysql(name, trx, FALSE, true);
|
||||
row_drop_table_for_mysql(name, trx, SQLCOM_DROP_TABLE, true);
|
||||
|
||||
if (trx_is_started(trx)) {
|
||||
|
||||
@@ -2731,7 +2732,7 @@ row_drop_table_for_mysql_in_background(
|
||||
|
||||
/* Try to drop the table in InnoDB */
|
||||
|
||||
error = row_drop_table_for_mysql(name, trx, FALSE, FALSE);
|
||||
error = row_drop_table_for_mysql(name, trx, SQLCOM_TRUNCATE);
|
||||
|
||||
trx_commit_for_mysql(trx);
|
||||
|
||||
@@ -2877,8 +2878,8 @@ row_mysql_drop_garbage_tables()
|
||||
|
||||
if (dict_load_table(table_name, true,
|
||||
DICT_ERR_IGNORE_ALL)) {
|
||||
row_drop_table_for_mysql(
|
||||
table_name, trx, FALSE, FALSE);
|
||||
row_drop_table_for_mysql(table_name, trx,
|
||||
SQLCOM_DROP_TABLE);
|
||||
trx_commit_for_mysql(trx);
|
||||
}
|
||||
|
||||
@@ -2942,6 +2943,7 @@ func_exit:
|
||||
@param[in,out] trx transaction
|
||||
@param[out] new_id new table id
|
||||
@return error code or DB_SUCCESS */
|
||||
static
|
||||
dberr_t
|
||||
row_mysql_table_id_reassign(
|
||||
dict_table_t* table,
|
||||
@@ -3421,20 +3423,20 @@ If the data dictionary was not already locked by the transaction,
|
||||
the transaction will be committed. Otherwise, the data dictionary
|
||||
will remain locked.
|
||||
@param[in] name Table name
|
||||
@param[in] trx Transaction handle
|
||||
@param[in] drop_db true=dropping whole database
|
||||
@param[in] create_failed TRUE=create table failed
|
||||
@param[in,out] trx Transaction handle
|
||||
@param[in] sqlcom type of SQL operation
|
||||
@param[in] create_failed true=create table failed
|
||||
because e.g. foreign key column
|
||||
@param[in] nonatomic Whether it is permitted to release
|
||||
and reacquire dict_operation_lock
|
||||
@return error code or DB_SUCCESS */
|
||||
dberr_t
|
||||
row_drop_table_for_mysql(
|
||||
const char* name,
|
||||
trx_t* trx,
|
||||
bool drop_db,
|
||||
ibool create_failed,
|
||||
bool nonatomic)
|
||||
const char* name,
|
||||
trx_t* trx,
|
||||
enum_sql_command sqlcom,
|
||||
bool create_failed,
|
||||
bool nonatomic)
|
||||
{
|
||||
dberr_t err;
|
||||
dict_foreign_t* foreign;
|
||||
@@ -3603,7 +3605,7 @@ row_drop_table_for_mysql(
|
||||
|
||||
foreign = *it;
|
||||
|
||||
const bool ref_ok = drop_db
|
||||
const bool ref_ok = sqlcom == SQLCOM_DROP_DB
|
||||
&& dict_tables_have_same_db(
|
||||
name,
|
||||
foreign->foreign_table_name_lookup);
|
||||
@@ -3741,12 +3743,11 @@ defer:
|
||||
dict_drop_index_tree(). */
|
||||
info = pars_info_create();
|
||||
pars_info_add_str_literal(info, "table_name", name);
|
||||
err = que_eval_sql(
|
||||
err = (sqlcom == SQLCOM_TRUNCATE) ? DB_SUCCESS : que_eval_sql(
|
||||
info,
|
||||
"PROCEDURE DROP_TABLE_PROC () IS\n"
|
||||
"PROCEDURE DROP_FOREIGN_PROC () IS\n"
|
||||
"sys_foreign_id CHAR;\n"
|
||||
"table_id CHAR;\n"
|
||||
"index_id CHAR;\n"
|
||||
"foreign_id CHAR;\n"
|
||||
"space_id INT;\n"
|
||||
"found INT;\n"
|
||||
@@ -3756,19 +3757,14 @@ defer:
|
||||
"WHERE FOR_NAME = :table_name\n"
|
||||
"AND TO_BINARY(FOR_NAME)\n"
|
||||
" = TO_BINARY(:table_name)\n"
|
||||
"LOCK IN SHARE MODE;\n"
|
||||
|
||||
"DECLARE CURSOR cur_idx IS\n"
|
||||
"SELECT ID FROM SYS_INDEXES\n"
|
||||
"WHERE TABLE_ID = table_id\n"
|
||||
"LOCK IN SHARE MODE;\n"
|
||||
"FOR UPDATE;\n"
|
||||
|
||||
"BEGIN\n"
|
||||
|
||||
"SELECT ID INTO table_id\n"
|
||||
"FROM SYS_TABLES\n"
|
||||
"WHERE NAME = :table_name\n"
|
||||
"LOCK IN SHARE MODE;\n"
|
||||
"FOR UPDATE;\n"
|
||||
"IF (SQL % NOTFOUND) THEN\n"
|
||||
" RETURN;\n"
|
||||
"END IF;\n"
|
||||
@@ -3784,7 +3780,7 @@ defer:
|
||||
"SELECT ID INTO sys_foreign_id\n"
|
||||
"FROM SYS_TABLES\n"
|
||||
"WHERE NAME = 'SYS_FOREIGN'\n"
|
||||
"LOCK IN SHARE MODE;\n"
|
||||
"FOR UPDATE;\n"
|
||||
"IF (SQL % NOTFOUND) THEN\n"
|
||||
" found := 0;\n"
|
||||
"END IF;\n"
|
||||
@@ -3811,36 +3807,65 @@ defer:
|
||||
"END LOOP;\n"
|
||||
"CLOSE cur_fk;\n"
|
||||
|
||||
"found := 1;\n"
|
||||
"OPEN cur_idx;\n"
|
||||
"WHILE found = 1 LOOP\n"
|
||||
" FETCH cur_idx INTO index_id;\n"
|
||||
" IF (SQL % NOTFOUND) THEN\n"
|
||||
" found := 0;\n"
|
||||
" ELSE\n"
|
||||
" DELETE FROM SYS_FIELDS\n"
|
||||
" WHERE INDEX_ID = index_id;\n"
|
||||
" DELETE FROM SYS_INDEXES\n"
|
||||
" WHERE ID = index_id\n"
|
||||
" AND TABLE_ID = table_id;\n"
|
||||
" END IF;\n"
|
||||
"END LOOP;\n"
|
||||
"CLOSE cur_idx;\n"
|
||||
|
||||
"DELETE FROM SYS_COLUMNS\n"
|
||||
"WHERE TABLE_ID = table_id;\n"
|
||||
"DELETE FROM SYS_TABLES\n"
|
||||
"WHERE NAME = :table_name;\n"
|
||||
|
||||
"DELETE FROM SYS_TABLESPACES\n"
|
||||
"WHERE SPACE = space_id;\n"
|
||||
"DELETE FROM SYS_DATAFILES\n"
|
||||
"WHERE SPACE = space_id;\n"
|
||||
|
||||
"DELETE FROM SYS_VIRTUAL\n"
|
||||
"WHERE TABLE_ID = table_id;\n"
|
||||
"END;\n",
|
||||
FALSE, trx);
|
||||
if (err == DB_SUCCESS) {
|
||||
if (sqlcom != SQLCOM_TRUNCATE) {
|
||||
info = pars_info_create();
|
||||
pars_info_add_str_literal(info, "table_name", name);
|
||||
}
|
||||
|
||||
err = que_eval_sql(
|
||||
info,
|
||||
"PROCEDURE DROP_TABLE_PROC () IS\n"
|
||||
"table_id CHAR;\n"
|
||||
"space_id INT;\n"
|
||||
"index_id CHAR;\n"
|
||||
|
||||
"DECLARE CURSOR cur_idx IS\n"
|
||||
"SELECT ID FROM SYS_INDEXES\n"
|
||||
"WHERE TABLE_ID = table_id\n"
|
||||
"FOR UPDATE;\n"
|
||||
|
||||
"BEGIN\n"
|
||||
"SELECT ID, SPACE INTO table_id,space_id\n"
|
||||
"FROM SYS_TABLES\n"
|
||||
"WHERE NAME = :table_name FOR UPDATE;\n"
|
||||
"IF (SQL % NOTFOUND) THEN\n"
|
||||
" RETURN;\n"
|
||||
"END IF;\n"
|
||||
|
||||
"DELETE FROM SYS_COLUMNS\n"
|
||||
"WHERE TABLE_ID = table_id;\n"
|
||||
"DELETE FROM SYS_TABLES\n"
|
||||
"WHERE NAME = :table_name;\n"
|
||||
|
||||
"DELETE FROM SYS_TABLESPACES\n"
|
||||
"WHERE SPACE = space_id;\n"
|
||||
"DELETE FROM SYS_DATAFILES\n"
|
||||
"WHERE SPACE = space_id;\n"
|
||||
|
||||
"DELETE FROM SYS_VIRTUAL\n"
|
||||
"WHERE TABLE_ID = table_id;\n"
|
||||
|
||||
"OPEN cur_idx;\n"
|
||||
"WHILE 1 = 1 LOOP\n"
|
||||
" FETCH cur_idx INTO index_id;\n"
|
||||
" IF (SQL % NOTFOUND) THEN\n"
|
||||
" EXIT;\n"
|
||||
" ELSE\n"
|
||||
" DELETE FROM SYS_FIELDS\n"
|
||||
" WHERE INDEX_ID = index_id;\n"
|
||||
" DELETE FROM SYS_INDEXES\n"
|
||||
" WHERE ID = index_id\n"
|
||||
" AND TABLE_ID = table_id;\n"
|
||||
" END IF;\n"
|
||||
"END LOOP;\n"
|
||||
"CLOSE cur_idx;\n"
|
||||
|
||||
"END;\n",
|
||||
FALSE, trx);
|
||||
}
|
||||
|
||||
switch (err) {
|
||||
fil_space_t* space;
|
||||
@@ -3968,6 +3993,13 @@ funct_exit_all_freed:
|
||||
DBUG_RETURN(err);
|
||||
}
|
||||
|
||||
/** Drop a table after failed CREATE TABLE. */
|
||||
dberr_t row_drop_table_after_create_fail(const char* name, trx_t* trx)
|
||||
{
|
||||
ib::warn() << "Dropping incompletely created " << name << " table.";
|
||||
return row_drop_table_for_mysql(name, trx, SQLCOM_DROP_DB, true);
|
||||
}
|
||||
|
||||
/*******************************************************************//**
|
||||
Drop all foreign keys in a database, see Bug#18942.
|
||||
Called at the end of row_drop_database_for_mysql().
|
||||
@@ -4155,7 +4187,8 @@ loop:
|
||||
goto loop;
|
||||
}
|
||||
|
||||
err = row_drop_table_for_mysql(table_name, trx, TRUE, FALSE);
|
||||
err = row_drop_table_for_mysql(
|
||||
table_name, trx, SQLCOM_DROP_DB);
|
||||
trx_commit_for_mysql(trx);
|
||||
|
||||
if (err != DB_SUCCESS) {
|
||||
|
||||
@@ -1110,6 +1110,7 @@ try_again:
|
||||
/* The table was corrupt in the data dictionary.
|
||||
dict_set_corrupted() works on an index, and
|
||||
we do not have an index to call it with. */
|
||||
close_exit:
|
||||
dict_table_close(node->table, FALSE, FALSE);
|
||||
node->table = NULL;
|
||||
err_exit:
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -444,8 +444,8 @@ row_undo_ins_parse_undo_rec(
|
||||
close_table:
|
||||
/* Normally, tables should not disappear or become
|
||||
unaccessible during ROLLBACK, because they should be
|
||||
protected by InnoDB table locks. TRUNCATE TABLE
|
||||
or table corruption could be valid exceptions.
|
||||
protected by InnoDB table locks. Corruption could be
|
||||
a valid exception.
|
||||
|
||||
FIXME: When running out of temporary tablespace, it
|
||||
would probably be better to just drop all temporary
|
||||
|
||||
@@ -1182,8 +1182,8 @@ row_undo_mod_parse_undo_rec(
|
||||
close_table:
|
||||
/* Normally, tables should not disappear or become
|
||||
unaccessible during ROLLBACK, because they should be
|
||||
protected by InnoDB table locks. TRUNCATE TABLE
|
||||
or table corruption could be valid exceptions.
|
||||
protected by InnoDB table locks. Corruption could be
|
||||
a valid exception.
|
||||
|
||||
FIXME: When running out of temporary tablespace, it
|
||||
would probably be better to just drop all temporary
|
||||
|
||||
@@ -286,29 +286,7 @@ row_upd_check_references_constraints(
|
||||
FALSE, FALSE, DICT_ERR_IGNORE_NONE);
|
||||
}
|
||||
|
||||
/* dict_operation_lock is held both here
|
||||
(UPDATE or DELETE with FOREIGN KEY) and by TRUNCATE
|
||||
TABLE operations.
|
||||
If a TRUNCATE TABLE operation is in progress,
|
||||
there can be 2 possible conditions:
|
||||
1) row_truncate_table_for_mysql() is not yet called.
|
||||
2) Truncate releases dict_operation_lock
|
||||
during eviction of pages from buffer pool
|
||||
for a file-per-table tablespace.
|
||||
|
||||
In case of (1), truncate will wait for FK operation
|
||||
to complete.
|
||||
In case of (2), truncate will be rolled forward even
|
||||
if it is interrupted. So if the foreign table is
|
||||
undergoing a truncate, ignore the FK check. */
|
||||
|
||||
if (foreign_table) {
|
||||
if (foreign_table->space
|
||||
&& foreign_table->space
|
||||
->is_being_truncated) {
|
||||
continue;
|
||||
}
|
||||
|
||||
foreign_table->inc_fk_checks();
|
||||
}
|
||||
|
||||
|
||||
@@ -1098,8 +1098,7 @@ srv_undo_tablespaces_init(bool create_new_db)
|
||||
buf_LRU_flush_or_remove_pages(*it, &dummy2);
|
||||
|
||||
/* Remove the truncate redo log file. */
|
||||
undo::Truncate undo_trunc;
|
||||
undo_trunc.done_logging(*it);
|
||||
undo::done(*it);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1330,6 +1329,12 @@ srv_prepare_to_delete_redo_log_files(
|
||||
ulint pending_io = 0;
|
||||
ulint count = 0;
|
||||
|
||||
if ((log_sys.log.format & ~LOG_HEADER_FORMAT_ENCRYPTED)
|
||||
!= LOG_HEADER_FORMAT_CURRENT
|
||||
|| log_sys.log.subformat != 2) {
|
||||
srv_log_file_size = 0;
|
||||
}
|
||||
|
||||
do {
|
||||
/* Clean the buffer pool. */
|
||||
buf_flush_sync_all_buf_pools();
|
||||
@@ -1345,11 +1350,12 @@ srv_prepare_to_delete_redo_log_files(
|
||||
|
||||
{
|
||||
ib::info info;
|
||||
if (srv_log_file_size == 0
|
||||
|| (log_sys.log.format
|
||||
& ~LOG_HEADER_FORMAT_ENCRYPTED)
|
||||
!= LOG_HEADER_FORMAT_CURRENT) {
|
||||
info << "Upgrading redo log: ";
|
||||
if (srv_log_file_size == 0) {
|
||||
info << ((log_sys.log.format
|
||||
& ~LOG_HEADER_FORMAT_ENCRYPTED)
|
||||
!= LOG_HEADER_FORMAT_10_4
|
||||
? "Upgrading redo log: "
|
||||
: "Downgrading redo log: ");
|
||||
} else if (n_files != srv_n_log_files
|
||||
|| srv_log_file_size
|
||||
!= srv_log_file_size_requested) {
|
||||
@@ -2176,8 +2182,10 @@ files_checked:
|
||||
== (srv_encrypt_log
|
||||
? LOG_HEADER_FORMAT_CURRENT
|
||||
| LOG_HEADER_FORMAT_ENCRYPTED
|
||||
: LOG_HEADER_FORMAT_CURRENT)) {
|
||||
/* No need to upgrade or resize the redo log. */
|
||||
: LOG_HEADER_FORMAT_CURRENT)
|
||||
&& log_sys.log.subformat == 2) {
|
||||
/* No need to add or remove encryption,
|
||||
upgrade, downgrade, or resize. */
|
||||
} else {
|
||||
/* Prepare to delete the old redo log files */
|
||||
flushed_lsn = srv_prepare_to_delete_redo_log_files(i);
|
||||
|
||||
@@ -519,18 +519,22 @@ truncate of the UNDO is in progress. This file is required during recovery
|
||||
to complete the truncate. */
|
||||
|
||||
namespace undo {
|
||||
/** Magic Number to indicate truncate action is complete. */
|
||||
static const ib_uint32_t s_magic = 76845412;
|
||||
|
||||
/** Populate log file name based on space_id
|
||||
@param[in] space_id id of the undo tablespace.
|
||||
@return DB_SUCCESS or error code */
|
||||
dberr_t populate_log_file_name(
|
||||
static dberr_t populate_log_file_name(
|
||||
ulint space_id,
|
||||
char*& log_file_name)
|
||||
{
|
||||
ulint log_file_name_sz =
|
||||
strlen(srv_log_group_home_dir) + 22 + 1 /* NUL */
|
||||
+ strlen(undo::s_log_prefix)
|
||||
+ strlen(undo::s_log_ext);
|
||||
static const char s_log_prefix[] = "undo_";
|
||||
static const char s_log_ext[] = "trunc.log";
|
||||
|
||||
ulint log_file_name_sz = strlen(srv_log_group_home_dir)
|
||||
+ (22 - 1 /* NUL */
|
||||
+ sizeof s_log_prefix + sizeof s_log_ext);
|
||||
|
||||
log_file_name = new (std::nothrow) char[log_file_name_sz];
|
||||
if (log_file_name == 0) {
|
||||
@@ -552,63 +556,12 @@ namespace undo {
|
||||
|
||||
snprintf(log_file_name + log_file_name_len,
|
||||
log_file_name_sz - log_file_name_len,
|
||||
"%s%lu_%s", undo::s_log_prefix,
|
||||
(ulong) space_id, s_log_ext);
|
||||
"%s" ULINTPF "_%s", s_log_prefix,
|
||||
space_id, s_log_ext);
|
||||
|
||||
return(DB_SUCCESS);
|
||||
}
|
||||
|
||||
/** Create the truncate log file.
|
||||
@param[in] space_id id of the undo tablespace to truncate.
|
||||
@return DB_SUCCESS or error code. */
|
||||
dberr_t init(ulint space_id)
|
||||
{
|
||||
dberr_t err;
|
||||
char* log_file_name;
|
||||
|
||||
/* Step-1: Create the log file name using the pre-decided
|
||||
prefix/suffix and table id of undo tablepsace to truncate. */
|
||||
err = populate_log_file_name(space_id, log_file_name);
|
||||
if (err != DB_SUCCESS) {
|
||||
return(err);
|
||||
}
|
||||
|
||||
/* Step-2: Create the log file, open it and write 0 to
|
||||
indicate init phase. */
|
||||
bool ret;
|
||||
os_file_t handle = os_file_create(
|
||||
innodb_log_file_key, log_file_name, OS_FILE_CREATE,
|
||||
OS_FILE_NORMAL, OS_LOG_FILE, srv_read_only_mode, &ret);
|
||||
if (!ret) {
|
||||
delete[] log_file_name;
|
||||
return(DB_IO_ERROR);
|
||||
}
|
||||
|
||||
ulint sz = srv_page_size;
|
||||
void* buf = ut_zalloc_nokey(sz + srv_page_size);
|
||||
if (buf == NULL) {
|
||||
os_file_close(handle);
|
||||
delete[] log_file_name;
|
||||
return(DB_OUT_OF_MEMORY);
|
||||
}
|
||||
|
||||
byte* log_buf = static_cast<byte*>(
|
||||
ut_align(buf, srv_page_size));
|
||||
|
||||
IORequest request(IORequest::WRITE);
|
||||
|
||||
err = os_file_write(
|
||||
request, log_file_name, handle, log_buf, 0, sz);
|
||||
|
||||
os_file_flush(handle);
|
||||
os_file_close(handle);
|
||||
|
||||
ut_free(buf);
|
||||
delete[] log_file_name;
|
||||
|
||||
return(err);
|
||||
}
|
||||
|
||||
/** Mark completion of undo truncate action by writing magic number to
|
||||
the log file and then removing it from the disk.
|
||||
If we are going to remove it from disk then why write magic number ?
|
||||
@@ -967,43 +920,137 @@ trx_purge_initiate_truncate(
|
||||
|
||||
|
||||
/* Step-3: Start the actual truncate.
|
||||
a. log-checkpoint
|
||||
b. Write the DDL log to protect truncate action from CRASH
|
||||
c. Remove rseg instance if added to purge queue before we
|
||||
a. Remove rseg instance if added to purge queue before we
|
||||
initiate truncate.
|
||||
d. Execute actual truncate
|
||||
e. Remove the DDL log. */
|
||||
|
||||
/* After truncate if server crashes then redo logging done for this
|
||||
undo tablespace might not stand valid as tablespace has been
|
||||
truncated. */
|
||||
log_make_checkpoint_at(LSN_MAX, TRUE);
|
||||
b. Execute actual truncate */
|
||||
|
||||
const ulint space_id = undo_trunc->get_marked_space_id();
|
||||
|
||||
ib::info() << "Truncating UNDO tablespace " << space_id;
|
||||
|
||||
#ifdef UNIV_DEBUG
|
||||
dberr_t err =
|
||||
#endif /* UNIV_DEBUG */
|
||||
undo_trunc->start_logging(space_id);
|
||||
ut_ad(err == DB_SUCCESS);
|
||||
|
||||
DBUG_EXECUTE_IF("ib_undo_trunc_before_truncate",
|
||||
ib::info() << "ib_undo_trunc_before_truncate";
|
||||
DBUG_SUICIDE(););
|
||||
|
||||
trx_purge_cleanse_purge_queue(undo_trunc);
|
||||
|
||||
if (!trx_undo_truncate_tablespace(undo_trunc)) {
|
||||
/* Note: In case of error we don't enable the rsegs
|
||||
and neither unmark the tablespace so the tablespace
|
||||
continue to remain inactive. */
|
||||
ib::error() << "Failed to truncate UNDO tablespace "
|
||||
<< space_id;
|
||||
ut_a(srv_is_undo_tablespace(space_id));
|
||||
|
||||
fil_space_t* space = fil_space_get(space_id);
|
||||
|
||||
if (!space) {
|
||||
not_found:
|
||||
ib::error() << "Failed to find UNDO tablespace " << space_id;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Flush all to-be-discarded pages of the tablespace.
|
||||
|
||||
During truncation, we do not want any writes to the
|
||||
to-be-discarded area, because we must set the space->size
|
||||
early in order to have deterministic page allocation.
|
||||
|
||||
If a log checkpoint was completed at LSN earlier than our
|
||||
mini-transaction commit and the server was killed, then
|
||||
discarding the to-be-trimmed pages without flushing would
|
||||
break crash recovery. So, we cannot avoid the write. */
|
||||
{
|
||||
FlushObserver observer(
|
||||
space,
|
||||
UT_LIST_GET_FIRST(purge_sys.query->thrs)->graph->trx,
|
||||
NULL);
|
||||
buf_LRU_flush_or_remove_pages(space_id, &observer);
|
||||
}
|
||||
|
||||
log_free_check();
|
||||
|
||||
/* Adjust the tablespace metadata. */
|
||||
space = fil_truncate_prepare(space_id);
|
||||
|
||||
if (!space) {
|
||||
goto not_found;
|
||||
}
|
||||
|
||||
/* Undo tablespace always are a single file. */
|
||||
ut_a(UT_LIST_GET_LEN(space->chain) == 1);
|
||||
fil_node_t* file = UT_LIST_GET_FIRST(space->chain);
|
||||
/* The undo tablespace files are never closed. */
|
||||
ut_ad(file->is_open());
|
||||
|
||||
/* Re-initialize tablespace, in a single mini-transaction. */
|
||||
mtr_t mtr;
|
||||
const ulint size = SRV_UNDO_TABLESPACE_SIZE_IN_PAGES;
|
||||
mtr.start();
|
||||
mtr_x_lock(&space->latch, &mtr);
|
||||
fil_truncate_log(space, size, &mtr);
|
||||
fsp_header_init(space, size, &mtr);
|
||||
mutex_enter(&fil_system.mutex);
|
||||
space->size = file->size = size;
|
||||
mutex_exit(&fil_system.mutex);
|
||||
|
||||
buf_block_t* sys_header = trx_sysf_get(&mtr);
|
||||
|
||||
for (ulint i = 0; i < undo_trunc->rsegs_size(); ++i) {
|
||||
trx_rsegf_t* rseg_header;
|
||||
|
||||
trx_rseg_t* rseg = undo_trunc->get_ith_rseg(i);
|
||||
|
||||
rseg->page_no = trx_rseg_header_create(
|
||||
space, rseg->id, sys_header, &mtr);
|
||||
|
||||
rseg_header = trx_rsegf_get_new(
|
||||
space_id, rseg->page_no, &mtr);
|
||||
|
||||
/* Before re-initialization ensure that we free the existing
|
||||
structure. There can't be any active transactions. */
|
||||
ut_a(UT_LIST_GET_LEN(rseg->undo_list) == 0);
|
||||
ut_a(UT_LIST_GET_LEN(rseg->old_insert_list) == 0);
|
||||
|
||||
trx_undo_t* next_undo;
|
||||
|
||||
for (trx_undo_t* undo = UT_LIST_GET_FIRST(rseg->undo_cached);
|
||||
undo != NULL;
|
||||
undo = next_undo) {
|
||||
|
||||
next_undo = UT_LIST_GET_NEXT(undo_list, undo);
|
||||
UT_LIST_REMOVE(rseg->undo_cached, undo);
|
||||
MONITOR_DEC(MONITOR_NUM_UNDO_SLOT_CACHED);
|
||||
ut_free(undo);
|
||||
}
|
||||
|
||||
UT_LIST_INIT(rseg->undo_list, &trx_undo_t::undo_list);
|
||||
UT_LIST_INIT(rseg->undo_cached, &trx_undo_t::undo_list);
|
||||
UT_LIST_INIT(rseg->old_insert_list, &trx_undo_t::undo_list);
|
||||
|
||||
/* These were written by trx_rseg_header_create(). */
|
||||
ut_ad(!mach_read_from_4(rseg_header + TRX_RSEG_FORMAT));
|
||||
ut_ad(!mach_read_from_4(rseg_header + TRX_RSEG_HISTORY_SIZE));
|
||||
|
||||
/* Initialize the undo log lists according to the rseg header */
|
||||
rseg->curr_size = 1;
|
||||
rseg->trx_ref_count = 0;
|
||||
rseg->last_page_no = FIL_NULL;
|
||||
rseg->last_offset = 0;
|
||||
rseg->last_commit = 0;
|
||||
rseg->needs_purge = false;
|
||||
}
|
||||
|
||||
mtr.commit();
|
||||
/* Write-ahead the redo log record. */
|
||||
log_write_up_to(mtr.commit_lsn(), true);
|
||||
|
||||
/* Trim the file size. */
|
||||
os_file_truncate(file->name, file->handle,
|
||||
os_offset_t(size) << srv_page_size_shift, true);
|
||||
|
||||
/* This is only executed by the srv_coordinator_thread. */
|
||||
export_vars.innodb_undo_truncations++;
|
||||
|
||||
/* TODO: PUNCH_HOLE the garbage (with write-ahead logging) */
|
||||
|
||||
mutex_enter(&fil_system.mutex);
|
||||
ut_ad(space->stop_new_ops);
|
||||
ut_ad(space->is_being_truncated);
|
||||
space->stop_new_ops = false;
|
||||
space->is_being_truncated = false;
|
||||
mutex_exit(&fil_system.mutex);
|
||||
|
||||
if (purge_sys.rseg != NULL
|
||||
&& purge_sys.rseg->last_page_no == FIL_NULL) {
|
||||
/* If purge_sys.rseg is pointing to rseg that was recently
|
||||
@@ -1017,14 +1064,11 @@ trx_purge_initiate_truncate(
|
||||
purge_sys.rseg = NULL;
|
||||
}
|
||||
|
||||
DBUG_EXECUTE_IF("ib_undo_trunc_before_ddl_log_end",
|
||||
ib::info() << "ib_undo_trunc_before_ddl_log_end";
|
||||
DBUG_EXECUTE_IF("ib_undo_trunc",
|
||||
ib::info() << "ib_undo_trunc";
|
||||
log_write_up_to(LSN_MAX, true);
|
||||
DBUG_SUICIDE(););
|
||||
|
||||
log_make_checkpoint_at(LSN_MAX, TRUE);
|
||||
|
||||
undo_trunc->done_logging(space_id);
|
||||
|
||||
/* Completed truncate. Now it is safe to re-use the tablespace. */
|
||||
for (ulint i = 0; i < undo_trunc->rsegs_size(); ++i) {
|
||||
trx_rseg_t* rseg = undo_trunc->get_ith_rseg(i);
|
||||
@@ -1035,10 +1079,6 @@ trx_purge_initiate_truncate(
|
||||
|
||||
undo_trunc->reset();
|
||||
undo::Truncate::clear_trunc_list();
|
||||
|
||||
DBUG_EXECUTE_IF("ib_undo_trunc_trunc_done",
|
||||
ib::info() << "ib_undo_trunc_trunc_done";
|
||||
DBUG_SUICIDE(););
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -306,7 +306,9 @@ trx_rseg_header_create(
|
||||
|
||||
/* Reset the undo log slots */
|
||||
for (ulint i = 0; i < TRX_RSEG_N_SLOTS; i++) {
|
||||
|
||||
/* FIXME: This is generating a lot of redo log.
|
||||
Why not just let it remain zero-initialized,
|
||||
and adjust trx_rsegf_undo_find_free() and friends? */
|
||||
trx_rsegf_set_nth_undo(rsegf, i, FIL_NULL, mtr);
|
||||
}
|
||||
|
||||
|
||||
@@ -1684,87 +1684,3 @@ trx_undo_free_at_shutdown(trx_t *trx)
|
||||
undo = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/** Truncate UNDO tablespace, reinitialize header and rseg.
|
||||
@param[in] undo_trunc UNDO tablespace handler
|
||||
@return true if success else false. */
|
||||
bool
|
||||
trx_undo_truncate_tablespace(
|
||||
undo::Truncate* undo_trunc)
|
||||
|
||||
{
|
||||
fil_space_t* space = fil_space_acquire(
|
||||
undo_trunc->get_marked_space_id());
|
||||
if (!space) return false;
|
||||
|
||||
/* Step-1: Truncate tablespace. */
|
||||
if (!fil_truncate_tablespace(
|
||||
space, SRV_UNDO_TABLESPACE_SIZE_IN_PAGES)) {
|
||||
space->release();
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Step-2: Re-initialize tablespace header.
|
||||
Avoid REDO logging as we don't want to apply the action if server
|
||||
crashes. For fix-up we have UNDO-truncate-ddl-log. */
|
||||
mtr_t mtr;
|
||||
mtr_start(&mtr);
|
||||
mtr_set_log_mode(&mtr, MTR_LOG_NO_REDO);
|
||||
fsp_header_init(space, SRV_UNDO_TABLESPACE_SIZE_IN_PAGES, &mtr);
|
||||
mtr_commit(&mtr);
|
||||
|
||||
/* Step-3: Re-initialize rollback segment header that resides
|
||||
in truncated tablespaced. */
|
||||
mtr_start(&mtr);
|
||||
mtr_set_log_mode(&mtr, MTR_LOG_NO_REDO);
|
||||
mtr_x_lock(&space->latch, &mtr);
|
||||
buf_block_t* sys_header = trx_sysf_get(&mtr);
|
||||
|
||||
for (ulint i = 0; i < undo_trunc->rsegs_size(); ++i) {
|
||||
trx_rsegf_t* rseg_header;
|
||||
|
||||
trx_rseg_t* rseg = undo_trunc->get_ith_rseg(i);
|
||||
|
||||
rseg->page_no = trx_rseg_header_create(
|
||||
space, rseg->id, sys_header, &mtr);
|
||||
|
||||
rseg_header = trx_rsegf_get_new(space->id, rseg->page_no,
|
||||
&mtr);
|
||||
|
||||
/* Before re-initialization ensure that we free the existing
|
||||
structure. There can't be any active transactions. */
|
||||
ut_a(UT_LIST_GET_LEN(rseg->undo_list) == 0);
|
||||
|
||||
trx_undo_t* next_undo;
|
||||
|
||||
for (trx_undo_t* undo = UT_LIST_GET_FIRST(rseg->undo_cached);
|
||||
undo != NULL;
|
||||
undo = next_undo) {
|
||||
|
||||
next_undo = UT_LIST_GET_NEXT(undo_list, undo);
|
||||
UT_LIST_REMOVE(rseg->undo_cached, undo);
|
||||
MONITOR_DEC(MONITOR_NUM_UNDO_SLOT_CACHED);
|
||||
ut_free(undo);
|
||||
}
|
||||
|
||||
UT_LIST_INIT(rseg->undo_list, &trx_undo_t::undo_list);
|
||||
UT_LIST_INIT(rseg->undo_cached, &trx_undo_t::undo_list);
|
||||
|
||||
/* Initialize the undo log lists according to the rseg header */
|
||||
rseg->curr_size = mtr_read_ulint(
|
||||
rseg_header + TRX_RSEG_HISTORY_SIZE, MLOG_4BYTES, &mtr)
|
||||
+ 1;
|
||||
|
||||
ut_ad(rseg->curr_size == 1);
|
||||
|
||||
rseg->trx_ref_count = 0;
|
||||
rseg->last_page_no = FIL_NULL;
|
||||
rseg->last_offset = 0;
|
||||
rseg->last_commit = 0;
|
||||
rseg->needs_purge = false;
|
||||
}
|
||||
mtr_commit(&mtr);
|
||||
space->release();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -12874,13 +12874,22 @@ int ha_mroonga::delete_all_rows()
|
||||
int ha_mroonga::wrapper_truncate()
|
||||
{
|
||||
int error = 0;
|
||||
MRN_SHARE *tmp_share;
|
||||
MRN_DBUG_ENTER_METHOD();
|
||||
|
||||
if (!(tmp_share = mrn_get_share(table->s->table_name.str, table, &error)))
|
||||
DBUG_RETURN(error);
|
||||
|
||||
MRN_SET_WRAP_SHARE_KEY(share, table->s);
|
||||
MRN_SET_WRAP_TABLE_KEY(this, table);
|
||||
error = wrap_handler->ha_truncate();
|
||||
error = parse_engine_table_options(ha_thd(), tmp_share->hton, table->s)
|
||||
? MRN_GET_ERROR_NUMBER
|
||||
: wrap_handler->ha_truncate();
|
||||
MRN_SET_BASE_SHARE_KEY(share, table->s);
|
||||
MRN_SET_BASE_TABLE_KEY(this, table);
|
||||
|
||||
mrn_free_share(tmp_share);
|
||||
|
||||
if (!error && wrapper_have_target_index()) {
|
||||
error = wrapper_truncate_index();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user