Merge lp:~akopytov/percona-server/bug1233841-5.6 into lp:percona-server/5.6

Proposed by Alexey Kopytov on 2013-11-25
Status: Merged
Approved by: Alexey Kopytov on 2013-11-25
Approved revision: 499
Merged at revision: 499
Proposed branch: lp:~akopytov/percona-server/bug1233841-5.6
Merge into: lp:percona-server/5.6
Diff against target: 124 lines (+83/-2)
3 files modified
Percona-Server/client/mysqldump.c (+7/-2)
Percona-Server/mysql-test/r/percona_mysqldump_innodb_optimize_keys.result (+49/-0)
Percona-Server/mysql-test/t/percona_mysqldump_innodb_optimize_keys.test (+27/-0)
To merge this branch: bzr merge lp:~akopytov/percona-server/bug1233841-5.6
Reviewer Review Type Date Requested Status
Alexey Kopytov (community) Approve on 2013-11-25
Review via email: mp+196491@code.launchpad.net

Description of the change

Cherry-picked fix for #1233841 from
lp:~pomyks/percona-server/5.5-bug1233841 as that branch was based on a
GCA revision.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Percona-Server/client/mysqldump.c'
2--- Percona-Server/client/mysqldump.c 2013-10-23 08:48:28 +0000
3+++ Percona-Server/client/mysqldump.c 2013-11-25 08:15:58 +0000
4@@ -2640,11 +2640,12 @@
5 const char *constr_from;
6 const char *constr_to;
7 LIST *keydef_node;
8+ my_bool keys_processed= FALSE;
9
10 strend= create_str + strlen(create_str);
11
12 ptr= create_str;
13- while (*ptr)
14+ while (*ptr && !keys_processed)
15 {
16 char *tmp, *orig_ptr, c;
17
18@@ -2728,7 +2729,11 @@
19 {
20 char *end;
21
22- if (last_comma != NULL && *ptr != ')')
23+ if (last_comma != NULL && *ptr == ')')
24+ {
25+ keys_processed= TRUE;
26+ }
27+ else if (last_comma != NULL && !keys_processed)
28 {
29 /*
30 It's not the last line of CREATE TABLE, so we have skipped a key
31
32=== modified file 'Percona-Server/mysql-test/r/percona_mysqldump_innodb_optimize_keys.result'
33--- Percona-Server/mysql-test/r/percona_mysqldump_innodb_optimize_keys.result 2013-05-27 03:01:29 +0000
34+++ Percona-Server/mysql-test/r/percona_mysqldump_innodb_optimize_keys.result 2013-11-25 08:15:58 +0000
35@@ -524,3 +524,52 @@
36
37 ######################################
38 DROP TABLE t1;
39+CREATE TABLE `t1` (
40+`id` int(11) NOT NULL AUTO_INCREMENT,
41+`c1` int(11) DEFAULT NULL,
42+PRIMARY KEY (`id`),
43+KEY `c1` (`c1`)
44+) ENGINE=InnoDB DEFAULT CHARSET=utf8
45+/*!50100 PARTITION BY HASH (id)
46+PARTITIONS 2*/;
47+######################################
48+
49+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
50+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
51+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
52+/*!40101 SET NAMES utf8 */;
53+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
54+/*!40103 SET TIME_ZONE='+00:00' */;
55+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
56+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
57+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
58+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
59+DROP TABLE IF EXISTS `t1`;
60+/*!40101 SET @saved_cs_client = @@character_set_client */;
61+/*!40101 SET character_set_client = utf8 */;
62+CREATE TABLE `t1` (
63+ `id` int(11) NOT NULL AUTO_INCREMENT,
64+ `c1` int(11) DEFAULT NULL,
65+ PRIMARY KEY (`id`)
66+) ENGINE=InnoDB DEFAULT CHARSET=utf8
67+/*!50100 PARTITION BY HASH (id)
68+PARTITIONS 2 */;
69+/*!40101 SET character_set_client = @saved_cs_client */;
70+
71+LOCK TABLES `t1` WRITE;
72+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
73+ALTER TABLE `t1` ADD KEY `c1` (`c1`);
74+/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
75+UNLOCK TABLES;
76+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
77+
78+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
79+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
80+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
81+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
82+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
83+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
84+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
85+
86+######################################
87+DROP TABLE t1;
88
89=== modified file 'Percona-Server/mysql-test/t/percona_mysqldump_innodb_optimize_keys.test'
90--- Percona-Server/mysql-test/t/percona_mysqldump_innodb_optimize_keys.test 2013-03-26 04:07:47 +0000
91+++ Percona-Server/mysql-test/t/percona_mysqldump_innodb_optimize_keys.test 2013-11-25 08:15:58 +0000
92@@ -271,5 +271,32 @@
93
94 DROP TABLE t1;
95
96+#############################################################################
97+# Bug #1233841: mysqldump --innodb-optimize-keys produces incorrect
98+# CREATE TABLE statement for partitioned tables
99+#############################################################################
100+
101+CREATE TABLE `t1` (
102+ `id` int(11) NOT NULL AUTO_INCREMENT,
103+ `c1` int(11) DEFAULT NULL,
104+ PRIMARY KEY (`id`),
105+ KEY `c1` (`c1`)
106+) ENGINE=InnoDB DEFAULT CHARSET=utf8
107+/*!50100 PARTITION BY HASH (id)
108+PARTITIONS 2*/;
109+
110+--exec $MYSQL_DUMP --skip-comments --innodb-optimize-keys test t1 >$file
111+
112+--echo ######################################
113+--cat_file $file
114+--echo ######################################
115+
116+# Check that the resulting dump can be imported back
117+
118+--exec $MYSQL test < $file
119+
120+--remove_file $file
121+
122+DROP TABLE t1;
123 # Wait till we reached the initial number of concurrent sessions
124 --source include/wait_until_count_sessions.inc

Subscribers

People subscribed via source and target branches