Commit 055a3334 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-13564 Mariabackup does not work with TRUNCATE

Implement undo tablespace truncation via normal redo logging.

Implement TRUNCATE TABLE as a combination of RENAME to #sql-ib name,
CREATE, and DROP.

Note: Orphan #sql-ib*.ibd may be left behind if MariaDB Server 10.2
is killed before the DROP operation is committed. If MariaDB Server 10.2
is killed during TRUNCATE, it is also possible that the old table
was renamed to #sql-ib*.ibd but the data dictionary will refer to the
table using the original name.

In MariaDB Server 10.3, RENAME inside InnoDB is transactional,
and #sql-* tables will be dropped on startup. So, this new TRUNCATE
will be fully crash-safe in 10.3.

ha_mroonga::wrapper_truncate(): Pass table options to the underlying
storage engine, now that ha_innobase::truncate() will need them.

rpl_slave_state::truncate_state_table(): Before truncating
mysql.gtid_slave_pos, evict any cached table handles from
the table definition cache, so that there will be no stale
references to the old table after truncating.

== TRUNCATE TABLE ==

WL#6501 in MySQL 5.7 introduced separate log files for implementing
atomic and crash-safe TRUNCATE TABLE, instead of using the InnoDB
undo and redo log. Some convoluted logic was added to the InnoDB
crash recovery, and some extra synchronization (including a redo log
checkpoint) was introduced to make this work. This synchronization
has caused performance problems and race conditions, and the extra
log files cannot be copied or applied by external backup programs.

In order to support crash-upgrade from MariaDB 10.2, we will keep
the logic for parsing and applying the extra log files, but we will
no longer generate those files in TRUNCATE TABLE.

A prerequisite for crash-safe TRUNCATE is a crash-safe RENAME TABLE
(with full redo and undo logging and proper rollback). This will
be implemented in MDEV-14717.

ha_innobase::truncate(): Invoke RENAME, create(), delete_table().
Because RENAME cannot be fully rolled back before MariaDB 10.3
due to missing undo logging, add some explicit rename-back in
case the operation fails.

ha_innobase::delete(): Introduce a variant that takes sqlcom as
a parameter. In TRUNCATE TABLE, we do not want to touch any
FOREIGN KEY constraints.

ha_innobase::create(): Add the parameters file_per_table, trx.
In TRUNCATE, the new table must be created in the same transaction
that renames the old table.

create_table_info_t::create_table_info_t(): Add the parameters
file_per_table, trx.

row_drop_table_for_mysql(): Replace a bool parameter with sqlcom.

row_drop_table_after_create_fail(): New function, wrapping
row_drop_table_for_mysql().

dict_truncate_index_tree_in_mem(), fil_truncate_tablespace(),
fil_prepare_for_truncate(), fil_reinit_space_header_for_table(),
row_truncate_table_for_mysql(), TruncateLogger,
row_truncate_prepare(), row_truncate_rollback(),
row_truncate_complete(), row_truncate_fts(),
row_truncate_update_system_tables(),
row_truncate_foreign_key_checks(), row_truncate_sanity_checks():
Remove.

row_upd_check_references_constraints(): Remove a check for
TRUNCATE, now that the table is no longer truncated in place.

The new test innodb.truncate_foreign uses DEBUG_SYNC to cover some
race-condition like scenarios. The test innodb-innodb.truncate does
not use any synchronization.

We add a redo log subformat to indicate backup-friendly format.
MariaDB 10.4 will remove support for the old TRUNCATE logging,
so crash-upgrade from old 10.2 or 10.3 to 10.4 will involve
limitations.

== Undo tablespace truncation ==

MySQL 5.7 implements undo tablespace truncation. It is only
possible when innodb_undo_tablespaces is set to at least 2.
The logging is implemented similar to the WL#6501 TRUNCATE,
that is, using separate log files and a redo log checkpoint.

We can simply implement undo tablespace truncation within
a single mini-transaction that reinitializes the undo log
tablespace file. Unfortunately, due to the redo log format
of some operations, currently, the total redo log written by
undo tablespace truncation will be more than the combined size
of the truncated undo tablespace. It should be acceptable
to have a little more than 1 megabyte of log in a single
mini-transaction. This will be fixed in MDEV-17138 in
MariaDB Server 10.4.

recv_sys_t: Add truncated_undo_spaces[] to remember for which undo
tablespaces a MLOG_FILE_CREATE2 record was seen.

namespace undo: Remove some unnecessary declarations.

fil_space_t::is_being_truncated: Document that this flag now
only applies to undo tablespaces. Remove some references.

fil_space_t::is_stopping(): Do not refer to is_being_truncated.
This check is for tablespaces of tables. Potentially used
tablespaces are never truncated any more.

buf_dblwr_process(): Suppress the out-of-bounds warning
for undo tablespaces.

fil_truncate_log(): Write a MLOG_FILE_CREATE2 with a nonzero
page number (new size of the tablespace in pages) to inform
crash recovery that the undo tablespace size has been reduced.

fil_op_write_log(): Relax assertions, so that MLOG_FILE_CREATE2
can be written for undo tablespaces (without .ibd file suffix)
for a nonzero page number.

os_file_truncate(): Add the parameter allow_shrink=false
so that undo tablespaces can actually be shrunk using this function.

fil_name_parse(): For undo tablespace truncation,
buffer MLOG_FILE_CREATE2 in truncated_undo_spaces[].

recv_read_in_area(): Avoid reading pages for which no redo log
records remain buffered, after recv_addr_trim() removed them.

trx_rseg_header_create(): Add a FIXME comment that we could write
much less redo log.

trx_undo_truncate_tablespace(): Reinitialize the undo tablespace
in a single mini-transaction, which will be flushed to the redo log
before the file size is trimmed.

recv_addr_trim(): Discard any redo logs for pages that were
logged after the new end of a file, before the truncation LSN.
If the rec_list becomes empty, reduce n_addrs. After removing
any affected records, actually truncate the file.

recv_apply_hashed_log_recs(): Invoke recv_addr_trim() right before
applying any log records. The undo tablespace files must be open
at this point.

buf_flush_or_remove_pages(), buf_flush_dirty_pages(),
buf_LRU_flush_or_remove_pages(): Add a parameter for specifying
the number of the first page to flush or remove (default 0).

