Skip to content

Commit 1844fbd

Browse files
committed
optimize undo_spaces_lock
1 parent 999d171 commit 1844fbd

24 files changed

+574
-26
lines changed

mysql-test/r/all_persisted_variables.result

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,17 @@ include/assert.inc [Expect 500+ variables in the table. Due to open Bugs, we are
4646

4747
# Test SET PERSIST
4848

49-
include/assert.inc [Expect 445 persisted variables in the table.]
49+
include/assert.inc [Expect 446 persisted variables in the table.]
5050

5151
************************************************************
5252
* 3. Restart server, it must preserve the persisted variable
5353
* settings. Verify persisted configuration.
5454
************************************************************
5555
# restart
5656

57-
include/assert.inc [Expect 445 persisted variables in persisted_variables table.]
58-
include/assert.inc [Expect 445 persisted variables shown as PERSISTED in variables_info table.]
59-
include/assert.inc [Expect 445 persisted variables with matching peristed and global values.]
57+
include/assert.inc [Expect 446 persisted variables in persisted_variables table.]
58+
include/assert.inc [Expect 446 persisted variables shown as PERSISTED in variables_info table.]
59+
include/assert.inc [Expect 446 persisted variables with matching peristed and global values.]
6060

6161
************************************************************
6262
* 4. Test RESET PERSIST IF EXISTS. Verify persisted variable

mysql-test/suite/innodb/r/monitor.result

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,9 @@ undo_truncate_count disabled
178178
undo_truncate_start_logging_count disabled
179179
undo_truncate_done_logging_count disabled
180180
undo_truncate_usec disabled
181+
undo_truncate_snapshot_ticket_grant_count disabled
182+
undo_truncate_snapshot_ticket_try_count disabled
183+
undo_truncate_snapshot_ticket_wait_count disabled
181184
log_lsn_last_flush disabled
182185
log_lsn_last_checkpoint disabled
183186
log_lsn_current disabled
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#
2+
# undo tablespace counter
3+
#
4+
SHOW VARIABLES LIKE 'innodb_rollback_segments';
5+
Variable_name Value
6+
innodb_rollback_segments 1
7+
SELECT NAME, SPACE_TYPE, STATE FROM INFORMATION_SCHEMA.INNODB_TABLESPACES
8+
WHERE SPACE_TYPE = 'Undo' ORDER BY NAME;
9+
NAME SPACE_TYPE STATE
10+
innodb_undo_001 Undo active
11+
innodb_undo_002 Undo active
12+
SET GLOBAL innodb_purge_stop_now=ON;
13+
create table t1(
14+
keyc int,
15+
c1 char(255),
16+
c2 char(255),
17+
c3 char(255),
18+
c4 char(255),
19+
c5 char(255),
20+
c6 char(255),
21+
primary key(keyc)) engine = innodb;
22+
CREATE PROCEDURE populate_t1()
23+
BEGIN
24+
DECLARE i INT DEFAULT 1;
25+
while (i <= 20000) DO
26+
insert into t1 values (i, 'a', 'b', 'c', 'd', 'e', 'f' );
27+
SET i = i + 1;
28+
END WHILE;
29+
END |
30+
call populate_t1();
31+
delete from t1 where keyc < 10000;
32+
update t1 set c1 = 'mysql' where keyc > 10000;
33+
update t1 set c2 = 'mysql' where keyc > 10000;
34+
update t1 set c3= 'mysql' where keyc > 10000;
35+
update t1 set c4= 'mysql' where keyc > 10000;
36+
update t1 set c5= 'mysql' where keyc > 10000;
37+
update t1 set c6= 'mysql' where keyc > 10000;
38+
SELECT @@innodb_undo_spaces_snapshot_tickets;
39+
@@innodb_undo_spaces_snapshot_tickets
40+
100
41+
SET GLOBAL debug="+d,until_undo_spaces_snapshot_change,abort_if_use_undospace_latch";
42+
SET GLOBAL innodb_purge_run_now=ON;
43+
SET GLOBAL debug="-d,until_undo_spaces_snapshot_change";
44+
update t1 set c6= 'modified' where keyc = 10000;
45+
SET GLOBAL debug="-d,abort_if_use_undospace_latch";
46+
drop PROCEDURE populate_t1;
47+
drop table t1;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
--innodb_rollback_segments=1
2+
--innodb_undo_log_truncate=1
3+
--innodb_max_undo_log_size=11M
4+
--innodb_purge_rseg_truncate_frequency=1
5+
--log-error-verbosity=3
6+
--innodb_undo_spaces_snapshot_tickets=100
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
--echo #
2+
--echo # undo tablespace counter
3+
--echo #
4+
5+
# This test uses debug settings like innodb_purge_stop_now.
6+
--source include/have_debug.inc
7+
8+
# Valgrind would complain about memory leaks when we crash on purpose.
9+
--source include/not_valgrind.inc
10+
11+
--source include/big_test.inc
12+
--source include/have_innodb_default_undo_tablespaces.inc
13+
14+
SHOW VARIABLES LIKE 'innodb_rollback_segments';
15+
SELECT NAME, SPACE_TYPE, STATE FROM INFORMATION_SCHEMA.INNODB_TABLESPACES
16+
WHERE SPACE_TYPE = 'Undo' ORDER BY NAME;
17+
18+
SET GLOBAL innodb_purge_stop_now=ON;
19+
20+
--connect(conn1,localhost,root,,test)
21+
--connection conn1
22+
23+
create table t1(
24+
keyc int,
25+
c1 char(255),
26+
c2 char(255),
27+
c3 char(255),
28+
c4 char(255),
29+
c5 char(255),
30+
c6 char(255),
31+
primary key(keyc)) engine = innodb;
32+
33+
delimiter |;
34+
CREATE PROCEDURE populate_t1()
35+
BEGIN
36+
DECLARE i INT DEFAULT 1;
37+
while (i <= 20000) DO
38+
insert into t1 values (i, 'a', 'b', 'c', 'd', 'e', 'f' );
39+
SET i = i + 1;
40+
END WHILE;
41+
END |
42+
delimiter ;|
43+
44+
call populate_t1();
45+
delete from t1 where keyc < 10000;
46+
update t1 set c1 = 'mysql' where keyc > 10000;
47+
update t1 set c2 = 'mysql' where keyc > 10000;
48+
update t1 set c3= 'mysql' where keyc > 10000;
49+
update t1 set c4= 'mysql' where keyc > 10000;
50+
update t1 set c5= 'mysql' where keyc > 10000;
51+
update t1 set c6= 'mysql' where keyc > 10000;
52+
53+
SELECT @@innodb_undo_spaces_snapshot_tickets;
54+
SET GLOBAL debug="+d,until_undo_spaces_snapshot_change,abort_if_use_undospace_latch";
55+
SET GLOBAL innodb_purge_run_now=ON;
56+
57+
# Wait until until_undo_spaces_snapshot_change to be reached.
58+
--sleep 10
59+
60+
connection default;
61+
SET GLOBAL debug="-d,until_undo_spaces_snapshot_change";
62+
# The command can succeed iff until_undo_spaces_snapshot_change loop has ended. Otherwise abort_if_use_undospace_latch will be triggered.
63+
update t1 set c6= 'modified' where keyc = 10000;
64+
65+
# Cleanup
66+
SET GLOBAL debug="-d,abort_if_use_undospace_latch";
67+
drop PROCEDURE populate_t1;
68+
drop table t1;
69+
--disconnect conn1
70+
71+
--sleep 5

mysql-test/suite/sys_vars/r/all_vars.result

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ innodb_log_spin_cpu_pct_hwm
4848
innodb_log_spin_cpu_pct_hwm
4949
innodb_log_wait_for_flush_spin_hwm
5050
innodb_log_wait_for_flush_spin_hwm
51+
innodb_undo_spaces_snapshot_tickets
52+
innodb_undo_spaces_snapshot_tickets
5153
keyring_operations
5254
keyring_operations
5355
log_replica_updates

mysql-test/suite/sys_vars/r/innodb_monitor_disable_basic.result

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,9 @@ undo_truncate_count disabled
178178
undo_truncate_start_logging_count disabled
179179
undo_truncate_done_logging_count disabled
180180
undo_truncate_usec disabled
181+
undo_truncate_snapshot_ticket_grant_count disabled
182+
undo_truncate_snapshot_ticket_try_count disabled
183+
undo_truncate_snapshot_ticket_wait_count disabled
181184
log_lsn_last_flush disabled
182185
log_lsn_last_checkpoint disabled
183186
log_lsn_current disabled

mysql-test/suite/sys_vars/r/innodb_monitor_enable_basic.result

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,9 @@ undo_truncate_count disabled
178178
undo_truncate_start_logging_count disabled
179179
undo_truncate_done_logging_count disabled
180180
undo_truncate_usec disabled
181+
undo_truncate_snapshot_ticket_grant_count disabled
182+
undo_truncate_snapshot_ticket_try_count disabled
183+
undo_truncate_snapshot_ticket_wait_count disabled
181184
log_lsn_last_flush disabled
182185
log_lsn_last_checkpoint disabled
183186
log_lsn_current disabled

mysql-test/suite/sys_vars/r/innodb_monitor_reset_all_basic.result

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,9 @@ undo_truncate_count disabled
178178
undo_truncate_start_logging_count disabled
179179
undo_truncate_done_logging_count disabled
180180
undo_truncate_usec disabled
181+
undo_truncate_snapshot_ticket_grant_count disabled
182+
undo_truncate_snapshot_ticket_try_count disabled
183+
undo_truncate_snapshot_ticket_wait_count disabled
181184
log_lsn_last_flush disabled
182185
log_lsn_last_checkpoint disabled
183186
log_lsn_current disabled

mysql-test/suite/sys_vars/r/innodb_monitor_reset_basic.result

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,9 @@ undo_truncate_count disabled
178178
undo_truncate_start_logging_count disabled
179179
undo_truncate_done_logging_count disabled
180180
undo_truncate_usec disabled
181+
undo_truncate_snapshot_ticket_grant_count disabled
182+
undo_truncate_snapshot_ticket_try_count disabled
183+
undo_truncate_snapshot_ticket_wait_count disabled
181184
log_lsn_last_flush disabled
182185
log_lsn_last_checkpoint disabled
183186
log_lsn_current disabled

0 commit comments

Comments
 (0)