Skip to content

Commit fbeece3

Browse files
committed
Tests introduced in WL9508 still fail periodically in PB2.
Make ALTER UNDO TABLESPACE SET INACTIVE more indempotent. Help truncate_recover_xx tests by doing a slow shutdown restart first in order to reduce the size of the undo logs so that the shutdown in the test does not timeout.
1 parent d9a5473 commit fbeece3

12 files changed

+37
-14
lines changed

mysql-test/suite/innodb_undo/include/truncate_recover_run.inc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ update t1 set c1 = 'mysql' where keyc > 20000;
99
update t1 set c2 = 'oracle' where keyc > 20000;
1010
eval set global debug = $debug_point;
1111
commit;
12-
set global innodb_fast_shutdown=0;
1312
--let $shutdown_server_timeout= 300
1413
--source include/shutdown_mysqld.inc
1514
--source include/search_pattern.inc

mysql-test/suite/innodb_undo/include/truncate_recover_setup.inc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,20 @@ let $rollback_segments_start_value = `SELECT @@global.innodb_rollback_segments`;
1313
let $max_undo_log_size_start_value = `SELECT @@global.innodb_max_undo_log_size`;
1414
let $log_error_verbosity_start_value = `SELECT @@global.log_error_verbosity`;
1515
let $undo_log_truncate_start_value = `SELECT @@global.innodb_undo_log_truncate`;
16+
let $innodb_fast_shutdown_start_value = `SELECT @@global.innodb_fast_shutdown`;
1617
--enable_query_log
1718

19+
# Do a slow shutdown and restart to clear out the undo logs
20+
SET @@global.innodb_fast_shutdown = 0;
21+
--let $shutdown_server_timeout = 300
22+
--source include/restart_mysqld.inc
23+
1824
SET @@global.innodb_undo_log_truncate = 1;
1925
SET @@global.innodb_purge_rseg_truncate_frequency = 1;
2026
SET @@global.innodb_rollback_segments = 3;
2127
SET @@global.innodb_max_undo_log_size = 11534336;
2228
SET @@global.log_error_verbosity = 3;
29+
SET @@global.innodb_fast_shutdown = 0;
2330

2431
--echo #
2532
--echo # Create procedure to populate the test-bed for Undo Truncate Recover tests

mysql-test/suite/innodb_undo/r/truncate_recover_01.result

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
#
22
# WL#6965: Truncate UNDO logs during recovery.
33
#
4+
SET @@global.innodb_fast_shutdown = 0;
5+
# restart
46
SET @@global.innodb_undo_log_truncate = 1;
57
SET @@global.innodb_purge_rseg_truncate_frequency = 1;
68
SET @@global.innodb_rollback_segments = 3;
79
SET @@global.innodb_max_undo_log_size = 11534336;
810
SET @@global.log_error_verbosity = 3;
11+
SET @@global.innodb_fast_shutdown = 0;
912
#
1013
# Create procedure to populate the test-bed for Undo Truncate Recover tests
1114
#
@@ -30,7 +33,6 @@ update t1 set c1 = 'mysql' where keyc > 20000;
3033
update t1 set c2 = 'oracle' where keyc > 20000;
3134
set global debug = "+d,ib_undo_trunc_before_buf_remove_all";
3235
commit;
33-
set global innodb_fast_shutdown=0;
3436
Pattern "ib_undo_trunc_before_buf_remove_all" found
3537
# restart
3638
drop table t1;

mysql-test/suite/innodb_undo/r/truncate_recover_02.result

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
#
22
# WL#6965: Truncate UNDO logs during recovery.
33
#
4+
SET @@global.innodb_fast_shutdown = 0;
5+
# restart
46
SET @@global.innodb_undo_log_truncate = 1;
57
SET @@global.innodb_purge_rseg_truncate_frequency = 1;
68
SET @@global.innodb_rollback_segments = 3;
79
SET @@global.innodb_max_undo_log_size = 11534336;
810
SET @@global.log_error_verbosity = 3;
11+
SET @@global.innodb_fast_shutdown = 0;
912
#
1013
# Create procedure to populate the test-bed for Undo Truncate Recover tests
1114
#
@@ -30,7 +33,6 @@ update t1 set c1 = 'mysql' where keyc > 20000;
3033
update t1 set c2 = 'oracle' where keyc > 20000;
3134
set global debug = "+d,ib_undo_trunc_before_ddl_log_start";
3235
commit;
33-
set global innodb_fast_shutdown=0;
3436
Pattern "ib_undo_trunc_before_ddl_log_start" found
3537
# restart
3638
drop table t1;

