| 1 |
# |
| 2 |
# DELETE LOW_PRIORITY |
| 3 |
# |
| 4 |
--source have_engine.inc |
| 5 |
|
| 6 |
--source include/count_sessions.inc |
| 7 |
|
| 8 |
--disable_warnings |
| 9 |
DROP TABLE IF EXISTS t1; |
| 10 |
--enable_warnings |
| 11 |
|
| 12 |
--let $create_definiiton = a $int_col, b $char_col |
| 13 |
--source create_table.inc |
| 14 |
INSERT INTO t1 (a,b) VALUES (1,'f'),(2,'b'); |
| 15 |
|
| 16 |
# We will have 3 connections: |
| 17 |
# con1 will start SELECT which should give us enough time; |
| 18 |
# default will run DELETE |
| 19 |
# con2 will then start another SELECT. |
| 20 |
# With LOW_PRIORITY_UPDATES = 0, |
| 21 |
# with standard DELETE we should see all rows in con1 resultset, |
| 22 |
# but no rows in con2 resultset. |
| 23 |
# With DELETE LOW_PRIORITY we should see all rows in both resultsets. |
| 24 |
# Then we will set LOW_PRIORITY_UPDATES to 1. |
| 25 |
# Then with standard DELETE we should see all rows in both resultsets. |
| 26 |
|
| 27 |
SET LOW_PRIORITY_UPDATES = 0; |
| 28 |
SET lock_wait_timeout = 4; |
| 29 |
|
| 30 |
# Normal DELETE with low_priority_updates=0 |
| 31 |
|
| 32 |
--connect (con1,localhost,root,,) |
| 33 |
SET lock_wait_timeout = 2; |
| 34 |
--send |
| 35 |
SELECT SLEEP(1) FROM t1; |
| 36 |
|
| 37 |
--connection default |
| 38 |
let $show_statement = SHOW PROCESSLIST; |
| 39 |
let $field = State; |
| 40 |
let $condition = = 'User sleep'; |
| 41 |
# We don't need to wait long, |
| 42 |
# if the feature works, threads |
| 43 |
# should show up in the processlist right away |
| 44 |
let $wait_timeout = 2; |
| 45 |
--source include/wait_show_condition.inc |
| 46 |
|
| 47 |
--send |
| 48 |
DELETE FROM t1; |
| 49 |
|
| 50 |
--connect (con2,localhost,root,,) |
| 51 |
SET lock_wait_timeout = 3; |
| 52 |
|
| 53 |
let $field = Info; |
| 54 |
let $condition = = 'DELETE FROM t1'; |
| 55 |
let $wait_timeout = 2; |
| 56 |
--source include/wait_show_condition.inc |
| 57 |
if (!$found) |
| 58 |
{ |
| 59 |
--let $mysql_errname = timeout in wait_show_condition.inc |
| 60 |
--let $functionality = DELETE or table locking |
| 61 |
--source unexpected_result.inc |
| 62 |
} |
| 63 |
if ($found) |
| 64 |
{ |
| 65 |
SELECT SLEEP(1) FROM t1; |
| 66 |
} |
| 67 |
|
| 68 |
--connection con1 |
| 69 |
--reap |
| 70 |
|
| 71 |
--connection default |
| 72 |
--reap |
| 73 |
--sorted_result |
| 74 |
SELECT a,b FROM t1; |
| 75 |
INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'); |
| 76 |
|
| 77 |
|
| 78 |
# DELETE LOW_PRIORITY |
| 79 |
|
| 80 |
--connection con1 |
| 81 |
--send |
| 82 |
SELECT SLEEP(1) FROM t1; |
| 83 |
|
| 84 |
--connection default |
| 85 |
let $field = State; |
| 86 |
let $condition = = 'User sleep'; |
| 87 |
let $wait_timeout = 2; |
| 88 |
--source include/wait_show_condition.inc |
| 89 |
--send |
| 90 |
DELETE LOW_PRIORITY FROM t1; |
| 91 |
|
| 92 |
--connection con2 |
| 93 |
let $field = Info; |
| 94 |
let $condition = = 'DELETE LOW_PRIORITY FROM t1'; |
| 95 |
let $wait_timeout = 2; |
| 96 |
--source include/wait_show_condition.inc |
| 97 |
if (!$found) |
| 98 |
{ |
| 99 |
--let $mysql_errname = timeout in wait_show_condition.inc |
| 100 |
--let $functionality = DELETE LOW_PRIORITY or table locking |
| 101 |
--source unexpected_result.inc |
| 102 |
} |
| 103 |
if ($found) |
| 104 |
{ |
| 105 |
SELECT SLEEP(1) FROM t1; |
| 106 |
} |
| 107 |
|
| 108 |
--connection con1 |
| 109 |
--reap |
| 110 |
|
| 111 |
--connection default |
| 112 |
--reap |
| 113 |
--sorted_result |
| 114 |
SELECT a,b FROM t1; |
| 115 |
INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'); |
| 116 |
|
| 117 |
SET LOW_PRIORITY_UPDATES = 1; |
| 118 |
|
| 119 |
# Normal DELETE with low_priority_updates=1 |
| 120 |
|
| 121 |
--connection con1 |
| 122 |
--send |
| 123 |
SELECT SLEEP(1) FROM t1; |
| 124 |
|
| 125 |
--connection default |
| 126 |
let $field = State; |
| 127 |
let $condition = = 'User sleep'; |
| 128 |
let $wait_timeout = 2; |
| 129 |
--source include/wait_show_condition.inc |
| 130 |
--send |
| 131 |
DELETE FROM t1; |
| 132 |
|
| 133 |
--connection con2 |
| 134 |
let $field = Info; |
| 135 |
let $condition = = 'DELETE FROM t1'; |
| 136 |
let $wait_timeout = 2; |
| 137 |
--source include/wait_show_condition.inc |
| 138 |
if ($found) |
| 139 |
{ |
| 140 |
SELECT SLEEP(1) FROM t1; |
| 141 |
} |
| 142 |
|
| 143 |
--connection con1 |
| 144 |
--reap |
| 145 |
|
| 146 |
--connection default |
| 147 |
--reap |
| 148 |
--sorted_result |
| 149 |
SELECT a,b FROM t1; |
| 150 |
|
| 151 |
--disconnect con1 |
| 152 |
--disconnect con2 |
| 153 |
|
| 154 |
# Cleanup |
| 155 |
DROP TABLE t1; |
| 156 |
|
| 157 |
--source include/wait_until_count_sessions.inc |
| 158 |
|
| 159 |
--source cleanup_engine.inc |
| 160 |
|