Merge lp:~sergei.glushchenko/percona-server/55-disable-flashcache into lp:percona-server/5.5

Proposed by Sergei Glushchenko
Status: Merged
Approved by: Alexey Kopytov
Approved revision: no longer in the source branch.
Merged at revision: 299
Proposed branch: lp:~sergei.glushchenko/percona-server/55-disable-flashcache
Merge into: lp:percona-server/5.5
Diff against target: 314 lines (+120/-14)
13 files modified
Percona-Server/mysql-test/include/have_flashcache.inc (+7/-0)
Percona-Server/mysql-test/r/have_flashcache.require (+2/-0)
Percona-Server/mysql-test/r/mysqld--help-notwin.result (+2/-0)
Percona-Server/mysql-test/r/mysqld--help-win.result (+2/-0)
Percona-Server/mysql-test/r/percona_bug747032.result (+1/-0)
Percona-Server/mysql-test/r/percona_server_variables_debug.result (+1/-0)
Percona-Server/mysql-test/r/percona_server_variables_release.result (+1/-0)
Percona-Server/mysql-test/suite/sys_vars/r/have_flashcache_basic.result (+21/-0)
Percona-Server/mysql-test/suite/sys_vars/t/have_flashcache_basic.test (+23/-0)
Percona-Server/mysql-test/t/percona_bug747032.test (+32/-0)
Percona-Server/sql/mysqld.cc (+23/-14)
Percona-Server/sql/set_var.h (+1/-0)
Percona-Server/sql/sys_vars.cc (+4/-0)
To merge this branch: bzr merge lp:~sergei.glushchenko/percona-server/55-disable-flashcache
Reviewer Review Type Date Requested Status
Alexey Kopytov (community) Approve
Review via email: mp+121776@code.launchpad.net

Description of the change

