| 1 |
# Setup connections |
| 2 |
SET @old_innodb_thread_concurrency := @@innodb_thread_concurrency; |
| 3 |
SET @old_innodb_concurrency_tickets := @@innodb_concurrency_tickets; |
| 4 |
SET @old_innodb_thread_sleep_delay := @@innodb_thread_sleep_delay; |
| 5 |
# |
| 6 |
# Bug #19386426 SHUTDOWN HANGS: CLIENT THREAD IN A LOOP |
| 7 |
# AROUND SRV_CONC_ENTER_INNODB() |
| 8 |
# |
| 9 |
SET GLOBAL innodb_thread_concurrency = 1; |
| 10 |
create table t1(f1 int) engine=innodb; |
| 11 |
SET DEBUG_SYNC= 'ib_after_row_insert |
| 12 |
SIGNAL opened WAIT_FOR flushed'; |
| 13 |
insert into t1 values(12); |
| 14 |
connection default; |
| 15 |
SET DEBUG_SYNC= 'now WAIT_FOR opened'; |
| 16 |
SET DEBUG_SYNC= 'user_thread_waiting |
| 17 |
SIGNAL flushed WAIT_FOR opened1'; |
| 18 |
insert into t1 values(13); |
| 19 |
set global innodb_thread_concurrency=0; |
| 20 |
SET DEBUG_SYNC= 'now SIGNAL opened1'; |
| 21 |
select * from t1; |
| 22 |
f1 |
| 23 |
12 |
| 24 |
13 |
| 25 |
drop table t1; |
| 26 |
# |
| 27 |
# bug#23476050 THREADS STUCK WAITING TO ENTER INNODB |
| 28 |
# |
| 29 |
# Scenario-1: High Priority Transaction |
| 30 |
In connection DEFAULT |
| 31 |
SET GLOBAL innodb_thread_concurrency = 1; |
| 32 |
CREATE TABLE t1(col1 INT PRIMARY KEY); |
| 33 |
INSERT INTO t1 VALUES(10); |
| 34 |
START TRANSACTION; |
| 35 |
# Lock Row |
| 36 |
UPDATE t1 SET col1 = 20 where col1 = 10; |
| 37 |
# stop after TrxInInnoDB and before innodb thread concurrency |
| 38 |
SET DEBUG_SYNC= 'ha_innobase_index_read_begin SIGNAL kill_me WAIT_FOR proceed'; |
| 39 |
UPDATE t1 SET col1 = 30 where col1 = 20; |
| 40 |
In connection CON-1 |
| 41 |
SET DEBUG_SYNC='now WAIT_FOR kill_me'; |
| 42 |
include/start_transaction_high_prio.inc |
| 43 |
START TRANSACTION /* HIGH PRIORITY */; |
| 44 |
SET DEBUG_SYNC= 'trx_kill_blocking_enter SIGNAL proceed'; |
| 45 |
UPDATE t1 SET col1 = 100; |
| 46 |
COMMIT; |
| 47 |
In connection DEFAULT |
| 48 |
# Rolled back by high priority transaction |
| 49 |
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction |
| 50 |
SELECT * FROM t1; |
| 51 |
col1 |
| 52 |
100 |
| 53 |
DROP TABLE t1; |
| 54 |
# Scenario-2: Auto Increment in partitioned table |
| 55 |
SET GLOBAL innodb_thread_concurrency = 1; |
| 56 |
CREATE TABLE t1 (col1 INT AUTO_INCREMENT PRIMARY KEY, col2 int) |
| 57 |
PARTITION BY KEY(col1) PARTITIONS 2; |
| 58 |
INSERT INTO t1(col2) VALUES(10); |
| 59 |
SELECT * FROM t1; |
| 60 |
col1 col2 |
| 61 |
1 10 |
| 62 |
# stop after innodb thread concurrency before auto increment lock |
| 63 |
SET DEBUG_SYNC='ib_after_row_insert SIGNAL got_innodb_ticket WAIT_FOR proceed'; |
| 64 |
INSERT INTO t1(col2) VALUES (20); |
| 65 |
In connection CON-1 |
| 66 |
SET LOCAL binlog_format = 'STATEMENT'; |
| 67 |
Warnings: |
| 68 |
Warning 1287 '@@binlog_format' is deprecated and will be removed in a future release. |
| 69 |
SET DEBUG_SYNC='now WAIT_FOR got_innodb_ticket'; |
| 70 |
INSERT INTO t1(col2) SELECT 30; |
| 71 |
In connection CON-2 |
| 72 |
SET DEBUG_SYNC='now SIGNAL proceed'; |
| 73 |
In connection CON-1 |
| 74 |
In connection DEFAULT |
| 75 |
SELECT * FROM t1 ORDER BY col1; |
| 76 |
col1 col2 |
| 77 |
1 10 |
| 78 |
2 20 |
| 79 |
3 30 |
| 80 |
DROP TABLE t1; |
| 81 |
# |
| 82 |
# bug#27661171 INNODB: TRX->DECLARED_TO_BE_INSIDE_INNODB |
| 83 |
# |
| 84 |
CREATE TABLE t1 (col1 INT AUTO_INCREMENT PRIMARY KEY, col2 int) |
| 85 |
PARTITION BY KEY(col1) PARTITIONS 2; |
| 86 |
# Insert 2 rows in same statement consuming the tickets |
| 87 |
SET GLOBAL innodb_concurrency_tickets = 2; |
| 88 |
SHOW VARIABLES LIKE 'innodb_concurrency_tickets'; |
| 89 |
Variable_name Value |
| 90 |
innodb_concurrency_tickets 2 |
| 91 |
INSERT INTO t1(col2) VALUES (10), (20); |
| 92 |
SELECT * FROM t1 ORDER BY col1; |
| 93 |
col1 col2 |
| 94 |
1 10 |
| 95 |
2 20 |
| 96 |
DROP TABLE t1; |
| 97 |
# Cleanup |
| 98 |
SET DEBUG_SYNC='reset'; |
| 99 |
SET GLOBAL innodb_thread_concurrency = @old_innodb_thread_concurrency; |
| 100 |
SET GLOBAL innodb_concurrency_tickets = @old_innodb_concurrency_tickets; |
| 101 |
SET GLOBAL innodb_thread_sleep_delay = @old_innodb_thread_sleep_delay; |