Merge lp:~laurynas-biveinis/percona-server/bug890404-5.1 into lp:percona-server/5.1

Proposed by Laurynas Biveinis on 2012-10-12
Status: Merged
Approved by: Stewart Smith on 2012-10-24
Approved revision: 485
Merged at revision: 500
Proposed branch: lp:~laurynas-biveinis/percona-server/bug890404-5.1
Merge into: lp:percona-server/5.1
Diff against target: 116 lines (+51/-5)
3 files modified
Percona-Server/mysql-test/r/percona_innodb_fake_changes.result (+22/-2)
Percona-Server/mysql-test/t/percona_innodb_fake_changes.test (+28/-2)
Percona-Server/storage/innodb_plugin/btr/btr0cur.c (+1/-1)
To merge this branch: bzr merge lp:~laurynas-biveinis/percona-server/bug890404-5.1
Reviewer Review Type Date Requested Status
Stewart Smith (community) Approve on 2012-10-24
Sergei Glushchenko (community) g2 2012-10-12 Approve on 2012-10-23
Review via email: mp+129411@code.launchpad.net

Description of the change

Fix bug 890404 (valgrind warning from innodb_fake_changes patch) and
improve the fake changes testcase.

The Valgrind warning in bug 890404 is "conditional jump depends on
uninitialized value(s)" and the value in question is roll_ptr in
btr_cur_pessimistic_update(). Normally roll_ptr is set by
the btr_cur_upd_lock_and_undo() call and then read by one of the
row_upd_index_entry_sys_field() calls. With the fake changes enabled,
roll_ptr write is skipped but read is not.

Fixed by skipping row_upd_index_entry_sys_field() calls in case of
fake changes.

Extended the percona_innodb_fake_changes testcase by dropping table t2
at the start too if exists, and by adding table checks and checksum
comparisons for tables with data that have fake changes workload to
see that fake changes do not cause corruption nor leak through.

http://jenkins.percona.com/job/percona-server-5.1-param/439/

26611

To post a comment you must log in.

Approve g2