trx_purge_initiate_truncate(): Remove the log checkpoints, the
extra logging, and some unnecessary crash points. Merge the code
from trx_undo_truncate_tablespace(). First, flush all to-be-discarded
pages (beyond the new end of the file), then trim the space->size
to make the page allocation deterministic. At the only remaining
crash injection point, flush the redo log, so that the recovery
can be tested.
parent 59950df5
...@@ -4188,6 +4188,7 @@ xtrabackup_backup_func() ...@@ -4188,6 +4188,7 @@ xtrabackup_backup_func()
byte MY_ALIGNED(OS_FILE_LOG_BLOCK_SIZE) log_hdr[OS_FILE_LOG_BLOCK_SIZE]; byte MY_ALIGNED(OS_FILE_LOG_BLOCK_SIZE) log_hdr[OS_FILE_LOG_BLOCK_SIZE];
memset(log_hdr, 0, sizeof log_hdr); memset(log_hdr, 0, sizeof log_hdr);
mach_write_to_4(LOG_HEADER_FORMAT + log_hdr, log_sys->log.format); mach_write_to_4(LOG_HEADER_FORMAT + log_hdr, log_sys->log.format);
mach_write_to_4(LOG_HEADER_SUBFORMAT + log_hdr, 1);
mach_write_to_8(LOG_HEADER_START_LSN + log_hdr, checkpoint_lsn_start); mach_write_to_8(LOG_HEADER_START_LSN + log_hdr, checkpoint_lsn_start);
strcpy(reinterpret_cast<char*>(LOG_HEADER_CREATOR + log_hdr), strcpy(reinterpret_cast<char*>(LOG_HEADER_CREATOR + log_hdr),
"Backup " MYSQL_SERVER_VERSION); "Backup " MYSQL_SERVER_VERSION);
......
...@@ -191,22 +191,18 @@ connection default; ...@@ -191,22 +191,18 @@ connection default;
COMMIT; COMMIT;
connect truncate,localhost,root,,; connect truncate,localhost,root,,;
REPLACE INTO t1(pk, y) SELECT pk,y FROM t1; REPLACE INTO t1(pk, y) SELECT pk,y FROM t1;
SET DEBUG_SYNC='row_trunc_before_dict_lock SIGNAL commit WAIT_FOR release';
TRUNCATE TABLE t1; TRUNCATE TABLE t1;
connection prevent_purge; connection prevent_purge;
SET DEBUG_SYNC='now WAIT_FOR commit';
COMMIT; COMMIT;
SET DEBUG_SYNC='now SIGNAL purge_start'; SET DEBUG_SYNC='now SIGNAL purge_start';
disconnect prevent_purge; disconnect prevent_purge;
connection default; connection default;
SET DEBUG_SYNC='now WAIT_FOR purge_start'; SET DEBUG_SYNC='now WAIT_FOR purge_start';
InnoDB 1 transactions not purged InnoDB 0 transactions not purged
SET DEBUG_SYNC='now SIGNAL release';
SET GLOBAL debug_dbug=@old_dbug; SET GLOBAL debug_dbug=@old_dbug;
connection truncate; connection truncate;
disconnect truncate; disconnect truncate;
connection default; connection default;
InnoDB 0 transactions not purged
DROP TABLE t1, t2; DROP TABLE t1, t2;
set debug_sync=reset; set debug_sync=reset;
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency; SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
...@@ -240,21 +240,16 @@ COMMIT; ...@@ -240,21 +240,16 @@ COMMIT;
connect(truncate,localhost,root,,); connect(truncate,localhost,root,,);
REPLACE INTO t1(pk, y) SELECT pk,y FROM t1; REPLACE INTO t1(pk, y) SELECT pk,y FROM t1;
SET DEBUG_SYNC='row_trunc_before_dict_lock SIGNAL commit WAIT_FOR release';
send TRUNCATE TABLE t1; send TRUNCATE TABLE t1;
connection prevent_purge; connection prevent_purge;
SET DEBUG_SYNC='now WAIT_FOR commit';
COMMIT; COMMIT;
SET DEBUG_SYNC='now SIGNAL purge_start'; SET DEBUG_SYNC='now SIGNAL purge_start';
disconnect prevent_purge; disconnect prevent_purge;
connection default; connection default;
SET DEBUG_SYNC='now WAIT_FOR purge_start'; SET DEBUG_SYNC='now WAIT_FOR purge_start';
let $wait_all_purged=1;
--source ../../innodb/include/wait_all_purged.inc --source ../../innodb/include/wait_all_purged.inc
let $wait_all_purged=0;
SET DEBUG_SYNC='now SIGNAL release';
SET GLOBAL debug_dbug=@old_dbug; SET GLOBAL debug_dbug=@old_dbug;
connection truncate; connection truncate;
...@@ -262,7 +257,6 @@ reap; ...@@ -262,7 +257,6 @@ reap;
disconnect truncate; disconnect truncate;
connection default; connection default;
--source ../../innodb/include/wait_all_purged.inc
DROP TABLE t1, t2; DROP TABLE t1, t2;
--source include/wait_until_count_sessions.inc --source include/wait_until_count_sessions.inc
......
#
# WL#6501: make truncate table atomic
#
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/big_test.inc
# Valgrind would complain about memory leaks when we crash on purpose.
--source include/not_valgrind.inc
# Embedded server does not support crashing
--source include/not_embedded.inc
# Avoid CrashReporter popup on Mac
--source include/not_crashrep.inc
# suppress expected warnings
call mtr.add_suppression("does not exist in the InnoDB internal");
################################################################################
#
# Will test following scenarios:
# 1. Hit crash point on completing drop of all indexes before creation of index
# is commenced.
# 2. Hit crash point after data is updated to system-table and in-memory dict.
#
################################################################################
#-----------------------------------------------------------------------------
#
# create test-bed
#
let $per_table = `select @@innodb_file_per_table`;
eval set global innodb_file_per_table = on;
let $WL6501_TMP_DIR = `select @@tmpdir`;
let $WL6501_DATA_DIR = `select @@datadir`;
let SEARCH_FILE = $MYSQLTEST_VARDIR/log/my_restart.err;
#-----------------------------------------------------------------------------
#
# 1. Hit crash point on completing drop of all indexes before creation of index
# is commenced.
#
--echo "1. Hit crash point on completing drop of all indexes before creation"
--echo " of index is commenced."
eval set global innodb_file_per_table = $wl6501_file_per_table;
set innodb_strict_mode=off;
--disable_warnings
eval create $wl6501_temp table t (
i int, f float, c char,
primary key pk(i), unique findex(f), index ck(c))
engine = innodb row_format = $wl6501_row_fmt
key_block_size = $wl6501_kbs;
--enable_warnings
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
select * from t;
check table t;
#
set session debug = "+d,ib_trunc_crash_drop_reinit_done_create_to_start";
--source include/expect_crash.inc
--error 2013
truncate table t;
#
--source include/start_mysqld.inc
check table t;
#-----------------------------------------------------------------------------
#
# 2. Hit crash point after data is updated to system-table and in-memory dict.
#
--echo "2. Hit crash point after data is updated to system-table and"
--echo " in-memory dict."
eval set global innodb_file_per_table = $wl6501_file_per_table;
set innodb_strict_mode=off;
--disable_warnings
eval create $wl6501_temp table t (
i int, f float, c char,
primary key pk(i), unique findex(f), index ck(c))
engine = innodb row_format = $wl6501_row_fmt
key_block_size = $wl6501_kbs;
--enable_warnings
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
select * from t;
check table t;
#
set session debug = "+d,ib_trunc_crash_on_updating_dict_sys_info";
--source include/expect_crash.inc
--error 2013
truncate table t;
#
--source include/start_mysqld.inc
check table t;
#-----------------------------------------------------------------------------
#
# remove test-bed
#
eval set global innodb_file_per_table = $per_table;
CREATE TABLE t (a SERIAL) ENGINE=InnoDB;
connect dml,localhost,root;
select * from t;
a
connection default;
TRUNCATE TABLE t;
disconnect dml;
DROP TABLE t;
#
# 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;
CREATE TABLE parent (a INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO parent SET a=1;
CREATE TABLE child (a INT PRIMARY KEY, FOREIGN KEY (a) REFERENCES parent(a)
ON UPDATE CASCADE)
ENGINE=InnoDB;
INSERT INTO child SET a=1;
TRUNCATE TABLE parent;
ERROR 42000: Cannot truncate a table referenced in a foreign key constraint (`test`.`child`, CONSTRAINT `child_ibfk_1` FOREIGN KEY (`a`) REFERENCES `test`.`parent` (`a`))
TRUNCATE TABLE child;
INSERT INTO child SET a=1;
UPDATE parent SET a=2;
SELECT * FROM child;
a
2
connect dml,localhost,root;
SET DEBUG_SYNC='foreign_constraint_update_cascade SIGNAL fk WAIT_FOR go';
UPDATE parent SET a=3;
connection default;
SET DEBUG_SYNC='now WAIT_FOR fk';
SET lock_wait_timeout=1;
TRUNCATE TABLE child;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
SET DEBUG_SYNC='now SIGNAL go';
connection dml;
SELECT * FROM child;
a
3
SET DEBUG_SYNC='foreign_constraint_check_for_update SIGNAL fk WAIT_FOR go';
DELETE FROM parent;
connection default;
SET DEBUG_SYNC='now WAIT_FOR fk';
TRUNCATE TABLE child;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
SET DEBUG_SYNC='now SIGNAL go';
connection dml;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `child_ibfk_1` FOREIGN KEY (`a`) REFERENCES `parent` (`a`) ON UPDATE CASCADE)
SELECT * FROM child;
a
3
INSERT INTO parent SET a=5;
SET DEBUG_SYNC='foreign_constraint_check_for_ins SIGNAL fk WAIT_FOR go';
INSERT INTO child SET a=5;
connection default;
SET DEBUG_SYNC='now WAIT_FOR fk';
SET foreign_key_checks=0;
TRUNCATE TABLE parent;
SET DEBUG_SYNC='now SIGNAL go';
connection dml;
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `child_ibfk_1` FOREIGN KEY (`a`) REFERENCES `parent` (`a`) ON UPDATE CASCADE)
SELECT * FROM parent;
a
SELECT * FROM child;
a
3
disconnect dml;
connection default;
SET DEBUG_SYNC = RESET;
DROP TABLE child, parent;
SET @save_dbug = @@SESSION.debug_dbug;
call mtr.add_suppression("InnoDB: Flagged corruption of .* in table `test`\\.`t` in TRUNCATE TABLE");
# 1. Error in assigning undo logs for truncate action
CREATE TABLE t (i int PRIMARY KEY, f float UNIQUE, c char(100), INDEX ck(c))
ENGINE = InnoDB;
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
check table t;
Table Op Msg_type Msg_text
test.t check status OK
SET debug_dbug = '+d,ib_err_trunc_assigning_undo_log';
truncate table t;
ERROR HY000: Got error 168 "Unknown (generic) error from engine" from storage engine InnoDB
SET debug_dbug = @save_dbug;
check table t;
Table Op Msg_type Msg_text
test.t check status OK
select * from t;
i f c
1 1.1 a
2 2.2 b
3 3.3 c
# 2. Error while preparing for truncate
SET debug_dbug = '+d,ib_err_trunc_preparing_for_truncate';
truncate table t;
ERROR HY000: Got error 168 "Unknown (generic) error from engine" from storage engine InnoDB
SET debug_dbug = @save_dbug;
check table t;
Table Op Msg_type Msg_text
test.t check status OK
select * from t;
i f c
1 1.1 a
2 2.2 b
3 3.3 c
# 3. Error while dropping/creating indexes
SET debug_dbug = '+d,ib_err_trunc_drop_index';
truncate table t;
ERROR HY000: Got error 168 "Unknown (generic) error from engine" from storage engine InnoDB
SET debug_dbug = @save_dbug;
check table t;
Table Op Msg_type Msg_text
test.t check Warning InnoDB: Index PRIMARY is marked as corrupted
test.t check error Corrupt
select * from t;
Got one of the listed errors
drop table t;
CREATE TABLE t (i int PRIMARY KEY, f float UNIQUE, c char(100), INDEX ck(c))
ENGINE = InnoDB;
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
check table t;
Table Op Msg_type Msg_text
test.t check status OK
SET debug_dbug = '+d,ib_err_trunc_create_index';
truncate table t;
ERROR HY000: Got error 168 "Unknown (generic) error from engine" from storage engine InnoDB
SET debug_dbug = @save_dbug;
check table t;
Table Op Msg_type Msg_text
test.t check Warning InnoDB: Index PRIMARY is marked as corrupted
test.t check error Corrupt
select * from t;
Got one of the listed errors
drop table t;
CREATE TABLE t (i int PRIMARY KEY, f float UNIQUE, c char(100), INDEX ck(c))
ENGINE = InnoDB;
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
check table t;
Table Op Msg_type Msg_text
test.t check status OK
SET debug_dbug = '+d,ib_err_trunc_temp_recreate_index';
truncate table t;
SET debug_dbug = @save_dbug;
check table t;
Table Op Msg_type Msg_text
test.t check status OK
select * from t;
i f c
drop table t;
# 4. Error while completing truncate of table involving FTS
CREATE TABLE t (i int PRIMARY KEY, f float UNIQUE, c char(100),
FULLTEXT INDEX(c)) ENGINE = InnoDB;
insert into t values (1, 1.1, 'mysql is now oracle company'),
(2, 2.2, 'innodb is part of mysql'),
(3, 3.3, 'innodb is default storage engine of mysql');
check table t;
Table Op Msg_type Msg_text
test.t check status OK
SET debug_dbug = '+d,ib_err_trunc_temp_recreate_index';
truncate table t;
SET debug_dbug = @save_dbug;
check table t;
Table Op Msg_type Msg_text
test.t check status OK
select * from t;
i f c
drop table t;
# 5. Error while updating sys-tables
CREATE TABLE t (i int PRIMARY KEY, f float UNIQUE, c char(100),
FULLTEXT INDEX(c)) ENGINE = InnoDB;
insert into t values (1, 1.1, 'mysql is now oracle company'),
(2, 2.2, 'innodb is part of mysql'),
(3, 3.3, 'innodb is default storage engine of mysql');
check table t;
Table Op Msg_type Msg_text
test.t check status OK
SET debug_dbug = '+d,ib_err_trunc_temp_recreate_index';
truncate table t;
SET debug_dbug = @save_dbug;
check table t;
Table Op Msg_type Msg_text
test.t check status OK
select * from t order by i;
i f c
drop table t;
call mtr.add_suppression("InnoDB: Operating system error number ");
call mtr.add_suppression("InnoDB: (The error means|If you are|Cannot open datafile) ");
call mtr.add_suppression("InnoDB: Ignoring tablespace for `test`\.`t`");
call mtr.add_suppression("InnoDB: Table test/t .* does not exist");
CREATE TABLE t (a SERIAL) ENGINE=InnoDB;
INSERT INTO t() VALUES();
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
`a` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
UNIQUE KEY `a` (`a`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
SELECT * FROM t;
ERROR 42S02: Table 'test.t' doesn't exist in engine
TRUNCATE TABLE t;
ERROR 42S02: Table 'test.t' doesn't exist in engine
DROP TABLE t;
#
# Bug #23070734 CONCURRENT TRUNCATE TABLES CAUSE STALLS
#
create table t1 (f1 int ,f2 int,key(f2)) engine=innodb;
begin;
insert into t1 values (10,45),(20,78),(30,88),(40,23),(50,78),(60,11),(70,56),(80,90);
delete from t1;
connect con2,localhost,root,,;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
connection default;
SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
commit;
connect con1,localhost,root,,;
SET DEBUG_SYNC= 'buffer_pool_scan SIGNAL started WAIT_FOR finish_scan';
truncate table t1;
connection con2;
SET DEBUG_SYNC= 'now WAIT_FOR started';
COMMIT;
disconnect con2;
connection default;
InnoDB 0 transactions not purged
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
SET DEBUG_SYNC = 'now SIGNAL finish_scan';
connection con1;
disconnect con1;
connection default;
SET DEBUG_SYNC = 'RESET';
drop table t1;
SET GLOBAL innodb_stats_persistent= ON;
CREATE TABLE t1 (t TEXT) ENGINE=InnoDB STATS_PERSISTENT=1;
connect con1,localhost,root,,test;
SET DEBUG_SYNC='ib_trunc_table_trunc_completing SIGNAL committed WAIT_FOR ever';
TRUNCATE TABLE t1;
connection default;
SET DEBUG_SYNC='now WAIT_FOR committed';
disconnect con1;
SELECT COUNT(*) FROM t1;
COUNT(*)
0
DROP TABLE t1;
--source include/have_innodb.inc
CREATE TABLE t (a SERIAL) ENGINE=InnoDB;
connect (dml,localhost,root);
# At the end of this statement, close_thread_tables()
# should add the open table handle to the table definition cache (tdc).
select * from t;
connection default;
# This should purge the handle from the tdc;
# otherwise ha_innobase::truncate() would hang,
# waiting for the reference count to drop to 0.
TRUNCATE TABLE t;
disconnect dml;
DROP TABLE t;
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
--source include/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
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
CREATE TABLE parent (a INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO parent SET a=1;
CREATE TABLE child (a INT PRIMARY KEY, FOREIGN KEY (a) REFERENCES parent(a)
ON UPDATE CASCADE)
ENGINE=InnoDB;
INSERT INTO child SET a=1;
--error ER_TRUNCATE_ILLEGAL_FK
TRUNCATE TABLE parent;
TRUNCATE TABLE child;
INSERT INTO child SET a=1;
UPDATE parent SET a=2;
SELECT * FROM child;
connect (dml,localhost,root);
SET DEBUG_SYNC='foreign_constraint_update_cascade SIGNAL fk WAIT_FOR go';
send UPDATE parent SET a=3;
connection default;
SET DEBUG_SYNC='now WAIT_FOR fk';
SET lock_wait_timeout=1;
--error ER_LOCK_WAIT_TIMEOUT
TRUNCATE TABLE child;
SET DEBUG_SYNC='now SIGNAL go';
connection dml;
reap;
SELECT * FROM child;
SET DEBUG_SYNC='foreign_constraint_check_for_update SIGNAL fk WAIT_FOR go';
send DELETE FROM parent;
connection default;
SET DEBUG_SYNC='now WAIT_FOR fk';
--error ER_LOCK_WAIT_TIMEOUT
TRUNCATE TABLE child;
SET DEBUG_SYNC='now SIGNAL go';
connection dml;
--error ER_ROW_IS_REFERENCED_2
reap;
SELECT * FROM child;
INSERT INTO parent SET a=5;
SET DEBUG_SYNC='foreign_constraint_check_for_ins SIGNAL fk WAIT_FOR go';
send INSERT INTO child SET a=5;
connection default;
SET DEBUG_SYNC='now WAIT_FOR fk';
SET foreign_key_checks=0;
TRUNCATE TABLE parent;
SET DEBUG_SYNC='now SIGNAL go';
connection dml;
--error ER_NO_REFERENCED_ROW_2
reap;
SELECT * FROM parent;
SELECT * FROM child;
disconnect dml;
connection default;
SET DEBUG_SYNC = RESET;
DROP TABLE child, parent;
# This test is based on innodb_zip.wl6501_error_1 in MySQL 5.7.
--source include/have_innodb.inc
--source include/innodb_row_format.inc
--source include/have_debug.inc
SET @save_dbug = @@SESSION.debug_dbug;
call mtr.add_suppression("InnoDB: Flagged corruption of .* in table `test`\\.`t` in TRUNCATE TABLE");
--echo # 1. Error in assigning undo logs for truncate action
CREATE TABLE t (i int PRIMARY KEY, f float UNIQUE, c char(100), INDEX ck(c))
ENGINE = InnoDB;
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
check table t;
#
SET debug_dbug = '+d,ib_err_trunc_assigning_undo_log';
--error ER_GET_ERRNO
truncate table t;
SET debug_dbug = @save_dbug;
check table t;
select * from t;
--echo # 2. Error while preparing for truncate
SET debug_dbug = '+d,ib_err_trunc_preparing_for_truncate';
--error ER_GET_ERRNO
truncate table t;
SET debug_dbug = @save_dbug;
check table t;
select * from t;
--echo # 3. Error while dropping/creating indexes
SET debug_dbug = '+d,ib_err_trunc_drop_index';
--error ER_GET_ERRNO
truncate table t;
SET debug_dbug = @save_dbug;
check table t;
--error ER_TABLE_CORRUPT,ER_GET_ERRNO
select * from t;
drop table t;
CREATE TABLE t (i int PRIMARY KEY, f float UNIQUE, c char(100), INDEX ck(c))
ENGINE = InnoDB;
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
check table t;
SET debug_dbug = '+d,ib_err_trunc_create_index';
--error ER_GET_ERRNO
truncate table t;
SET debug_dbug = @save_dbug;
check table t;
--error ER_TABLE_CORRUPT,ER_GET_ERRNO
select * from t;
drop table t;
CREATE TABLE t (i int PRIMARY KEY, f float UNIQUE, c char(100), INDEX ck(c))
ENGINE = InnoDB;
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
check table t;
SET debug_dbug = '+d,ib_err_trunc_temp_recreate_index';
truncate table t;
SET debug_dbug = @save_dbug;
check table t;
select * from t;
drop table t;
--echo # 4. Error while completing truncate of table involving FTS
CREATE TABLE t (i int PRIMARY KEY, f float UNIQUE, c char(100),
FULLTEXT INDEX(c)) ENGINE = InnoDB;
insert into t values (1, 1.1, 'mysql is now oracle company'),
(2, 2.2, 'innodb is part of mysql'),
(3, 3.3, 'innodb is default storage engine of mysql');
check table t;
SET debug_dbug = '+d,ib_err_trunc_temp_recreate_index';
truncate table t;
SET debug_dbug = @save_dbug;
check table t;
select * from t;
drop table t;
--echo # 5. Error while updating sys-tables
CREATE TABLE t (i int PRIMARY KEY, f float UNIQUE, c char(100),
FULLTEXT INDEX(c)) ENGINE = InnoDB;
insert into t values (1, 1.1, 'mysql is now oracle company'),
(2, 2.2, 'innodb is part of mysql'),
(3, 3.3, 'innodb is default storage engine of mysql');
check table t;
SET debug_dbug = '+d,ib_err_trunc_temp_recreate_index';
truncate table t;
SET debug_dbug = @save_dbug;
check table t;
select * from t order by i;
drop table t;
--source include/have_innodb.inc
--source include/not_embedded.inc
call mtr.add_suppression("InnoDB: Operating system error number ");
call mtr.add_suppression("InnoDB: (The error means|If you are|Cannot open datafile) ");
call mtr.add_suppression("InnoDB: Ignoring tablespace for `test`\.`t`");
call mtr.add_suppression("InnoDB: Table test/t .* does not exist");
CREATE TABLE t (a SERIAL) ENGINE=InnoDB;
INSERT INTO t() VALUES();
SHOW CREATE TABLE t;
let $datadir=`select @@datadir`;
--source include/shutdown_mysqld.inc
--remove_file $datadir/test/t.ibd
--source include/start_mysqld.inc
--error ER_NO_SUCH_TABLE_IN_ENGINE
SELECT * FROM t;
--error ER_NO_SUCH_TABLE_IN_ENGINE
TRUNCATE TABLE t;
DROP TABLE t;
--innodb-purge-threads=1
--innodb-purge-batch-size=1
--innodb-stats-persistent=OFF
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
--source include/count_sessions.inc
--echo #
--echo # Bug #23070734 CONCURRENT TRUNCATE TABLES CAUSE STALLS
--echo #
create table t1 (f1 int ,f2 int,key(f2)) engine=innodb;
begin;
insert into t1 values (10,45),(20,78),(30,88),(40,23),(50,78),(60,11),(70,56),(80,90);
delete from t1;
connect (con2,localhost,root,,);
# Stop the purge thread
START TRANSACTION WITH CONSISTENT SNAPSHOT;
connection default;
# Ensure that the history list length will actually be decremented by purge.
SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
commit;
connect (con1,localhost,root,,);
SET DEBUG_SYNC= 'buffer_pool_scan SIGNAL started WAIT_FOR finish_scan';
send truncate table t1;
connection con2;
SET DEBUG_SYNC= 'now WAIT_FOR started';
# Allow purge to proceed, by discarding our read view.
COMMIT;
disconnect con2;
connection default;
--source include/wait_all_purged.inc
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
SET DEBUG_SYNC = 'now SIGNAL finish_scan';
connection con1;
reap;
disconnect con1;
connection default;
SET DEBUG_SYNC = 'RESET';
drop table t1;
--source include/wait_until_count_sessions.inc
--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;
#
# Bug#25053705 - INVALID I/O ON TABLE AFTER TRUNCATE
#
CREATE TABLE t1 (a INT, d INT, b VARCHAR(198), c CHAR(158), FULLTEXT fts1(c,b),
FULLTEXT fts2(c));
TRUNCATE TABLE t1;
INSERT INTO t1 (a,d,b,c) VALUES (
'79795','6',repeat('uololoaroolccaaruolraloouuoocorrcorurlu','1'),
repeat('orouculcaocuocloooolooloooaorlroclouulrrucclulalouaulrluorooaclllluuorc
cuullucocraloracurooulrooauuar','1'));
CREATE TABLE t2 (a INT, d INT, b VARCHAR(198), c CHAR(158), FULLTEXT fts1(c,b));
INSERT INTO t2 VALUES (1, 1, repeat('uololoaroolccaaruolraloouuoocorrcorurlu','1'),
repeat('orouculcaocuocloooolooloooaorlroclouulrrucclulalouaulrluorooaclllluuorccuullucocraloracurooulrooauuar','1'));
create procedure insert_t2(IN total int)
begin
declare i int default 1;
while (i <= total) DO
insert into t2 select * from t2;
set i = i + 1;
end while;
end|
CALL insert_t2(15);
SET @save_dbug = @@SESSION.DEBUG_DBUG;
SET DEBUG_DBUG = '+d,innodb_invalid_read_after_truncate';
INSERT INTO t1 (a,d,b,c) VALUES (
'7795','6',repeat('uololoaroolccaaruolraloouuoocorrcorurlu','1'),
repeat('orouculcaocuocloooolooloooaorlroclouulrrucclulalouaulrluorooaclllluuorc
cuullucocraloracurooulrooauuar','1'));
SET DEBUG_DBUG = @save_dbug;
DROP PROCEDURE insert_t2;
DROP TABLE t1,t2;
--source include/have_innodb.inc
--source include/have_debug.inc
--echo #
--echo # Bug#25053705 - INVALID I/O ON TABLE AFTER TRUNCATE
--echo #
CREATE TABLE t1 (a INT, d INT, b VARCHAR(198), c CHAR(158), FULLTEXT fts1(c,b),
FULLTEXT fts2(c));
TRUNCATE TABLE t1;
INSERT INTO t1 (a,d,b,c) VALUES (
'79795','6',repeat('uololoaroolccaaruolraloouuoocorrcorurlu','1'),
repeat('orouculcaocuocloooolooloooaorlroclouulrrucclulalouaulrluorooaclllluuorc
cuullucocraloracurooulrooauuar','1'));
# The following CREATE TABLE and INSERTs are used to remove the pages related to table t1
# from the buffer pool.
CREATE TABLE t2 (a INT, d INT, b VARCHAR(198), c CHAR(158), FULLTEXT fts1(c,b));
INSERT INTO t2 VALUES (1, 1, repeat('uololoaroolccaaruolraloouuoocorrcorurlu','1'),
repeat('orouculcaocuocloooolooloooaorlroclouulrrucclulalouaulrluorooaclllluuorccuullucocraloracurooulrooauuar','1'));
delimiter |;
create procedure insert_t2(IN total int)
begin
declare i int default 1;
while (i <= total) DO
insert into t2 select * from t2;
set i = i + 1;
end while;
end|
delimiter ;|
CALL insert_t2(15);
SET @save_dbug = @@SESSION.DEBUG_DBUG;
SET DEBUG_DBUG = '+d,innodb_invalid_read_after_truncate';
INSERT INTO t1 (a,d,b,c) VALUES (
'7795','6',repeat('uololoaroolccaaruolraloouuoocorrcorurlu','1'),
repeat('orouculcaocuocloooolooloooaorlroclouulrrucclulalouaulrluorooaclllluuorc
cuullucocraloracurooulrooauuar','1'));
SET DEBUG_DBUG = @save_dbug;
DROP PROCEDURE insert_t2;
DROP TABLE t1,t2;
begin;
update t1 set c = 'MariaDB';
update t1 set c = 'InnoDB';
eval set global debug_dbug = '+d,$SEARCH_PATTERN';
commit;
--source include/shutdown_mysqld.inc
--source include/search_pattern_in_file.inc
--source include/start_mysqld.inc
call mtr.add_suppression("InnoDB: The transaction log size is too large");
SET GLOBAL innodb_fast_shutdown=0; SET GLOBAL innodb_fast_shutdown=0;
create table t1(keyc int primary key, c1 char(100)) engine = innodb; create table t1(keyc int primary key, c1 char(100)) engine = innodb;
begin; begin;
......
call mtr.add_suppression("InnoDB: The transaction log size is too large");
SET GLOBAL innodb_fast_shutdown=0; SET GLOBAL innodb_fast_shutdown=0;
create table t1(keyc int primary key, c char(100)) engine = innodb; create table t1(keyc int primary key, c char(100)) engine = innodb;
create table t2(keyc int primary key, c char(100)) engine = innodb; create table t2(keyc int primary key, c char(100)) engine = innodb;
......
SET GLOBAL innodb_undo_logs = 4;
SET GLOBAL innodb_undo_log_truncate = 1;
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
create table t1(keyc int primary key, c char(100)) engine = innodb; create table t1(keyc int primary key, c char(100)) engine = innodb;
begin; begin;
commit; commit;
begin; begin;
update t1 set c = 'MariaDB'; update t1 set c = 'MariaDB';
update t1 set c = 'InnoDB'; update t1 set c = 'InnoDB';
set global debug_dbug = '+d,ib_undo_trunc_before_truncate'; set global debug_dbug = '+d,ib_undo_trunc';
commit; commit;
FOUND 1 /ib_undo_trunc_before_truncate/ in mysqld.1.err call mtr.add_suppression("InnoDB: The transaction log size is too large");
begin; SET GLOBAL innodb_fast_shutdown=0;
update t1 set c = 'MariaDB'; FOUND 1 /ib_undo_trunc/ in mysqld.1.err
update t1 set c = 'InnoDB'; drop table t1;
set global debug_dbug = '+d,ib_undo_trunc_before_ddl_log_end';
commit;
FOUND 1 /ib_undo_trunc_before_ddl_log_end/ in mysqld.1.err
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
# The test is restarting the server to force undo truncation. # The test is restarting the server to force undo truncation.
--source include/not_embedded.inc --source include/not_embedded.inc
call mtr.add_suppression("InnoDB: The transaction log size is too large");
SET GLOBAL innodb_fast_shutdown=0; SET GLOBAL innodb_fast_shutdown=0;
--let $restart_parameters=--innodb_undo_tablespaces=2 --innodb_undo_logs=4 --let $restart_parameters=--innodb_undo_tablespaces=2 --innodb_undo_logs=4
--source include/restart_mysqld.inc --source include/restart_mysqld.inc
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
--source include/have_innodb_max_16k.inc --source include/have_innodb_max_16k.inc
--source include/have_undo_tablespaces.inc --source include/have_undo_tablespaces.inc
call mtr.add_suppression("InnoDB: The transaction log size is too large");
SET GLOBAL innodb_fast_shutdown=0; SET GLOBAL innodb_fast_shutdown=0;
--let $restart_parameters=--innodb_undo_tablespaces=2 --innodb_undo_logs=4 --let $restart_parameters=--innodb_undo_tablespaces=2 --innodb_undo_logs=4
--source include/restart_mysqld.inc --source include/restart_mysqld.inc
......
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
# WL#6965: Truncate UNDO logs. # WL#6965: Truncate UNDO logs.
# #
# With larger innodb_page_size, the undo log tablespaces do not grow enough.
--source include/innodb_page_size_small.inc
--source include/have_innodb.inc --source include/have_innodb.inc
--source include/have_debug.inc --source include/have_debug.inc
# With larger innodb_page_size, the undo log tablespaces do not grow enough.
--source include/have_innodb_max_16k.inc
--source include/have_undo_tablespaces.inc --source include/have_undo_tablespaces.inc
# Valgrind would complain about memory leaks when we crash on purpose. # Valgrind would complain about memory leaks when we crash on purpose.
...@@ -15,15 +15,9 @@ ...@@ -15,15 +15,9 @@
# Avoid CrashReporter popup on Mac # Avoid CrashReporter popup on Mac
--source include/not_crashrep.inc --source include/not_crashrep.inc
--disable_query_log SET GLOBAL innodb_undo_logs = 4;
# FIXME: The doublewrite buffer should not issue these warnings. SET GLOBAL innodb_undo_log_truncate = 1;
# FIXME: Maybe buf_dblwr_process() should empty the buffer at the end? SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
call mtr.add_suppression("InnoDB: A copy of page.*in the doublewrite buffer slot.*is not within space bounds");
FLUSH TABLES;
--enable_query_log
--let $restart_parameters=--innodb-undo-logs=4 --innodb-undo-tablespaces=2 --innodb-undo-log-truncate=1 --innodb-max-undo-log-size=10485760 --innodb-purge-rseg-truncate-frequency=1 --innodb-fast-shutdown=0
--source include/restart_mysqld.inc
let SEARCH_FILE = $MYSQLTEST_VARDIR/log/mysqld.1.err; let SEARCH_FILE = $MYSQLTEST_VARDIR/log/mysqld.1.err;
...@@ -38,13 +32,19 @@ while ($i) { ...@@ -38,13 +32,19 @@ while ($i) {
--enable_query_log --enable_query_log
commit; commit;
let SEARCH_PATTERN = ib_undo_trunc_before_truncate; let SEARCH_PATTERN = ib_undo_trunc;
--source include/truncate_recover.inc begin;
update t1 set c = 'MariaDB';
let SEARCH_PATTERN = ib_undo_trunc_before_ddl_log_end; update t1 set c = 'InnoDB';
--source include/truncate_recover.inc eval set global debug_dbug = '+d,$SEARCH_PATTERN';
commit;
# FIXME: remove this work-around, and generate less log!
call mtr.add_suppression("InnoDB: The transaction log size is too large");
SET GLOBAL innodb_fast_shutdown=0;
--source include/shutdown_mysqld.inc
--source include/search_pattern_in_file.inc
# FIXME: remove this work-around, and generate less log!
--let $restart_parameters= --innodb-buffer-pool-size=16m
--source include/start_mysqld.inc
let SEARCH_PATTERN = ib_undo_trunc_trunc_done;
let $restart_parameters=
--source include/truncate_recover.inc
drop table t1; drop table t1;
#
# 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;
...@@ -418,12 +418,12 @@ ALTER TABLE t7_restart TRUNCATE PARTITION p1; ...@@ -418,12 +418,12 @@ ALTER TABLE t7_restart TRUNCATE PARTITION p1;
=== information_schema.innodb_sys_tablespaces and innodb_sys_datafiles === === information_schema.innodb_sys_tablespaces and innodb_sys_datafiles ===
Space_Name Space_Type Page_Size Zip_Size Formats_Permitted Path Space_Name Space_Type Page_Size Zip_Size Formats_Permitted Path
test/t4_restart Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t4_restart.ibd test/t4_restart Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t4_restart.ibd
test/t5_restart Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t5_restart.ibd
test/t6_restart#p#p0 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p0.ibd test/t6_restart#p#p0 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p0.ibd
test/t6_restart#p#p1 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p1.ibd test/t6_restart#p#p1 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p1.ibd
test/t6_restart#p#p2 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p2.ibd
test/t7_restart#p#p0#sp#s0 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s0.ibd test/t7_restart#p#p0#sp#s0 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s0.ibd
test/t7_restart#p#p0#sp#s1 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s1.ibd test/t7_restart#p#p0#sp#s1 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s1.ibd
test/t5_restart Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t5_restart.ibd
test/t6_restart#p#p2 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p2.ibd
test/t7_restart#p#p1#sp#s2 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s2.ibd test/t7_restart#p#p1#sp#s2 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s2.ibd
test/t7_restart#p#p1#sp#s3 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s3.ibd test/t7_restart#p#p1#sp#s3 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s3.ibd
INSERT INTO t5_restart VALUES (1000000000, 'MySQL', 'InnoDB', '2011-11-11', 'Read this after reboot'); INSERT INTO t5_restart VALUES (1000000000, 'MySQL', 'InnoDB', '2011-11-11', 'Read this after reboot');
...@@ -521,12 +521,12 @@ innodb_file_per_table ON ...@@ -521,12 +521,12 @@ innodb_file_per_table ON
=== information_schema.innodb_sys_tablespaces and innodb_sys_datafiles === === information_schema.innodb_sys_tablespaces and innodb_sys_datafiles ===
Space_Name Space_Type Page_Size Zip_Size Formats_Permitted Path Space_Name Space_Type Page_Size Zip_Size Formats_Permitted Path
test/t4_restart Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t4_restart.ibd test/t4_restart Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t4_restart.ibd
test/t5_restart Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t5_restart.ibd
test/t6_restart#p#p0 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p0.ibd test/t6_restart#p#p0 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p0.ibd
test/t6_restart#p#p1 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p1.ibd test/t6_restart#p#p1 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p1.ibd
test/t6_restart#p#p2 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p2.ibd
test/t7_restart#p#p0#sp#s0 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s0.ibd test/t7_restart#p#p0#sp#s0 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s0.ibd
test/t7_restart#p#p0#sp#s1 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s1.ibd test/t7_restart#p#p0#sp#s1 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p0#sp#s1.ibd
test/t5_restart Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t5_restart.ibd
test/t6_restart#p#p2 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t6_restart#p#p2.ibd
test/t7_restart#p#p1#sp#s2 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s2.ibd test/t7_restart#p#p1#sp#s2 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s2.ibd
test/t7_restart#p#p1#sp#s3 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s3.ibd test/t7_restart#p#p1#sp#s3 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t7_restart#p#p1#sp#s3.ibd
SELECT count(*) FROM t5_restart; SELECT count(*) FROM t5_restart;
...@@ -621,12 +621,12 @@ RENAME TABLE t7_restart TO t77_restart; ...@@ -621,12 +621,12 @@ RENAME TABLE t7_restart TO t77_restart;
=== information_schema.innodb_sys_tablespaces and innodb_sys_datafiles === === information_schema.innodb_sys_tablespaces and innodb_sys_datafiles ===
Space_Name Space_Type Page_Size Zip_Size Formats_Permitted Path Space_Name Space_Type Page_Size Zip_Size Formats_Permitted Path
test/t4_restart Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t4_restart.ibd test/t4_restart Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t4_restart.ibd
test/t55_restart Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t55_restart.ibd
test/t66_restart#p#p0 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p0.ibd test/t66_restart#p#p0 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p0.ibd
test/t66_restart#p#p1 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p1.ibd test/t66_restart#p#p1 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p1.ibd
test/t66_restart#p#p2 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p2.ibd
test/t77_restart#p#p0#sp#s0 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p0#sp#s0.ibd test/t77_restart#p#p0#sp#s0 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p0#sp#s0.ibd
test/t77_restart#p#p0#sp#s1 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p0#sp#s1.ibd test/t77_restart#p#p0#sp#s1 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p0#sp#s1.ibd
test/t55_restart Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t55_restart.ibd
test/t66_restart#p#p2 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p2.ibd
test/t77_restart#p#p1#sp#s2 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p1#sp#s2.ibd test/t77_restart#p#p1#sp#s2 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p1#sp#s2.ibd
test/t77_restart#p#p1#sp#s3 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p1#sp#s3.ibd test/t77_restart#p#p1#sp#s3 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p1#sp#s3.ibd
INSERT INTO t55_restart (SELECT 0, c2, c3, c4, c5 FROM t55_restart); INSERT INTO t55_restart (SELECT 0, c2, c3, c4, c5 FROM t55_restart);
...@@ -717,12 +717,12 @@ innodb_file_per_table ON ...@@ -717,12 +717,12 @@ innodb_file_per_table ON
=== information_schema.innodb_sys_tablespaces and innodb_sys_datafiles === === information_schema.innodb_sys_tablespaces and innodb_sys_datafiles ===
Space_Name Space_Type Page_Size Zip_Size Formats_Permitted Path Space_Name Space_Type Page_Size Zip_Size Formats_Permitted Path
test/t4_restart Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t4_restart.ibd test/t4_restart Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t4_restart.ibd
test/t55_restart Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t55_restart.ibd
test/t66_restart#p#p0 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p0.ibd test/t66_restart#p#p0 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p0.ibd
test/t66_restart#p#p1 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p1.ibd test/t66_restart#p#p1 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p1.ibd
test/t66_restart#p#p2 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p2.ibd
test/t77_restart#p#p0#sp#s0 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p0#sp#s0.ibd test/t77_restart#p#p0#sp#s0 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p0#sp#s0.ibd
test/t77_restart#p#p0#sp#s1 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p0#sp#s1.ibd test/t77_restart#p#p0#sp#s1 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p0#sp#s1.ibd
test/t55_restart Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t55_restart.ibd
test/t66_restart#p#p2 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/alt_dir/test/t66_restart#p#p2.ibd
test/t77_restart#p#p1#sp#s2 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p1#sp#s2.ibd test/t77_restart#p#p1#sp#s2 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p1#sp#s2.ibd
test/t77_restart#p#p1#sp#s3 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p1#sp#s3.ibd test/t77_restart#p#p1#sp#s3 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/alt_dir/test/t77_restart#p#p1#sp#s3.ibd
INSERT INTO t55_restart (SELECT 0, c2, c3, c4, c5 FROM t55_restart); INSERT INTO t55_restart (SELECT 0, c2, c3, c4, c5 FROM t55_restart);
...@@ -848,12 +848,12 @@ t77_restart#p#p1#sp#s3.ibd ...@@ -848,12 +848,12 @@ t77_restart#p#p1#sp#s3.ibd
=== information_schema.innodb_sys_tablespaces and innodb_sys_datafiles === === information_schema.innodb_sys_tablespaces and innodb_sys_datafiles ===
Space_Name Space_Type Page_Size Zip_Size Formats_Permitted Path Space_Name Space_Type Page_Size Zip_Size Formats_Permitted Path
test/t4_restart Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/new_dir/test/t4_restart.ibd test/t4_restart Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/new_dir/test/t4_restart.ibd
test/t55_restart Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/new_dir/test/t55_restart.ibd
test/t66_restart#p#p0 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/new_dir/test/t66_restart#p#p0.ibd test/t66_restart#p#p0 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/new_dir/test/t66_restart#p#p0.ibd
test/t66_restart#p#p1 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/new_dir/test/t66_restart#p#p1.ibd test/t66_restart#p#p1 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/new_dir/test/t66_restart#p#p1.ibd
test/t66_restart#p#p2 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/new_dir/test/t66_restart#p#p2.ibd
test/t77_restart#p#p0#sp#s0 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/new_dir/test/t77_restart#p#p0#sp#s0.ibd test/t77_restart#p#p0#sp#s0 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/new_dir/test/t77_restart#p#p0#sp#s0.ibd
test/t77_restart#p#p0#sp#s1 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/new_dir/test/t77_restart#p#p0#sp#s1.ibd test/t77_restart#p#p0#sp#s1 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/new_dir/test/t77_restart#p#p0#sp#s1.ibd
test/t55_restart Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/new_dir/test/t55_restart.ibd
test/t66_restart#p#p2 Single DEFAULT DEFAULT Compressed MYSQL_TMP_DIR/new_dir/test/t66_restart#p#p2.ibd
test/t77_restart#p#p1#sp#s2 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/new_dir/test/t77_restart#p#p1#sp#s2.ibd test/t77_restart#p#p1#sp#s2 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/new_dir/test/t77_restart#p#p1#sp#s2.ibd
test/t77_restart#p#p1#sp#s3 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/new_dir/test/t77_restart#p#p1#sp#s3.ibd test/t77_restart#p#p1#sp#s3 Single DEFAULT DEFAULT Dynamic MYSQL_TMP_DIR/new_dir/test/t77_restart#p#p1#sp#s3.ibd
INSERT INTO t4_restart (SELECT 0, c2, c3, c4, c5 FROM t4_restart); INSERT INTO t4_restart (SELECT 0, c2, c3, c4, c5 FROM t4_restart);
...@@ -983,12 +983,12 @@ t77_restart.par ...@@ -983,12 +983,12 @@ t77_restart.par
=== information_schema.innodb_sys_tablespaces and innodb_sys_datafiles === === information_schema.innodb_sys_tablespaces and innodb_sys_datafiles ===
Space_Name Space_Type Page_Size Zip_Size Formats_Permitted Path Space_Name Space_Type Page_Size Zip_Size Formats_Permitted Path
test/t4_restart Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t4_restart.ibd test/t4_restart Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t4_restart.ibd
test/t55_restart Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t55_restart.ibd
test/t66_restart#p#p0 Single DEFAULT DEFAULT Compressed MYSQLD_DATADIR/test/t66_restart#p#p0.ibd test/t66_restart#p#p0 Single DEFAULT DEFAULT Compressed MYSQLD_DATADIR/test/t66_restart#p#p0.ibd
test/t66_restart#p#p1 Single DEFAULT DEFAULT Compressed MYSQLD_DATADIR/test/t66_restart#p#p1.ibd test/t66_restart#p#p1 Single DEFAULT DEFAULT Compressed MYSQLD_DATADIR/test/t66_restart#p#p1.ibd
test/t66_restart#p#p2 Single DEFAULT DEFAULT Compressed MYSQLD_DATADIR/test/t66_restart#p#p2.ibd
test/t77_restart#p#p0#sp#s0 Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t77_restart#p#p0#sp#s0.ibd test/t77_restart#p#p0#sp#s0 Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t77_restart#p#p0#sp#s0.ibd
test/t77_restart#p#p0#sp#s1 Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t77_restart#p#p0#sp#s1.ibd test/t77_restart#p#p0#sp#s1 Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t77_restart#p#p0#sp#s1.ibd
test/t55_restart Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t55_restart.ibd
test/t66_restart#p#p2 Single DEFAULT DEFAULT Compressed MYSQLD_DATADIR/test/t66_restart#p#p2.ibd
test/t77_restart#p#p1#sp#s2 Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t77_restart#p#p1#sp#s2.ibd test/t77_restart#p#p1#sp#s2 Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t77_restart#p#p1#sp#s2.ibd
test/t77_restart#p#p1#sp#s3 Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t77_restart#p#p1#sp#s3.ibd test/t77_restart#p#p1#sp#s3 Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t77_restart#p#p1#sp#s3.ibd
INSERT INTO t4_restart (SELECT 0, c2, c3, c4, c5 FROM t4_restart); INSERT INTO t4_restart (SELECT 0, c2, c3, c4, c5 FROM t4_restart);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
set innodb_strict_mode=OFF;
create procedure populate()
begin
declare i int default 1;
while (i <= 5000) do
insert into t1 values (i, 'a', 'b');
insert into t2 values (i, 'a', 'b');
insert into t3 values (i, 'a', 'b');
set i = i + 1;
end while;
end|
create procedure populate_small()
begin
declare i int default 10001;
while (i <= 12000) do
insert into t1 values (i, 'c', 'd');
insert into t2 values (i, 'a', 'b');
insert into t3 values (i, 'a', 'b');
set i = i + 1;
end while;
end|
set global innodb_file_per_table = 1;
create table tNUMBER
(i int, cNUMBER char(NUMBER), cNUMBER char(NUMBER),
index cNUMBER_idx(cNUMBER))
engine=innodb row_format=compact
key_block_size=NUMBER;
Warnings:
Warning NUMBER InnoDB: ignoring KEY_BLOCK_SIZE=NUMBER unless ROW_FORMAT=COMPRESSED.
create table t2
(i int, c1 char(100), c2 char(100),
index c1_idx(c1))
engine=innodb row_format=compact
key_block_size=16;
Warnings:
Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=16 unless ROW_FORMAT=COMPRESSED.
create temporary table t3
(i int, c1 char(100), c2 char(100),
index c1_idx(c1))
engine=innodb row_format=compact
key_block_size=16;
Warnings:
Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE.
Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=16.
select count(*) from t1;
count(*)
0
select count(*) from t2;
count(*)
0
select count(*) from t3;
count(*)
0
begin;
call populate();
commit;
select count(*) from t1;
count(*)
5000
select count(*) from t2;
count(*)
5000
select count(*) from t3;
count(*)
5000
truncate table t1;
select count(*) from t1;
count(*)
0
select count(*) from t2;
count(*)
5000
select count(*) from t3;
count(*)
5000
call populate_small();
select count(*) from t1;
count(*)
2000
select count(*) from t2;
count(*)
7000
select count(*) from t3;
count(*)
7000
truncate table t2;
truncate table t3;
select count(*) from t1;
count(*)
2000
select count(*) from t2;
count(*)
0
select count(*) from t3;
count(*)
0
call populate_small();
select count(*) from t1;
count(*)
4000
select count(*) from t2;
count(*)
2000
select count(*) from t3;
count(*)
2000
drop table t1;
drop table t2;
drop table t3;
drop procedure populate;
drop procedure populate_small;
set global innodb_file_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;
This diff is collapsed.
#
# WL#6501: make truncate table atomic
#
# TC tries to hit crash point during truncate of
# compressed non-temp table residing in single tablespace
# with page-size=16k
--source include/have_innodb.inc
--source include/have_innodb_16k.inc
--source include/have_debug.inc
--source include/big_test.inc
# Valgrind would complain about memory leaks when we crash on purpose.
--source include/not_valgrind.inc
# Embedded server does not support crashing
--source include/not_embedded.inc
# Avoid CrashReporter popup on Mac
--source include/not_crashrep.inc
let $wl6501_file_per_table = 1;
let $wl6501_row_fmt = compressed;
let $wl6501_kbs = 16;
--source suite/innodb/include/innodb_wl6501_crash.inc
#
# WL#6501: make truncate table atomic
#
# TC tries to hit crash point during truncate of
# compressed non-temp table residing in single tablespace.
# with page-size=4k
--source include/have_innodb.inc
--source include/have_innodb_4k.inc
--source include/have_debug.inc
--source include/big_test.inc
# Valgrind would complain about memory leaks when we crash on purpose.
--source include/not_valgrind.inc
# Embedded server does not support crashing
--source include/not_embedded.inc
# Avoid CrashReporter popup on Mac
--source include/not_crashrep.inc
let $wl6501_file_per_table = 1;
let $wl6501_row_fmt = compressed;
let $wl6501_kbs = 4;
--source suite/innodb/include/innodb_wl6501_crash.inc
let $wl6501_temp = temporary;
--source suite/innodb/include/innodb_wl6501_crash_temp.inc
#
# 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
#
# WL#6501: make truncate table atomic
#
# load table with some significiant amount of data
# and then try truncate
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/big_test.inc
--source include/have_innodb_16k.inc
# Valgrind would complain about memory leaks when we crash on purpose.
--source include/not_valgrind.inc
# Embedded server does not support crashing
--source include/not_embedded.inc
# Avoid CrashReporter popup on Mac
--source include/not_crashrep.inc
# Single-Tablespace/Non-Compressed
let $wl6501_file_per_table = 1;
let $wl6501_row_fmt = compact;
let $wl6501_kbs = 16;
--source suite/innodb_zip/include/innodb_wl6501_scale.inc
# Single-Tablespace/Compressed
let $wl6501_file_per_table = 1;
let $wl6501_row_fmt = compressed;
let $wl6501_kbs = 16;
--source suite/innodb_zip/include/innodb_wl6501_scale.inc
# System-Tablespace/Non-Compressed
let $wl6501_file_per_table = 0;
let $wl6501_row_fmt = compact;
let $wl6501_kbs = 16;
--source suite/innodb_zip/include/innodb_wl6501_scale.inc
...@@ -7,7 +7,6 @@ CREATE TABLE t1 ENGINE=InnoDB SELECT 1; ...@@ -7,7 +7,6 @@ CREATE TABLE t1 ENGINE=InnoDB SELECT 1;
--let after_load_tablespaces=TRUNCATE test.t1 --let after_load_tablespaces=TRUNCATE test.t1
--disable_result_log --disable_result_log
--error 1
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir --dbug=+d,mariabackup_events; exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir --dbug=+d,mariabackup_events;
--enable_result_log --enable_result_log
......
...@@ -402,6 +402,8 @@ rpl_slave_state::truncate_state_table(THD *thd) ...@@ -402,6 +402,8 @@ rpl_slave_state::truncate_state_table(THD *thd)
NULL, TL_WRITE); NULL, TL_WRITE);
if (!(err= open_and_lock_tables(thd, &tlist, FALSE, 0))) if (!(err= open_and_lock_tables(thd, &tlist, FALSE, 0)))
{ {
tdc_remove_table(thd, TDC_RT_REMOVE_UNUSED, "mysql",
rpl_gtid_slave_state_table_name.str, false);
err= tlist.table->file->ha_truncate(); err= tlist.table->file->ha_truncate();
if (err) if (err)
......
...@@ -563,7 +563,8 @@ buf_dblwr_process() ...@@ -563,7 +563,8 @@ buf_dblwr_process()
is scheduled for truncation or was truncated is scheduled for truncation or was truncated
and we have parsed an MLOG_TRUNCATE record. */ and we have parsed an MLOG_TRUNCATE record. */
if (!srv_is_tablespace_truncated(space_id) if (!srv_is_tablespace_truncated(space_id)
&& !srv_was_tablespace_truncated(space)) { && !srv_was_tablespace_truncated(space)
&& !srv_is_undo_tablespace(space_id)) {
ib::warn() << "A copy of page " << page_id ib::warn() << "A copy of page " << page_id
<< " in the doublewrite buffer slot " << " in the doublewrite buffer slot "
<< page_no_dblwr << page_no_dblwr
......
...@@ -560,13 +560,15 @@ the list as they age towards the tail of the LRU. ...@@ -560,13 +560,15 @@ the list as they age towards the tail of the LRU.
@param[in] id tablespace identifier @param[in] id tablespace identifier
@param[in] observer flush observer (to check for interrupt), @param[in] observer flush observer (to check for interrupt),
or NULL if the files should not be written to or NULL if the files should not be written to
@return whether all dirty pages were freed */ @param[in] first first page to be flushed or evicted
@return whether all matching dirty pages were removed */
static MY_ATTRIBUTE((warn_unused_result)) static MY_ATTRIBUTE((warn_unused_result))
bool bool
buf_flush_or_remove_pages( buf_flush_or_remove_pages(
buf_pool_t* buf_pool, buf_pool_t* buf_pool,
ulint id, ulint id,
FlushObserver* observer) FlushObserver* observer,
ulint first)
{ {
buf_page_t* prev; buf_page_t* prev;
buf_page_t* bpage; buf_page_t* bpage;
...@@ -607,6 +609,8 @@ buf_flush_or_remove_pages( ...@@ -607,6 +609,8 @@ buf_flush_or_remove_pages(
} else if (id != bpage->id.space()) { } else if (id != bpage->id.space()) {
/* Skip this block, because it is for a /* Skip this block, because it is for a
different tablespace. */ different tablespace. */
} else if (bpage->id.page_no() < first) {
/* Skip this block, because it is below the limit. */
} else if (!buf_flush_or_remove_page( } else if (!buf_flush_or_remove_page(
buf_pool, bpage, observer != NULL)) { buf_pool, bpage, observer != NULL)) {
...@@ -670,18 +674,20 @@ the tail of the LRU list. ...@@ -670,18 +674,20 @@ the tail of the LRU list.
@param[in] id tablespace identifier @param[in] id tablespace identifier
@param[in] observer flush observer, @param[in] observer flush observer,
or NULL if the files should not be written to or NULL if the files should not be written to
*/ @param[in] first first page to be flushed or evicted */
static static
void void
buf_flush_dirty_pages( buf_flush_dirty_pages(
buf_pool_t* buf_pool, buf_pool_t* buf_pool,
ulint id, ulint id,
FlushObserver* observer) FlushObserver* observer,
ulint first)
{ {
for (;;) { for (;;) {
buf_pool_mutex_enter(buf_pool); buf_pool_mutex_enter(buf_pool);
bool freed = buf_flush_or_remove_pages(buf_pool, id, observer); bool freed = buf_flush_or_remove_pages(buf_pool, id, observer,
first);
buf_pool_mutex_exit(buf_pool); buf_pool_mutex_exit(buf_pool);
...@@ -696,20 +702,24 @@ buf_flush_dirty_pages( ...@@ -696,20 +702,24 @@ buf_flush_dirty_pages(
} }
ut_ad((observer && observer->is_interrupted()) ut_ad((observer && observer->is_interrupted())
|| first
|| buf_pool_get_dirty_pages_count(buf_pool, id, observer) == 0); || buf_pool_get_dirty_pages_count(buf_pool, id, observer) == 0);
} }
/** Empty the flush list for all pages belonging to a tablespace. /** Empty the flush list for all pages belonging to a tablespace.
@param[in] id tablespace identifier @param[in] id tablespace identifier
@param[in] observer flush observer, @param[in] observer flush observer,
or NULL if nothing is to be written */ or NULL if nothing is to be written
void buf_LRU_flush_or_remove_pages(ulint id, FlushObserver* observer) @param[in] first first page to be flushed or evicted */
void buf_LRU_flush_or_remove_pages(ulint id, FlushObserver* observer,
ulint first)
{ {
/* Pages in the system tablespace must never be discarded. */ /* Pages in the system tablespace must never be discarded. */
ut_ad(id || observer); ut_ad(id || observer);
for (ulint i = 0; i < srv_buf_pool_instances; i++) { for (ulint i = 0; i < srv_buf_pool_instances; i++) {
buf_flush_dirty_pages(buf_pool_from_array(i), id, observer); buf_flush_dirty_pages(buf_pool_from_array(i), id, observer,
first);
} }
if (observer && !observer->is_interrupted()) { if (observer && !observer->is_interrupted()) {
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2015, 2017, MariaDB Corporation. Copyright (c) 2015, 2018, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
...@@ -176,17 +176,6 @@ buf_read_page_low( ...@@ -176,17 +176,6 @@ buf_read_page_low(
dst = ((buf_block_t*) bpage)->frame; dst = ((buf_block_t*) bpage)->frame;
} }
DBUG_EXECUTE_IF(
"innodb_invalid_read_after_truncate",
if (fil_space_t* space = fil_space_acquire(page_id.space())) {
if (!strcmp(space->name, "test/t1")
&& page_id.page_no() == space->size - 1) {
type = 0;
sync = true;
}
fil_space_release(space);
});
IORequest request(type | IORequest::READ); IORequest request(type | IORequest::READ);
*err = fil_io( *err = fil_io(
...@@ -332,19 +321,6 @@ buf_read_ahead_random( ...@@ -332,19 +321,6 @@ buf_read_ahead_random(
that is, reside near the start of the LRU list. */ that is, reside near the start of the LRU list. */
for (i = low; i < high; i++) { for (i = low; i < high; i++) {
DBUG_EXECUTE_IF(
"innodb_invalid_read_after_truncate",
if (fil_space_t* space = fil_space_acquire(
page_id.space())) {
bool skip = !strcmp(space->name, "test/t1");
fil_space_release(space);
if (skip) {
high = space->size;
buf_pool_mutex_exit(buf_pool);
goto read_ahead;
}
});
const buf_page_t* bpage = buf_page_hash_get( const buf_page_t* bpage = buf_page_hash_get(
buf_pool, page_id_t(page_id.space(), i)); buf_pool, page_id_t(page_id.space(), i));
......
This diff is collapsed.
...@@ -943,8 +943,8 @@ fil_crypt_read_crypt_data(fil_space_t* space) ...@@ -943,8 +943,8 @@ fil_crypt_read_crypt_data(fil_space_t* space)
/* The encryption metadata has already been read, or /* The encryption metadata has already been read, or
the tablespace is not encrypted and the file has been the tablespace is not encrypted and the file has been
opened already, or the file cannot be accessed, opened already, or the file cannot be accessed,
likely due to a concurrent TRUNCATE or likely due to a concurrent DROP
RENAME or DROP (possibly as part of ALTER TABLE). (possibly as part of TRUNCATE or ALTER TABLE).
FIXME: The file can become unaccessible any time FIXME: The file can become unaccessible any time
after this check! We should really remove this after this check! We should really remove this
function and instead make crypt_data an integral function and instead make crypt_data an integral
...@@ -1628,7 +1628,7 @@ fil_crypt_get_page_throttle_func( ...@@ -1628,7 +1628,7 @@ fil_crypt_get_page_throttle_func(
ut_ad(space->n_pending_ops > 0); ut_ad(space->n_pending_ops > 0);
/* Before reading from tablespace we need to make sure that /* Before reading from tablespace we need to make sure that
the tablespace is not about to be dropped or truncated. */ the tablespace is not about to be dropped. */
if (space->is_stopping()) { if (space->is_stopping()) {
return NULL; return NULL;
} }
......
This diff is collapsed.
...@@ -639,7 +639,6 @@ fsp_space_modify_check( ...@@ -639,7 +639,6 @@ fsp_space_modify_check(
ut_ad(space->purpose == FIL_TYPE_TEMPORARY ut_ad(space->purpose == FIL_TYPE_TEMPORARY
|| space->purpose == FIL_TYPE_IMPORT || space->purpose == FIL_TYPE_IMPORT
|| space->redo_skipped_count || space->redo_skipped_count
|| space->is_being_truncated
|| srv_is_tablespace_truncated(space->id)); || srv_is_tablespace_truncated(space->id));
return; return;
case MTR_LOG_ALL: case MTR_LOG_ALL:
......
...@@ -1470,7 +1470,8 @@ fts_drop_table( ...@@ -1470,7 +1470,8 @@ fts_drop_table(
/* Pass nonatomic=false (dont allow data dict unlock), /* Pass nonatomic=false (dont allow data dict unlock),
because the transaction may hold locks on SYS_* tables from because the transaction may hold locks on SYS_* tables from
previous calls to fts_drop_table(). */ previous calls to fts_drop_table(). */
error = row_drop_table_for_mysql(table_name, trx, true, false, false); error = row_drop_table_for_mysql(table_name, trx,
SQLCOM_DROP_DB, false, false);
if (error != DB_SUCCESS) { if (error != DB_SUCCESS) {
ib::error() << "Unable to drop FTS index aux table " ib::error() << "Unable to drop FTS index aux table "
...@@ -1944,8 +1945,8 @@ fts_create_common_tables( ...@@ -1944,8 +1945,8 @@ fts_create_common_tables(
if (error != DB_SUCCESS) { if (error != DB_SUCCESS) {
for (it = common_tables.begin(); it != common_tables.end(); for (it = common_tables.begin(); it != common_tables.end();
++it) { ++it) {
row_drop_table_for_mysql( row_drop_table_for_mysql((*it)->name.m_name, trx,
(*it)->name.m_name, trx, true, FALSE); SQLCOM_DROP_DB);
} }
} }
...@@ -2105,8 +2106,8 @@ fts_create_index_tables_low( ...@@ -2105,8 +2106,8 @@ fts_create_index_tables_low(
for (it = aux_idx_tables.begin(); it != aux_idx_tables.end(); for (it = aux_idx_tables.begin(); it != aux_idx_tables.end();
++it) { ++it) {
row_drop_table_for_mysql( row_drop_table_for_mysql((*it)->name.m_name, trx,
(*it)->name.m_name, trx, true, FALSE); SQLCOM_DROP_DB);
} }
} }
...@@ -6712,7 +6713,8 @@ fts_drop_obsolete_aux_table_from_vector( ...@@ -6712,7 +6713,8 @@ fts_drop_obsolete_aux_table_from_vector(
trx_start_for_ddl(trx_drop, TRX_DICT_OP_TABLE); trx_start_for_ddl(trx_drop, TRX_DICT_OP_TABLE);
err = row_drop_table_for_mysql( err = row_drop_table_for_mysql(
aux_drop_table->name, trx_drop, false, true); aux_drop_table->name, trx_drop,
SQLCOM_DROP_TABLE, true);
trx_drop->dict_operation_lock_mode = 0; trx_drop->dict_operation_lock_mode = 0;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment