Merge lp:~laurynas-biveinis/percona-server/bug1217002-5.6 into lp:percona-server/5.6

Proposed by Laurynas Biveinis
Status: Merged
Approved by: Alexey Kopytov
Approved revision: no longer in the source branch.
Merged at revision: 429
Proposed branch: lp:~laurynas-biveinis/percona-server/bug1217002-5.6
Merge into: lp:percona-server/5.6
Diff against target: 322 lines (+178/-6)
11 files modified
Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp_debug.result (+14/-0)
Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_debug-master.opt (+1/-1)
Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_debug.test (+50/-0)
Percona-Server/mysql-test/suite/sys_vars/r/innodb_track_redo_log_now_basic.result (+28/-0)
Percona-Server/mysql-test/suite/sys_vars/t/innodb_track_changed_pages_basic.test (+1/-0)
Percona-Server/mysql-test/suite/sys_vars/t/innodb_track_redo_log_now_basic.test (+27/-0)
Percona-Server/storage/innobase/fil/fil0fil.cc (+5/-0)
Percona-Server/storage/innobase/handler/ha_innodb.cc (+42/-4)
Percona-Server/storage/innobase/handler/handler0alter.cc (+2/-0)
Percona-Server/storage/innobase/log/log0recv.cc (+2/-1)
Percona-Server/storage/innobase/srv/srv0srv.cc (+6/-0)
To merge this branch: bzr merge lp:~laurynas-biveinis/percona-server/bug1217002-5.6
Reviewer Review Type Date Requested Status
Alexey Kopytov (community) Approve
Review via email: mp+184618@code.launchpad.net

Description of the change

A QA blocker.

http://jenkins.percona.com/job/percona-server-5.6-param/264/

Merge bug 1217002 and bug 1213885 fixes from 5.5. The only change
from the 5.5 version is that the debug sync point is moved to
commit_cache_rebuild and renamed to commit_cache_rebuild_middle to
account for 5.6 InnoDB ALTER TABLE refactorings.