review: Approve (g2)
Stewart Smith (stewart) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Percona-Server/mysql-test/r/percona_innodb_fake_changes.result'
2--- Percona-Server/mysql-test/r/percona_innodb_fake_changes.result 2011-11-24 02:00:54 +0000
3+++ Percona-Server/mysql-test/r/percona_innodb_fake_changes.result 2012-10-12 12:38:32 +0000
4@@ -1,4 +1,4 @@
5-DROP TABLE IF EXISTS t1;
6+DROP TABLE IF EXISTS t1, t2, t3;
7 # Checking variables
8 SHOW VARIABLES LIKE 'innodb_fake_changes';
9 Variable_name Value
10@@ -36,6 +36,12 @@
11 COMMIT;
12 ERROR HY000: Got error 131 during COMMIT
13 SET innodb_fake_changes=default;
14+# Verify that the fake changes to t1 did not leak through
15+CHECK TABLE t1;
16+Table Op Msg_type Msg_text
17+test.t1 check status OK
18+should_be_1
19+1
20 DROP TABLE t1;
21 # DDL must result in error
22 CREATE TABLE t1 (a INT) ENGINE=InnoDB;
23@@ -51,5 +57,19 @@
24 ALTER TABLE t1 ENGINE=MyISAM;
25 ERROR HY000: Got error 131 during COMMIT
26 ROLLBACK;
27+SET innodb_fake_changes=0;
28+CREATE TABLE t3 (a INT primary key, b text) ENGINE=InnoDB;
29+INSERT INTO t3 VALUES (1,'');
30+COMMIT;
31+SET innodb_fake_changes=1;
32+UPDATE t3 set b=lpad('b',11000,'c') where a=1;
33+COMMIT;
34+ERROR HY000: Got error 131 during COMMIT
35 SET innodb_fake_changes=default;
36-DROP TABLE t1;
37+# Verify that the fake changes to t3 did not leak through
38+CHECK TABLE t3;
39+Table Op Msg_type Msg_text
40+test.t3 check status OK
41+should_be_1
42+1
43+DROP TABLE t1, t3;
44
45=== modified file 'Percona-Server/mysql-test/t/percona_innodb_fake_changes.test'
46--- Percona-Server/mysql-test/t/percona_innodb_fake_changes.test 2011-11-24 02:00:54 +0000
47+++ Percona-Server/mysql-test/t/percona_innodb_fake_changes.test 2012-10-12 12:38:32 +0000
48@@ -1,7 +1,7 @@
49 --source include/have_innodb_plugin.inc
50
51 --disable_warnings
52-DROP TABLE IF EXISTS t1;
53+DROP TABLE IF EXISTS t1, t2, t3;
54 --enable_warnings
55
56
57@@ -19,6 +19,7 @@
58 --echo # DML should be fine
59 CREATE TABLE t1 (a INT) ENGINE=InnoDB;
60 INSERT INTO t1 VALUES (1);
61+let $t1_checksum_1= `CHECKSUM TABLE t1 EXTENDED`;
62 SET autocommit=0;
63 SET innodb_fake_changes=1;
64 BEGIN;
65@@ -29,6 +30,12 @@
66 --error 1180
67 COMMIT;
68 SET innodb_fake_changes=default;
69+--echo # Verify that the fake changes to t1 did not leak through
70+CHECK TABLE t1;
71+let $t1_checksum_2= `CHECKSUM TABLE t1 EXTENDED`;
72+--disable_query_log
73+eval SELECT "$t1_checksum_1" LIKE "$t1_checksum_2" AS should_be_1;
74+--enable_query_log
75 DROP TABLE t1;
76
77 --echo # DDL must result in error
78@@ -45,5 +52,24 @@
79 --error 1180
80 ALTER TABLE t1 ENGINE=MyISAM;
81 ROLLBACK;
82+
83+# Test for bug 890404: uninitialized value warning in btr_cur_pessimistic_update
84+SET innodb_fake_changes=0;
85+CREATE TABLE t3 (a INT primary key, b text) ENGINE=InnoDB;
86+INSERT INTO t3 VALUES (1,'');
87+COMMIT;
88+let $t3_checksum_1= `CHECKSUM TABLE t3 EXTENDED`;
89+SET innodb_fake_changes=1;
90+
91+UPDATE t3 set b=lpad('b',11000,'c') where a=1;
92+--error ER_ERROR_DURING_COMMIT
93+COMMIT;
94+
95 SET innodb_fake_changes=default;
96-DROP TABLE t1;
97+--echo # Verify that the fake changes to t3 did not leak through
98+CHECK TABLE t3;
99+let $t3_checksum_2= `CHECKSUM TABLE t3 EXTENDED`;
100+--disable_query_log
101+eval SELECT "$t3_checksum_1" LIKE "$t3_checksum_2" AS should_be_1;
102+--enable_query_log
103+DROP TABLE t1, t3;
104
105=== modified file 'Percona-Server/storage/innodb_plugin/btr/btr0cur.c'
106--- Percona-Server/storage/innodb_plugin/btr/btr0cur.c 2012-08-20 03:14:02 +0000
107+++ Percona-Server/storage/innodb_plugin/btr/btr0cur.c 2012-10-12 12:38:32 +0000
108@@ -2334,7 +2334,7 @@
109 itself. Thus the following call is safe. */
110 row_upd_index_replace_new_col_vals_index_pos(new_entry, index, update,
111 FALSE, *heap);
112- if (!(flags & BTR_KEEP_SYS_FLAG)) {
113+ if (!(flags & BTR_KEEP_SYS_FLAG) && !trx->fake_changes) {
114 row_upd_index_entry_sys_field(new_entry, index, DATA_ROLL_PTR,
115 roll_ptr);
116 row_upd_index_entry_sys_field(new_entry, index, DATA_TRX_ID,

Subscribers

People subscribed via source and target branches