mysql-test/suite/innodb_undo/r/truncate_recover_03.result

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
#
22
# WL#6965: Truncate UNDO logs during recovery.
33
#
4+
SET @@global.innodb_fast_shutdown = 0;
5+
# restart
46
SET @@global.innodb_undo_log_truncate = 1;
57
SET @@global.innodb_purge_rseg_truncate_frequency = 1;
68
SET @@global.innodb_rollback_segments = 3;
79
SET @@global.innodb_max_undo_log_size = 11534336;
810
SET @@global.log_error_verbosity = 3;
11+
SET @@global.innodb_fast_shutdown = 0;
912
#
1013
# Create procedure to populate the test-bed for Undo Truncate Recover tests
1114
#
@@ -30,7 +33,6 @@ update t1 set c1 = 'mysql' where keyc > 20000;
3033
update t1 set c2 = 'oracle' where keyc > 20000;
3134
set global debug = "+d,ib_undo_trunc_before_truncate";
3235
commit;
33-
set global innodb_fast_shutdown=0;
3436
Pattern "ib_undo_trunc_before_truncate" found
3537
# restart
3638
drop table t1;

mysql-test/suite/innodb_undo/r/truncate_recover_04.result

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
#
22
# WL#6965: Truncate UNDO logs during recovery.
33
#
4+
SET @@global.innodb_fast_shutdown = 0;
5+
# restart
46
SET @@global.innodb_undo_log_truncate = 1;
57
SET @@global.innodb_purge_rseg_truncate_frequency = 1;
68
SET @@global.innodb_rollback_segments = 3;
79
SET @@global.innodb_max_undo_log_size = 11534336;
810
SET @@global.log_error_verbosity = 3;
11+
SET @@global.innodb_fast_shutdown = 0;
912
#
1013
# Create procedure to populate the test-bed for Undo Truncate Recover tests
1114
#
@@ -30,7 +33,6 @@ update t1 set c1 = 'mysql' where keyc > 20000;
3033
update t1 set c2 = 'oracle' where keyc > 20000;
3134
set global debug = "+d,ib_undo_trunc_empty_file";
3235
commit;
33-
set global innodb_fast_shutdown=0;
3436
Pattern "ib_undo_trunc_empty_file" found
3537
# restart
3638
drop table t1;

mysql-test/suite/innodb_undo/r/truncate_recover_05.result

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
#
22
# WL#6965: Truncate UNDO logs during recovery.
33
#
4+
SET @@global.innodb_fast_shutdown = 0;
5+
# restart
46
SET @@global.innodb_undo_log_truncate = 1;
57
SET @@global.innodb_purge_rseg_truncate_frequency = 1;
68
SET @@global.innodb_rollback_segments = 3;
79
SET @@global.innodb_max_undo_log_size = 11534336;
810
SET @@global.log_error_verbosity = 3;
11+
SET @@global.innodb_fast_shutdown = 0;
912
#
1013
# Create procedure to populate the test-bed for Undo Truncate Recover tests
1114
#
@@ -30,7 +33,6 @@ update t1 set c1 = 'mysql' where keyc > 20000;
3033
update t1 set c2 = 'oracle' where keyc > 20000;
3134
set global debug = "+d,ib_undo_trunc_before_rsegs";
3235
commit;
33-
set global innodb_fast_shutdown=0;
3436
Pattern "ib_undo_trunc_before_rsegs" found
3537
# restart
3638
drop table t1;

mysql-test/suite/innodb_undo/r/truncate_recover_06.result

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
#
22
# WL#6965: Truncate UNDO logs during recovery.
33
#
4+
SET @@global.innodb_fast_shutdown = 0;
5+
# restart
46
SET @@global.innodb_undo_log_truncate = 1;
57
SET @@global.innodb_purge_rseg_truncate_frequency = 1;
68
SET @@global.innodb_rollback_segments = 3;
79
SET @@global.innodb_max_undo_log_size = 11534336;
810
SET @@global.log_error_verbosity = 3;
11+
SET @@global.innodb_fast_shutdown = 0;
912
#
1013
# Create procedure to populate the test-bed for Undo Truncate Recover tests
1114
#
@@ -31,7 +34,6 @@ update t1 set c1 = 'mysql' where keyc > 20000;
3134
update t1 set c2 = 'oracle' where keyc > 20000;
3235
set global debug = "+d,ib_undo_trunc_before_buf_flush";
3336
commit;
34-
set global innodb_fast_shutdown=0;
3537
Pattern "ib_undo_trunc_before_buf_flush" found
3638
# restart
3739
drop table t1;

