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

Proposed by Laurynas Biveinis
Status: Merged
Approved by: Vlad Lesin
Approved revision: no longer in the source branch.
Merged at revision: 591
Proposed branch: lp:~laurynas-biveinis/percona-server/bug1191580-1191589-5.1
Merge into: lp:percona-server/5.1
Prerequisite: lp:~laurynas-biveinis/percona-server/bug1217002-5.1
Diff against target: 158 lines (+73/-7)
4 files modified
Percona-Server/mysql-test/suite/innodb_plugin/r/percona_changed_page_bmp_debug.result (+6/-0)
Percona-Server/mysql-test/suite/innodb_plugin/t/percona_changed_page_bmp_debug.test (+31/-0)
Percona-Server/storage/innodb_plugin/handler/i_s.cc (+2/-0)
Percona-Server/storage/innodb_plugin/log/log0online.c (+34/-7)
To merge this branch: bzr merge lp:~laurynas-biveinis/percona-server/bug1191580-1191589-5.1
Reviewer Review Type Date Requested Status
Vlad Lesin (community) g2 Approve
Registry Administrators Pending
Review via email: mp+187456@code.launchpad.net

This proposal supersedes a proposal from 2013-09-20.

Description of the change

No BT or ST, 5.6 QA blocker.

2nd MP:

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

Changes from the 1st MP:
- Addressed schema_store_table_record() comment.
- Merged bug 1204075 change from XtraBackup.

1st MP:

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

Fix
- bug 1191580 (InnoDB: Failing assertion:
  bitmap_files->files[0].seq_num == first_file_seq_num in file
  log0online.cc line 1423 | abort in
  log_online_setup_bitmap_file_range);
