Merge lp:~laurynas-biveinis/percona-xtrabackup/BT-28340-bug1158154-2.0 into lp:percona-xtrabackup/2.0

Proposed by Laurynas Biveinis
Status: Merged
Approved by: Stewart Smith
Approved revision: no longer in the source branch.
Merged at revision: 523
Proposed branch: lp:~laurynas-biveinis/percona-xtrabackup/BT-28340-bug1158154-2.0
Merge into: lp:percona-xtrabackup/2.0
Diff against target: 255 lines (+213/-0)
5 files modified
patches/innodb51.patch (+43/-0)
patches/innodb51_builtin.patch (+41/-0)
patches/innodb55.patch (+43/-0)
patches/xtradb51.patch (+43/-0)
patches/xtradb55.patch (+43/-0)
To merge this branch: bzr merge lp:~laurynas-biveinis/percona-xtrabackup/BT-28340-bug1158154-2.0
Reviewer Review Type Date Requested Status
Stewart Smith (community) Approve
Registry Administrators Pending
Review via email: mp+154856@code.launchpad.net

Description of the change

Fix bug 1158154 (Suboptimal debug code in mem_init_buf() and
mem_erase_buf()) in all configurations by patching mem_init_buf() and
mem_erase_buf() to use memset() instead of a
ut_rnd_gen_ibool()-calling loops.

BT 28340

http://jenkins.percona.com/job/percona-xtrabackup-2.0-param/382/

To post a comment you must log in.
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

Note that merging this to 2.0 will *not* be enough to set the bug to Fix Released on 2.0. innodb56.patch needs to be fixed as well, this was not done in the current MP because the 2.0 and 2.1 GCA precedes innodb56.patch introduction.

Revision history for this message
Stewart Smith (stewart) :
review: Approve
Revision history for this message
Stewart Smith (stewart) wrote :

As I mentioned for 2.1 review: may be good to have valgrind annotations if we don't already.

Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

