2017-06-13 15:20:21 +02:00
|
|
|
--source include/have_innodb.inc
|
MDEV-13039 innodb_fast_shutdown=0 may fail to purge all undo log
When a slow shutdown is performed soon after spawning some work for
background threads that can create or commit transactions, it is possible
that new transactions are started or committed after the purge has finished.
This is violating the specification of innodb_fast_shutdown=0, namely that
the purge must be completed. (None of the history of the recent transactions
would be purged.)
Also, it is possible that the purge threads would exit in slow shutdown
while there exist active transactions, such as recovered incomplete
transactions that are being rolled back. Thus, the slow shutdown could
fail to purge some undo log that becomes purgeable after the transaction
commit or rollback.
srv_undo_sources: A flag that indicates if undo log can be generated
or the persistent, whether by background threads or by user SQL.
Even when this flag is clear, active transactions that already exist
in the system may be committed or rolled back.
innodb_shutdown(): Renamed from innobase_shutdown_for_mysql().
Do not return an error code; the operation never fails.
Clear the srv_undo_sources flag, and also ensure that the background
DROP TABLE queue is empty.
srv_purge_should_exit(): Do not allow the purge to exit if
srv_undo_sources are active or the background DROP TABLE queue is not
empty, or in slow shutdown, if any active transactions exist
(and are being rolled back).
srv_purge_coordinator_thread(): Remove some previous workarounds
for this bug.
innobase_start_or_create_for_mysql(): Set buf_page_cleaner_is_active
and srv_dict_stats_thread_active directly. Set srv_undo_sources before
starting the purge subsystem, to prevent immediate shutdown of the purge.
Create dict_stats_thread and fts_optimize_thread immediately
after setting srv_undo_sources, so that shutdown can use this flag to
determine if these subsystems were started.
dict_stats_shutdown(): Shut down dict_stats_thread. Backported from 10.2.
srv_shutdown_table_bg_threads(): Remove (unused).
2017-06-08 14:43:06 +02:00
|
|
|
# Embedded mode doesn't allow restarting
|
|
|
|
--source include/not_embedded.inc
|
|
|
|
|
|
|
|
create table t1 (a int not null, d varchar(15) not null, b
|
|
|
|
varchar(198) not null, c char(156),
|
|
|
|
fulltext ftsic(c)) engine=InnoDB
|
|
|
|
row_format=redundant;
|
|
|
|
|
|
|
|
insert into t1 values(123, 'abcdef', 'jghikl', 'mnop');
|
|
|
|
insert into t1 values(456, 'abcdef', 'jghikl', 'mnop');
|
|
|
|
insert into t1 values(789, 'abcdef', 'jghikl', 'mnop');
|
|
|
|
insert into t1 values(134, 'kasdfsdsadf', 'adfjlasdkfjasd', 'adfsadflkasdasdfljasdf');
|
|
|
|
insert into t1 select * from t1;
|
|
|
|
insert into t1 select * from t1;
|
|
|
|
insert into t1 select * from t1;
|
|
|
|
insert into t1 select * from t1;
|
|
|
|
insert into t1 select * from t1;
|
|
|
|
insert into t1 select * from t1;
|
|
|
|
insert into t1 select * from t1;
|
|
|
|
insert into t1 select * from t1;
|
|
|
|
insert into t1 select * from t1;
|
|
|
|
insert into t1 select * from t1;
|
|
|
|
|
|
|
|
SET GLOBAL innodb_file_per_table=OFF;
|
|
|
|
create table t2 (a int not null, d varchar(15) not null, b
|
|
|
|
varchar(198) not null, c char(156), fulltext ftsic(c)) engine=InnoDB
|
|
|
|
row_format=redundant;
|
|
|
|
|
|
|
|
insert into t2 select * from t1;
|
|
|
|
|
|
|
|
create table t3 (a int not null, d varchar(15) not null, b varchar(198),
|
|
|
|
c varchar(150), index k1(c(99), b(56)), index k2(b(5), c(10))) engine=InnoDB
|
|
|
|
row_format=redundant;
|
|
|
|
|
|
|
|
insert into t3 values(444, 'dddd', 'bbbbb', 'aaaaa');
|
|
|
|
insert into t3 values(555, 'eeee', 'ccccc', 'aaaaa');
|
|
|
|
|
|
|
|
# read-only restart requires the change buffer to be empty; therefore we
|
|
|
|
# do a slow shutdown.
|
|
|
|
SET GLOBAL innodb_fast_shutdown=0;
|
|
|
|
--let $restart_parameters = --innodb-read-only
|
|
|
|
--source include/restart_mysqld.inc
|
|
|
|
|
|
|
|
SELECT COUNT(*) FROM t1;
|
|
|
|
SELECT COUNT(*) FROM t2;
|
|
|
|
SELECT COUNT(*) FROM t3;
|
|
|
|
|
|
|
|
--error ER_OPEN_AS_READONLY
|
|
|
|
TRUNCATE TABLE t1;
|
|
|
|
--error ER_OPEN_AS_READONLY
|
|
|
|
TRUNCATE TABLE t2;
|
|
|
|
--error ER_OPEN_AS_READONLY
|
|
|
|
TRUNCATE TABLE t3;
|
|
|
|
|
|
|
|
--let $restart_parameters =
|
|
|
|
--source include/restart_mysqld.inc
|
|
|
|
|
|
|
|
TRUNCATE TABLE t1;
|
|
|
|
TRUNCATE TABLE t2;
|
|
|
|
TRUNCATE TABLE t3;
|
|
|
|
|
|
|
|
DROP TABLE t1,t2,t3;
|