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

Proposed by Laurynas Biveinis
Status: Merged
Approved by: Sergei Glushchenko
Approved revision: no longer in the source branch.
Merged at revision: 625
Proposed branch: lp:~laurynas-biveinis/percona-server/bug1193332-5.6
Merge into: lp:percona-server/5.6
Diff against target: 221 lines (+120/-19)
7 files modified
mysql-test/suite/innodb/r/percona_changed_page_bmp_debug.result (+16/-0)
mysql-test/suite/innodb/t/percona_changed_page_bmp_debug.test (+56/-0)
storage/innobase/handler/i_s.cc (+12/-0)
storage/innobase/include/log0log.h (+12/-0)
storage/innobase/include/log0log.ic (+21/-0)
storage/innobase/log/log0log.cc (+0/-19)
storage/innobase/log/log0online.cc (+3/-0)
To merge this branch: bzr merge lp:~laurynas-biveinis/percona-server/bug1193332-5.6
Reviewer Review Type Date Requested Status
Sergei Glushchenko (community) g2 Approve
Review via email: mp+222800@code.launchpad.net

Description of the change

To post a comment you must log in.
Revision history for this message
Sergei Glushchenko (sergei.glushchenko) wrote :

Approve

review: Approve (g2)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'mysql-test/suite/innodb/r/percona_changed_page_bmp_debug.result'
--- mysql-test/suite/innodb/r/percona_changed_page_bmp_debug.result 2013-09-25 06:04:21 +0000
+++ mysql-test/suite/innodb/r/percona_changed_page_bmp_debug.result 2014-06-11 13:23:16 +0000
@@ -43,3 +43,19 @@
43ERROR HY000: Can't read record in system table43ERROR HY000: Can't read record in system table
44SET DEBUG_SYNC="RESET";44SET DEBUG_SYNC="RESET";
45DROP TABLE t2;45DROP TABLE t2;
46RESET CHANGED_PAGE_BITMAPS;
474th restart
48SET DEBUG_SYNC="i_s_innodb_changed_pages_range_ready SIGNAL ready WAIT_FOR finish";
49SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES;
50SET DEBUG_SYNC="now WAIT_FOR ready";
51SET @@GLOBAL.innodb_track_changed_pages=FALSE;
52SET @@GLOBAL.innodb_log_checkpoint_now=TRUE;
53CREATE TABLE t1 (a INT)ENGINE=InnoDB;
54INSERT INTO t1 VALUES (1);
55CREATE TABLE t2 (a INT) ENGINE=InnoDB;
56INSERT INTO t2 VALUES (2);
57SET @@GLOBAL.innodb_log_checkpoint_now=TRUE;
58SET @@GLOBAL.innodb_track_changed_pages=TRUE;
59SET @@GLOBAL.innodb_track_redo_log_now=TRUE;
60SET DEBUG_SYNC="now SIGNAL finish";
61DROP TABLE t1, t2;
4662
=== modified file 'mysql-test/suite/innodb/t/percona_changed_page_bmp_debug.test'
--- mysql-test/suite/innodb/t/percona_changed_page_bmp_debug.test 2013-09-25 06:04:21 +0000
+++ mysql-test/suite/innodb/t/percona_changed_page_bmp_debug.test 2014-06-11 13:23:16 +0000
@@ -131,5 +131,61 @@
131disconnect con2;131disconnect con2;
132132
133DROP TABLE t2;133DROP TABLE t2;
134RESET CHANGED_PAGE_BITMAPS;
135
136--source include/wait_until_count_sessions.inc
137
138#
139# Test for bug 1193332 ([Warning] InnoDB: changed page bitmap file
140# './ib_modified_log_11_951286349.xdb' does not contain a complete run at the end.)
141#
142
143# Setup an error on the 2nd bitmap page write, so that bitmap contains an incomplete run
144--echo 4th restart
145--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
146--shutdown_server 10
147--source include/wait_until_disconnected.inc
148--enable_reconnect
149--exec echo "restart:-#d,bitmap_page_2_write_error" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
150--source include/wait_until_connected_again.inc
151
152--source include/count_sessions.inc
153
154--connect(con2,localhost,root,,)
155
156SET DEBUG_SYNC="i_s_innodb_changed_pages_range_ready SIGNAL ready WAIT_FOR finish";
157send SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES;
158
159--connection default
160
161SET DEBUG_SYNC="now WAIT_FOR ready";
162
163# Pause the log tracker
164SET @@GLOBAL.innodb_track_changed_pages=FALSE;
165SET @@GLOBAL.innodb_log_checkpoint_now=TRUE;
166
167# Prepare two pages of bitmap data
168CREATE TABLE t1 (a INT)ENGINE=InnoDB;
169INSERT INTO t1 VALUES (1);
170CREATE TABLE t2 (a INT) ENGINE=InnoDB;
171INSERT INTO t2 VALUES (2);
172
173# Resume the log tracker so it crashes after writing one page
174SET @@GLOBAL.innodb_log_checkpoint_now=TRUE;
175SET @@GLOBAL.innodb_track_changed_pages=TRUE;
176SET @@GLOBAL.innodb_track_redo_log_now=TRUE;
177
178SET DEBUG_SYNC="now SIGNAL finish";
179
180--connection con2
181# With the bug present the query will fail with ER_CANT_FIND_SYSTEM_REC
182--disable_result_log
183reap;
184--enable_result_log
185
186--disconnect con2
187--connection default
188
189DROP TABLE t1, t2;
134190
135--source include/wait_until_count_sessions.inc191--source include/wait_until_count_sessions.inc
136192
=== modified file 'storage/innobase/handler/i_s.cc'
--- storage/innobase/handler/i_s.cc 2014-04-24 05:16:52 +0000
+++ storage/innobase/handler/i_s.cc 2014-06-11 13:23:16 +0000
@@ -42,6 +42,7 @@
42#include "i_s.h"42#include "i_s.h"
43#include <sql_plugin.h>43#include <sql_plugin.h>
44#include <mysql/innodb_priv.h>44#include <mysql/innodb_priv.h>
45#include <debug_sync.h>
4546
46#include "btr0pcur.h"47#include "btr0pcur.h"
47#include "btr0types.h"48#include "btr0types.h"
@@ -8435,12 +8436,23 @@
8435 limit_lsn_range_from_condition(table, cond, &min_lsn,8436 limit_lsn_range_from_condition(table, cond, &min_lsn,
8436 &max_lsn);8437 &max_lsn);
8437 }8438 }
8439
8440 /* If the log tracker is running and our max_lsn > current tracked LSN,
8441 cap the max lsn so that we don't try to read any partial runs as the
8442 tracked LSN advances. */
8443 if (srv_track_changed_pages) {
8444 ib_uint64_t tracked_lsn = log_get_tracked_lsn();
8445 if (max_lsn > tracked_lsn)
8446 max_lsn = tracked_lsn;
8447 }
84388448
8439 if (!log_online_bitmap_iterator_init(&i, min_lsn, max_lsn)) {8449 if (!log_online_bitmap_iterator_init(&i, min_lsn, max_lsn)) {
8440 my_error(ER_CANT_FIND_SYSTEM_REC, MYF(0));8450 my_error(ER_CANT_FIND_SYSTEM_REC, MYF(0));
8441 DBUG_RETURN(1);8451 DBUG_RETURN(1);
8442 }8452 }
84438453
8454 DEBUG_SYNC(thd, "i_s_innodb_changed_pages_range_ready");
8455
8444 while(log_online_bitmap_iterator_next(&i) &&8456 while(log_online_bitmap_iterator_next(&i) &&
8445 (!srv_max_changed_pages ||8457 (!srv_max_changed_pages ||
8446 output_rows_num < srv_max_changed_pages) &&8458 output_rows_num < srv_max_changed_pages) &&
84478459
=== modified file 'storage/innobase/include/log0log.h'
--- storage/innobase/include/log0log.h 2014-03-03 17:51:33 +0000
+++ storage/innobase/include/log0log.h 2014-06-11 13:23:16 +0000
@@ -593,6 +593,18 @@
593log_mem_free(void);593log_mem_free(void);
594/*==============*/594/*==============*/
595595
596/****************************************************************//**
597Safely reads the log_sys->tracked_lsn value. Uses atomic operations
598if available, otherwise this field is protected with the log system
599mutex. The writer counterpart function is log_set_tracked_lsn() in
600log0online.c.
601
602@return log_sys->tracked_lsn value. */
603UNIV_INLINE
604lsn_t
605log_get_tracked_lsn(void);
606/*=====================*/
607
596extern log_t* log_sys;608extern log_t* log_sys;
597609
598/* Values used as flags */610/* Values used as flags */
599611
=== modified file 'storage/innobase/include/log0log.ic'
--- storage/innobase/include/log0log.ic 2013-10-23 08:48:28 +0000
+++ storage/innobase/include/log0log.ic 2014-06-11 13:23:16 +0000
@@ -512,3 +512,24 @@
512 }512 }
513}513}
514#endif /* !UNIV_HOTBACKUP */514#endif /* !UNIV_HOTBACKUP */
515
516/****************************************************************//**
517Safely reads the log_sys->tracked_lsn value. Uses atomic operations
518if available, otherwise this field is protected with the log system
519mutex. The writer counterpart function is log_set_tracked_lsn() in
520log0online.c.
521
522@return log_sys->tracked_lsn value. */
523UNIV_INLINE
524lsn_t
525log_get_tracked_lsn(void)
526/*=====================*/
527{
528#ifdef HAVE_ATOMIC_BUILTINS_64
529 return os_atomic_increment_uint64(&log_sys->tracked_lsn, 0);
530#else
531 ut_ad(mutex_own(&(log_sys->mutex)));
532 return log_sys->tracked_lsn;
533#endif
534}
535
515536
=== modified file 'storage/innobase/log/log0log.cc'
--- storage/innobase/log/log0log.cc 2014-05-19 04:55:11 +0000
+++ storage/innobase/log/log0log.cc 2014-06-11 13:23:16 +0000
@@ -188,25 +188,6 @@
188}188}
189189
190/****************************************************************//**190/****************************************************************//**
191Safely reads the log_sys->tracked_lsn value. Uses atomic operations
192if available, otherwise this field is protected with the log system
193mutex. The writer counterpart function is log_set_tracked_lsn() in
194log0online.c.
195
196@return log_sys->tracked_lsn value. */
197UNIV_INLINE
198lsn_t
199log_get_tracked_lsn()
200{
201#ifdef HAVE_ATOMIC_BUILTINS_64
202 return os_atomic_increment_uint64(&log_sys->tracked_lsn, 0);
203#else
204 ut_ad(mutex_own(&(log_sys->mutex)));
205 return log_sys->tracked_lsn;
206#endif
207}
208
209/****************************************************************//**
210Checks if the log groups have a big enough margin of free space in191Checks if the log groups have a big enough margin of free space in
211so that a new log entry can be written without overwriting log data192so that a new log entry can be written without overwriting log data
212that is not read by the changed page bitmap thread.193that is not read by the changed page bitmap thread.
213194
=== modified file 'storage/innobase/log/log0online.cc'
--- storage/innobase/log/log0online.cc 2014-04-25 10:55:01 +0000
+++ storage/innobase/log/log0online.cc 2014-06-11 13:23:16 +0000
@@ -1196,6 +1196,9 @@
11961196
1197 bmp_tree_node = (ib_rbt_node_t*)1197 bmp_tree_node = (ib_rbt_node_t*)
1198 rbt_next(log_bmp_sys->modified_pages, bmp_tree_node);1198 rbt_next(log_bmp_sys->modified_pages, bmp_tree_node);
1199
1200 DBUG_EXECUTE_IF("bitmap_page_2_write_error",
1201 DBUG_SET("+d,bitmap_page_write_error"););
1199 }1202 }
12001203
1201 rbt_reset(log_bmp_sys->modified_pages);1204 rbt_reset(log_bmp_sys->modified_pages);

Subscribers

People subscribed via source and target branches