To post a comment you must log in.
Revision history for this message
Alexey Kopytov (akopytov) :
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/suite/innodb/r/percona_changed_page_bmp_debug.result'
2--- Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp_debug.result 2013-05-09 19:43:37 +0000
3+++ Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp_debug.result 2013-09-09 16:36:50 +0000
4@@ -23,3 +23,17 @@
5 INSERT INTO t1 SELECT x FROM t1;
6 3rd restart
7 DROP TABLE t1;
8+CREATE TABLE t1 (x INT NOT NULL UNIQUE KEY) ENGINE=InnoDB;
9+INSERT INTO t1 VALUES(5);
10+SET @@GLOBAL.innodb_track_changed_pages=FALSE;
11+SET @@GLOBAL.innodb_log_checkpoint_now=TRUE;
12+RENAME TABLE t1 TO t2;
13+SET DEBUG_SYNC="commit_cache_rebuild_middle SIGNAL alter_table_ready WAIT_FOR finish_alter_table";
14+ALTER TABLE t2 ADD PRIMARY KEY(x);
15+SET DEBUG_SYNC="now WAIT_FOR alter_table_ready";
16+SET @@GLOBAL.innodb_log_checkpoint_now=TRUE;
17+SET @@GLOBAL.innodb_track_changed_pages=TRUE;
18+SET @@GLOBAL.innodb_track_redo_log_now=TRUE;
19+SET DEBUG_SYNC="now SIGNAL finish_alter_table";
20+SET DEBUG_SYNC="RESET";
21+DROP TABLE t2;
22
23=== modified file 'Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_debug-master.opt'
24--- Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_debug-master.opt 2013-02-07 07:32:03 +0000
25+++ Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_debug-master.opt 2013-09-09 16:36:50 +0000
26@@ -1,1 +1,1 @@
27---innodb_track_changed_pages=TRUE --innodb_log_file_size=5M
28+--innodb_track_changed_pages=TRUE --innodb_log_file_size=5M --innodb-file-per-table
29
30=== modified file 'Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_debug.test'
31--- Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_debug.test 2013-05-09 19:43:37 +0000
32+++ Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_debug.test 2013-09-09 16:36:50 +0000
33@@ -3,6 +3,7 @@
34 #
35 --source include/have_debug.inc
36 --source include/have_innodb.inc
37+--source include/count_sessions.inc
38
39 --disable_warnings
40 DROP TABLE IF EXISTS t1;
41@@ -56,3 +57,52 @@
42 --source include/restart_mysqld.inc
43
44 DROP TABLE t1;
45+
46+#
47+# Test for bug 1217002 (RENAME/DROP crashes with innodb_track_changed_pages)
48+#
49+CREATE TABLE t1 (x INT NOT NULL UNIQUE KEY) ENGINE=InnoDB;
50+INSERT INTO t1 VALUES(5);
51+
52+# 1. Pause the log tracking thread
53+SET @@GLOBAL.innodb_track_changed_pages=FALSE;
54+SET @@GLOBAL.innodb_log_checkpoint_now=TRUE;
55+
56+# 2. Rename a table to log a MLOG_FILE_RENAME operation
57+RENAME TABLE t1 TO t2;
58+
59+# 3. Start an ALTER TABLE and stop it after the table -> temp table rename
60+--connect (con2,localhost,root,,)
61+--connection default
62+
63+SET DEBUG_SYNC="commit_cache_rebuild_middle SIGNAL alter_table_ready WAIT_FOR finish_alter_table";
64+
65+send ALTER TABLE t2 ADD PRIMARY KEY(x);
66+
67+# 4. Force a checkpoint and resume the log tracker thread, so that it misapplies the t1 > t2 rename.
68+--connection con2
69+
70+SET DEBUG_SYNC="now WAIT_FOR alter_table_ready";
71+
72+SET @@GLOBAL.innodb_log_checkpoint_now=TRUE;
73+SET @@GLOBAL.innodb_track_changed_pages=TRUE;
74+
75+# 5. Force the log tracker to catch up.
76+SET @@GLOBAL.innodb_track_redo_log_now=TRUE;
77+
78+# 6. Finish the ALTER TABLE, which then crashes if the bug is present.
79+SET DEBUG_SYNC="now SIGNAL finish_alter_table";
80+
81+--connection default
82+reap;
83+SET DEBUG_SYNC="RESET";
84+
85+disconnect con2;
86+
87+DROP TABLE t2;
88+
89+--source include/wait_until_count_sessions.inc
90+
91+# SET DEBUG_SYNC="commit_cache_rebuild_middle SIGNAL alter_table_ready WAIT_FOR finish_alter_table";
92+
93+# send ALTER TABLE t2 ADD COLUMN y INT AFTER x, ALGORITHM=INPLACE;
94
95=== added file 'Percona-Server/mysql-test/suite/sys_vars/r/innodb_track_redo_log_now_basic.result'
96--- Percona-Server/mysql-test/suite/sys_vars/r/innodb_track_redo_log_now_basic.result 1970-01-01 00:00:00 +0000
97+++ Percona-Server/mysql-test/suite/sys_vars/r/innodb_track_redo_log_now_basic.result 2013-09-09 16:36:50 +0000
98@@ -0,0 +1,28 @@
99+SELECT @@GLOBAL.innodb_track_redo_log_now;
100+@@GLOBAL.innodb_track_redo_log_now
101+0
102+SET @@GLOBAL.innodb_track_redo_log_now=1;
103+SELECT @@GLOBAL.innodb_track_redo_log_now;
104+@@GLOBAL.innodb_track_redo_log_now
105+0
106+SET @@GLOBAL.innodb_track_redo_log_now=0;
107+SELECT @@GLOBAL.innodb_track_redo_log_now;
108+@@GLOBAL.innodb_track_redo_log_now
109+0
110+SET @@GLOBAL.innodb_track_redo_log_now=ON;
111+SELECT @@GLOBAL.innodb_track_redo_log_now;
112+@@GLOBAL.innodb_track_redo_log_now
113+0
114+SET @@GLOBAL.innodb_track_redo_log_now=OFF;
115+SELECT @@GLOBAL.innodb_track_redo_log_now;
116+@@GLOBAL.innodb_track_redo_log_now
117+0
118+SET @@SESSION.innodb_track_redo_log_now=ON;
119+ERROR HY000: Variable 'innodb_track_redo_log_now' is a GLOBAL variable and should be set with SET GLOBAL
120+SET @@GLOBAL.innodb_track_redo_log_now=1.1;
121+ERROR 42000: Incorrect argument type to variable 'innodb_track_redo_log_now'
122+SET @@GLOBAL.innodb_track_redo_log_now='foo';
123+ERROR 42000: Variable 'innodb_track_redo_log_now' can't be set to the value of 'foo'
124+SET @@GLOBAL.innodb_track_redo_log_now=1e1;
125+ERROR 42000: Incorrect argument type to variable 'innodb_track_redo_log_now'
126+SET @@GLOBAL.innodb_track_redo_log_now=default;
127
128=== modified file 'Percona-Server/mysql-test/suite/sys_vars/t/innodb_track_changed_pages_basic.test'
129--- Percona-Server/mysql-test/suite/sys_vars/t/innodb_track_changed_pages_basic.test 2012-08-22 07:21:28 +0000
130+++ Percona-Server/mysql-test/suite/sys_vars/t/innodb_track_changed_pages_basic.test 2013-09-09 16:36:50 +0000
131@@ -1,6 +1,7 @@
132 # Tests for innodb_track_changed_pages variable
133
134 --source include/have_innodb.inc
135+--source include/have_nodebug.inc
136
137 SELECT COUNT(@@GLOBAL.innodb_track_changed_pages);
138
139
140=== added file 'Percona-Server/mysql-test/suite/sys_vars/t/innodb_track_redo_log_now_basic.test'
141--- Percona-Server/mysql-test/suite/sys_vars/t/innodb_track_redo_log_now_basic.test 1970-01-01 00:00:00 +0000
142+++ Percona-Server/mysql-test/suite/sys_vars/t/innodb_track_redo_log_now_basic.test 2013-09-09 16:36:50 +0000
143@@ -0,0 +1,27 @@
144+# A global BOOL variable
145+
146+--source include/have_innodb.inc
147+--source include/have_debug.inc
148+
149+SELECT @@GLOBAL.innodb_track_redo_log_now;
150+
151+SET @@GLOBAL.innodb_track_redo_log_now=1;
152+SELECT @@GLOBAL.innodb_track_redo_log_now;
153+SET @@GLOBAL.innodb_track_redo_log_now=0;
154+SELECT @@GLOBAL.innodb_track_redo_log_now;
155+SET @@GLOBAL.innodb_track_redo_log_now=ON;
156+SELECT @@GLOBAL.innodb_track_redo_log_now;
157+SET @@GLOBAL.innodb_track_redo_log_now=OFF;
158+SELECT @@GLOBAL.innodb_track_redo_log_now;
159+
160+--error ER_GLOBAL_VARIABLE
161+SET @@SESSION.innodb_track_redo_log_now=ON;
162+
163+--error ER_WRONG_TYPE_FOR_VAR
164+SET @@GLOBAL.innodb_track_redo_log_now=1.1;
165+--error ER_WRONG_VALUE_FOR_VAR
166+SET @@GLOBAL.innodb_track_redo_log_now='foo';
167+--error ER_WRONG_TYPE_FOR_VAR
168+SET @@GLOBAL.innodb_track_redo_log_now=1e1;
169+
170+SET @@GLOBAL.innodb_track_redo_log_now=default;
171
172=== modified file 'Percona-Server/storage/innobase/fil/fil0fil.cc'
173--- Percona-Server/storage/innobase/fil/fil0fil.cc 2013-08-14 03:57:21 +0000
174+++ Percona-Server/storage/innobase/fil/fil0fil.cc 2013-09-09 16:36:50 +0000
175@@ -2365,6 +2365,11 @@
176 */
177 if (!space_id) {
178 return(ptr);
179+ } else {
180+ /* Only replay file ops during recovery. This is a
181+ release-build assert to minimize any data loss risk by a
182+ misapplied file operation. */
183+ ut_a(recv_recovery_is_on());
184 }
185
186 /* Let us try to perform the file operation, if sensible. Note that
187
188=== modified file 'Percona-Server/storage/innobase/handler/ha_innodb.cc'
189--- Percona-Server/storage/innobase/handler/ha_innodb.cc 2013-08-30 13:23:53 +0000
190+++ Percona-Server/storage/innobase/handler/ha_innodb.cc 2013-09-09 16:36:50 +0000
191@@ -15834,6 +15834,7 @@
192 static my_bool innodb_purge_run_now = TRUE;
193 static my_bool innodb_purge_stop_now = TRUE;
194 static my_bool innodb_log_checkpoint_now = TRUE;
195+static my_bool innodb_track_redo_log_now = TRUE;
196
197 /****************************************************************//**
198 Set the purge state to RUN. If purge is disabled then it
199@@ -15907,6 +15908,31 @@
200 fil_flush_file_spaces(FIL_TABLESPACE);
201 }
202 }
203+
204+/****************************************************************//**
205+Force log tracker to track the log synchronously. */
206+static
207+void
208+track_redo_log_now_set(
209+/*===================*/
210+ THD* thd /*!< in: thread handle */
211+ __attribute__((unused)),
212+ struct st_mysql_sys_var* var /*!< in: pointer to system
213+ variable */
214+ __attribute__((unused)),
215+ void* var_ptr /*!< out: where the formal
216+ string goes */
217+ __attribute__((unused)),
218+ const void* save) /*!< in: immediate result from
219+ check function */
220+{
221+ if (*(my_bool*) save && srv_track_changed_pages) {
222+
223+ log_online_follow_redo_log();
224+ }
225+}
226+
227+
228 #endif /* UNIV_DEBUG */
229
230 /***********************************************************************
231@@ -15964,7 +15990,6 @@
232 }
233
234
235-
236 /***********************************************************************
237 Find and retrieve the size of the current result
238 @return number of matching rows */
239@@ -16162,6 +16187,12 @@
240 PLUGIN_VAR_OPCMDARG,
241 "Force checkpoint now",
242 NULL, checkpoint_now_set, FALSE);
243+
244+static MYSQL_SYSVAR_BOOL(track_redo_log_now,
245+ innodb_track_redo_log_now,
246+ PLUGIN_VAR_OPCMDARG,
247+ "Force log tracker to catch up with checkpoint now",
248+ NULL, track_redo_log_now_set, FALSE);
249 #endif /* UNIV_DEBUG */
250
251 static MYSQL_SYSVAR_ULONG(purge_batch_size, srv_purge_batch_size,
252@@ -16829,9 +16860,15 @@
253 NULL, NULL, SRV_STATS_NULLS_EQUAL, &innodb_stats_method_typelib);
254
255 static MYSQL_SYSVAR_BOOL(track_changed_pages, srv_track_changed_pages,
256- PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
257- "Track the redo log for changed pages and output a changed page bitmap",
258- NULL, NULL, FALSE);
259+ PLUGIN_VAR_NOCMDARG
260+#ifndef UNIV_DEBUG
261+ /* Make this variable dynamic for debug builds to
262+ provide a testcase sync facility */
263+ | PLUGIN_VAR_READONLY
264+#endif
265+ ,
266+ "Track the redo log for changed pages and output a changed page bitmap",
267+ NULL, NULL, FALSE);
268
269 static MYSQL_SYSVAR_ULONGLONG(max_bitmap_file_size, srv_max_bitmap_file_size,
270 PLUGIN_VAR_RQCMDARG,
271@@ -17111,6 +17148,7 @@
272 MYSQL_SYSVAR(purge_run_now),
273 MYSQL_SYSVAR(purge_stop_now),
274 MYSQL_SYSVAR(log_checkpoint_now),
275+ MYSQL_SYSVAR(track_redo_log_now),
276 #endif /* UNIV_DEBUG */
277 #if defined UNIV_DEBUG || defined UNIV_PERF_DEBUG
278 MYSQL_SYSVAR(page_hash_locks),
279
280=== modified file 'Percona-Server/storage/innobase/handler/handler0alter.cc'
281--- Percona-Server/storage/innobase/handler/handler0alter.cc 2013-08-06 15:16:34 +0000
282+++ Percona-Server/storage/innobase/handler/handler0alter.cc 2013-09-09 16:36:50 +0000
283@@ -4892,6 +4892,8 @@
284 ctx->old_table, ctx->tmp_name, FALSE);
285 ut_a(error == DB_SUCCESS);
286
287+ DEBUG_SYNC_C("commit_cache_rebuild_middle");
288+
289 error = dict_table_rename_in_cache(
290 ctx->new_table, old_name, FALSE);
291 ut_a(error == DB_SUCCESS);
292
293=== modified file 'Percona-Server/storage/innobase/log/log0recv.cc'
294--- Percona-Server/storage/innobase/log/log0recv.cc 2013-08-14 03:57:21 +0000
295+++ Percona-Server/storage/innobase/log/log0recv.cc 2013-09-09 16:36:50 +0000
296@@ -1313,7 +1313,8 @@
297 break;
298 case MLOG_FILE_RENAME:
299 ptr = fil_op_log_parse_or_replay(ptr, end_ptr, type,
300- space_id, 0);
301+ (recv_recovery_is_on()
302+ ? space_id : 0), 0);
303 break;
304 case MLOG_FILE_CREATE:
305 case MLOG_FILE_DELETE:
306
307=== modified file 'Percona-Server/storage/innobase/srv/srv0srv.cc'
308--- Percona-Server/storage/innobase/srv/srv0srv.cc 2013-09-02 12:24:08 +0000
309+++ Percona-Server/storage/innobase/srv/srv0srv.cc 2013-09-09 16:36:50 +0000
310@@ -2218,6 +2218,12 @@
311 os_event_wait(srv_checkpoint_completed_event);
312 os_event_reset(srv_checkpoint_completed_event);
313
314+#ifdef UNIV_DEBUG
315+ if (!srv_track_changed_pages) {
316+ continue;
317+ }
318+#endif
319+
320 if (srv_shutdown_state < SRV_SHUTDOWN_LAST_PHASE) {
321 if (!log_online_follow_redo_log()) {
322 /* TODO: sync with I_S log tracking status? */

Subscribers

People subscribed via source and target branches