mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
MDEV-13564: Implement innodb_unsafe_truncate=ON for compatibility
While MariaDB Server 10.2 is not really guaranteed to be compatible with Percona XtraBackup 2.4 (for example, the MySQL 5.7 undo log format change that could be present in XtraBackup, but was reverted from MariaDB in MDEV-12289), we do not want to disrupt users who have deployed xtrabackup and MariaDB Server 10.2 in their environments. With this change, MariaDB 10.2 will continue to use the backup-unsafe TRUNCATE TABLE code, so that neither the undo log nor the redo log formats will change in an incompatible way. Undo tablespace truncation will keep using the redo log only. Recovery or backup with old code will fail to shrink the undo tablespace files, but the contents will be recovered just fine. In the MariaDB Server 10.2 series only, we introduce the configuration parameter innodb_unsafe_truncate and make it ON by default. To allow MariaDB Backup (mariabackup) to work properly with TRUNCATE TABLE operations, use loose_innodb_unsafe_truncate=OFF. MariaDB Server 10.3.10 and later releases will always use the backup-safe TRUNCATE TABLE, and this parameter will not be added there. recv_recovery_rollback_active(): Skip row_mysql_drop_garbage_tables() unless innodb_unsafe_truncate=OFF. It is too unsafe to drop orphan tables if RENAME operations are not transactional within InnoDB. LOG_HEADER_FORMAT_10_3: Replaces LOG_HEADER_FORMAT_CURRENT. log_init(), log_group_file_header_flush(), srv_prepare_to_delete_redo_log_files(), innobase_start_or_create_for_mysql(): Choose the redo log format and subformat based on the value of innodb_unsafe_truncate.
This commit is contained in:
1
mysql-test/suite/gcol/t/innodb_virtual_debug_purge.opt
Normal file
1
mysql-test/suite/gcol/t/innodb_virtual_debug_purge.opt
Normal file
@ -0,0 +1 @@
|
||||
--skip-innodb-unsafe-truncate
|
416
mysql-test/suite/innodb/include/innodb_wl6501_crash.inc
Normal file
416
mysql-test/suite/innodb/include/innodb_wl6501_crash.inc
Normal file
@ -0,0 +1,416 @@
|
||||
#
|
||||
# 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;
|
98
mysql-test/suite/innodb/include/innodb_wl6501_crash_temp.inc
Normal file
98
mysql-test/suite/innodb/include/innodb_wl6501_crash_temp.inc
Normal file
@ -0,0 +1,98 @@
|
||||
#
|
||||
# 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;
|
8
mysql-test/suite/innodb/include/truncate_recover.inc
Normal file
8
mysql-test/suite/innodb/include/truncate_recover.inc
Normal file
@ -0,0 +1,8 @@
|
||||
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
|
88
mysql-test/suite/innodb/r/truncate_debug.result
Normal file
88
mysql-test/suite/innodb/r/truncate_debug.result
Normal file
@ -0,0 +1,88 @@
|
||||
#
|
||||
# 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;
|
||||
create index idx1 on t1(f3);
|
||||
create table t2 (f1 int,f2 int,key(f2),f3 int) engine=innodb;
|
||||
create table t3 (f1 int,f2 int,key(f2)) engine=innodb;
|
||||
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;
|
114
mysql-test/suite/innodb/r/truncate_inject.result
Normal file
114
mysql-test/suite/innodb/r/truncate_inject.result
Normal file
@ -0,0 +1,114 @@
|
||||
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;
|
29
mysql-test/suite/innodb/r/truncate_purge_debug.result
Normal file
29
mysql-test/suite/innodb/r/truncate_purge_debug.result
Normal file
@ -0,0 +1,29 @@
|
||||
#
|
||||
# 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;
|
12
mysql-test/suite/innodb/r/truncate_restart.result
Normal file
12
mysql-test/suite/innodb/r/truncate_restart.result
Normal file
@ -0,0 +1,12 @@
|
||||
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
mysql-test/suite/innodb/t/alter_copy.opt
Normal file
1
mysql-test/suite/innodb/t/alter_copy.opt
Normal file
@ -0,0 +1 @@
|
||||
--loose-skip-innodb-unsafe-truncate
|
@ -1 +1,2 @@
|
||||
--loose-innodb-sys-tables
|
||||
--loose-skip-innodb-unsafe-truncate
|
||||
|
1
mysql-test/suite/innodb/t/drop_table_background.opt
Normal file
1
mysql-test/suite/innodb/t/drop_table_background.opt
Normal file
@ -0,0 +1 @@
|
||||
--loose-skip-innodb-unsafe-truncate
|
1
mysql-test/suite/innodb/t/rename_table_debug.opt
Normal file
1
mysql-test/suite/innodb/t/rename_table_debug.opt
Normal file
@ -0,0 +1 @@
|
||||
--loose-skip-innodb-unsafe-truncate
|
1
mysql-test/suite/innodb/t/truncate.opt
Normal file
1
mysql-test/suite/innodb/t/truncate.opt
Normal file
@ -0,0 +1 @@
|
||||
--loose-skip-innodb-unsafe-truncate
|
1
mysql-test/suite/innodb/t/truncate_crash.opt
Normal file
1
mysql-test/suite/innodb/t/truncate_crash.opt
Normal file
@ -0,0 +1 @@
|
||||
--loose-skip-innodb-unsafe-truncate
|
127
mysql-test/suite/innodb/t/truncate_debug.test
Normal file
127
mysql-test/suite/innodb/t/truncate_debug.test
Normal file
@ -0,0 +1,127 @@
|
||||
--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;
|
||||
create index idx1 on t1(f3);
|
||||
create table t2 (f1 int,f2 int,key(f2),f3 int) engine=innodb;
|
||||
create table t3 (f1 int,f2 int,key(f2)) engine=innodb;
|
||||
|
||||
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
|
1
mysql-test/suite/innodb/t/truncate_foreign.opt
Normal file
1
mysql-test/suite/innodb/t/truncate_foreign.opt
Normal file
@ -0,0 +1 @@
|
||||
--loose-skip-innodb-unsafe-truncate
|
97
mysql-test/suite/innodb/t/truncate_inject.test
Normal file
97
mysql-test/suite/innodb/t/truncate_inject.test
Normal file
@ -0,0 +1,97 @@
|
||||
# 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;
|
1
mysql-test/suite/innodb/t/truncate_missing.opt
Normal file
1
mysql-test/suite/innodb/t/truncate_missing.opt
Normal file
@ -0,0 +1 @@
|
||||
--loose-skip-innodb-unsafe-truncate
|
3
mysql-test/suite/innodb/t/truncate_purge_debug.opt
Normal file
3
mysql-test/suite/innodb/t/truncate_purge_debug.opt
Normal file
@ -0,0 +1,3 @@
|
||||
--innodb-purge-threads=1
|
||||
--innodb-purge-batch-size=1
|
||||
--innodb-stats-persistent=OFF
|
49
mysql-test/suite/innodb/t/truncate_purge_debug.test
Normal file
49
mysql-test/suite/innodb/t/truncate_purge_debug.test
Normal file
@ -0,0 +1,49 @@
|
||||
--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
|
16
mysql-test/suite/innodb/t/truncate_restart.test
Normal file
16
mysql-test/suite/innodb/t/truncate_restart.test
Normal file
@ -0,0 +1,16 @@
|
||||
--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;
|
112
mysql-test/suite/innodb_zip/include/innodb_wl6501_scale.inc
Normal file
112
mysql-test/suite/innodb_zip/include/innodb_wl6501_scale.inc
Normal file
@ -0,0 +1,112 @@
|
||||
#
|
||||
# load tables with some significant amount of data and then truncate it.
|
||||
#
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
#
|
||||
# create test-bed
|
||||
#
|
||||
let $per_table = `select @@innodb_file_per_table`;
|
||||
let $format = `select @@innodb_file_format`;
|
||||
|
||||
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_format = $format;
|
||||
eval set global innodb_file_per_table = $per_table;
|
1202
mysql-test/suite/innodb_zip/r/wl6501_1.result
Normal file
1202
mysql-test/suite/innodb_zip/r/wl6501_1.result
Normal file
File diff suppressed because it is too large
Load Diff
462
mysql-test/suite/innodb_zip/r/wl6501_crash_3.result
Normal file
462
mysql-test/suite/innodb_zip/r/wl6501_crash_3.result
Normal file
@ -0,0 +1,462 @@
|
||||
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;
|
519
mysql-test/suite/innodb_zip/r/wl6501_crash_4.result
Normal file
519
mysql-test/suite/innodb_zip/r/wl6501_crash_4.result
Normal file
@ -0,0 +1,519 @@
|
||||
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;
|
462
mysql-test/suite/innodb_zip/r/wl6501_crash_5.result
Normal file
462
mysql-test/suite/innodb_zip/r/wl6501_crash_5.result
Normal file
@ -0,0 +1,462 @@
|
||||
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;
|
345
mysql-test/suite/innodb_zip/r/wl6501_scale_1.result
Normal file
345
mysql-test/suite/innodb_zip/r/wl6501_scale_1.result
Normal file
@ -0,0 +1,345 @@
|
||||
set innodb_strict_mode=OFF;
|
||||
create procedure populate()
|
||||
begin
|
||||
declare i int default 1;
|
||||
while (i <= 5000) do
|
||||
insert into t1 values (i, 'a', 'b');
|
||||
insert into t2 values (i, 'a', 'b');
|
||||
insert into t3 values (i, 'a', 'b');
|
||||
set i = i + 1;
|
||||
end while;
|
||||
end|
|
||||
create procedure populate_small()
|
||||
begin
|
||||
declare i int default 10001;
|
||||
while (i <= 12000) do
|
||||
insert into t1 values (i, 'c', 'd');
|
||||
insert into t2 values (i, 'a', 'b');
|
||||
insert into t3 values (i, 'a', 'b');
|
||||
set i = i + 1;
|
||||
end while;
|
||||
end|
|
||||
set global innodb_file_per_table = 1;
|
||||
create table tNUMBER
|
||||
(i int, cNUMBER char(NUMBER), cNUMBER char(NUMBER),
|
||||
index cNUMBER_idx(cNUMBER))
|
||||
engine=innodb row_format=compact
|
||||
key_block_size=NUMBER;
|
||||
Warnings:
|
||||
Warning NUMBER InnoDB: ignoring KEY_BLOCK_SIZE=NUMBER unless ROW_FORMAT=COMPRESSED.
|
||||
create table t2
|
||||
(i int, c1 char(100), c2 char(100),
|
||||
index c1_idx(c1))
|
||||
engine=innodb row_format=compact
|
||||
key_block_size=16;
|
||||
Warnings:
|
||||
Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=16 unless ROW_FORMAT=COMPRESSED.
|
||||
create temporary table t3
|
||||
(i int, c1 char(100), c2 char(100),
|
||||
index c1_idx(c1))
|
||||
engine=innodb row_format=compact
|
||||
key_block_size=16;
|
||||
Warnings:
|
||||
Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE.
|
||||
Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=16.
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
0
|
||||
select count(*) from t2;
|
||||
count(*)
|
||||
0
|
||||
select count(*) from t3;
|
||||
count(*)
|
||||
0
|
||||
begin;
|
||||
call populate();
|
||||
commit;
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
5000
|
||||
select count(*) from t2;
|
||||
count(*)
|
||||
5000
|
||||
select count(*) from t3;
|
||||
count(*)
|
||||
5000
|
||||
truncate table t1;
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
0
|
||||
select count(*) from t2;
|
||||
count(*)
|
||||
5000
|
||||
select count(*) from t3;
|
||||
count(*)
|
||||
5000
|
||||
call populate_small();
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from t2;
|
||||
count(*)
|
||||
7000
|
||||
select count(*) from t3;
|
||||
count(*)
|
||||
7000
|
||||
truncate table t2;
|
||||
truncate table t3;
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from t2;
|
||||
count(*)
|
||||
0
|
||||
select count(*) from t3;
|
||||
count(*)
|
||||
0
|
||||
call populate_small();
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
4000
|
||||
select count(*) from t2;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from t3;
|
||||
count(*)
|
||||
2000
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
drop table t3;
|
||||
drop procedure populate;
|
||||
drop procedure populate_small;
|
||||
set global innodb_file_format = Barracuda;
|
||||
Warnings:
|
||||
Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See https://mariadb.com/kb/en/library/xtradbinnodb-file-format/
|
||||
set global innodb_file_per_table = 1;
|
||||
set innodb_strict_mode=OFF;
|
||||
create procedure populate()
|
||||
begin
|
||||
declare i int default 1;
|
||||
while (i <= 5000) do
|
||||
insert into t1 values (i, 'a', 'b');
|
||||
insert into t2 values (i, 'a', 'b');
|
||||
insert into t3 values (i, 'a', 'b');
|
||||
set i = i + 1;
|
||||
end while;
|
||||
end|
|
||||
create procedure populate_small()
|
||||
begin
|
||||
declare i int default 10001;
|
||||
while (i <= 12000) do
|
||||
insert into t1 values (i, 'c', 'd');
|
||||
insert into t2 values (i, 'a', 'b');
|
||||
insert into t3 values (i, 'a', 'b');
|
||||
set i = i + 1;
|
||||
end while;
|
||||
end|
|
||||
set global innodb_file_per_table = 1;
|
||||
create table tNUMBER
|
||||
(i int, cNUMBER char(NUMBER), cNUMBER char(NUMBER),
|
||||
index cNUMBER_idx(cNUMBER))
|
||||
engine=innodb row_format=compressed
|
||||
key_block_size=NUMBER;
|
||||
create table t2
|
||||
(i int, c1 char(100), c2 char(100),
|
||||
index c1_idx(c1))
|
||||
engine=innodb row_format=compressed
|
||||
key_block_size=16;
|
||||
create temporary table t3
|
||||
(i int, c1 char(100), c2 char(100),
|
||||
index c1_idx(c1))
|
||||
engine=innodb row_format=compressed
|
||||
key_block_size=16;
|
||||
Warnings:
|
||||
Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE.
|
||||
Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=16.
|
||||
Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE.
|
||||
Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC.
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
0
|
||||
select count(*) from t2;
|
||||
count(*)
|
||||
0
|
||||
select count(*) from t3;
|
||||
count(*)
|
||||
0
|
||||
begin;
|
||||
call populate();
|
||||
commit;
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
5000
|
||||
select count(*) from t2;
|
||||
count(*)
|
||||
5000
|
||||
select count(*) from t3;
|
||||
count(*)
|
||||
5000
|
||||
truncate table t1;
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
0
|
||||
select count(*) from t2;
|
||||
count(*)
|
||||
5000
|
||||
select count(*) from t3;
|
||||
count(*)
|
||||
5000
|
||||
call populate_small();
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from t2;
|
||||
count(*)
|
||||
7000
|
||||
select count(*) from t3;
|
||||
count(*)
|
||||
7000
|
||||
truncate table t2;
|
||||
truncate table t3;
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from t2;
|
||||
count(*)
|
||||
0
|
||||
select count(*) from t3;
|
||||
count(*)
|
||||
0
|
||||
call populate_small();
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
4000
|
||||
select count(*) from t2;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from t3;
|
||||
count(*)
|
||||
2000
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
drop table t3;
|
||||
drop procedure populate;
|
||||
drop procedure populate_small;
|
||||
set global innodb_file_format = Barracuda;
|
||||
Warnings:
|
||||
Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See https://mariadb.com/kb/en/library/xtradbinnodb-file-format/
|
||||
set global innodb_file_per_table = 1;
|
||||
set innodb_strict_mode=OFF;
|
||||
create procedure populate()
|
||||
begin
|
||||
declare i int default 1;
|
||||
while (i <= 5000) do
|
||||
insert into t1 values (i, 'a', 'b');
|
||||
insert into t2 values (i, 'a', 'b');
|
||||
insert into t3 values (i, 'a', 'b');
|
||||
set i = i + 1;
|
||||
end while;
|
||||
end|
|
||||
create procedure populate_small()
|
||||
begin
|
||||
declare i int default 10001;
|
||||
while (i <= 12000) do
|
||||
insert into t1 values (i, 'c', 'd');
|
||||
insert into t2 values (i, 'a', 'b');
|
||||
insert into t3 values (i, 'a', 'b');
|
||||
set i = i + 1;
|
||||
end while;
|
||||
end|
|
||||
set global innodb_file_per_table = 0;
|
||||
create table tNUMBER
|
||||
(i int, cNUMBER char(NUMBER), cNUMBER char(NUMBER),
|
||||
index cNUMBER_idx(cNUMBER))
|
||||
engine=innodb row_format=compact
|
||||
key_block_size=NUMBER;
|
||||
Warnings:
|
||||
Warning NUMBER InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
|
||||
Warning NUMBER InnoDB: ignoring KEY_BLOCK_SIZE=NUMBER.
|
||||
create table t2
|
||||
(i int, c1 char(100), c2 char(100),
|
||||
index c1_idx(c1))
|
||||
engine=innodb row_format=compact
|
||||
key_block_size=16;
|
||||
Warnings:
|
||||
Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
|
||||
Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=16.
|
||||
create temporary table t3
|
||||
(i int, c1 char(100), c2 char(100),
|
||||
index c1_idx(c1))
|
||||
engine=innodb row_format=compact
|
||||
key_block_size=16;
|
||||
Warnings:
|
||||
Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE.
|
||||
Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=16.
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
0
|
||||
select count(*) from t2;
|
||||
count(*)
|
||||
0
|
||||
select count(*) from t3;
|
||||
count(*)
|
||||
0
|
||||
begin;
|
||||
call populate();
|
||||
commit;
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
5000
|
||||
select count(*) from t2;
|
||||
count(*)
|
||||
5000
|
||||
select count(*) from t3;
|
||||
count(*)
|
||||
5000
|
||||
truncate table t1;
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
0
|
||||
select count(*) from t2;
|
||||
count(*)
|
||||
5000
|
||||
select count(*) from t3;
|
||||
count(*)
|
||||
5000
|
||||
call populate_small();
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from t2;
|
||||
count(*)
|
||||
7000
|
||||
select count(*) from t3;
|
||||
count(*)
|
||||
7000
|
||||
truncate table t2;
|
||||
truncate table t3;
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from t2;
|
||||
count(*)
|
||||
0
|
||||
select count(*) from t3;
|
||||
count(*)
|
||||
0
|
||||
call populate_small();
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
4000
|
||||
select count(*) from t2;
|
||||
count(*)
|
||||
2000
|
||||
select count(*) from t3;
|
||||
count(*)
|
||||
2000
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
drop table t3;
|
||||
drop procedure populate;
|
||||
drop procedure populate_small;
|
||||
set global innodb_file_format = Barracuda;
|
||||
Warnings:
|
||||
Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See https://mariadb.com/kb/en/library/xtradbinnodb-file-format/
|
||||
set global innodb_file_per_table = 1;
|
@ -1,3 +1,4 @@
|
||||
--loose-innodb-sys-tables
|
||||
--loose-innodb-sys-tablespaces
|
||||
--loose-innodb-sys-datafiles
|
||||
--loose-skip-innodb-unsafe-truncate
|
||||
|
451
mysql-test/suite/innodb_zip/t/wl6501_1.test
Normal file
451
mysql-test/suite/innodb_zip/t/wl6501_1.test
Normal file
@ -0,0 +1,451 @@
|
||||
|
||||
####################################################################
|
||||
# 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
|
||||
}
|
||||
|
||||
|
||||
|
25
mysql-test/suite/innodb_zip/t/wl6501_crash_3.test
Normal file
25
mysql-test/suite/innodb_zip/t/wl6501_crash_3.test
Normal file
@ -0,0 +1,25 @@
|
||||
#
|
||||
# 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
|
||||
|
27
mysql-test/suite/innodb_zip/t/wl6501_crash_4.test
Normal file
27
mysql-test/suite/innodb_zip/t/wl6501_crash_4.test
Normal file
@ -0,0 +1,27 @@
|
||||
#
|
||||
# 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
|
25
mysql-test/suite/innodb_zip/t/wl6501_crash_5.test
Normal file
25
mysql-test/suite/innodb_zip/t/wl6501_crash_5.test
Normal file
@ -0,0 +1,25 @@
|
||||
#
|
||||
# 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
|
||||
|
37
mysql-test/suite/innodb_zip/t/wl6501_scale_1.test
Normal file
37
mysql-test/suite/innodb_zip/t/wl6501_scale_1.test
Normal file
@ -0,0 +1,37 @@
|
||||
#
|
||||
# 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
|
1
mysql-test/suite/mariabackup/truncate_during_backup.opt
Normal file
1
mysql-test/suite/mariabackup/truncate_during_backup.opt
Normal file
@ -0,0 +1 @@
|
||||
--loose-skip-innodb-unsafe-truncate
|
@ -2974,6 +2974,20 @@ NUMERIC_BLOCK_SIZE 0
|
||||
ENUM_VALUE_LIST NULL
|
||||
READ_ONLY YES
|
||||
COMMAND_LINE_ARGUMENT REQUIRED
|
||||
VARIABLE_NAME INNODB_UNSAFE_TRUNCATE
|
||||
SESSION_VALUE NULL
|
||||
GLOBAL_VALUE ON
|
||||
GLOBAL_VALUE_ORIGIN COMPILE-TIME
|
||||
DEFAULT_VALUE ON
|
||||
VARIABLE_SCOPE GLOBAL
|
||||
VARIABLE_TYPE BOOLEAN
|
||||
VARIABLE_COMMENT Use backup-unsafe TRUNCATE TABLE for compatibility with xtrabackup (on by default)
|
||||
NUMERIC_MIN_VALUE NULL
|
||||
NUMERIC_MAX_VALUE NULL
|
||||
NUMERIC_BLOCK_SIZE NULL
|
||||
ENUM_VALUE_LIST OFF,ON
|
||||
READ_ONLY YES
|
||||
COMMAND_LINE_ARGUMENT OPTIONAL
|
||||
VARIABLE_NAME INNODB_USE_ATOMIC_WRITES
|
||||
SESSION_VALUE NULL
|
||||
GLOBAL_VALUE ON
|
||||
|
@ -1140,6 +1140,73 @@ dict_recreate_index_tree(
|
||||
return(FIL_NULL);
|
||||
}
|
||||
|
||||
/*******************************************************************//**
|
||||
Truncates the index tree but don't update SYSTEM TABLES.
|
||||
@return DB_SUCCESS or error */
|
||||
dberr_t
|
||||
dict_truncate_index_tree_in_mem(
|
||||
/*============================*/
|
||||
dict_index_t* index) /*!< in/out: index */
|
||||
{
|
||||
mtr_t mtr;
|
||||
bool truncate;
|
||||
ulint space = index->space;
|
||||
|
||||
ut_ad(mutex_own(&dict_sys->mutex));
|
||||
ut_ad(dict_table_is_temporary(index->table));
|
||||
|
||||
ulint type = index->type;
|
||||
ulint root_page_no = index->page;
|
||||
|
||||
if (root_page_no == FIL_NULL) {
|
||||
|
||||
/* The tree has been freed. */
|
||||
ib::warn() << "Trying to TRUNCATE a missing index of table "
|
||||
<< index->table->name << "!";
|
||||
|
||||
truncate = false;
|
||||
} else {
|
||||
truncate = true;
|
||||
}
|
||||
|
||||
bool found;
|
||||
const page_size_t page_size(fil_space_get_page_size(space,
|
||||
&found));
|
||||
|
||||
if (!found) {
|
||||
|
||||
/* It is a single table tablespace and the .ibd file is
|
||||
missing: do nothing */
|
||||
|
||||
ib::warn()
|
||||
<< "Trying to TRUNCATE a missing .ibd file of table "
|
||||
<< index->table->name << "!";
|
||||
}
|
||||
|
||||
/* If table to truncate resides in its on own tablespace that will
|
||||
be re-created on truncate then we can ignore freeing of existing
|
||||
tablespace objects. */
|
||||
|
||||
if (truncate) {
|
||||
btr_free(page_id_t(space, root_page_no), page_size);
|
||||
}
|
||||
|
||||
mtr_start(&mtr);
|
||||
mtr_set_log_mode(&mtr, MTR_LOG_NO_REDO);
|
||||
|
||||
root_page_no = btr_create(
|
||||
type, space, page_size, index->id, index, NULL, &mtr);
|
||||
|
||||
DBUG_EXECUTE_IF("ib_err_trunc_temp_recreate_index",
|
||||
root_page_no = FIL_NULL;);
|
||||
|
||||
index->page = root_page_no;
|
||||
|
||||
mtr_commit(&mtr);
|
||||
|
||||
return(index->page == FIL_NULL ? DB_ERROR : DB_SUCCESS);
|
||||
}
|
||||
|
||||
/*********************************************************************//**
|
||||
Creates a table create graph.
|
||||
@return own: table create node */
|
||||
|
@ -3112,6 +3112,154 @@ void fil_truncate_log(fil_space_t* space, ulint size, mtr_t* mtr)
|
||||
NULL, space->flags & ~FSP_FLAGS_MEM_MASK, mtr);
|
||||
}
|
||||
|
||||
/** Truncate the tablespace to needed size.
|
||||
@param[in] space_id id of tablespace to truncate
|
||||
@param[in] size_in_pages truncate size.
|
||||
@return true if truncate was successful. */
|
||||
bool
|
||||
fil_truncate_tablespace(
|
||||
ulint space_id,
|
||||
ulint size_in_pages)
|
||||
{
|
||||
/* 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);
|
||||
}
|
||||
|
||||
/* 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);
|
||||
fil_space_t* space = fil_space_get_by_id(space_id);
|
||||
|
||||
/* 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) * UNIV_PAGE_SIZE;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
/*******************************************************************//**
|
||||
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 */
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
/** Reinitialize the original tablespace header with the same space id
|
||||
for single tablespace
|
||||
@param[in] table table belongs to tablespace
|
||||
@param[in] size size in blocks
|
||||
@param[in] trx Transaction covering truncate */
|
||||
void
|
||||
fil_reinit_space_header_for_table(
|
||||
dict_table_t* table,
|
||||
ulint size,
|
||||
trx_t* trx)
|
||||
{
|
||||
ulint id = table->space;
|
||||
|
||||
ut_a(!is_system_tablespace(id));
|
||||
|
||||
/* Invalidate in the buffer pool all pages belonging
|
||||
to the tablespace. The buffer pool scan may take long
|
||||
time to complete, therefore we release dict_sys->mutex
|
||||
and the dict operation lock during the scan and aquire
|
||||
it again after the buffer pool scan.*/
|
||||
|
||||
/* Release the lock on the indexes too. So that
|
||||
they won't violate the latch ordering. */
|
||||
dict_table_x_unlock_indexes(table);
|
||||
row_mysql_unlock_data_dictionary(trx);
|
||||
|
||||
/* Lock the search latch in shared mode to prevent user
|
||||
from disabling AHI during the scan */
|
||||
btr_search_s_lock_all();
|
||||
DEBUG_SYNC_C("buffer_pool_scan");
|
||||
buf_LRU_flush_or_remove_pages(id, NULL);
|
||||
btr_search_s_unlock_all();
|
||||
|
||||
row_mysql_lock_data_dictionary(trx);
|
||||
|
||||
dict_table_x_lock_indexes(table);
|
||||
|
||||
/* Remove all insert buffer entries for the tablespace */
|
||||
ibuf_delete_for_discarded_space(id);
|
||||
|
||||
mutex_enter(&fil_system->mutex);
|
||||
|
||||
fil_space_t* space = fil_space_get_by_id(id);
|
||||
|
||||
/* 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);
|
||||
|
||||
space->size = node->size = size;
|
||||
|
||||
mutex_exit(&fil_system->mutex);
|
||||
|
||||
mtr_t mtr;
|
||||
|
||||
mtr_start(&mtr);
|
||||
mtr.set_named_space(id);
|
||||
|
||||
fsp_header_init(id, size, &mtr);
|
||||
|
||||
mtr_commit(&mtr);
|
||||
}
|
||||
|
||||
#ifdef UNIV_DEBUG
|
||||
/** Increase redo skipped count for a tablespace.
|
||||
@param[in] id space id */
|
||||
@ -4971,6 +5119,7 @@ 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()) {
|
||||
|
||||
@ -5877,6 +6026,7 @@ 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) {
|
||||
|
@ -639,6 +639,7 @@ fsp_space_modify_check(
|
||||
ut_ad(space->purpose == FIL_TYPE_TEMPORARY
|
||||
|| space->purpose == FIL_TYPE_IMPORT
|
||||
|| space->redo_skipped_count
|
||||
|| space->is_being_truncated
|
||||
|| srv_is_tablespace_truncated(space->id));
|
||||
return;
|
||||
case MTR_LOG_ALL:
|
||||
|
@ -13452,6 +13452,37 @@ int ha_innobase::truncate()
|
||||
|
||||
update_thd();
|
||||
|
||||
if (srv_57_truncate) {
|
||||
if (!trx_is_started(m_prebuilt->trx)) {
|
||||
++m_prebuilt->trx->will_lock;
|
||||
}
|
||||
|
||||
dberr_t err = row_truncate_table_for_mysql(
|
||||
m_prebuilt->table, m_prebuilt->trx);
|
||||
|
||||
int error;
|
||||
|
||||
switch (err) {
|
||||
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);
|
||||
error = HA_ERR_TABLESPACE_MISSING;
|
||||
break;
|
||||
default:
|
||||
error = convert_error_code_to_mysql(
|
||||
err, m_prebuilt->table->flags,
|
||||
m_prebuilt->trx->mysql_thd);
|
||||
break;
|
||||
}
|
||||
table->status = STATUS_NOT_FOUND;
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
|
||||
HA_CREATE_INFO info;
|
||||
mem_heap_t* heap = mem_heap_create(1000);
|
||||
dict_table_t* ib_table = m_prebuilt->table;
|
||||
@ -20663,6 +20694,11 @@ static MYSQL_SYSVAR_BOOL(read_only, srv_read_only_mode,
|
||||
"Start InnoDB in read only mode (off by default)",
|
||||
NULL, NULL, FALSE);
|
||||
|
||||
static MYSQL_SYSVAR_BOOL(unsafe_truncate, srv_57_truncate,
|
||||
PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,
|
||||
"Use backup-unsafe TRUNCATE TABLE for compatibility with xtrabackup (on by default)",
|
||||
NULL, NULL, TRUE);
|
||||
|
||||
static MYSQL_SYSVAR_BOOL(cmp_per_index_enabled, srv_cmp_per_index_enabled,
|
||||
PLUGIN_VAR_OPCMDARG,
|
||||
"Enable INFORMATION_SCHEMA.innodb_cmp_per_index,"
|
||||
@ -21042,6 +21078,7 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
|
||||
MYSQL_SYSVAR(random_read_ahead),
|
||||
MYSQL_SYSVAR(read_ahead_threshold),
|
||||
MYSQL_SYSVAR(read_only),
|
||||
MYSQL_SYSVAR(unsafe_truncate),
|
||||
MYSQL_SYSVAR(io_capacity),
|
||||
MYSQL_SYSVAR(io_capacity_max),
|
||||
MYSQL_SYSVAR(page_cleaners),
|
||||
|
@ -142,6 +142,14 @@ dict_create_index_tree_in_mem(
|
||||
dict_index_t* index, /*!< in/out: index */
|
||||
const trx_t* trx); /*!< in: InnoDB transaction handle */
|
||||
|
||||
/*******************************************************************//**
|
||||
Truncates the index tree but don't update SYSTEM TABLES.
|
||||
@return DB_SUCCESS or error */
|
||||
dberr_t
|
||||
dict_truncate_index_tree_in_mem(
|
||||
/*============================*/
|
||||
dict_index_t* index); /*!< in/out: index */
|
||||
|
||||
/*******************************************************************//**
|
||||
Drops the index tree but don't update SYS_INDEXES table. */
|
||||
void
|
||||
|
@ -955,6 +955,37 @@ fil_space_t* fil_truncate_prepare(ulint space_id);
|
||||
void fil_truncate_log(fil_space_t* space, ulint size, mtr_t* mtr)
|
||||
MY_ATTRIBUTE((nonnull));
|
||||
|
||||
/** Truncate the tablespace to needed size.
|
||||
@param[in] space_id id of tablespace to truncate
|
||||
@param[in] size_in_pages truncate size.
|
||||
@return true if truncate was successful. */
|
||||
bool
|
||||
fil_truncate_tablespace(
|
||||
ulint space_id,
|
||||
ulint size_in_pages);
|
||||
|
||||
/*******************************************************************//**
|
||||
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 */
|
||||
|
||||
/** Reinitialize the original tablespace header with the same space id
|
||||
for single tablespace
|
||||
@param[in] table table belongs to the tablespace
|
||||
@param[in] size size in blocks
|
||||
@param[in] trx Transaction covering truncate */
|
||||
void
|
||||
fil_reinit_space_header_for_table(
|
||||
dict_table_t* table,
|
||||
ulint size,
|
||||
trx_t* trx);
|
||||
|
||||
/*******************************************************************//**
|
||||
Closes a single-table tablespace. The tablespace must be cached in the
|
||||
memory cache. Free all pages used by the tablespace.
|
||||
|
@ -519,7 +519,7 @@ 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_CURRENT 103
|
||||
#define LOG_HEADER_FORMAT_10_3 103
|
||||
/** The old MariaDB 10.2.2..10.2.17 log format */
|
||||
#define LOG_HEADER_FORMAT_10_2 1
|
||||
/** Future MariaDB 10.4 log format */
|
||||
@ -559,7 +559,7 @@ of log_sys->write_mutex, which should affect nothing for now. */
|
||||
struct log_group_t{
|
||||
/** number of files in the group */
|
||||
ulint n_files;
|
||||
/** format of the redo log: e.g., LOG_HEADER_FORMAT_CURRENT */
|
||||
/** format of the redo log: e.g., LOG_HEADER_FORMAT_10_3 */
|
||||
uint32_t format;
|
||||
/** redo log subformat: 0 with separately logged TRUNCATE,
|
||||
1 with fully redo-logged TRUNCATE */
|
||||
|
@ -421,4 +421,9 @@ private:
|
||||
const char* log_file_name);
|
||||
};
|
||||
|
||||
/** MySQL 5.7 TRUNCATE TABLE.
|
||||
@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 */
|
||||
|
@ -256,6 +256,9 @@ extern my_bool high_level_read_only;
|
||||
/** store to its own file each table created by an user; data
|
||||
dictionary tables are in the system tablespace 0 */
|
||||
extern my_bool srv_file_per_table;
|
||||
/** whether to use the MySQL 5.7 WL#6501 TRUNCATE TABLE implementation
|
||||
that does not work with backup */
|
||||
extern my_bool srv_57_truncate;
|
||||
/** Sleep delay for threads waiting to enter InnoDB. In micro-seconds. */
|
||||
extern ulong srv_thread_sleep_delay;
|
||||
/** Maximum sleep delay (in micro-seconds), value of 0 disables it.*/
|
||||
|
@ -790,10 +790,16 @@ log_init(ulint n_files)
|
||||
log_group_t* group = &log_sys->log;
|
||||
|
||||
group->n_files = n_files;
|
||||
group->subformat = !srv_57_truncate;
|
||||
if (srv_57_truncate) {
|
||||
group->format = srv_encrypt_log
|
||||
? LOG_HEADER_FORMAT_CURRENT | LOG_HEADER_FORMAT_ENCRYPTED
|
||||
: LOG_HEADER_FORMAT_CURRENT;
|
||||
group->subformat = 1;
|
||||
? LOG_HEADER_FORMAT_10_2 | LOG_HEADER_FORMAT_ENCRYPTED
|
||||
: LOG_HEADER_FORMAT_10_2;
|
||||
} else {
|
||||
group->format = srv_encrypt_log
|
||||
? LOG_HEADER_FORMAT_10_3 | LOG_HEADER_FORMAT_ENCRYPTED
|
||||
: LOG_HEADER_FORMAT_10_3;
|
||||
}
|
||||
group->file_size = srv_log_file_size;
|
||||
group->state = LOG_GROUP_OK;
|
||||
group->lsn = LOG_START_LSN;
|
||||
@ -875,13 +881,15 @@ log_group_file_header_flush(
|
||||
ut_ad(!recv_no_log_write);
|
||||
ut_a(nth_file < group->n_files);
|
||||
ut_ad((group->format & ~LOG_HEADER_FORMAT_ENCRYPTED)
|
||||
== LOG_HEADER_FORMAT_CURRENT);
|
||||
== (srv_57_truncate
|
||||
? LOG_HEADER_FORMAT_10_2
|
||||
: LOG_HEADER_FORMAT_10_3));
|
||||
|
||||
buf = *(group->file_header_bufs + nth_file);
|
||||
|
||||
memset(buf, 0, OS_FILE_LOG_BLOCK_SIZE);
|
||||
mach_write_to_4(buf + LOG_HEADER_FORMAT, group->format);
|
||||
mach_write_to_4(buf + LOG_HEADER_SUBFORMAT, group->subformat);
|
||||
mach_write_to_4(buf + LOG_HEADER_SUBFORMAT, !srv_57_truncate);
|
||||
mach_write_to_8(buf + LOG_HEADER_START_LSN, start_lsn);
|
||||
strcpy(reinterpret_cast<char*>(buf) + LOG_HEADER_CREATOR,
|
||||
LOG_HEADER_CREATOR_CURRENT);
|
||||
|
@ -1165,10 +1165,10 @@ recv_find_max_checkpoint(ulint* max_field)
|
||||
switch (group->format) {
|
||||
case 0:
|
||||
return(recv_find_max_checkpoint_0(&group, max_field));
|
||||
case LOG_HEADER_FORMAT_CURRENT:
|
||||
case LOG_HEADER_FORMAT_CURRENT | LOG_HEADER_FORMAT_ENCRYPTED:
|
||||
case LOG_HEADER_FORMAT_10_2:
|
||||
case LOG_HEADER_FORMAT_10_2 | LOG_HEADER_FORMAT_ENCRYPTED:
|
||||
case LOG_HEADER_FORMAT_10_3:
|
||||
case LOG_HEADER_FORMAT_10_3 | 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. */
|
||||
@ -1246,8 +1246,8 @@ recv_find_max_checkpoint(ulint* max_field)
|
||||
}
|
||||
|
||||
switch (group->format) {
|
||||
case LOG_HEADER_FORMAT_CURRENT:
|
||||
case LOG_HEADER_FORMAT_CURRENT | LOG_HEADER_FORMAT_ENCRYPTED:
|
||||
case LOG_HEADER_FORMAT_10_3:
|
||||
case LOG_HEADER_FORMAT_10_3 | LOG_HEADER_FORMAT_ENCRYPTED:
|
||||
if (group->subformat == 1) {
|
||||
/* 10.2 with new crash-safe TRUNCATE */
|
||||
break;
|
||||
@ -3431,8 +3431,8 @@ skip_apply:
|
||||
case LOG_HEADER_FORMAT_10_2:
|
||||
case LOG_HEADER_FORMAT_10_2 | LOG_HEADER_FORMAT_ENCRYPTED:
|
||||
break;
|
||||
case LOG_HEADER_FORMAT_CURRENT:
|
||||
case LOG_HEADER_FORMAT_CURRENT | LOG_HEADER_FORMAT_ENCRYPTED:
|
||||
case LOG_HEADER_FORMAT_10_3:
|
||||
case LOG_HEADER_FORMAT_10_3 | LOG_HEADER_FORMAT_ENCRYPTED:
|
||||
if (log_sys->log.subformat == 1) {
|
||||
/* 10.2 with new crash-safe TRUNCATE */
|
||||
break;
|
||||
@ -3769,6 +3769,7 @@ recv_recovery_rollback_active(void)
|
||||
/* Drop partially created indexes. */
|
||||
row_merge_drop_temp_indexes();
|
||||
/* Drop garbage tables. */
|
||||
if (!srv_57_truncate)
|
||||
row_mysql_drop_garbage_tables();
|
||||
|
||||
/* Drop any auxiliary tables that were not dropped when the
|
||||
|
@ -1629,7 +1629,8 @@ row_ins_check_foreign_constraint(
|
||||
|
||||
if (check_table == NULL
|
||||
|| !check_table->is_readable()
|
||||
|| check_index == NULL) {
|
||||
|| check_index == NULL
|
||||
|| fil_space_get(check_table->space)->is_being_truncated) {
|
||||
|
||||
if (!srv_read_only_mode && check_ref) {
|
||||
FILE* ef = dict_foreign_err_file;
|
||||
|
@ -4403,7 +4403,7 @@ row_rename_table_for_mysql(
|
||||
goto funct_exit;
|
||||
}
|
||||
|
||||
if (!table->is_temporary()) {
|
||||
if (!table->is_temporary() && !srv_57_truncate) {
|
||||
err = trx_undo_report_rename(trx, table);
|
||||
|
||||
if (err != DB_SUCCESS) {
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -286,6 +286,34 @@ 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) {
|
||||
mutex_enter(&fil_system->mutex);
|
||||
const fil_space_t* space = fil_space_get_by_id(
|
||||
foreign_table->space);
|
||||
const bool being_truncated = space
|
||||
&& space->is_being_truncated;
|
||||
mutex_exit(&fil_system->mutex);
|
||||
if (being_truncated) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/* NOTE that if the thread ends up waiting for a lock
|
||||
we will release dict_operation_lock temporarily!
|
||||
But the counter on the table protects 'foreign' from
|
||||
|
@ -152,6 +152,9 @@ my_bool srv_read_only_mode;
|
||||
/** store to its own file each table created by an user; data
|
||||
dictionary tables are in the system tablespace 0 */
|
||||
my_bool srv_file_per_table;
|
||||
/** whether to use the MySQL 5.7 WL#6501 TRUNCATE TABLE implementation
|
||||
that does not work with backup */
|
||||
my_bool srv_57_truncate;
|
||||
/** The file format to use on new *.ibd files. */
|
||||
ulint srv_file_format;
|
||||
/** Whether to check file format during startup. A value of
|
||||
|
@ -1393,11 +1393,18 @@ srv_prepare_to_delete_redo_log_files(
|
||||
ulint pending_io = 0;
|
||||
ulint count = 0;
|
||||
|
||||
if (srv_57_truncate) {
|
||||
if ((log_sys->log.format & ~LOG_HEADER_FORMAT_ENCRYPTED)
|
||||
!= LOG_HEADER_FORMAT_CURRENT
|
||||
!= LOG_HEADER_FORMAT_10_2) {
|
||||
srv_log_file_size = 0;
|
||||
}
|
||||
} else {
|
||||
if ((log_sys->log.format & ~LOG_HEADER_FORMAT_ENCRYPTED)
|
||||
!= LOG_HEADER_FORMAT_10_3
|
||||
|| log_sys->log.subformat != 1) {
|
||||
srv_log_file_size = 0;
|
||||
}
|
||||
}
|
||||
|
||||
do {
|
||||
/* Clean the buffer pool. */
|
||||
@ -1417,7 +1424,7 @@ srv_prepare_to_delete_redo_log_files(
|
||||
if (srv_log_file_size == 0) {
|
||||
info << ((log_sys->log.format
|
||||
& ~LOG_HEADER_FORMAT_ENCRYPTED)
|
||||
< LOG_HEADER_FORMAT_CURRENT
|
||||
< LOG_HEADER_FORMAT_10_3
|
||||
? "Upgrading redo log: "
|
||||
: "Downgrading redo log: ");
|
||||
} else if (n_files != srv_n_log_files
|
||||
@ -2392,11 +2399,16 @@ files_checked:
|
||||
} else if (srv_log_file_size_requested == srv_log_file_size
|
||||
&& srv_n_log_files_found == srv_n_log_files
|
||||
&& log_sys->log.format
|
||||
== (srv_encrypt_log
|
||||
? LOG_HEADER_FORMAT_CURRENT
|
||||
== (srv_57_truncate
|
||||
? (srv_encrypt_log
|
||||
? LOG_HEADER_FORMAT_10_2
|
||||
| LOG_HEADER_FORMAT_ENCRYPTED
|
||||
: LOG_HEADER_FORMAT_CURRENT)
|
||||
&& log_sys->log.subformat == 1) {
|
||||
: LOG_HEADER_FORMAT_10_2)
|
||||
: (srv_encrypt_log
|
||||
? LOG_HEADER_FORMAT_10_3
|
||||
| LOG_HEADER_FORMAT_ENCRYPTED
|
||||
: LOG_HEADER_FORMAT_10_3))
|
||||
&& log_sys->log.subformat == !srv_57_truncate) {
|
||||
/* No need to add or remove encryption,
|
||||
upgrade, downgrade, or resize. */
|
||||
} else {
|
||||
|
@ -1938,6 +1938,7 @@ trx_undo_report_rename(trx_t* trx, const dict_table_t* table)
|
||||
ut_ad(!trx->read_only);
|
||||
ut_ad(trx->id);
|
||||
ut_ad(!table->is_temporary());
|
||||
ut_ad(!srv_57_truncate);
|
||||
|
||||
trx_rseg_t* rseg = trx->rsegs.m_redo.rseg;
|
||||
trx_undo_t** pundo = &trx->rsegs.m_redo.insert_undo;
|
||||
|
Reference in New Issue
Block a user