- bug 1191589 (mysqld-debug: .../sql/protocol.cc:518: void
  Protocol::end_statement(): Assertion `0' failed on a
  INFORMATION_SCHEMA.INNODB_CHANGED_PAGES query).

The issue is bug 1191580 is a race condition between the two bitmap
file enumeration passes in log_online_setup_bitmap_file_range(). If
the 1st bitmap file in the range is deleted at that point, then the
debug build will crash as reported on this bug. For release builds
this is not an issue as the missing bitmap file will be detected and
diagnosed on an attempt to open it, as fixed by bug 1179974. The
current bug shows that the fix for the latter was incomplete.

Fixed by adjusting the range check code in
log_online_setup_bitmap_file_range() to check for the above condition,
print diagnostics, and return range setup error. Since these
diagnostics are now printed in two places instead of one, pull it out
to a new static function log_online_diagnose_inconsistent_dir().
Adjust it to print "Warning" instead of "Error" as it's not a fatal
issue.

At the same time fix bug 1191589. The issue there is that on
log_online_bitmap_iterator_init() failure (such as bug 1191580), the
error is not returned to client properly. Fixed by returning
ER_CANT_FIND_SYSTEM_REC. At the same time replace
schema_table_store_record() return value check with an OK() assert to
avoid having to return some error in the case of its failure as well.

Add a testcase, common for both bugs, to
percona_changed_page_bmp_debug.test.

To post a comment you must log in.
Revision history for this message
Vlad Lesin (vlad-lesin) wrote : Posted in a previous version of this proposal

This change

@@ -4029,11 +4030,7 @@
                if (cond && !cond->val_int())
                        continue;

- if (schema_table_store_record(thd, table))
- {
- log_online_bitmap_iterator_release(&i);
- DBUG_RETURN(1);
- }
+ OK(schema_table_store_record(thd, table));

                ++output_rows_num;
        }

should be reverted because if schema_table_store_record() fails (for example there is no free space for MyISAM temp table) there will be memory leak as heap memory allocation was done during initialization of "i" iterator.

review: Needs Fixing (g2)
Revision history for this message
Vlad Lesin (vlad-lesin) :
review: Approve (g2)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'Percona-Server/mysql-test/suite/innodb_plugin/r/percona_changed_page_bmp_debug.result'
--- Percona-Server/mysql-test/suite/innodb_plugin/r/percona_changed_page_bmp_debug.result 2013-09-09 13:09:38 +0000
+++ Percona-Server/mysql-test/suite/innodb_plugin/r/percona_changed_page_bmp_debug.result 2013-09-25 07:59:41 +0000
@@ -33,5 +33,11 @@
33SET @@GLOBAL.innodb_track_changed_pages=TRUE;33SET @@GLOBAL.innodb_track_changed_pages=TRUE;
34SET @@GLOBAL.innodb_track_redo_log_now=TRUE;34SET @@GLOBAL.innodb_track_redo_log_now=TRUE;
35SET DEBUG_SYNC="now SIGNAL finish_alter_table";35SET DEBUG_SYNC="now SIGNAL finish_alter_table";
36SET DEBUG_SYNC="setup_bitmap_range_middle SIGNAL changed_pages_query_ready WAIT_FOR finish_changed_pages_query";
37SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES;
38SET DEBUG_SYNC="now WAIT_FOR changed_pages_query_ready";
39call mtr.add_suppression("InnoDB: Warning: inconsistent bitmap file directory");
40SET DEBUG_SYNC="now SIGNAL finish_changed_pages_query";
41ERROR HY000: Can't read record in system table
36SET DEBUG_SYNC="RESET";42SET DEBUG_SYNC="RESET";
37DROP TABLE t2;43DROP TABLE t2;
3844
=== modified file 'Percona-Server/mysql-test/suite/innodb_plugin/t/percona_changed_page_bmp_debug.test'
--- Percona-Server/mysql-test/suite/innodb_plugin/t/percona_changed_page_bmp_debug.test 2013-09-09 13:09:38 +0000
+++ Percona-Server/mysql-test/suite/innodb_plugin/t/percona_changed_page_bmp_debug.test 2013-09-25 07:59:41 +0000
@@ -93,6 +93,37 @@
9393
94--connection default94--connection default
95reap;95reap;
96
97#
98# Test for
99# - bug 1191580 (InnoDB: Failing assertion: bitmap_files->files[0].seq_num
100# == first_file_seq_num in file log0online.cc line 1423 | abort in
101# log_online_setup_bitmap_file_range)
102# - bug 1191589 (mysqld-debug: .../sql/protocol.cc:518: void
103# Protocol::end_statement(): Assertion `0' failed on a
104# INFORMATION_SCHEMA.INNODB_CHANGED_PAGES query)
105#
106
107SET DEBUG_SYNC="setup_bitmap_range_middle SIGNAL changed_pages_query_ready WAIT_FOR finish_changed_pages_query";
108
109send SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES;
110
111--connection con2
112
113SET DEBUG_SYNC="now WAIT_FOR changed_pages_query_ready";
114
115# Remove the first bitmap file in the range after it has been enumerated
116remove_files_wildcard $MYSQLD_DATADIR ib_modified_log_1_*.xdb;
117
118call mtr.add_suppression("InnoDB: Warning: inconsistent bitmap file directory");
119
120SET DEBUG_SYNC="now SIGNAL finish_changed_pages_query";
121
122--connection default
123
124--error ER_CANT_FIND_SYSTEM_REC
125reap;
126
96SET DEBUG_SYNC="RESET";127SET DEBUG_SYNC="RESET";
97128
98disconnect con2;129disconnect con2;
99130
=== modified file 'Percona-Server/storage/innodb_plugin/handler/i_s.cc'
--- Percona-Server/storage/innodb_plugin/handler/i_s.cc 2013-08-05 13:11:52 +0000
+++ Percona-Server/storage/innodb_plugin/handler/i_s.cc 2013-09-25 07:59:41 +0000
@@ -3969,6 +3969,7 @@
3969 }3969 }
39703970
3971 if (!log_online_bitmap_iterator_init(&i, min_lsn, max_lsn)) {3971 if (!log_online_bitmap_iterator_init(&i, min_lsn, max_lsn)) {
3972 my_error(ER_CANT_FIND_SYSTEM_REC, MYF(0));
3972 DBUG_RETURN(1);3973 DBUG_RETURN(1);
3973 }3974 }
39743975
@@ -4032,6 +4033,7 @@
4032 if (schema_table_store_record(thd, table))4033 if (schema_table_store_record(thd, table))
4033 {4034 {
4034 log_online_bitmap_iterator_release(&i);4035 log_online_bitmap_iterator_release(&i);
4036 my_error(ER_CANT_FIND_SYSTEM_REC, MYF(0));
4035 DBUG_RETURN(1);4037 DBUG_RETURN(1);
4036 }4038 }
40374039
40384040
=== modified file 'Percona-Server/storage/innodb_plugin/log/log0online.c'
--- Percona-Server/storage/innodb_plugin/log/log0online.c 2013-05-31 09:06:13 +0000
+++ Percona-Server/storage/innodb_plugin/log/log0online.c 2013-09-25 07:59:41 +0000
@@ -34,6 +34,14 @@
34#include "trx0sys.h"34#include "trx0sys.h"
35#include "ut0rbt.h"35#include "ut0rbt.h"
3636
37#ifdef __WIN__
38/* error LNK2001: unresolved external symbol _debug_sync_C_callback_ptr */
39# define DEBUG_SYNC_C(dummy) ((void) 0)
40#else
41# include "m_string.h" /* for my_sys.h */
42# include "my_sys.h" /* DEBUG_SYNC_C */
43#endif
44
37enum { FOLLOW_SCAN_SIZE = 4 * (UNIV_PAGE_SIZE_MAX) };45enum { FOLLOW_SCAN_SIZE = 4 * (UNIV_PAGE_SIZE_MAX) };
3846
39/** Log parsing and bitmap output data structure */47/** Log parsing and bitmap output data structure */
@@ -1248,6 +1256,24 @@
1248}1256}
12491257
1250/*********************************************************************//**1258/*********************************************************************//**
1259Diagnose a bitmap file range setup failure and free the partially-initialized
1260bitmap file range. */
1261static
1262void
1263log_online_diagnose_inconsistent_dir(
1264/*=================================*/
1265 log_online_bitmap_file_range_t *bitmap_files) /*!<in/out: bitmap file
1266 range */
1267{
1268 fprintf(stderr,
1269 "InnoDB: Warning: inconsistent bitmap file "
1270 "directory for a "
1271 "INFORMATION_SCHEMA.INNODB_CHANGED_PAGES query"
1272 "\n");
1273 free(bitmap_files->files);
1274}
1275
1276/*********************************************************************//**
1251List the bitmap files in srv_data_home and setup their range that contains the1277List the bitmap files in srv_data_home and setup their range that contains the
1252specified LSN interval. This range, if non-empty, will start with a file that1278specified LSN interval. This range, if non-empty, will start with a file that
1253has the greatest LSN equal to or less than the start LSN and will include all1279has the greatest LSN equal to or less than the start LSN and will include all
@@ -1348,6 +1374,8 @@
13481374
1349 bitmap_files->count = last_file_seq_num - first_file_seq_num + 1;1375 bitmap_files->count = last_file_seq_num - first_file_seq_num + 1;
13501376
1377 DEBUG_SYNC_C("setup_bitmap_range_middle");
1378
1351 /* 2nd pass: get the file names in the file_seq_num order */1379 /* 2nd pass: get the file names in the file_seq_num order */
13521380
1353 bitmap_dir = os_file_opendir(srv_data_home, FALSE);1381 bitmap_dir = os_file_opendir(srv_data_home, FALSE);
@@ -1383,12 +1411,7 @@
1383 array_pos = file_seq_num - first_file_seq_num;1411 array_pos = file_seq_num - first_file_seq_num;
1384 if (UNIV_UNLIKELY(array_pos >= bitmap_files->count)) {1412 if (UNIV_UNLIKELY(array_pos >= bitmap_files->count)) {
13851413
1386 fprintf(stderr,1414 log_online_diagnose_inconsistent_dir(bitmap_files);
1387 "InnoDB: Error: inconsistent bitmap file "
1388 "directory for a "
1389 "INFORMATION_SCHEMA.INNODB_CHANGED_PAGES query"
1390 "\n");
1391 free(bitmap_files->files);
1392 return FALSE;1415 return FALSE;
1393 }1416 }
13941417
@@ -1415,8 +1438,12 @@
1415 }1438 }
14161439
1417#ifdef UNIV_DEBUG1440#ifdef UNIV_DEBUG
1441 if (!bitmap_files->files[0].seq_num) {
1442
1443 log_online_diagnose_inconsistent_dir(bitmap_files);
1444 return FALSE;
1445 }
1418 ut_ad(bitmap_files->files[0].seq_num == first_file_seq_num);1446 ut_ad(bitmap_files->files[0].seq_num == first_file_seq_num);
1419 ut_ad(bitmap_files->files[0].start_lsn == first_file_start_lsn);
1420 {1447 {
1421 size_t i;1448 size_t i;
1422 for (i = 1; i < bitmap_files->count; i++) {1449 for (i = 1; i < bitmap_files->count; i++) {

Subscribers

People subscribed via source and target branches