Merge lp:~vlad-lesin/percona-server/5.1-bug915814 into lp:percona-server/5.1

Proposed by Vlad Lesin on 2014-01-13
Status: Merged
Approved by: Laurynas Biveinis on 2014-01-14
Approved revision: no longer in the source branch.
Merged at revision: 609
Proposed branch: lp:~vlad-lesin/percona-server/5.1-bug915814
Merge into: lp:percona-server/5.1
Diff against target: 67 lines (+27/-1)
4 files modified
Percona-Server/mysql-test/r/percona_bug856404.result (+8/-0)
Percona-Server/mysql-test/t/percona_bug856404-master.opt (+1/-0)
Percona-Server/mysql-test/t/percona_bug856404.test (+15/-0)
Percona-Server/sql/sql_cache.cc (+3/-1)
To merge this branch: bzr merge lp:~vlad-lesin/percona-server/5.1-bug915814
Reviewer Review Type Date Requested Status
Laurynas Biveinis (community) 2014-01-13 Approve on 2014-01-14
Review via email: mp+201368@code.launchpad.net

Description of the change

This is backport of fix for bug #915814 from
  https://code.launchpad.net/~akopytov/percona-server/bug915814-5.5 revision 228.

  Revision 443 of this branch already contains fixes for this bug but not all of them. The
  differences between them are the following:
  1) 5.5 fix uses macros for counting buffer size for query in replication slave
  event handler while 5.1 fix does not;
  2) QueryStripComments::set() - copy the next symbol from query string to buffer
  only if it's index does not exceed query length;
  3) QueryStripComments_Backup::QueryStripComments_Backup() - copy current DB name
  length(thd->db_length) to the end of QueryStripComments::query() buffer after
  terminating NULL;
  4) Query_cache::send_result_to_client() - the same as 3;
  5) percona_bug856404 test case.

  All items except 1 are backported.

http://jenkins.percona.com/view/PS%205.1/job/percona-server-5.1-param/592

To post a comment you must log in.
review: Approve
596. By Vlad Lesin on 2014-03-03

This is backport of fix for bug #915814 from
https://code.launchpad.net/~akopytov/percona-server/bug915814-5.5 revision 228.

Revision 443 of this branch already contains fixes for this bug but not all of them. The
differences between them are the following:
1) 5.5 fix uses macros for counting buffer size for query in replication slave
event handler while 5.1 fix does not;
2) QueryStripComments::set() - copy the next symbol from query string to buffer
only if it's index does not exceed query length;
3) QueryStripComments_Backup::QueryStripComments_Backup() - copy current DB name
length(thd->db_length) to the end of QueryStripComments::query() buffer after
terminating NULL;
4) Query_cache::send_result_to_client() - the same as 3;
5) percona_bug856404 test case.

All items except 1 are backported.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'Percona-Server/mysql-test/r/percona_bug856404.result'
2--- Percona-Server/mysql-test/r/percona_bug856404.result 1970-01-01 00:00:00 +0000
3+++ Percona-Server/mysql-test/r/percona_bug856404.result 2014-03-03 08:12:47 +0000
4@@ -0,0 +1,8 @@
5+DROP TABLE IF EXISTS table17_int;
6+DROP TABLE IF EXISTS table30_int;
7+CREATE TABLE `table17_int` (pk integer auto_increment primary key, `col_char_10_not_null_key` char(10), `col_enum_not_null_key` int);
8+CREATE TABLE `table30_int` (pk integer auto_increment primary key, `col_enum_not_null_key` int);
9+SELECT X . `pk` FROM `table17_int` AS X LEFT JOIN `table30_int` AS Y USING ( `col_enum_not_null_key` ) WHERE X . `col_char_10_not_null_key` != ' you need to translate Views labels into other languages, consider installing the <a href=\" !path\">Internationalization</a> package\'s Views translation module.' LIMIT 7 /*Generated by THREAD_ID 1*/;
10+pk
11+DROP TABLE table17_int;
12+DROP TABLE table30_int;
13
14=== added file 'Percona-Server/mysql-test/t/percona_bug856404-master.opt'
15--- Percona-Server/mysql-test/t/percona_bug856404-master.opt 1970-01-01 00:00:00 +0000
16+++ Percona-Server/mysql-test/t/percona_bug856404-master.opt 2014-03-03 08:12:47 +0000
17@@ -0,0 +1,1 @@
18+--query-cache-size=10M --query-cache-strip-comments
19
20=== added file 'Percona-Server/mysql-test/t/percona_bug856404.test'
21--- Percona-Server/mysql-test/t/percona_bug856404.test 1970-01-01 00:00:00 +0000
22+++ Percona-Server/mysql-test/t/percona_bug856404.test 2014-03-03 08:12:47 +0000
23@@ -0,0 +1,15 @@
24+########################################################################
25+# Bug #856404: Crash when query_cache_strip_comments enabled
26+########################################################################
27+
28+--disable_warnings
29+DROP TABLE IF EXISTS table17_int;
30+DROP TABLE IF EXISTS table30_int;
31+--enable_warnings
32+
33+CREATE TABLE `table17_int` (pk integer auto_increment primary key, `col_char_10_not_null_key` char(10), `col_enum_not_null_key` int);
34+CREATE TABLE `table30_int` (pk integer auto_increment primary key, `col_enum_not_null_key` int);
35+SELECT X . `pk` FROM `table17_int` AS X LEFT JOIN `table30_int` AS Y USING ( `col_enum_not_null_key` ) WHERE X . `col_char_10_not_null_key` != ' you need to translate Views labels into other languages, consider installing the <a href=\" !path\">Internationalization</a> package\'s Views translation module.' LIMIT 7 /*Generated by THREAD_ID 1*/;
36+
37+DROP TABLE table17_int;
38+DROP TABLE table30_int;
39
40=== modified file 'Percona-Server/sql/sql_cache.cc'
41--- Percona-Server/sql/sql_cache.cc 2013-06-03 03:53:55 +0000
42+++ Percona-Server/sql/sql_cache.cc 2014-03-03 08:12:47 +0000
43@@ -466,7 +466,7 @@
44 buffer[position++] = ' ';
45 }
46 }
47- else
48+ else if (query_position < query_length)
49 {
50 buffer[position++] = query[query_position++];
51 }
52@@ -496,6 +496,7 @@
53 query = thd->query();
54 length = thd->query_length();
55 qsc->set(query,length,thd->db_length + sizeof(size_t) + 1 + QUERY_CACHE_FLAGS_SIZE);
56+ *(size_t *) (qsc->query() + qsc->query_length() + 1)= thd->db_length;
57 thd->set_query(qsc->query(),qsc->query_length());
58 }
59 else
60@@ -1788,6 +1789,7 @@
61 thd->db_length + QUERY_CACHE_FLAGS_SIZE);
62 sql = query_strip_comments->query();
63 query_length = query_strip_comments->query_length();
64+ *(size_t *) (sql + query_length + 1)= thd->db_length;
65 }
66
67 tot_length= query_length + 1 + sizeof(size_t) +

Subscribers

People subscribed via source and target branches