102.1.1
by kinoyasu
add header and rule, as the first step of the reordering patch for separate release |
1 |
# name : sql_no_fcache.patch |
2 |
# introduced : 12 |
|
3 |
# maintainer : Oleg |
|
4 |
# |
|
5 |
#!!! notice !!! |
|
6 |
# Any small change to this file in the main branch |
|
7 |
# should be done or reviewed by the maintainer! |
|
120.1.1
by Oleg Tsarev
fix bug 649623 |
8 |
diff -ruN a/client/mysqldump.c b/client/mysqldump.c
|
78.1.1
by Oleg Tsarev
adapt patches to 5.1.49 version |
9 |
--- a/client/mysqldump.c 2010-07-28 16:47:58.264067653 +0400
|
10 |
+++ b/client/mysqldump.c 2010-07-28 16:47:59.604985656 +0400
|
|
72.1.1
by Oleg Tsarev
backup |
11 |
@@ -132,6 +132,8 @@
|
12 |
#endif |
|
13 |
static uint opt_protocol= 0; |
|
14 |
||
15 |
+static my_bool server_supports_sql_no_fcache= FALSE;
|
|
16 |
+
|
|
17 |
/* |
|
18 |
Dynamic_string wrapper functions. In this file use these |
|
19 |
wrappers, they will terminate the process if there is |
|
20 |
@@ -1512,6 +1514,17 @@
|
|
21 |
/* Don't switch charsets for 4.1 and earlier. (bug#34192). */ |
|
22 |
server_supports_switching_charsets= FALSE; |
|
23 |
} |
|
24 |
+
|
|
25 |
+ /* Check to see if we support SQL_NO_FCACHE on this server. */
|
|
26 |
+ if (mysql_query(mysql, "SELECT SQL_NO_FCACHE NOW()") == 0)
|
|
27 |
+ {
|
|
28 |
+ MYSQL_RES *res = mysql_store_result(mysql);
|
|
29 |
+ if (res)
|
|
30 |
+ {
|
|
31 |
+ mysql_free_result(res);
|
|
32 |
+ }
|
|
33 |
+ server_supports_sql_no_fcache= TRUE;
|
|
34 |
+ }
|
|
35 |
/* |
|
36 |
As we're going to set SQL_MODE, it would be lost on reconnect, so we |
|
37 |
cannot reconnect. |
|
208.2.1
by Oleg Tsarev
fix Oleg and Alexey patches to 5.1.56 |
38 |
@@ -3175,7 +3188,12 @@
|
72.1.1
by Oleg Tsarev
backup |
39 |
|
40 |
/* now build the query string */ |
|
41 |
||
42 |
- dynstr_append_checked(&query_string, "SELECT /*!40001 SQL_NO_CACHE */ * INTO OUTFILE '");
|
|
43 |
+ dynstr_append_checked(&query_string, "SELECT /*!40001 SQL_NO_CACHE */ ");
|
|
44 |
+ if (server_supports_sql_no_fcache)
|
|
45 |
+ {
|
|
46 |
+ dynstr_append_checked(&query_string, "/*!50084 SQL_NO_FCACHE */ ");
|
|
47 |
+ }
|
|
48 |
+ dynstr_append_checked(&query_string, "* INTO OUTFILE '");
|
|
49 |
dynstr_append_checked(&query_string, filename); |
|
50 |
dynstr_append_checked(&query_string, "'"); |
|
51 |
||
208.2.1
by Oleg Tsarev
fix Oleg and Alexey patches to 5.1.56 |
52 |
@@ -3225,7 +3243,12 @@
|
72.1.1
by Oleg Tsarev
backup |
53 |
check_io(md_result_file); |
54 |
} |
|
55 |
||
56 |
- dynstr_append_checked(&query_string, "SELECT /*!40001 SQL_NO_CACHE */ * FROM ");
|
|
57 |
+ dynstr_append_checked(&query_string, "SELECT /*!40001 SQL_NO_CACHE */ ");
|
|
58 |
+ if (server_supports_sql_no_fcache)
|
|
59 |
+ {
|
|
60 |
+ dynstr_append_checked(&query_string, "/*!50084 SQL_NO_FCACHE */ ");
|
|
61 |
+ }
|
|
62 |
+ dynstr_append_checked(&query_string, "* FROM ");
|
|
63 |
dynstr_append_checked(&query_string, result_table); |
|
64 |
||
65 |
if (where) |
|
120.1.1
by Oleg Tsarev
fix bug 649623 |
66 |
diff -ruN a/include/flashcache_ioctl.h b/include/flashcache_ioctl.h
|
72.1.1
by Oleg Tsarev
backup |
67 |
--- a/include/flashcache_ioctl.h 1970-01-01 03:00:00.000000000 +0300
|
78.1.1
by Oleg Tsarev
adapt patches to 5.1.49 version |
68 |
+++ b/include/flashcache_ioctl.h 2010-07-28 16:47:59.744079911 +0400
|
72.1.1
by Oleg Tsarev
backup |
69 |
@@ -0,0 +1,53 @@
|
70 |
+/****************************************************************************
|
|
71 |
+ * flashcache_ioctl.h
|
|
72 |
+ * FlashCache: Device mapper target for block-level disk caching
|
|
73 |
+ *
|
|
74 |
+ * Copyright 2010 Facebook, Inc.
|
|
75 |
+ * Author: Mohan Srinivasan (mohan@facebook.com)
|
|
76 |
+ *
|
|
77 |
+ * Based on DM-Cache:
|
|
78 |
+ * Copyright (C) International Business Machines Corp., 2006
|
|
79 |
+ * Author: Ming Zhao (mingzhao@ufl.edu)
|
|
80 |
+ *
|
|
81 |
+ * This program is free software; you can redistribute it and/or modify
|
|
82 |
+ * it under the terms of the GNU General Public License as published by
|
|
83 |
+ * the Free Software Foundation; under version 2 of the License.
|
|
84 |
+ *
|
|
85 |
+ * This program is distributed in the hope that it will be useful,
|
|
86 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
87 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
88 |
+ * GNU General Public License for more details.
|
|
89 |
+ *
|
|
90 |
+ * You should have received a copy of the GNU General Public License
|
|
91 |
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
92 |
+ ****************************************************************************/
|
|
93 |
+
|
|
94 |
+#ifndef FLASHCACHE_IOCTL_H
|
|
95 |
+#define FLASHCACHE_IOCTL_H
|
|
96 |
+
|
|
97 |
+#include <linux/types.h>
|
|
98 |
+
|
|
99 |
+#define FLASHCACHE_IOCTL 0xfe
|
|
100 |
+
|
|
101 |
+enum {
|
|
102 |
+ FLASHCACHEADDNCPID_CMD=200,
|
|
103 |
+ FLASHCACHEDELNCPID_CMD,
|
|
104 |
+ FLASHCACHEDELNCALL_CMD,
|
|
105 |
+ FLASHCACHEADDWHITELIST_CMD,
|
|
106 |
+ FLASHCACHEDELWHITELIST_CMD,
|
|
107 |
+ FLASHCACHEDELWHITELISTALL_CMD,
|
|
108 |
+};
|
|
109 |
+
|
|
110 |
+#define FLASHCACHEADDNCPID _IOW(FLASHCACHE_IOCTL, FLASHCACHEADDNCPID_CMD, pid_t)
|
|
111 |
+#define FLASHCACHEDELNCPID _IOW(FLASHCACHE_IOCTL, FLASHCACHEDELNCPID_CMD, pid_t)
|
|
112 |
+#define FLASHCACHEDELNCALL _IOW(FLASHCACHE_IOCTL, FLASHCACHEDELNCALL_CMD, pid_t)
|
|
113 |
+
|
|
114 |
+#define FLASHCACHEADDBLACKLIST FLASHCACHEADDNCPID
|
|
115 |
+#define FLASHCACHEDELBLACKLIST FLASHCACHEDELNCPID
|
|
116 |
+#define FLASHCACHEDELALLBLACKLIST FLASHCACHEDELNCALL
|
|
117 |
+
|
|
118 |
+#define FLASHCACHEADDWHITELIST _IOW(FLASHCACHE_IOCTL, FLASHCACHEADDWHITELIST_CMD, pid_t)
|
|
119 |
+#define FLASHCACHEDELWHITELIST _IOW(FLASHCACHE_IOCTL, FLASHCACHEDELWHITELIST_CMD, pid_t)
|
|
120 |
+#define FLASHCACHEDELALLWHITELIST _IOW(FLASHCACHE_IOCTL, FLASHCACHEDELWHITELISTALL_CMD, pid_t)
|
|
121 |
+
|
|
122 |
+#endif
|
|
120.1.1
by Oleg Tsarev
fix bug 649623 |
123 |
diff -ruN a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result
|
78.1.1
by Oleg Tsarev
adapt patches to 5.1.49 version |
124 |
--- a/mysql-test/r/mysqldump.result 2010-07-28 16:47:58.334083833 +0400
|
125 |
+++ b/mysql-test/r/mysqldump.result 2010-07-28 16:48:14.805318437 +0400
|
|
126 |
@@ -1832,7 +1832,7 @@
|
|
127 |
# Bug#21288 mysqldump segmentation fault when using --where |
|
128 |
# |
|
129 |
create table t1 (a int); |
|
130 |
-mysqldump: Couldn't execute 'SELECT /*!40001 SQL_NO_CACHE */ * FROM `t1` WHERE xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx': You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' at line 1 (1064)
|
|
131 |
+mysqldump: Couldn't execute 'SELECT /*!40001 SQL_NO_CACHE */ /*!50084 SQL_NO_FCACHE */ * FROM `t1` WHERE xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx': You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' at line 1 (1064)
|
|
132 |
mysqldump: Got error: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' at line 1 when retrieving data from server |
|
133 |
||
134 |
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; |
|
120.1.1
by Oleg Tsarev
fix bug 649623 |
135 |
diff -ruN a/patch_info/sql_no_fcache.info b/patch_info/sql_no_fcache.info
|
72.1.2
by Oleg Tsarev
fix bug 606965 |
136 |
--- a/patch_info/sql_no_fcache.info 1970-01-01 03:00:00.000000000 +0300
|
78.1.1
by Oleg Tsarev
adapt patches to 5.1.49 version |
137 |
+++ b/patch_info/sql_no_fcache.info 2010-07-28 16:47:59.915439165 +0400
|
72.1.2
by Oleg Tsarev
fix bug 606965 |
138 |
@@ -0,0 +1,6 @@
|
139 |
+File=sql_no_fcache.patch
|
|
140 |
+Name=Support for flashcache including the SQL_NO_FCACHE option that prevents blocks from being cached during a query.
|
|
141 |
+Version=1.0
|
|
72.1.4
by Oleg Tsarev
additional tests to sql_no_facche |
142 |
+Author=Facebook
|
72.1.2
by Oleg Tsarev
fix bug 606965 |
143 |
+License=GPL
|
144 |
+Comment=
|
|
120.1.1
by Oleg Tsarev
fix bug 649623 |
145 |
diff -ruN a/sql/lex.h b/sql/lex.h
|
78.1.1
by Oleg Tsarev
adapt patches to 5.1.49 version |
146 |
--- a/sql/lex.h 2010-07-28 16:47:58.575318748 +0400
|
147 |
+++ b/sql/lex.h 2010-07-28 16:48:00.134078469 +0400
|
|
72.1.1
by Oleg Tsarev
backup |
148 |
@@ -500,6 +500,7 @@
|
149 |
{ "SQL_CACHE", SYM(SQL_CACHE_SYM)}, |
|
150 |
{ "SQL_CALC_FOUND_ROWS", SYM(SQL_CALC_FOUND_ROWS)}, |
|
151 |
{ "SQL_NO_CACHE", SYM(SQL_NO_CACHE_SYM)}, |
|
152 |
+ { "SQL_NO_FCACHE", SYM(SQL_NO_FCACHE_SYM)},
|
|
153 |
{ "SQL_SMALL_RESULT", SYM(SQL_SMALL_RESULT)}, |
|
154 |
{ "SQL_THREAD", SYM(SQL_THREAD)}, |
|
155 |
{ "SQL_TSI_FRAC_SECOND", SYM(FRAC_SECOND_SYM)}, |
|
120.1.1
by Oleg Tsarev
fix bug 649623 |
156 |
diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
|
78.1.1
by Oleg Tsarev
adapt patches to 5.1.49 version |
157 |
--- a/sql/mysqld.cc 2010-07-28 16:47:58.565318871 +0400
|
158 |
+++ b/sql/mysqld.cc 2010-07-28 16:48:03.004544367 +0400
|
|
166.2.1
by Oleg Tsarev
add --without-response_time_distribution |
159 |
@@ -45,6 +45,11 @@
|
120.1.1
by Oleg Tsarev
fix bug 649623 |
160 |
#define OPT_NDB_SHM_DEFAULT 0 |
161 |
#endif |
|
162 |
#endif |
|
163 |
+#if defined(__linux__)
|
|
72.1.1
by Oleg Tsarev
backup |
164 |
+#include <mntent.h>
|
165 |
+#include <sys/statfs.h>
|
|
166 |
+#include "flashcache_ioctl.h"
|
|
120.1.1
by Oleg Tsarev
fix bug 649623 |
167 |
+#endif//__linux__
|
168 |
||
72.1.1
by Oleg Tsarev
backup |
169 |
#ifndef DEFAULT_SKIP_THREAD_PRIORITY |
170 |
#define DEFAULT_SKIP_THREAD_PRIORITY 0 |
|
176
by Oleg Tsarev
port Oleg's and Alexey's patches to 5.1.54 |
171 |
@@ -593,6 +598,11 @@
|
72.1.1
by Oleg Tsarev
backup |
172 |
ulong max_connections, max_connect_errors; |
173 |
uint max_user_connections= 0; |
|
174 |
ulonglong denied_connections = 0; |
|
175 |
+
|
|
176 |
+/* flashcache */
|
|
177 |
+int cachedev_fd;
|
|
178 |
+my_bool cachedev_enabled= FALSE;
|
|
179 |
+
|
|
180 |
/** |
|
181 |
Limit of the total number of prepared statements in the server. |
|
182 |
Is necessary to protect the server against out-of-memory attacks. |
|
208.2.1
by Oleg Tsarev
fix Oleg and Alexey patches to 5.1.56 |
183 |
@@ -4391,6 +4401,97 @@
|
72.1.1
by Oleg Tsarev
backup |
184 |
} |
185 |
#endif//DBUG_OFF |
|
186 |
||
120.1.1
by Oleg Tsarev
fix bug 649623 |
187 |
+#if defined(__linux__)
|
72.1.1
by Oleg Tsarev
backup |
188 |
+/*
|
189 |
+ * Auto detect if we support flash cache on the host system.
|
|
190 |
+ * This needs to be called before we setuid away from root
|
|
191 |
+ * to avoid permission problems on opening the device node.
|
|
192 |
+ */
|
|
193 |
+static void init_cachedev(void)
|
|
194 |
+{
|
|
195 |
+ struct statfs stfs_data_home_dir;
|
|
196 |
+ struct statfs stfs;
|
|
197 |
+ struct mntent *ent;
|
|
198 |
+ pid_t pid = getpid();
|
|
199 |
+ FILE *mounts;
|
|
200 |
+ char *error_message= NULL;
|
|
201 |
+
|
|
202 |
+ // disabled by default
|
|
203 |
+ cachedev_fd = -1;
|
|
204 |
+ cachedev_enabled= FALSE;
|
|
205 |
+
|
|
206 |
+ if (!mysql_data_home)
|
|
207 |
+ {
|
|
208 |
+ error_message= "mysql_data_home not set";
|
|
209 |
+ goto epilogue;
|
|
210 |
+ }
|
|
211 |
+
|
|
212 |
+ if (statfs(mysql_data_home, &stfs_data_home_dir) < 0)
|
|
213 |
+ {
|
|
214 |
+ error_message= "statfs failed";
|
|
215 |
+ goto epilogue;
|
|
216 |
+ }
|
|
217 |
+
|
|
218 |
+ mounts = setmntent("/etc/mtab", "r");
|
|
219 |
+ if (mounts == NULL)
|
|
220 |
+ {
|
|
221 |
+ error_message= "setmntent failed";
|
|
222 |
+ goto epilogue;
|
|
223 |
+ }
|
|
224 |
+
|
|
225 |
+ while ((ent = getmntent(mounts)) != NULL)
|
|
226 |
+ {
|
|
227 |
+ if (statfs(ent->mnt_dir, &stfs) < 0)
|
|
228 |
+ continue;
|
|
229 |
+ if (memcmp(&stfs.f_fsid, &stfs_data_home_dir.f_fsid, sizeof(fsid_t)) == 0)
|
|
230 |
+ break;
|
|
231 |
+ }
|
|
232 |
+ endmntent(mounts);
|
|
233 |
+
|
|
234 |
+ if (ent == NULL)
|
|
235 |
+ {
|
|
236 |
+ error_message= "getmntent loop failed";
|
|
237 |
+ goto epilogue;
|
|
238 |
+ }
|
|
239 |
+
|
|
240 |
+ cachedev_fd = open(ent->mnt_fsname, O_RDONLY);
|
|
241 |
+ if (cachedev_fd < 0)
|
|
242 |
+ {
|
|
243 |
+ error_message= "open flash device failed";
|
|
244 |
+ goto epilogue;
|
|
245 |
+ }
|
|
246 |
+
|
|
247 |
+ /* cleanup previous whitelistings */
|
|
248 |
+ if (ioctl(cachedev_fd, FLASHCACHEDELALLWHITELIST, &pid) < 0)
|
|
249 |
+ {
|
|
250 |
+ close(cachedev_fd);
|
|
251 |
+ cachedev_fd = -1;
|
|
252 |
+ error_message= "ioctl failed";
|
|
253 |
+ } else {
|
|
254 |
+ ioctl(cachedev_fd, FLASHCACHEADDWHITELIST, &pid);
|
|
255 |
+ }
|
|
256 |
+
|
|
257 |
+epilogue:
|
|
258 |
+ sql_print_information("Flashcache bypass: %s",
|
|
259 |
+ (cachedev_fd > 0) ? "enabled" : "disabled");
|
|
260 |
+ if (error_message)
|
|
261 |
+ sql_print_information("Flashcache setup error is : %s\n", error_message);
|
|
262 |
+ else
|
|
263 |
+ cachedev_enabled= TRUE;
|
|
264 |
+
|
|
265 |
+}
|
|
266 |
+
|
|
267 |
+static void cleanup_cachedev(void)
|
|
268 |
+{
|
|
269 |
+ pid_t pid = getpid();
|
|
270 |
+
|
|
271 |
+ if (cachedev_enabled) {
|
|
272 |
+ ioctl(cachedev_fd, FLASHCACHEDELWHITELIST, &pid);
|
|
273 |
+ close(cachedev_fd);
|
|
274 |
+ cachedev_fd = -1;
|
|
275 |
+ }
|
|
276 |
+}
|
|
120.1.1
by Oleg Tsarev
fix bug 649623 |
277 |
+#endif//__linux__
|
72.1.1
by Oleg Tsarev
backup |
278 |
|
279 |
#ifdef __WIN__ |
|
280 |
int win_main(int argc, char **argv) |
|
208.2.1
by Oleg Tsarev
fix Oleg and Alexey patches to 5.1.56 |
281 |
@@ -4495,6 +4596,10 @@
|
72.1.1
by Oleg Tsarev
backup |
282 |
test_lc_time_sz(); |
283 |
#endif |
|
284 |
||
120.1.1
by Oleg Tsarev
fix bug 649623 |
285 |
+#if defined(__linux__)
|
72.1.1
by Oleg Tsarev
backup |
286 |
+ init_cachedev();
|
120.1.1
by Oleg Tsarev
fix bug 649623 |
287 |
+#endif//__linux__
|
288 |
+
|
|
72.1.1
by Oleg Tsarev
backup |
289 |
/* |
290 |
We have enough space for fiddling with the argv, continue |
|
291 |
*/ |
|
208.2.1
by Oleg Tsarev
fix Oleg and Alexey patches to 5.1.56 |
292 |
@@ -4696,6 +4801,10 @@
|
72.1.1
by Oleg Tsarev
backup |
293 |
clean_up_mutexes(); |
294 |
my_end(opt_endinfo ? MY_CHECK_ERROR | MY_GIVE_INFO : 0); |
|
295 |
||
120.1.1
by Oleg Tsarev
fix bug 649623 |
296 |
+#if defined(__linux__)
|
72.1.1
by Oleg Tsarev
backup |
297 |
+ cleanup_cachedev();
|
120.1.1
by Oleg Tsarev
fix bug 649623 |
298 |
+#endif//__linux__
|
72.1.1
by Oleg Tsarev
backup |
299 |
+
|
300 |
exit(0); |
|
301 |
return(0); /* purecov: deadcode */ |
|
302 |
} |
|
208.2.1
by Oleg Tsarev
fix Oleg and Alexey patches to 5.1.56 |
303 |
@@ -7853,6 +7962,7 @@
|
72.1.1
by Oleg Tsarev
backup |
304 |
{"Delayed_errors", (char*) &delayed_insert_errors, SHOW_LONG}, |
305 |
{"Delayed_insert_threads", (char*) &delayed_insert_threads, SHOW_LONG_NOFLUSH}, |
|
306 |
{"Delayed_writes", (char*) &delayed_insert_writes, SHOW_LONG}, |
|
307 |
+ {"Flashcache_enabled", (char*) &cachedev_enabled, SHOW_BOOL },
|
|
308 |
{"Flush_commands", (char*) &refresh_version, SHOW_LONG_NOFLUSH}, |
|
309 |
{"Handler_commit", (char*) offsetof(STATUS_VAR, ha_commit_count), SHOW_LONG_STATUS}, |
|
310 |
{"Handler_delete", (char*) offsetof(STATUS_VAR, ha_delete_count), SHOW_LONG_STATUS}, |
|
120.1.1
by Oleg Tsarev
fix bug 649623 |
311 |
diff -ruN a/sql/mysql_priv.h b/sql/mysql_priv.h
|
78.1.1
by Oleg Tsarev
adapt patches to 5.1.49 version |
312 |
--- a/sql/mysql_priv.h 2010-07-28 16:47:58.575318748 +0400
|
313 |
+++ b/sql/mysql_priv.h 2010-07-28 16:48:05.505952089 +0400
|
|
195
by Oleg Tsarev
Port Oleg and Alexey patches to 5.1.55 |
314 |
@@ -819,6 +819,8 @@
|
72.1.1
by Oleg Tsarev
backup |
315 |
*/ |
316 |
extern ulong server_id, concurrency; |
|
317 |
||
318 |
+/* flashcache */
|
|
319 |
+extern int cachedev_fd;
|
|
320 |
||
321 |
typedef my_bool (*qc_engine_callback)(THD *thd, char *table_key, |
|
322 |
uint key_length, |
|
120.1.1
by Oleg Tsarev
fix bug 649623 |
323 |
diff -ruN a/sql/sql_lex.cc b/sql/sql_lex.cc
|
78.1.1
by Oleg Tsarev
adapt patches to 5.1.49 version |
324 |
--- a/sql/sql_lex.cc 2010-07-28 16:47:58.555318714 +0400
|
325 |
+++ b/sql/sql_lex.cc 2010-07-28 16:48:07.794069239 +0400
|
|
326 |
@@ -306,6 +306,7 @@
|
|
72.1.1
by Oleg Tsarev
backup |
327 |
lex->describe= 0; |
328 |
lex->subqueries= FALSE; |
|
195
by Oleg Tsarev
Port Oleg and Alexey patches to 5.1.55 |
329 |
lex->context_analysis_only= 0; |
72.1.1
by Oleg Tsarev
backup |
330 |
+ lex->disable_flashcache= FALSE;
|
331 |
lex->derived_tables= 0; |
|
332 |
lex->lock_option= TL_READ; |
|
333 |
lex->safe_to_cache_query= 1; |
|
120.1.1
by Oleg Tsarev
fix bug 649623 |
334 |
diff -ruN a/sql/sql_lex.h b/sql/sql_lex.h
|
78.1.1
by Oleg Tsarev
adapt patches to 5.1.49 version |
335 |
--- a/sql/sql_lex.h 2010-07-28 16:47:58.575318748 +0400
|
336 |
+++ b/sql/sql_lex.h 2010-07-28 16:48:08.405691834 +0400
|
|
195
by Oleg Tsarev
Port Oleg and Alexey patches to 5.1.55 |
337 |
@@ -1722,6 +1722,7 @@
|
338 |
||
339 |
uint8 context_analysis_only; |
|
72.1.1
by Oleg Tsarev
backup |
340 |
bool safe_to_cache_query; |
341 |
+ bool disable_flashcache;
|
|
342 |
bool subqueries, ignore; |
|
343 |
st_parsing_options parsing_options; |
|
344 |
Alter_info alter_info; |
|
120.1.1
by Oleg Tsarev
fix bug 649623 |
345 |
diff -ruN a/sql/sql_select.cc b/sql/sql_select.cc
|
78.1.1
by Oleg Tsarev
adapt patches to 5.1.49 version |
346 |
--- a/sql/sql_select.cc 2010-07-28 16:47:58.555318714 +0400
|
347 |
+++ b/sql/sql_select.cc 2010-07-28 16:48:13.414069437 +0400
|
|
120.1.1
by Oleg Tsarev
fix bug 649623 |
348 |
@@ -37,6 +37,12 @@
|
72.1.1
by Oleg Tsarev
backup |
349 |
#include <hash.h> |
350 |
#include <ft_global.h> |
|
351 |
||
352 |
+#include <sys/syscall.h>
|
|
353 |
+#include <sys/ioctl.h>
|
|
120.1.1
by Oleg Tsarev
fix bug 649623 |
354 |
+#if defined(__linux__)
|
72.1.1
by Oleg Tsarev
backup |
355 |
+#include "flashcache_ioctl.h"
|
120.1.1
by Oleg Tsarev
fix bug 649623 |
356 |
+#endif//__linux__
|
72.1.1
by Oleg Tsarev
backup |
357 |
+
|
358 |
const char *join_type_str[]={ "UNKNOWN","system","const","eq_ref","ref", |
|
359 |
"MAYBE_REF","ALL","range","index","fulltext", |
|
360 |
"ref_or_null","unique_subquery","index_subquery", |
|
190
by Alexey Kopytov
This patch fixes compiler warnings introduced by Percona patches in the |
361 |
@@ -239,9 +245,20 @@
|
72.1.1
by Oleg Tsarev
backup |
362 |
ulong setup_tables_done_option) |
363 |
{ |
|
364 |
bool res; |
|
190
by Alexey Kopytov
This patch fixes compiler warnings introduced by Percona patches in the |
365 |
+#if defined(__linux__)
|
72.1.1
by Oleg Tsarev
backup |
366 |
+ pid_t pid;
|
190
by Alexey Kopytov
This patch fixes compiler warnings introduced by Percona patches in the |
367 |
+#endif
|
72.1.1
by Oleg Tsarev
backup |
368 |
register SELECT_LEX *select_lex = &lex->select_lex; |
369 |
DBUG_ENTER("handle_select"); |
|
370 |
||
120.1.1
by Oleg Tsarev
fix bug 649623 |
371 |
+#if defined(__linux__)
|
72.1.1
by Oleg Tsarev
backup |
372 |
+ if(lex->disable_flashcache && cachedev_fd > 0)
|
373 |
+ {
|
|
374 |
+ pid = syscall(SYS_gettid);
|
|
375 |
+ ioctl(cachedev_fd, FLASHCACHEADDNCPID, &pid);
|
|
376 |
+ }
|
|
120.1.1
by Oleg Tsarev
fix bug 649623 |
377 |
+#endif//__linux__
|
378 |
+
|
|
72.1.1
by Oleg Tsarev
backup |
379 |
if (select_lex->master_unit()->is_union() || |
380 |
select_lex->master_unit()->fake_select_lex) |
|
381 |
res= mysql_union(thd, lex, result, &lex->unit, setup_tables_done_option); |
|
195
by Oleg Tsarev
Port Oleg and Alexey patches to 5.1.55 |
382 |
@@ -274,6 +291,12 @@
|
72.1.1
by Oleg Tsarev
backup |
383 |
if (unlikely(res)) |
384 |
result->abort(); |
|
385 |
||
120.1.1
by Oleg Tsarev
fix bug 649623 |
386 |
+#if defined(__linux__)
|
72.1.1
by Oleg Tsarev
backup |
387 |
+ if (lex->disable_flashcache && cachedev_fd > 0)
|
388 |
+ {
|
|
389 |
+ ioctl(cachedev_fd, FLASHCACHEDELNCPID, &pid);
|
|
390 |
+ }
|
|
120.1.1
by Oleg Tsarev
fix bug 649623 |
391 |
+#endif//__linux__
|
72.1.1
by Oleg Tsarev
backup |
392 |
DBUG_RETURN(res); |
393 |
} |
|
394 |
||
120.1.1
by Oleg Tsarev
fix bug 649623 |
395 |
diff -ruN a/sql/sql_yacc.yy b/sql/sql_yacc.yy
|
78.1.1
by Oleg Tsarev
adapt patches to 5.1.49 version |
396 |
--- a/sql/sql_yacc.yy 2010-07-28 16:47:58.565318871 +0400
|
397 |
+++ b/sql/sql_yacc.yy 2010-07-28 16:48:14.205317990 +0400
|
|
398 |
@@ -1164,6 +1164,7 @@
|
|
72.1.1
by Oleg Tsarev
backup |
399 |
%token SQL_CACHE_SYM |
400 |
%token SQL_CALC_FOUND_ROWS |
|
401 |
%token SQL_NO_CACHE_SYM |
|
402 |
+%token SQL_NO_FCACHE_SYM
|
|
403 |
%token SQL_SMALL_RESULT |
|
404 |
%token SQL_SYM /* SQL-2003-R */ |
|
405 |
%token SQL_THREAD |
|
127.1.1
by Oleg Tsarev
port Oleg's patches to 5.1.51 |
406 |
@@ -6752,6 +6753,10 @@
|
72.1.1
by Oleg Tsarev
backup |
407 |
Lex->select_lex.options&= ~OPTION_TO_QUERY_CACHE; |
408 |
Lex->select_lex.sql_cache= SELECT_LEX::SQL_NO_CACHE; |
|
409 |
} |
|
410 |
+ | SQL_NO_FCACHE_SYM
|
|
411 |
+ {
|
|
412 |
+ Lex->disable_flashcache= TRUE;
|
|
413 |
+ }
|
|
414 |
| SQL_CACHE_SYM |
|
415 |
{ |
|
416 |
/* |