mysql-test/suite/innodb_undo/r/truncate_recover_07.result

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
#
22
# WL#6965: Truncate UNDO logs during recovery.
33
#
4+
SET @@global.innodb_fast_shutdown = 0;
5+
# restart
46
SET @@global.innodb_undo_log_truncate = 1;
57
SET @@global.innodb_purge_rseg_truncate_frequency = 1;
68
SET @@global.innodb_rollback_segments = 3;
79
SET @@global.innodb_max_undo_log_size = 11534336;
810
SET @@global.log_error_verbosity = 3;
11+
SET @@global.innodb_fast_shutdown = 0;
912
#
1013
# Create procedure to populate the test-bed for Undo Truncate Recover tests
1114
#
@@ -30,7 +33,6 @@ update t1 set c1 = 'mysql' where keyc > 20000;
3033
update t1 set c2 = 'oracle' where keyc > 20000;
3134
set global debug = "+d,ib_undo_trunc_before_dd_update";
3235
commit;
33-
set global innodb_fast_shutdown=0;
3436
Pattern "ib_undo_trunc_before_dd_update" found
3537
# restart
3638
drop table t1;

mysql-test/suite/innodb_undo/r/truncate_recover_08.result

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
#
22
# WL#6965: Truncate UNDO logs during recovery.
33
#
4+
SET @@global.innodb_fast_shutdown = 0;
5+
# restart
46
SET @@global.innodb_undo_log_truncate = 1;
57
SET @@global.innodb_purge_rseg_truncate_frequency = 1;
68
SET @@global.innodb_rollback_segments = 3;
79
SET @@global.innodb_max_undo_log_size = 11534336;
810
SET @@global.log_error_verbosity = 3;
11+
SET @@global.innodb_fast_shutdown = 0;
912
#
1013
# Create procedure to populate the test-bed for Undo Truncate Recover tests
1114
#
@@ -30,7 +33,6 @@ update t1 set c1 = 'mysql' where keyc > 20000;
3033
update t1 set c2 = 'oracle' where keyc > 20000;
3134
set global debug = "+d,ib_undo_trunc_before_done_logging";
3235
commit;
33-
set global innodb_fast_shutdown=0;
3436
Pattern "ib_undo_trunc_before_done_logging" found
3537
# restart
3638
drop table t1;

mysql-test/suite/innodb_undo/r/truncate_recover_09.result

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
#
22
# WL#6965: Truncate UNDO logs during recovery.
33
#
4+
SET @@global.innodb_fast_shutdown = 0;
5+
# restart
46
SET @@global.innodb_undo_log_truncate = 1;
57
SET @@global.innodb_purge_rseg_truncate_frequency = 1;
68
SET @@global.innodb_rollback_segments = 3;
79
SET @@global.innodb_max_undo_log_size = 11534336;
810
SET @@global.log_error_verbosity = 3;
11+
SET @@global.innodb_fast_shutdown = 0;
912
#
1013
# Create procedure to populate the test-bed for Undo Truncate Recover tests
1114
#
@@ -30,7 +33,6 @@ update t1 set c1 = 'mysql' where keyc > 20000;
3033
update t1 set c2 = 'oracle' where keyc > 20000;
3134
set global debug = "+d,ib_undo_trunc_trunc_done";
3235
commit;
33-
set global innodb_fast_shutdown=0;
3436
Pattern "ib_undo_trunc_trunc_done" found
3537
# restart
3638
drop table t1;

storage/innobase/handler/ha_innodb.cc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14154,7 +14154,8 @@ static int innodb_alter_undo_tablespace_inactive(handlerton *hton, THD *thd,
1415414154
dd::String_type dd_state,
1415514155
dd::Tablespace *dd_space) {
1415614156
/* If it is already empty, just return. */
14157-
if (undo_space->is_empty()) {
14157+
if (undo_space->is_empty() &&
14158+
dd_state == dd_space_state_values[DD_SPACE_STATE_EMPTY]) {
1415814159
return (0);
1415914160
}
1416014161

@@ -14183,9 +14184,7 @@ static int innodb_alter_undo_tablespace_inactive(handlerton *hton, THD *thd,
1418314184
}
1418414185

1418514186
/* Make sure the DD shows inactive if it is active. */
14186-
if (dd_state == dd_space_state_values[DD_SPACE_STATE_ACTIVE]) {
14187-
dd_tablespace_set_state(dd_space, DD_SPACE_STATE_INACTIVE);
14188-
}
14187+
dd_tablespace_set_state(dd_space, DD_SPACE_STATE_INACTIVE);
1418914188

1419014189
/* Apply this to new transactions. */
1419114190
undo_space->set_inactive_explicit();

0 commit comments

Comments
 (0)