| 1 |
# |
| 2 |
# Bug#38231 Innodb crash in lock_reset_all_on_table() on TRUNCATE + LOCK / UNLOCK |
| 3 |
# http://bugs.mysql.com/38231 |
| 4 |
# |
| 5 |
|
| 6 |
SET default_storage_engine=InnoDB; |
| 7 |
|
| 8 |
# we care only that the following SQL commands do not crash the server |
| 9 |
-- disable_query_log |
| 10 |
-- disable_result_log |
| 11 |
|
| 12 |
DROP TABLE IF EXISTS bug38231_1; |
| 13 |
CREATE TABLE bug38231_1 (a INT); |
| 14 |
|
| 15 |
-- connect (lock_gain,localhost,root,,) |
| 16 |
-- connect (lock_wait1,localhost,root,,) |
| 17 |
-- connect (lock_wait2,localhost,root,,) |
| 18 |
-- connect (truncate_wait,localhost,root,,) |
| 19 |
|
| 20 |
-- connection lock_gain |
| 21 |
SET autocommit=0; |
| 22 |
LOCK TABLE bug38231_1 WRITE; |
| 23 |
|
| 24 |
-- connection lock_wait1 |
| 25 |
SET autocommit=0; |
| 26 |
-- send |
| 27 |
LOCK TABLE bug38231_1 WRITE; |
| 28 |
|
| 29 |
-- connection lock_wait2 |
| 30 |
SET autocommit=0; |
| 31 |
-- send |
| 32 |
LOCK TABLE bug38231_1 WRITE; |
| 33 |
|
| 34 |
-- connection truncate_wait |
| 35 |
-- send |
| 36 |
TRUNCATE TABLE bug38231_1; |
| 37 |
|
| 38 |
-- connection lock_gain |
| 39 |
# this crashes the server if the bug is present |
| 40 |
UNLOCK TABLES; |
| 41 |
|
| 42 |
# clean up |
| 43 |
|
| 44 |
# do not clean up - we do not know which of the three has been released |
| 45 |
# so the --reap command may hang because the command that is being executed |
| 46 |
# in that connection is still running/waiting |
| 47 |
#-- connection lock_wait1 |
| 48 |
#-- reap |
| 49 |
#UNLOCK TABLES; |
| 50 |
# |
| 51 |
#-- connection lock_wait2 |
| 52 |
#-- reap |
| 53 |
#UNLOCK TABLES; |
| 54 |
# |
| 55 |
#-- connection truncate_wait |
| 56 |
#-- reap |
| 57 |
|
| 58 |
-- connection default |
| 59 |
|
| 60 |
-- disconnect lock_gain |
| 61 |
-- disconnect lock_wait1 |
| 62 |
-- disconnect lock_wait2 |
| 63 |
-- disconnect truncate_wait |
| 64 |
|
| 65 |
DROP TABLE bug38231_1; |
| 66 |
|
| 67 |
-- enable_query_log |
| 68 |
-- enable_result_log |
| 69 |
|
| 70 |
-- connection default |