@@ -100,12 +100,10 @@ t1 CREATE TABLE `t1` (
100
100
) ENGINE=ENGINE DEFAULT CHARSET=utf8mb4
101
101
drop table t1;
102
102
#------------------------------------------------------------------------
103
- # Tests for Bug#6760 and Bug#12689
103
+ # Test for Bug#6760
104
104
SET @row_count = 4;
105
105
SET @sleep_time_per_result_row = 1;
106
106
SET @max_acceptable_delay = 2;
107
- SET @save_query_cache_size=@@query_cache_size;
108
- SET @@global.query_cache_size = 1024 * 64;
109
107
DROP TEMPORARY TABLE IF EXISTS t_history;
110
108
DROP TABLE IF EXISTS t1;
111
109
CREATE TEMPORARY TABLE t_history (attempt SMALLINT,
@@ -116,83 +114,15 @@ INSERT INTO t1 VALUES (1);
116
114
INSERT INTO t1 VALUES (1);
117
115
INSERT INTO t1 VALUES (1);
118
116
INSERT INTO t1 VALUES (1);
119
- INSERT INTO t_history
120
- SET attempt = 4 - 4 + 1, start_ts = NOW(),
121
- start_cached = 0;
122
- SELECT *, SLEEP(@sleep_time_per_result_row) FROM t1;
123
- f1 SLEEP(@sleep_time_per_result_row)
124
- 1 0
125
- 1 0
126
- 1 0
127
- 1 0
128
- UPDATE t_history SET end_ts = NOW()
129
- WHERE attempt = 4 - 4 + 1;
130
- UPDATE t_history SET end_cached = 0
131
- WHERE attempt = 4 - 4 + 1;
132
- INSERT INTO t_history
133
- SET attempt = 4 - 3 + 1, start_ts = NOW(),
134
- start_cached = 0;
135
- SELECT *, SLEEP(@sleep_time_per_result_row) FROM t1;
136
- f1 SLEEP(@sleep_time_per_result_row)
137
- 1 0
138
- 1 0
139
- 1 0
140
- 1 0
141
- UPDATE t_history SET end_ts = NOW()
142
- WHERE attempt = 4 - 3 + 1;
143
- UPDATE t_history SET end_cached = 0
144
- WHERE attempt = 4 - 3 + 1;
145
- INSERT INTO t_history
146
- SET attempt = 4 - 2 + 1, start_ts = NOW(),
147
- start_cached = 0;
148
- SELECT *, SLEEP(@sleep_time_per_result_row) FROM t1;
149
- f1 SLEEP(@sleep_time_per_result_row)
150
- 1 0
151
- 1 0
152
- 1 0
153
- 1 0
154
- UPDATE t_history SET end_ts = NOW()
155
- WHERE attempt = 4 - 2 + 1;
156
- UPDATE t_history SET end_cached = 0
157
- WHERE attempt = 4 - 2 + 1;
158
- INSERT INTO t_history
159
- SET attempt = 4 - 1 + 1, start_ts = NOW(),
160
- start_cached = 0;
161
- SELECT *, SLEEP(@sleep_time_per_result_row) FROM t1;
162
- f1 SLEEP(@sleep_time_per_result_row)
163
- 1 0
164
- 1 0
165
- 1 0
166
- 1 0
167
- UPDATE t_history SET end_ts = NOW()
168
- WHERE attempt = 4 - 1 + 1;
169
- UPDATE t_history SET end_cached = 0
170
- WHERE attempt = 4 - 1 + 1;
171
117
# Test 1: Does the query with SLEEP need a reasonable time?
172
- SELECT COUNT(*) >= 4 - 1 INTO @aux1 FROM t_history
118
+ SELECT COUNT(*) >= - 1 INTO @aux1 FROM t_history
173
119
WHERE TIMEDIFF(end_ts,start_ts) - @sleep_time_per_result_row * @row_count
174
120
BETWEEN 0 AND @max_acceptable_delay;
175
121
SELECT @aux1 AS "Expect 1";
176
122
Expect 1
177
123
1
178
- # Test 2: Does the query with SLEEP need a reasonable time even in case
179
- # of the non first execution?
180
- SELECT COUNT(*) >= 4 - 1 - 1 INTO @aux2 FROM t_history
181
- WHERE TIMEDIFF(end_ts,start_ts) - @sleep_time_per_result_row * @row_count
182
- BETWEEN 0 AND @max_acceptable_delay
183
- AND attempt > 1;
184
- SELECT @aux2 AS "Expect 1";
185
- Expect 1
186
- 1
187
- # Test 3: The query with SLEEP must be not cached.
188
- SELECT COUNT(*) = 4 INTO @aux3 FROM t_history
189
- WHERE end_cached = start_cached;
190
- SELECT @aux3 AS "Expect 1";
191
- Expect 1
192
- 1
193
124
DROP TABLE t1;
194
125
DROP TEMPORARY TABLE t_history;
195
- SET @@global.query_cache_size = @save_query_cache_size;
196
126
create table t1 select INET_ATON('255.255.0.1') as `a`;
197
127
show create table t1;
198
128
Table Create Table
0 commit comments