Merge fix from 5.1 series

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'Percona-Server/mysql-test/include/have_flashcache.inc'
2--- Percona-Server/mysql-test/include/have_flashcache.inc 1970-01-01 00:00:00 +0000
3+++ Percona-Server/mysql-test/include/have_flashcache.inc 2012-08-29 09:13:30 +0000
4@@ -0,0 +1,7 @@
5+# check if binary compiled with flashcache support
6+
7+-- require r/have_flashcache.require
8+
9+disable_query_log;
10+show variables like 'have_flashcache';
11+enable_query_log;
12
13=== added file 'Percona-Server/mysql-test/r/have_flashcache.require'
14--- Percona-Server/mysql-test/r/have_flashcache.require 1970-01-01 00:00:00 +0000
15+++ Percona-Server/mysql-test/r/have_flashcache.require 2012-08-29 09:13:30 +0000
16@@ -0,0 +1,2 @@
17+Variable_name Value
18+have_flashcache YES
19
20=== modified file 'Percona-Server/mysql-test/r/mysqld--help-notwin.result'
21--- Percona-Server/mysql-test/r/mysqld--help-notwin.result 2012-08-07 06:10:00 +0000
22+++ Percona-Server/mysql-test/r/mysqld--help-notwin.result 2012-08-29 09:13:30 +0000
23@@ -154,6 +154,7 @@
24 With this option enabled you can run myisamchk to test
25 (not repair) tables while the MySQL server is running.
26 Disable with --skip-external-locking.
27+ --flashcache Enable flashcache detection.
28 --flush Flush MyISAM tables to disk between SQL commands
29 --flush-time=# A dedicated thread is created to flush all tables at the
30 given interval
31@@ -855,6 +856,7 @@
32 expand-fast-index-creation FALSE
33 expire-logs-days 0
34 external-locking FALSE
35+flashcache FALSE
36 flush FALSE
37 flush-time 0
38 ft-boolean-syntax + -><()~*:""&|
39
40=== modified file 'Percona-Server/mysql-test/r/mysqld--help-win.result'
41--- Percona-Server/mysql-test/r/mysqld--help-win.result 2012-08-07 06:10:00 +0000
42+++ Percona-Server/mysql-test/r/mysqld--help-win.result 2012-08-29 09:13:30 +0000
43@@ -154,6 +154,7 @@
44 With this option enabled you can run myisamchk to test
45 (not repair) tables while the MySQL server is running.
46 Disable with --skip-external-locking.
47+ --flashcache Enable flashcache detection.
48 --flush Flush MyISAM tables to disk between SQL commands
49 --flush-time=# A dedicated thread is created to flush all tables at the
50 given interval
51@@ -806,6 +807,7 @@
52 expand-fast-index-creation FALSE
53 expire-logs-days 0
54 external-locking FALSE
55+flashcache FALSE
56 flush FALSE
57 flush-time 1800
58 ft-boolean-syntax + -><()~*:""&|
59
60=== added file 'Percona-Server/mysql-test/r/percona_bug747032.result'
61--- Percona-Server/mysql-test/r/percona_bug747032.result 1970-01-01 00:00:00 +0000
62+++ Percona-Server/mysql-test/r/percona_bug747032.result 2012-08-29 09:13:30 +0000
63@@ -0,0 +1,1 @@
64+Occurrences: 0
65
66=== modified file 'Percona-Server/mysql-test/r/percona_server_variables_debug.result'
67--- Percona-Server/mysql-test/r/percona_server_variables_debug.result 2012-08-09 06:49:56 +0000
68+++ Percona-Server/mysql-test/r/percona_server_variables_debug.result 2012-08-29 09:13:30 +0000
69@@ -61,6 +61,7 @@
70 HAVE_CRYPT
71 HAVE_CSV
72 HAVE_DYNAMIC_LOADING
73+HAVE_FLASHCACHE
74 HAVE_GEOMETRY
75 HAVE_INNODB
76 HAVE_NDBCLUSTER
77
78=== modified file 'Percona-Server/mysql-test/r/percona_server_variables_release.result'
79--- Percona-Server/mysql-test/r/percona_server_variables_release.result 2012-08-07 06:10:00 +0000
80+++ Percona-Server/mysql-test/r/percona_server_variables_release.result 2012-08-29 09:13:30 +0000
81@@ -59,6 +59,7 @@
82 HAVE_CRYPT
83 HAVE_CSV
84 HAVE_DYNAMIC_LOADING
85+HAVE_FLASHCACHE
86 HAVE_GEOMETRY
87 HAVE_INNODB
88 HAVE_NDBCLUSTER
89
90=== added file 'Percona-Server/mysql-test/suite/sys_vars/r/have_flashcache_basic.result'
91--- Percona-Server/mysql-test/suite/sys_vars/r/have_flashcache_basic.result 1970-01-01 00:00:00 +0000
92+++ Percona-Server/mysql-test/suite/sys_vars/r/have_flashcache_basic.result 2012-08-29 09:13:30 +0000
93@@ -0,0 +1,21 @@
94+select @@global.have_flashcache="1";
95+@@global.have_flashcache="1"
96+0
97+select @@session.have_flashcache;
98+ERROR HY000: Variable 'have_flashcache' is a GLOBAL variable
99+show global variables like 'have_flashcache';
100+Variable_name Value
101+have_flashcache #
102+show session variables like 'have_flashcache';
103+Variable_name Value
104+have_flashcache #
105+select * from information_schema.global_variables where variable_name='have_flashcache';
106+VARIABLE_NAME VARIABLE_VALUE
107+HAVE_FLASHCACHE #
108+select * from information_schema.session_variables where variable_name='have_flashcache';
109+VARIABLE_NAME VARIABLE_VALUE
110+HAVE_FLASHCACHE #
111+set global have_flashcache=1;
112+ERROR HY000: Variable 'have_flashcache' is a read only variable
113+set session have_flashcache=1;
114+ERROR HY000: Variable 'have_flashcache' is a read only variable
115
116=== added file 'Percona-Server/mysql-test/suite/sys_vars/t/have_flashcache_basic.test'
117--- Percona-Server/mysql-test/suite/sys_vars/t/have_flashcache_basic.test 1970-01-01 00:00:00 +0000
118+++ Percona-Server/mysql-test/suite/sys_vars/t/have_flashcache_basic.test 2012-08-29 09:13:30 +0000
119@@ -0,0 +1,23 @@
120+#
121+# only global
122+#
123+select @@global.have_flashcache="1";
124+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
125+select @@session.have_flashcache;
126+--replace_column 2 #
127+show global variables like 'have_flashcache';
128+--replace_column 2 #
129+show session variables like 'have_flashcache';
130+--replace_column 2 #
131+select * from information_schema.global_variables where variable_name='have_flashcache';
132+--replace_column 2 #
133+select * from information_schema.session_variables where variable_name='have_flashcache';
134+
135+#
136+# show that it's read-only
137+#
138+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
139+set global have_flashcache=1;
140+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
141+set session have_flashcache=1;
142+
143
144=== added file 'Percona-Server/mysql-test/t/percona_bug747032.test'
145--- Percona-Server/mysql-test/t/percona_bug747032.test 1970-01-01 00:00:00 +0000
146+++ Percona-Server/mysql-test/t/percona_bug747032.test 2012-08-29 09:13:30 +0000
147@@ -0,0 +1,32 @@
148+###################### percona_bug747032.test ########################
149+# Bug #747032: Flashcache throws an error on startup when flashcache #
150+# is not used #
151+# #
152+# Test is designed to verify that --flashcache option work properly #
153+# to disable flashcache checks at startup #
154+######################################################################
155+
156+--source include/not_embedded.inc
157+--source include/have_flashcache.inc
158+
159+let $log_error_= `SELECT @@GLOBAL.log_error`;
160+if(!`select LENGTH('$log_error_')`)
161+{
162+ # MySQL Server on windows is started with --console and thus
163+ # does not know the location of its .err log, use default location
164+ let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.1.err;
165+}
166+# Assign env variable LOG_ERROR
167+let LOG_ERROR=$log_error_;
168+
169+perl;
170+ use strict;
171+ my $log_error= $ENV{'LOG_ERROR'} or die "LOG_ERROR not set";
172+ open(FILE, "$log_error") or die("Unable to open $log_error: $!\n");
173+ my $count = grep(/Flashcache bypass support initialized successfully/g,<FILE>);
174+ print "Occurrences: $count\n";
175+ close(FILE);
176+ # Clean error log file
177+ open(FILE, '>', "$log_error");
178+ close(FILE);
179+EOF
180
181=== modified file 'Percona-Server/sql/mysqld.cc'
182--- Percona-Server/sql/mysqld.cc 2012-08-07 06:10:00 +0000
183+++ Percona-Server/sql/mysqld.cc 2012-08-29 09:13:30 +0000
184@@ -641,6 +641,7 @@
185 SHOW_COMP_OPTION have_geometry, have_rtree_keys;
186 SHOW_COMP_OPTION have_crypt, have_compress;
187 SHOW_COMP_OPTION have_profiling;
188+SHOW_COMP_OPTION have_flashcache;
189
190 ulonglong opt_log_warnings_suppress= 0;
191
192@@ -4294,24 +4295,23 @@
193
194 // disabled by default
195 cachedev_fd = -1;
196- cachedev_enabled= FALSE;
197
198 if (!mysql_data_home)
199 {
200- error_message= "mysql_data_home not set";
201+ error_message= "Flashcache setup error (mysql_data_home not set)";
202 goto epilogue;
203 }
204
205 if (statfs(mysql_data_home, &stfs_data_home_dir) < 0)
206 {
207- error_message= "statfs failed";
208+ error_message= "Flashcache setup error (statfs)";
209 goto epilogue;
210 }
211
212 mounts = setmntent("/etc/mtab", "r");
213 if (mounts == NULL)
214 {
215- error_message= "setmntent failed";
216+ error_message= "Flashcache setup error (setmntent)";
217 goto epilogue;
218 }
219
220@@ -4326,14 +4326,14 @@
221
222 if (ent == NULL)
223 {
224- error_message= "getmntent loop failed";
225+ error_message= "Flashcache setup error (getmntent loop)";
226 goto epilogue;
227 }
228
229 cachedev_fd = open(ent->mnt_fsname, O_RDONLY);
230 if (cachedev_fd < 0)
231 {
232- error_message= "open flash device failed";
233+ error_message= "Flashcache setup error (open flash device)";
234 goto epilogue;
235 }
236
237@@ -4342,18 +4342,17 @@
238 {
239 close(cachedev_fd);
240 cachedev_fd = -1;
241- error_message= "ioctl failed";
242+ error_message= "Flashcache setup error (ioctl)";
243 } else {
244 ioctl(cachedev_fd, FLASHCACHEADDWHITELIST, &pid);
245 }
246
247 epilogue:
248- sql_print_information("Flashcache bypass: %s",
249- (cachedev_fd > 0) ? "enabled" : "disabled");
250- if (error_message)
251- sql_print_information("Flashcache setup error is : %s\n", error_message);
252- else
253- cachedev_enabled= TRUE;
254+ if (error_message) {
255+ sql_perror(error_message);
256+ unireg_abort(1);
257+ }
258+ sql_print_information("Flashcache bypass support initialized successfully");
259
260 }
261
262@@ -4630,7 +4629,11 @@
263 #endif
264
265 #if defined(__linux__)
266- init_cachedev();
267+ have_flashcache= SHOW_OPTION_YES;
268+ if (cachedev_enabled)
269+ init_cachedev();
270+#else
271+ have_flashcache= SHOW_OPTION_NO;
272 #endif//__linux__
273
274 /*
275@@ -6288,6 +6291,12 @@
276 {"table_cache", 0, "Deprecated; use --table-open-cache instead.",
277 &table_cache_size, &table_cache_size, 0, GET_ULONG,
278 REQUIRED_ARG, TABLE_OPEN_CACHE_DEFAULT, 1, 512*1024L, 0, 1, 0},
279+ {"flashcache",
280+ 0,
281+ "Enable flashcache detection.",
282+ &cachedev_enabled,
283+ &cachedev_enabled,
284+ 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
285 {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
286 };
287
288
289=== modified file 'Percona-Server/sql/set_var.h'
290--- Percona-Server/sql/set_var.h 2012-08-07 18:49:16 +0000
291+++ Percona-Server/sql/set_var.h 2012-08-29 09:13:30 +0000
292@@ -306,6 +306,7 @@
293 extern SHOW_COMP_OPTION have_geometry, have_rtree_keys;
294 extern SHOW_COMP_OPTION have_crypt;
295 extern SHOW_COMP_OPTION have_compress;
296+extern SHOW_COMP_OPTION have_flashcache;
297
298 /*
299 Prototypes for helper functions
300
301=== modified file 'Percona-Server/sql/sys_vars.cc'
302--- Percona-Server/sql/sys_vars.cc 2012-08-07 06:10:00 +0000
303+++ Percona-Server/sql/sys_vars.cc 2012-08-29 09:13:30 +0000
304@@ -3055,6 +3055,10 @@
305 "have_symlink", "have_symlink",
306 READ_ONLY GLOBAL_VAR(have_symlink), NO_CMD_LINE);
307
308+static Sys_var_have Sys_have_flashcache(
309+ "have_flashcache", "have_flashcache",
310+ READ_ONLY GLOBAL_VAR(have_flashcache), NO_CMD_LINE);
311+
312 static bool fix_log_state(sys_var *self, THD *thd, enum_var_type type);
313 static Sys_var_mybool Sys_general_log(
314 "general_log", "Log connections and queries to a table or log file. "

Subscribers

People subscribed via source and target branches