They are there already, UNIV_MEM_ASSERT_W/UNIV_MEM_INVALID.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'patches/innodb51.patch'
2--- patches/innodb51.patch 2013-03-13 05:02:58 +0000
3+++ patches/innodb51.patch 2013-03-22 05:16:21 +0000
4@@ -1262,3 +1262,46 @@
5 } else {
6 fprintf(stderr,
7 "InnoDB: Since"
8+--- a/storage/innodb_plugin/mem/mem0dbg.c
9++++ b/storage/innodb_plugin/mem/mem0dbg.c
10+@@ -272,18 +272,10 @@
11+ byte* buf, /*!< in: pointer to buffer */
12+ ulint n) /*!< in: length of buffer */
13+ {
14+- byte* ptr;
15+-
16+ UNIV_MEM_ASSERT_W(buf, n);
17+
18+- for (ptr = buf; ptr < buf + n; ptr++) {
19+-
20+- if (ut_rnd_gen_ibool()) {
21+- *ptr = 0xBA;
22+- } else {
23+- *ptr = 0xBE;
24+- }
25+- }
26++ /* Fix https://bugs.launchpad.net/percona-xtrabackup/+bug/1158154 */
27++ memset(buf, 0xBA, n);
28+
29+ UNIV_MEM_INVALID(buf, n);
30+ }
31+@@ -298,17 +290,10 @@
32+ byte* buf, /*!< in: pointer to buffer */
33+ ulint n) /*!< in: length of buffer */
34+ {
35+- byte* ptr;
36+-
37+ UNIV_MEM_ASSERT_W(buf, n);
38+
39+- for (ptr = buf; ptr < buf + n; ptr++) {
40+- if (ut_rnd_gen_ibool()) {
41+- *ptr = 0xDE;
42+- } else {
43+- *ptr = 0xAD;
44+- }
45+- }
46++ /* Fix https://bugs.launchpad.net/percona-xtrabackup/+bug/1158154 */
47++ memset(buf, 0xDE, n);
48+
49+ UNIV_MEM_FREE(buf, n);
50+ }
51
52=== modified file 'patches/innodb51_builtin.patch'
53--- patches/innodb51_builtin.patch 2013-03-13 05:02:58 +0000
54+++ patches/innodb51_builtin.patch 2013-03-22 05:16:21 +0000
55@@ -1029,6 +1029,47 @@
56 #ifdef UNIV_MEM_DEBUG
57 /**********************************************************************
58 Initializes an allocated memory field in the debug version. */
59+@@ -221,18 +242,10 @@
60+ byte* buf, /* in: pointer to buffer */
61+ ulint n) /* in: length of buffer */
62+ {
63+- byte* ptr;
64+-
65+ UNIV_MEM_ASSERT_W(buf, n);
66+
67+- for (ptr = buf; ptr < buf + n; ptr++) {
68+-
69+- if (ut_rnd_gen_ibool()) {
70+- *ptr = 0xBA;
71+- } else {
72+- *ptr = 0xBE;
73+- }
74+- }
75++ /* Fix https://bugs.launchpad.net/percona-xtrabackup/+bug/1158154 */
76++ memset(buf, 0xBA, n);
77+
78+ UNIV_MEM_INVALID(buf, n);
79+ }
80+@@ -247,17 +260,10 @@
81+ byte* buf, /* in: pointer to buffer */
82+ ulint n) /* in: length of buffer */
83+ {
84+- byte* ptr;
85+-
86+ UNIV_MEM_ASSERT_W(buf, n);
87+
88+- for (ptr = buf; ptr < buf + n; ptr++) {
89+- if (ut_rnd_gen_ibool()) {
90+- *ptr = 0xDE;
91+- } else {
92+- *ptr = 0xAD;
93+- }
94+- }
95++ /* Fix https://bugs.launchpad.net/percona-xtrabackup/+bug/1158154 */
96++ memset(buf, 0xDE, n);
97+
98+ UNIV_MEM_FREE(buf, n);
99+ }
100 --- a/storage/innobase/mem/mem0mem.c
101 +++ b/storage/innobase/mem/mem0mem.c
102 @@ -472,6 +472,7 @@
103
104=== modified file 'patches/innodb55.patch'
105--- patches/innodb55.patch 2013-03-13 05:02:58 +0000
106+++ patches/innodb55.patch 2013-03-22 05:16:21 +0000
107@@ -1179,3 +1179,46 @@
108 ut_a(purge_sys->trx->n_active_thrs == 0);
109
110 rw_lock_x_lock(&purge_sys->latch);
111+--- a/storage/innobase/mem/mem0dbg.c
112++++ b/storage/innobase/mem/mem0dbg.c
113+@@ -280,18 +280,10 @@
114+ byte* buf, /*!< in: pointer to buffer */
115+ ulint n) /*!< in: length of buffer */
116+ {
117+- byte* ptr;
118+-
119+ UNIV_MEM_ASSERT_W(buf, n);
120+
121+- for (ptr = buf; ptr < buf + n; ptr++) {
122+-
123+- if (ut_rnd_gen_ibool()) {
124+- *ptr = 0xBA;
125+- } else {
126+- *ptr = 0xBE;
127+- }
128+- }
129++ /* Fix https://bugs.launchpad.net/percona-xtrabackup/+bug/1158154 */
130++ memset(buf, 0xBA, n);
131+
132+ UNIV_MEM_INVALID(buf, n);
133+ }
134+@@ -306,17 +298,10 @@
135+ byte* buf, /*!< in: pointer to buffer */
136+ ulint n) /*!< in: length of buffer */
137+ {
138+- byte* ptr;
139+-
140+ UNIV_MEM_ASSERT_W(buf, n);
141+
142+- for (ptr = buf; ptr < buf + n; ptr++) {
143+- if (ut_rnd_gen_ibool()) {
144+- *ptr = 0xDE;
145+- } else {
146+- *ptr = 0xAD;
147+- }
148+- }
149++ /* Fix https://bugs.launchpad.net/percona-xtrabackup/+bug/1158154 */
150++ memset(buf, 0xDE, n);
151+
152+ UNIV_MEM_FREE(buf, n);
153+ }
154
155=== modified file 'patches/xtradb51.patch'
156--- patches/xtradb51.patch 2013-03-13 05:02:58 +0000
157+++ patches/xtradb51.patch 2013-03-22 05:16:21 +0000
158@@ -1345,3 +1345,46 @@
159
160 /* Write the log but do not flush it to disk */
161
162+--- a/storage/innodb_plugin/mem/mem0dbg.c
163++++ b/storage/innodb_plugin/mem/mem0dbg.c
164+@@ -272,18 +272,10 @@
165+ byte* buf, /*!< in: pointer to buffer */
166+ ulint n) /*!< in: length of buffer */
167+ {
168+- byte* ptr;
169+-
170+ UNIV_MEM_ASSERT_W(buf, n);
171+
172+- for (ptr = buf; ptr < buf + n; ptr++) {
173+-
174+- if (ut_rnd_gen_ibool()) {
175+- *ptr = 0xBA;
176+- } else {
177+- *ptr = 0xBE;
178+- }
179+- }
180++ /* Fix https://bugs.launchpad.net/percona-xtrabackup/+bug/1158154 */
181++ memset(buf, 0xBA, n);
182+
183+ UNIV_MEM_INVALID(buf, n);
184+ }
185+@@ -298,17 +290,10 @@
186+ byte* buf, /*!< in: pointer to buffer */
187+ ulint n) /*!< in: length of buffer */
188+ {
189+- byte* ptr;
190+-
191+ UNIV_MEM_ASSERT_W(buf, n);
192+
193+- for (ptr = buf; ptr < buf + n; ptr++) {
194+- if (ut_rnd_gen_ibool()) {
195+- *ptr = 0xDE;
196+- } else {
197+- *ptr = 0xAD;
198+- }
199+- }
200++ /* Fix https://bugs.launchpad.net/percona-xtrabackup/+bug/1158154 */
201++ memset(buf, 0xDE, n);
202+
203+ UNIV_MEM_FREE(buf, n);
204+ }
205
206=== modified file 'patches/xtradb55.patch'
207--- patches/xtradb55.patch 2013-03-13 05:02:58 +0000
208+++ patches/xtradb55.patch 2013-03-22 05:16:21 +0000
209@@ -1339,3 +1339,46 @@
210 LINK_LIBRARIES(${CMAKE_THREAD_LIBS_INIT})
211
212 OPTION(WITH_LIBWRAP "Compile with tcp wrappers support" OFF)
213+--- a/storage/innobase/mem/mem0dbg.c
214++++ b/storage/innobase/mem/mem0dbg.c
215+@@ -280,18 +280,10 @@
216+ byte* buf, /*!< in: pointer to buffer */
217+ ulint n) /*!< in: length of buffer */
218+ {
219+- byte* ptr;
220+-
221+ UNIV_MEM_ASSERT_W(buf, n);
222+
223+- for (ptr = buf; ptr < buf + n; ptr++) {
224+-
225+- if (ut_rnd_gen_ibool()) {
226+- *ptr = 0xBA;
227+- } else {
228+- *ptr = 0xBE;
229+- }
230+- }
231++ /* Fix https://bugs.launchpad.net/percona-xtrabackup/+bug/1158154 */
232++ memset(buf, 0xBA, n);
233+
234+ UNIV_MEM_INVALID(buf, n);
235+ }
236+@@ -306,17 +298,10 @@
237+ byte* buf, /*!< in: pointer to buffer */
238+ ulint n) /*!< in: length of buffer */
239+ {
240+- byte* ptr;
241+-
242+ UNIV_MEM_ASSERT_W(buf, n);
243+
244+- for (ptr = buf; ptr < buf + n; ptr++) {
245+- if (ut_rnd_gen_ibool()) {
246+- *ptr = 0xDE;
247+- } else {
248+- *ptr = 0xAD;
249+- }
250+- }
251++ /* Fix https://bugs.launchpad.net/percona-xtrabackup/+bug/1158154 */
252++ memset(buf, 0xDE, n);
253+
254+ UNIV_MEM_FREE(buf, n);
255+ }

Subscribers

People subscribed via source and target branches