Merge lp:~stewart/percona-server/bug1011047 into lp:percona-server/5.5

Proposed by Stewart Smith
Status: Work in progress
Proposed branch: lp:~stewart/percona-server/bug1011047
Merge into: lp:percona-server/5.5
Diff against target: 235 lines (+187/-5)
5 files modified
Percona-Server/mysql-test/include/have_example_plugin.inc (+2/-2)
Percona-Server/mysql-test/r/percona_plugin_with_userstats.result (+65/-0)
Percona-Server/mysql-test/t/percona_plugin_with_userstats-master.opt (+2/-0)
Percona-Server/mysql-test/t/percona_plugin_with_userstats.test (+115/-0)
Percona-Server/sql/mysqld.cc (+3/-3)
To merge this branch: bzr merge lp:~stewart/percona-server/bug1011047
Reviewer Review Type Date Requested Status
Laurynas Biveinis (community) Needs Fixing
Review via email: mp+121114@code.launchpad.net

Description of the change

Fix "can't start server with plugins loaded" bug. Basically, we were initing the userstats features too late.

http://jenkins.percona.com/view/PS%205.5/job/percona-server-5.5-param/477/

To post a comment you must log in.
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

Stewart -

1) Can you reconcile your have_example_plugin.inc fix with Bjorn's reply to you on mysql-internals?
2) Why a simple --source include/restart_mysqld.inc is not enough to replace lines 119--135?
3) Line 98 has "Edit" at the end, a copy paste from somewhere?

review: Needs Fixing

Unmerged revisions

294. By Stewart Smith

Add a test for server not starting with userstats enabled/plugin installed (bug lp:1011047)

293. By Stewart Smith

fix bug: 'mysqld can't startup when a plugin was installed'. table and index statistics were inited too late, they instead need to be inited *before* plugins.

292. By Stewart Smith

