Merge lp:~laurynas-biveinis/percona-server/26611-bug917942-5.5 into lp:percona-server/5.5
- 26611-bug917942-5.5
- Merge into 5.5
Proposed by
Laurynas Biveinis
Status: | Merged |
---|---|
Approved by: | Stewart Smith |
Approved revision: | no longer in the source branch. |
Merged at revision: | 341 |
Proposed branch: | lp:~laurynas-biveinis/percona-server/26611-bug917942-5.5 |
Merge into: | lp:percona-server/5.5 |
Prerequisite: | lp:~laurynas-biveinis/percona-server/bug898306-5.5 |
Diff against target: |
563 lines (+363/-90) 9 files modified
Percona-Server/mysql-test/r/percona_innodb_fake_changes.result (+75/-0) Percona-Server/mysql-test/r/percona_innodb_fake_changes_bug_917942.result (+151/-0) Percona-Server/mysql-test/r/percona_innodb_fake_changes_locks.result (+0/-83) Percona-Server/mysql-test/t/percona_innodb_fake_changes_bug_917942-master.opt (+1/-0) Percona-Server/mysql-test/t/percona_innodb_fake_changes_bug_917942.test (+103/-0) Percona-Server/storage/innobase/btr/btr0cur.c (+28/-4) Percona-Server/storage/innobase/btr/btr0pcur.c (+1/-0) Percona-Server/storage/innobase/ibuf/ibuf0ibuf.c (+1/-1) Percona-Server/storage/innobase/include/btr0cur.h (+3/-2) |
To merge this branch: | bzr merge lp:~laurynas-biveinis/percona-server/26611-bug917942-5.5 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Stewart Smith (community) | Approve | ||
Review via email: mp+130079@code.launchpad.net |
Commit message
Description of the change
Automerge bug 917942 fix from 5.1. Adjust the InnoDB flavor check in
the testcase.`
http://
26611
To post a comment you must log in.
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote : | # |
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote : | # |
I have no idea why the preview diff shows the removal of Percona-
Revision history for this message
Stewart Smith (stewart) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === added file 'Percona-Server/mysql-test/r/percona_innodb_fake_changes.result' |
2 | --- Percona-Server/mysql-test/r/percona_innodb_fake_changes.result 1970-01-01 00:00:00 +0000 |
3 | +++ Percona-Server/mysql-test/r/percona_innodb_fake_changes.result 2012-10-17 11:35:24 +0000 |
4 | @@ -0,0 +1,75 @@ |
5 | +DROP TABLE IF EXISTS t1, t2, t3; |
6 | +# Checking variables |
7 | +SHOW VARIABLES LIKE 'innodb_fake_changes'; |
8 | +Variable_name Value |
9 | +innodb_fake_changes OFF |
10 | +SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='innodb_fake_changes'; |
11 | +VARIABLE_VALUE |
12 | +OFF |
13 | +SET innodb_fake_changes=1; |
14 | +SHOW VARIABLES LIKE 'innodb_fake_changes'; |
15 | +Variable_name Value |
16 | +innodb_fake_changes ON |
17 | +SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='innodb_fake_changes'; |
18 | +VARIABLE_VALUE |
19 | +ON |
20 | +SET innodb_fake_changes=default; |
21 | +SHOW VARIABLES LIKE 'innodb_fake_changes'; |
22 | +Variable_name Value |
23 | +innodb_fake_changes OFF |
24 | +SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='innodb_fake_changes'; |
25 | +VARIABLE_VALUE |
26 | +OFF |
27 | +# Explicit COMMIT should fail when innodb_fake_changes is enabled |
28 | +# DML should be fine |
29 | +CREATE TABLE t1 (a INT) ENGINE=InnoDB; |
30 | +INSERT INTO t1 VALUES (1); |
31 | +SET autocommit=0; |
32 | +SET innodb_fake_changes=1; |
33 | +BEGIN; |
34 | +INSERT INTO t1 VALUES (2); |
35 | +UPDATE t1 SET a=0; |
36 | +DELETE FROM t1 LIMIT 1; |
37 | +SELECT * FROM t1; |
38 | +a |
39 | +1 |
40 | +COMMIT; |
41 | +ERROR HY000: Got error 131 during COMMIT |
42 | +SET innodb_fake_changes=default; |
43 | +# Verify that the fake changes to t1 did not leak through |
44 | +CHECK TABLE t1; |
45 | +Table Op Msg_type Msg_text |
46 | +test.t1 check status OK |
47 | +should_be_1 |
48 | +1 |
49 | +DROP TABLE t1; |
50 | +# DDL must result in error |
51 | +CREATE TABLE t1 (a INT) ENGINE=InnoDB; |
52 | +SET autocommit=0; |
53 | +SET innodb_fake_changes=1; |
54 | +BEGIN; |
55 | +CREATE TABLE t2 (a INT) ENGINE=InnoDB; |
56 | +ERROR HY000: Can't create table 'test.t2' (errno: 131) |
57 | +DROP TABLE t1; |
58 | +ERROR 42S02: Unknown table 't1' |
59 | +TRUNCATE TABLE t1; |
60 | +ERROR HY000: Got error 131 during COMMIT |
61 | +ALTER TABLE t1 ENGINE=MyISAM; |
62 | +ERROR HY000: Got error 131 during COMMIT |
63 | +ROLLBACK; |
64 | +SET innodb_fake_changes=0; |
65 | +CREATE TABLE t3 (a INT primary key, b text) ENGINE=InnoDB; |
66 | +INSERT INTO t3 VALUES (1,''); |
67 | +COMMIT; |
68 | +SET innodb_fake_changes=1; |
69 | +UPDATE t3 set b=lpad('b',11000,'c') where a=1; |
70 | +COMMIT; |
71 | +ERROR HY000: Got error 131 during COMMIT |
72 | +SET innodb_fake_changes=default; |
73 | +# Verify that the fake changes to t3 did not leak through |
74 | +CHECK TABLE t3; |
75 | +Table Op Msg_type Msg_text |
76 | +test.t3 check status OK |
77 | +should_be_1 |
78 | +1 |
79 | +DROP TABLE t1, t3; |
80 | |
81 | === added file 'Percona-Server/mysql-test/r/percona_innodb_fake_changes_bug_917942.result' |
82 | --- Percona-Server/mysql-test/r/percona_innodb_fake_changes_bug_917942.result 1970-01-01 00:00:00 +0000 |
83 | +++ Percona-Server/mysql-test/r/percona_innodb_fake_changes_bug_917942.result 2012-10-17 11:35:24 +0000 |
84 | @@ -0,0 +1,151 @@ |
85 | +DROP TABLE IF EXISTS t1; |
86 | +Test compressed |
87 | +CREATE TABLE t1 (id INT PRIMARY KEY AUTO_INCREMENT, v VARCHAR(200), t TEXT) ENGINE=INNODB KEY_BLOCK_SIZE=8; |
88 | +INSERT INTO t1 VALUES(NULL, LPAD("v", 2, "b"), LPAD("a", 100, "b")); |
89 | +SET innodb_fake_changes=1; |
90 | +INSERT INTO t1 VALUES(1, "foo", LPAD("a", 4600, "b")) ON DUPLICATE KEY UPDATE T = VALUES(T); |
91 | +ERROR HY000: Got error 131 during COMMIT |
92 | +UPDATE t1 SET T = LPAD("A", 4600, "b"); |
93 | +ERROR HY000: Got error 131 during COMMIT |
94 | +SET innodb_fake_changes=0; |
95 | +CHECK TABLE t1; |
96 | +Table Op Msg_type Msg_text |
97 | +test.t1 check status OK |
98 | +should_be_1 |
99 | +1 |
100 | +DROP TABLE t1; |
101 | +Test for uncompressed |
102 | +CREATE TABLE t1 (id INT PRIMARY KEY AUTO_INCREMENT, v VARCHAR(200), t TEXT) ENGINE=INNODB; |
103 | +INSERT INTO t1 VALUES(NULL, LPAD("v", 2, "b"), LPAD("a", 100, "b")); |
104 | +SET innodb_fake_changes=1; |
105 | +ERROR HY000: Got error 131 during COMMIT |
106 | +ERROR HY000: Got error 131 during COMMIT |
107 | +ERROR HY000: Got error 131 during COMMIT |
108 | +ERROR HY000: Got error 131 during COMMIT |
109 | +ERROR HY000: Got error 131 during COMMIT |
110 | +ERROR HY000: Got error 131 during COMMIT |
111 | +ERROR HY000: Got error 131 during COMMIT |
112 | +ERROR HY000: Got error 131 during COMMIT |
113 | +ERROR HY000: Got error 131 during COMMIT |
114 | +ERROR HY000: Got error 131 during COMMIT |
115 | +ERROR HY000: Got error 131 during COMMIT |
116 | +ERROR HY000: Got error 131 during COMMIT |
117 | +ERROR HY000: Got error 131 during COMMIT |
118 | +ERROR HY000: Got error 131 during COMMIT |
119 | +ERROR HY000: Got error 131 during COMMIT |
120 | +ERROR HY000: Got error 131 during COMMIT |
121 | +ERROR HY000: Got error 131 during COMMIT |
122 | +ERROR HY000: Got error 131 during COMMIT |
123 | +ERROR HY000: Got error 131 during COMMIT |
124 | +ERROR HY000: Got error 131 during COMMIT |
125 | +ERROR HY000: Got error 131 during COMMIT |
126 | +ERROR HY000: Got error 131 during COMMIT |
127 | +ERROR HY000: Got error 131 during COMMIT |
128 | +ERROR HY000: Got error 131 during COMMIT |
129 | +ERROR HY000: Got error 131 during COMMIT |
130 | +ERROR HY000: Got error 131 during COMMIT |
131 | +ERROR HY000: Got error 131 during COMMIT |
132 | +ERROR HY000: Got error 131 during COMMIT |
133 | +ERROR HY000: Got error 131 during COMMIT |
134 | +ERROR HY000: Got error 131 during COMMIT |
135 | +ERROR HY000: Got error 131 during COMMIT |
136 | +ERROR HY000: Got error 131 during COMMIT |
137 | +ERROR HY000: Got error 131 during COMMIT |
138 | +ERROR HY000: Got error 131 during COMMIT |
139 | +ERROR HY000: Got error 131 during COMMIT |
140 | +ERROR HY000: Got error 131 during COMMIT |
141 | +ERROR HY000: Got error 131 during COMMIT |
142 | +ERROR HY000: Got error 131 during COMMIT |
143 | +ERROR HY000: Got error 131 during COMMIT |
144 | +ERROR HY000: Got error 131 during COMMIT |
145 | +ERROR HY000: Got error 131 during COMMIT |
146 | +ERROR HY000: Got error 131 during COMMIT |
147 | +ERROR HY000: Got error 131 during COMMIT |
148 | +ERROR HY000: Got error 131 during COMMIT |
149 | +ERROR HY000: Got error 131 during COMMIT |
150 | +ERROR HY000: Got error 131 during COMMIT |
151 | +ERROR HY000: Got error 131 during COMMIT |
152 | +ERROR HY000: Got error 131 during COMMIT |
153 | +ERROR HY000: Got error 131 during COMMIT |
154 | +ERROR HY000: Got error 131 during COMMIT |
155 | +ERROR HY000: Got error 131 during COMMIT |
156 | +ERROR HY000: Got error 131 during COMMIT |
157 | +ERROR HY000: Got error 131 during COMMIT |
158 | +ERROR HY000: Got error 131 during COMMIT |
159 | +ERROR HY000: Got error 131 during COMMIT |
160 | +ERROR HY000: Got error 131 during COMMIT |
161 | +ERROR HY000: Got error 131 during COMMIT |
162 | +ERROR HY000: Got error 131 during COMMIT |
163 | +ERROR HY000: Got error 131 during COMMIT |
164 | +ERROR HY000: Got error 131 during COMMIT |
165 | +ERROR HY000: Got error 131 during COMMIT |
166 | +ERROR HY000: Got error 131 during COMMIT |
167 | +ERROR HY000: Got error 131 during COMMIT |
168 | +ERROR HY000: Got error 131 during COMMIT |
169 | +ERROR HY000: Got error 131 during COMMIT |
170 | +ERROR HY000: Got error 131 during COMMIT |
171 | +ERROR HY000: Got error 131 during COMMIT |
172 | +ERROR HY000: Got error 131 during COMMIT |
173 | +ERROR HY000: Got error 131 during COMMIT |
174 | +ERROR HY000: Got error 131 during COMMIT |
175 | +ERROR HY000: Got error 131 during COMMIT |
176 | +ERROR HY000: Got error 131 during COMMIT |
177 | +ERROR HY000: Got error 131 during COMMIT |
178 | +ERROR HY000: Got error 131 during COMMIT |
179 | +ERROR HY000: Got error 131 during COMMIT |
180 | +ERROR HY000: Got error 131 during COMMIT |
181 | +ERROR HY000: Got error 131 during COMMIT |
182 | +ERROR HY000: Got error 131 during COMMIT |
183 | +ERROR HY000: Got error 131 during COMMIT |
184 | +ERROR HY000: Got error 131 during COMMIT |
185 | +ERROR HY000: Got error 131 during COMMIT |
186 | +ERROR HY000: Got error 131 during COMMIT |
187 | +ERROR HY000: Got error 131 during COMMIT |
188 | +ERROR HY000: Got error 131 during COMMIT |
189 | +ERROR HY000: Got error 131 during COMMIT |
190 | +ERROR HY000: Got error 131 during COMMIT |
191 | +ERROR HY000: Got error 131 during COMMIT |
192 | +ERROR HY000: Got error 131 during COMMIT |
193 | +ERROR HY000: Got error 131 during COMMIT |
194 | +ERROR HY000: Got error 131 during COMMIT |
195 | +ERROR HY000: Got error 131 during COMMIT |
196 | +ERROR HY000: Got error 131 during COMMIT |
197 | +ERROR HY000: Got error 131 during COMMIT |
198 | +ERROR HY000: Got error 131 during COMMIT |
199 | +ERROR HY000: Got error 131 during COMMIT |
200 | +ERROR HY000: Got error 131 during COMMIT |
201 | +ERROR HY000: Got error 131 during COMMIT |
202 | +ERROR HY000: Got error 131 during COMMIT |
203 | +ERROR HY000: Got error 131 during COMMIT |
204 | +ERROR HY000: Got error 131 during COMMIT |
205 | +SET innodb_fake_changes=0; |
206 | +CHECK TABLE t1; |
207 | +Table Op Msg_type Msg_text |
208 | +test.t1 check status OK |
209 | +should_be_1 |
210 | +1 |
211 | +DROP TABLE t1; |
212 | +CREATE TABLE t1 (id INT PRIMARY KEY AUTO_INCREMENT, v VARCHAR(200), t TEXT) ENGINE=INNODB KEY_BLOCK_SIZE=8; |
213 | +INSERT INTO t1 VALUES(2, LPAD("v", 2, "b"), LPAD("a", 200, "b")); |
214 | +SET innodb_fake_changes=1; |
215 | +INSERT INTO t1 VALUES (3, "foo", LPAD("a", 4600, "b")); |
216 | +ERROR HY000: Got error 131 during COMMIT |
217 | +SET innodb_fake_changes=0; |
218 | +CHECK TABLE t1; |
219 | +Table Op Msg_type Msg_text |
220 | +test.t1 check status OK |
221 | +should_be_1 |
222 | +1 |
223 | +DROP TABLE t1; |
224 | +CREATE TABLE t1 (id INT PRIMARY KEY AUTO_INCREMENT, v VARCHAR(200), t TEXT) ENGINE=INNODB; |
225 | +INSERT INTO t1 VALUES(2, LPAD("v", 3, "b"), LPAD("a", 100, "b")); |
226 | +SET innodb_fake_changes=1; |
227 | +INSERT INTO t1 VALUES (3, "foo", LPAD("a", 4600, "b")); |
228 | +ERROR HY000: Got error 131 during COMMIT |
229 | +SET innodb_fake_changes=0; |
230 | +CHECK TABLE t1; |
231 | +Table Op Msg_type Msg_text |
232 | +test.t1 check status OK |
233 | +should_be_1 |
234 | +1 |
235 | +DROP TABLE t1; |
236 | |
237 | === removed file 'Percona-Server/mysql-test/r/percona_innodb_fake_changes_locks.result' |
238 | --- Percona-Server/mysql-test/r/percona_innodb_fake_changes_locks.result 2012-10-17 11:35:24 +0000 |
239 | +++ Percona-Server/mysql-test/r/percona_innodb_fake_changes_locks.result 1970-01-01 00:00:00 +0000 |
240 | @@ -1,83 +0,0 @@ |
241 | -DROP TABLE IF EXISTS t1, t2; |
242 | -CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; |
243 | -INSERT INTO t1 VALUES (1); |
244 | -CREATE TABLE t2 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; |
245 | -INSERT INTO t2 VALUES (1, 1); |
246 | -# Verifying that X_LOCK not acquired |
247 | -SET autocommit=0; |
248 | -SET innodb_fake_changes=1; |
249 | -BEGIN; |
250 | -SELECT * FROM t1 FOR UPDATE; |
251 | -a |
252 | -1 |
253 | -SET innodb_lock_wait_timeout=3; |
254 | -UPDATE t1 SET a=2; |
255 | -ERROR HY000: Lock wait timeout exceeded; try restarting transaction |
256 | -SELECT * FROM t1 LOCK IN SHARE MODE; |
257 | -a |
258 | -1 |
259 | -ROLLBACK; |
260 | -# Confirm no lock wait timeouts when innodb_locking_fake_changes=0 |
261 | -SET GLOBAL innodb_locking_fake_changes=0; |
262 | -BEGIN; |
263 | -SELECT * FROM t1 FOR UPDATE; |
264 | -a |
265 | -1 |
266 | -BEGIN; |
267 | -UPDATE t1 SET a=3 WHERE a=1; |
268 | -SELECT * FROM t1 LOCK IN SHARE MODE; |
269 | -a |
270 | -3 |
271 | -ROLLBACK; |
272 | -ROLLBACK; |
273 | -# Confirm that fake UPDATE does not hold a lock |
274 | -BEGIN; |
275 | -SELECT * FROM t1 FOR UPDATE; |
276 | -a |
277 | -1 |
278 | -BEGIN; |
279 | -UPDATE t1 SET a=3 WHERE a=1; |
280 | -ROLLBACK; |
281 | -ROLLBACK; |
282 | -BEGIN; |
283 | -UPDATE t1 SET a=3 WHERE a=1; |
284 | -BEGIN; |
285 | -UPDATE t1 SET a=3 WHERE a=1; |
286 | -ROLLBACK; |
287 | -ROLLBACK; |
288 | -# Confirm that fake INSERT does not hold a lock |
289 | -BEGIN; |
290 | -INSERT INTO t1 VALUES(4); |
291 | -BEGIN; |
292 | -INSERT INTO t1 VALUES(4); |
293 | -ROLLBACK; |
294 | -ROLLBACK; |
295 | -# Confirm that fake DELETE does not hold a lock |
296 | -BEGIN; |
297 | -DELETE FROM t1 WHERE a=1; |
298 | -BEGIN; |
299 | -DELETE FROM t1 WHERE a=1; |
300 | -ROLLBACK; |
301 | -ROLLBACK; |
302 | -# Confirm that fake REPLACE does not hold a lock |
303 | -BEGIN; |
304 | -REPLACE INTO t2 VALUES(1, 2); |
305 | -BEGIN; |
306 | -REPLACE INTO t2 VALUES(1, 2); |
307 | -ROLLBACK; |
308 | -ROLLBACK; |
309 | -SET innodb_fake_changes=default; |
310 | -SET GLOBAL innodb_locking_fake_changes=default; |
311 | -# Verify that the fake changes to t1 did not leak through |
312 | -CHECK TABLE t1; |
313 | -Table Op Msg_type Msg_text |
314 | -test.t1 check status OK |
315 | -should_be_1 |
316 | -1 |
317 | -# Verify that the fake changes to t2 did not leak through |
318 | -CHECK TABLE t2; |
319 | -Table Op Msg_type Msg_text |
320 | -test.t2 check status OK |
321 | -should_be_1 |
322 | -1 |
323 | -DROP TABLE t1, t2; |
324 | |
325 | === added file 'Percona-Server/mysql-test/t/percona_innodb_fake_changes_bug_917942-master.opt' |
326 | --- Percona-Server/mysql-test/t/percona_innodb_fake_changes_bug_917942-master.opt 1970-01-01 00:00:00 +0000 |
327 | +++ Percona-Server/mysql-test/t/percona_innodb_fake_changes_bug_917942-master.opt 2012-10-17 11:35:24 +0000 |
328 | @@ -0,0 +1,1 @@ |
329 | +--innodb_file_per_table --innodb_file_format=barracuda |
330 | |
331 | === added file 'Percona-Server/mysql-test/t/percona_innodb_fake_changes_bug_917942.test' |
332 | --- Percona-Server/mysql-test/t/percona_innodb_fake_changes_bug_917942.test 1970-01-01 00:00:00 +0000 |
333 | +++ Percona-Server/mysql-test/t/percona_innodb_fake_changes_bug_917942.test 2012-10-17 11:35:24 +0000 |
334 | @@ -0,0 +1,103 @@ |
335 | +# Test for bug 917942, based on FB percona_innodb_fake_changes_bugs2 and ... _bugs3 test cases. |
336 | +# Meant to be run under Valgrind. |
337 | + |
338 | +--source include/have_innodb.inc |
339 | + |
340 | +--disable_warnings |
341 | +DROP TABLE IF EXISTS t1; |
342 | +--enable_warnings |
343 | + |
344 | +# |
345 | +# Confirm that cursor->tree_height is initialized when calling btr_cur_pessimistic_update |
346 | +# for transactions with innodb_fake_changes set |
347 | +# |
348 | + |
349 | +--echo Test compressed |
350 | +CREATE TABLE t1 (id INT PRIMARY KEY AUTO_INCREMENT, v VARCHAR(200), t TEXT) ENGINE=INNODB KEY_BLOCK_SIZE=8; |
351 | + |
352 | +INSERT INTO t1 VALUES(NULL, LPAD("v", 2, "b"), LPAD("a", 100, "b")); |
353 | +let $t1_checksum_1= `CHECKSUM TABLE t1 EXTENDED`; |
354 | + |
355 | +SET innodb_fake_changes=1; |
356 | + |
357 | +--error 1180 |
358 | +INSERT INTO t1 VALUES(1, "foo", LPAD("a", 4600, "b")) ON DUPLICATE KEY UPDATE T = VALUES(T); |
359 | +--error 1180 |
360 | +UPDATE t1 SET T = LPAD("A", 4600, "b"); |
361 | + |
362 | +SET innodb_fake_changes=0; |
363 | +CHECK TABLE t1; |
364 | +let $t1_checksum_2= `CHECKSUM TABLE t1 EXTENDED`; |
365 | +--disable_query_log |
366 | +eval SELECT "$t1_checksum_1" LIKE "$t1_checksum_2" AS should_be_1; |
367 | +--enable_query_log |
368 | +DROP TABLE t1; |
369 | + |
370 | +--echo Test for uncompressed |
371 | +CREATE TABLE t1 (id INT PRIMARY KEY AUTO_INCREMENT, v VARCHAR(200), t TEXT) ENGINE=INNODB; |
372 | + |
373 | +INSERT INTO t1 VALUES(NULL, LPAD("v", 2, "b"), LPAD("a", 100, "b")); |
374 | +let $t1_checksum_1= `CHECKSUM TABLE t1 EXTENDED`; |
375 | + |
376 | +SET innodb_fake_changes=1; |
377 | + |
378 | +--disable_query_log |
379 | +let $x = 50; |
380 | +while ($x) |
381 | +{ |
382 | + --error 1180 |
383 | + eval INSERT INTO t1 VALUES ($x, "foo", lpad("a", (($x * 100) + 4500) MOD 9000, "b")) ON DUPLICATE KEY UPDATE t = VALUES(t); |
384 | + --error 1180 |
385 | + eval UPDATE t1 SET t = LPAD("a", (($x * 100) + 4500) MOD 9000, "b"); |
386 | + dec $x; |
387 | +} |
388 | +--enable_query_log |
389 | + |
390 | +SET innodb_fake_changes=0; |
391 | +CHECK TABLE t1; |
392 | +let $t1_checksum_2= `CHECKSUM TABLE t1 EXTENDED`; |
393 | +--disable_query_log |
394 | +eval SELECT "$t1_checksum_1" LIKE "$t1_checksum_2" AS should_be_1; |
395 | +--enable_query_log |
396 | +DROP TABLE t1; |
397 | + |
398 | +# |
399 | +# Confirm that cursor->tree_height is initialized when calling btr_cur_pessimistic_insert |
400 | +# for transactions with innodb_fake_changes set |
401 | +# |
402 | + |
403 | +CREATE TABLE t1 (id INT PRIMARY KEY AUTO_INCREMENT, v VARCHAR(200), t TEXT) ENGINE=INNODB KEY_BLOCK_SIZE=8; |
404 | + |
405 | +INSERT INTO t1 VALUES(2, LPAD("v", 2, "b"), LPAD("a", 200, "b")); |
406 | +let $t1_checksum_1= `CHECKSUM TABLE t1 EXTENDED`; |
407 | + |
408 | +SET innodb_fake_changes=1; |
409 | + |
410 | +--error 1180 |
411 | +INSERT INTO t1 VALUES (3, "foo", LPAD("a", 4600, "b")); |
412 | + |
413 | +SET innodb_fake_changes=0; |
414 | +CHECK TABLE t1; |
415 | +let $t1_checksum_2= `CHECKSUM TABLE t1 EXTENDED`; |
416 | +--disable_query_log |
417 | +eval SELECT "$t1_checksum_1" LIKE "$t1_checksum_2" AS should_be_1; |
418 | +--enable_query_log |
419 | +DROP TABLE t1; |
420 | + |
421 | +CREATE TABLE t1 (id INT PRIMARY KEY AUTO_INCREMENT, v VARCHAR(200), t TEXT) ENGINE=INNODB; |
422 | + |
423 | +INSERT INTO t1 VALUES(2, LPAD("v", 3, "b"), LPAD("a", 100, "b")); |
424 | +let $t1_checksum_1= `CHECKSUM TABLE t1 EXTENDED`; |
425 | + |
426 | +SET innodb_fake_changes=1; |
427 | + |
428 | +--error 1180 |
429 | +INSERT INTO t1 VALUES (3, "foo", LPAD("a", 4600, "b")); |
430 | + |
431 | +SET innodb_fake_changes=0; |
432 | +CHECK TABLE t1; |
433 | +let $t1_checksum_2= `CHECKSUM TABLE t1 EXTENDED`; |
434 | +--disable_query_log |
435 | +eval SELECT "$t1_checksum_1" LIKE "$t1_checksum_2" AS should_be_1; |
436 | +--enable_query_log |
437 | +DROP TABLE t1; |
438 | |
439 | === modified file 'Percona-Server/storage/innobase/btr/btr0cur.c' |
440 | --- Percona-Server/storage/innobase/btr/btr0cur.c 2012-10-17 11:35:24 +0000 |
441 | +++ Percona-Server/storage/innobase/btr/btr0cur.c 2012-10-17 11:35:24 +0000 |
442 | @@ -1572,6 +1572,9 @@ |
443 | } |
444 | |
445 | if (!(flags & BTR_NO_UNDO_LOG_FLAG)) { |
446 | + |
447 | + ut_a(cursor->tree_height != ULINT_UNDEFINED); |
448 | + |
449 | /* First reserve enough free space for the file segments |
450 | of the index tree, so that the insert will not fail because |
451 | of lack of space */ |
452 | @@ -1866,7 +1869,8 @@ |
453 | ulint length, /*!< in: size needed */ |
454 | ibool create, /*!< in: TRUE=delete-and-insert, |
455 | FALSE=update-in-place */ |
456 | - mtr_t* mtr) /*!< in: mini-transaction */ |
457 | + mtr_t* mtr, /*!< in: mini-transaction */ |
458 | + trx_t* trx) /*!< in: NULL or transaction */ |
459 | { |
460 | ut_a(page_zip == buf_block_get_page_zip(block)); |
461 | ut_ad(page_zip); |
462 | @@ -1883,6 +1887,14 @@ |
463 | return(FALSE); |
464 | } |
465 | |
466 | + if (trx && trx->fake_changes) { |
467 | + /* Don't call page_zip_compress_write_log_no_data as that has |
468 | + assert which would fail. Assume there won't be a compression |
469 | + failure. */ |
470 | + |
471 | + return TRUE; |
472 | + } |
473 | + |
474 | if (!page_zip_compress(page_zip, buf_block_get_frame(block), |
475 | index, mtr)) { |
476 | /* Unable to compress the page */ |
477 | @@ -1966,7 +1978,8 @@ |
478 | /* Check that enough space is available on the compressed page. */ |
479 | if (page_zip |
480 | && !btr_cur_update_alloc_zip(page_zip, block, index, |
481 | - rec_offs_size(offsets), FALSE, mtr)) { |
482 | + rec_offs_size(offsets), FALSE, mtr, |
483 | + trx)) { |
484 | return(DB_ZIP_OVERFLOW); |
485 | } |
486 | |
487 | @@ -2165,7 +2178,8 @@ |
488 | |
489 | if (page_zip |
490 | && !btr_cur_update_alloc_zip(page_zip, block, index, |
491 | - new_rec_size, TRUE, mtr)) { |
492 | + new_rec_size, TRUE, mtr, |
493 | + thr_get_trx(thr))) { |
494 | err = DB_ZIP_OVERFLOW; |
495 | goto err_exit; |
496 | } |
497 | @@ -2404,7 +2418,15 @@ |
498 | of the index tree, so that the update will not fail because |
499 | of lack of space */ |
500 | |
501 | - n_extents = cursor->tree_height / 16 + 3; |
502 | + if (UNIV_UNLIKELY(cursor->tree_height == ULINT_UNDEFINED)) { |
503 | + /* When the tree height is uninitialized due to fake |
504 | + changes, reserve some hardcoded number of extents. */ |
505 | + ut_a(thr && thr_get_trx(thr)->fake_changes); |
506 | + n_extents = 3; |
507 | + } |
508 | + else { |
509 | + n_extents = cursor->tree_height / 16 + 3; |
510 | + } |
511 | |
512 | if (flags & BTR_NO_UNDO_LOG_FLAG) { |
513 | reserve_flag = FSP_CLEANING; |
514 | @@ -3205,6 +3227,8 @@ |
515 | of the index tree, so that the node pointer updates will |
516 | not fail because of lack of space */ |
517 | |
518 | + ut_a(cursor->tree_height != ULINT_UNDEFINED); |
519 | + |
520 | n_extents = cursor->tree_height / 32 + 1; |
521 | |
522 | success = fsp_reserve_free_extents(&n_reserved, |
523 | |
524 | === modified file 'Percona-Server/storage/innobase/btr/btr0pcur.c' |
525 | --- Percona-Server/storage/innobase/btr/btr0pcur.c 2012-06-01 12:15:25 +0000 |
526 | +++ Percona-Server/storage/innobase/btr/btr0pcur.c 2012-10-17 11:35:24 +0000 |
527 | @@ -47,6 +47,7 @@ |
528 | |
529 | pcur->btr_cur.index = NULL; |
530 | btr_pcur_init(pcur); |
531 | + pcur->btr_cur.tree_height = ULINT_UNDEFINED; |
532 | |
533 | return(pcur); |
534 | } |
535 | |
536 | === modified file 'Percona-Server/storage/innobase/ibuf/ibuf0ibuf.c' |
537 | --- Percona-Server/storage/innobase/ibuf/ibuf0ibuf.c 2012-06-01 12:15:25 +0000 |
538 | +++ Percona-Server/storage/innobase/ibuf/ibuf0ibuf.c 2012-10-17 11:35:24 +0000 |
539 | @@ -4037,7 +4037,7 @@ |
540 | update) |
541 | && (!page_zip || btr_cur_update_alloc_zip( |
542 | page_zip, block, index, |
543 | - rec_offs_size(offsets), FALSE, mtr))) { |
544 | + rec_offs_size(offsets), FALSE, mtr, NULL))) { |
545 | /* This is the easy case. Do something similar |
546 | to btr_cur_update_in_place(). */ |
547 | row_upd_rec_in_place(rec, index, offsets, |
548 | |
549 | === modified file 'Percona-Server/storage/innobase/include/btr0cur.h' |
550 | --- Percona-Server/storage/innobase/include/btr0cur.h 2012-05-10 07:49:14 +0000 |
551 | +++ Percona-Server/storage/innobase/include/btr0cur.h 2012-10-17 11:35:24 +0000 |
552 | @@ -259,8 +259,9 @@ |
553 | ulint length, /*!< in: size needed */ |
554 | ibool create, /*!< in: TRUE=delete-and-insert, |
555 | FALSE=update-in-place */ |
556 | - mtr_t* mtr) /*!< in: mini-transaction */ |
557 | - __attribute__((nonnull, warn_unused_result)); |
558 | + mtr_t* mtr, /*!< in: mini-transaction */ |
559 | + trx_t* trx) /*!< in: NULL or transaction */ |
560 | + __attribute__((nonnull (1, 2, 3, 6), warn_unused_result)); |
561 | /*************************************************************//** |
562 | Updates a record when the update causes no size changes in its fields. |
563 | @return DB_SUCCESS or error number */ |
Will self-approve once 5.1 is accepted.