fix mysql-test/include/have_example_plugin.inc so that it's compatible with MTRv2 and detects EXAMPLE_PLUGIN_OPT instead of EXAMPLE_PLUGIN.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Percona-Server/mysql-test/include/have_example_plugin.inc'
2--- Percona-Server/mysql-test/include/have_example_plugin.inc 2012-01-20 11:35:48 +0000
3+++ Percona-Server/mysql-test/include/have_example_plugin.inc 2012-08-24 04:41:23 +0000
4@@ -8,8 +8,8 @@
5 #
6 # Check if the variable EXAMPLE_PLUGIN is set
7 #
8-if (!$EXAMPLE_PLUGIN) {
9- --skip Example plugin requires the environment variable \$EXAMPLE_PLUGIN to be set (normally done by mtr)
10+if (!$EXAMPLE_PLUGIN_OPT) {
11+ --skip Requires Example plugin to be built
12 }
13
14 #
15
16=== added file 'Percona-Server/mysql-test/r/percona_plugin_with_userstats.result'
17--- Percona-Server/mysql-test/r/percona_plugin_with_userstats.result 1970-01-01 00:00:00 +0000
18+++ Percona-Server/mysql-test/r/percona_plugin_with_userstats.result 2012-08-24 04:41:23 +0000
19@@ -0,0 +1,65 @@
20+CREATE TABLE t1(a int) ENGINE=EXAMPLE;
21+Warnings:
22+Warning 1286 Unknown storage engine 'EXAMPLE'
23+Warning 1266 Using storage engine MyISAM for table 't1'
24+DROP TABLE t1;
25+INSTALL PLUGIN example SONAME 'ha_example.so';
26+INSTALL PLUGIN EXAMPLE SONAME 'ha_example.so';
27+ERROR HY000: Function 'EXAMPLE' already exists
28+UNINSTALL PLUGIN example;
29+INSTALL PLUGIN example SONAME 'ha_example.so';
30+CREATE TABLE t1(a int) ENGINE=EXAMPLE;
31+SELECT * FROM t1;
32+a
33+DROP TABLE t1;
34+set global example_ulong_var=500;
35+set global example_enum_var= e1;
36+show status like 'example%';
37+Variable_name Value
38+example_func_example enum_var is 0, ulong_var is 500, really
39+show variables like 'example%';
40+Variable_name Value
41+example_enum_var e1
42+example_ulong_var 500
43+UNINSTALL PLUGIN example;
44+UNINSTALL PLUGIN EXAMPLE;
45+ERROR 42000: PLUGIN EXAMPLE does not exist
46+UNINSTALL PLUGIN non_exist;
47+ERROR 42000: PLUGIN non_exist does not exist
48+#
49+# Bug#32034: check_func_enum() does not check correct values but set it
50+# to impossible int val
51+#
52+INSTALL PLUGIN example SONAME 'ha_example.so';
53+SET GLOBAL example_enum_var= e1;
54+SET GLOBAL example_enum_var= e2;
55+SET GLOBAL example_enum_var= impossible;
56+ERROR 42000: Variable 'example_enum_var' can't be set to the value of 'impossible'
57+UNINSTALL PLUGIN example;
58+INSTALL PLUGIN example SONAME 'ha_example.so';
59+select @@session.sql_mode into @old_sql_mode;
60+set session sql_mode='';
61+set global example_ulong_var=500;
62+select @@global.example_ulong_var;
63+@@global.example_ulong_var
64+500
65+set global example_ulong_var=1111;
66+Warnings:
67+Warning 1292 Truncated incorrect example_ulong_var value: '1111'
68+select @@global.example_ulong_var;
69+@@global.example_ulong_var
70+1000
71+set session sql_mode='STRICT_ALL_TABLES';
72+set global example_ulong_var=500;
73+select @@global.example_ulong_var;
74+@@global.example_ulong_var
75+500
76+set global example_ulong_var=1111;
77+ERROR 42000: Variable 'example_ulong_var' can't be set to the value of '1111'
78+select @@global.example_ulong_var;
79+@@global.example_ulong_var
80+500
81+set session sql_mode=@old_sql_mode;
82+set session old=bla;
83+ERROR HY000: Variable 'old' is a read only variable
84+UNINSTALL PLUGIN example;
85
86=== added file 'Percona-Server/mysql-test/t/percona_plugin_with_userstats-master.opt'
87--- Percona-Server/mysql-test/t/percona_plugin_with_userstats-master.opt 1970-01-01 00:00:00 +0000
88+++ Percona-Server/mysql-test/t/percona_plugin_with_userstats-master.opt 2012-08-24 04:41:23 +0000
89@@ -0,0 +1,2 @@
90+$EXAMPLE_PLUGIN_OPT
91+--userstat
92
93=== added file 'Percona-Server/mysql-test/t/percona_plugin_with_userstats.test'
94--- Percona-Server/mysql-test/t/percona_plugin_with_userstats.test 1970-01-01 00:00:00 +0000
95+++ Percona-Server/mysql-test/t/percona_plugin_with_userstats.test 2012-08-24 04:41:23 +0000
96@@ -0,0 +1,115 @@
97+# This is a test for Bug lp:1011047
98+# mysqld can't startup when a plugin was installed Edit
99+#
100+# It is copied from plugin.test, except that we restart the
101+# server in the middle, which on a server without the fix for this bug,
102+# will cause the test to fail (server crash).
103+#
104+# The critical difference is *enabling* --userstat as a server option
105+# as otherwise things work just fine
106+
107+--source include/not_windows_embedded.inc
108+--source include/have_example_plugin.inc
109+
110+CREATE TABLE t1(a int) ENGINE=EXAMPLE;
111+DROP TABLE t1;
112+
113+--replace_regex /\.dll/.so/
114+eval INSTALL PLUGIN example SONAME '$EXAMPLE_PLUGIN';
115+--replace_regex /\.dll/.so/
116+--error 1125
117+eval INSTALL PLUGIN EXAMPLE SONAME '$EXAMPLE_PLUGIN';
118+
119+let $expect_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect;
120+# MTR will remove this file later, but this might be too late.
121+--error 0,1
122+--remove_file $expect_file
123+--write_file $expect_file
124+wait
125+EOF
126+--shutdown_server 10
127+--source include/wait_until_disconnected.inc
128+#
129+# Restart the server
130+#
131+--append_file $expect_file
132+restart
133+EOF
134+--enable_reconnect
135+--source include/wait_until_connected_again.inc
136+
137+UNINSTALL PLUGIN example;
138+
139+--replace_regex /\.dll/.so/
140+eval INSTALL PLUGIN example SONAME '$EXAMPLE_PLUGIN';
141+
142+CREATE TABLE t1(a int) ENGINE=EXAMPLE;
143+
144+# Let's do some advanced ops with the example engine :)
145+SELECT * FROM t1;
146+
147+DROP TABLE t1;
148+
149+# a couple of tests for variables
150+set global example_ulong_var=500;
151+set global example_enum_var= e1;
152+show status like 'example%';
153+show variables like 'example%';
154+
155+UNINSTALL PLUGIN example;
156+--error 1305
157+UNINSTALL PLUGIN EXAMPLE;
158+
159+--error 1305
160+UNINSTALL PLUGIN non_exist;
161+
162+
163+--echo #
164+--echo # Bug#32034: check_func_enum() does not check correct values but set it
165+--echo # to impossible int val
166+--echo #
167+--replace_regex /\.dll/.so/
168+eval INSTALL PLUGIN example SONAME '$EXAMPLE_PLUGIN';
169+
170+SET GLOBAL example_enum_var= e1;
171+SET GLOBAL example_enum_var= e2;
172+--error 1231
173+SET GLOBAL example_enum_var= impossible;
174+
175+UNINSTALL PLUGIN example;
176+
177+
178+
179+#
180+# Bug #32757 hang with sql_mode set when setting some global variables
181+#
182+--replace_regex /\.dll/.so/
183+eval INSTALL PLUGIN example SONAME '$EXAMPLE_PLUGIN';
184+
185+select @@session.sql_mode into @old_sql_mode;
186+
187+# first, try normal sql_mode (no error, send OK)
188+set session sql_mode='';
189+set global example_ulong_var=500;
190+select @@global.example_ulong_var;
191+# overflow -- correct value, but throw warning
192+set global example_ulong_var=1111;
193+select @@global.example_ulong_var;
194+
195+# now, try STRICT (error occurrs, no message is sent, so send default)
196+set session sql_mode='STRICT_ALL_TABLES';
197+set global example_ulong_var=500;
198+select @@global.example_ulong_var;
199+# overflow -- throw warning, do NOT change value
200+--error ER_WRONG_VALUE_FOR_VAR
201+set global example_ulong_var=1111;
202+select @@global.example_ulong_var;
203+
204+set session sql_mode=@old_sql_mode;
205+
206+# finally, show that conditions that already raised an error are not
207+# adversely affected (error was already sent, do nothing)
208+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
209+set session old=bla;
210+
211+UNINSTALL PLUGIN example;
212
213=== modified file 'Percona-Server/sql/mysqld.cc'
214--- Percona-Server/sql/mysqld.cc 2012-08-07 06:10:00 +0000
215+++ Percona-Server/sql/mysqld.cc 2012-08-24 04:41:23 +0000
216@@ -3790,6 +3790,9 @@
217 init_slave_list();
218 #endif
219
220+ init_global_table_stats();
221+ init_global_index_stats();
222+
223 /* Setup logs */
224
225 /*
226@@ -4007,9 +4010,6 @@
227 /* We have to initialize the storage engines before CSV logging */
228 TC_init();
229
230- init_global_table_stats();
231- init_global_index_stats();
232-
233 if (ha_init())
234 {
235 sql_print_error("Can't init databases");

Subscribers

People subscribed via source and target branches