Merge lp:~percona-dev/percona-server/sql_no_fcache-fix into lp:percona-server/release-5.1.49-12

Proposed by Aleksandr Kuzminsky
Status: Merged
Approved by: Percona
Approved revision: no longer in the source branch.
Merged at revision: 108
Proposed branch: lp:~percona-dev/percona-server/sql_no_fcache-fix
Merge into: lp:percona-server/release-5.1.49-12
Diff against target: 135 lines (+34/-21)
1 file modified
sql_no_fcache.patch (+34/-21)
To merge this branch: bzr merge lp:~percona-dev/percona-server/sql_no_fcache-fix
Reviewer Review Type Date Requested Status
Oleg Tsarev (community) Approve
Percona developers Pending
Review via email: mp+34677@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Oleg Tsarev (tsarev) wrote :

All fine

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'sql_no_fcache.patch'
2--- sql_no_fcache.patch 2010-08-23 11:04:47 +0000
3+++ sql_no_fcache.patch 2010-09-06 14:17:41 +0000
4@@ -156,17 +156,18 @@
5 diff -Nur a/sql/mysqld.cc b/sql/mysqld.cc
6 --- a/sql/mysqld.cc 2010-07-28 16:47:58.565318871 +0400
7 +++ b/sql/mysqld.cc 2010-07-28 16:48:03.004544367 +0400
8-@@ -47,6 +47,10 @@
9- #endif
10- #endif
11-
12+@@ -46,6 +46,11 @@
13+ #define OPT_NDB_SHM_DEFAULT 0
14+ #endif
15+ #endif
16++#if defined(__linux__)
17 +#include <mntent.h>
18 +#include <sys/statfs.h>
19 +#include "flashcache_ioctl.h"
20-+
21++#endif//__linux__
22+
23 #ifndef DEFAULT_SKIP_THREAD_PRIORITY
24 #define DEFAULT_SKIP_THREAD_PRIORITY 0
25- #endif
26 @@ -591,6 +595,11 @@
27 ulong max_connections, max_connect_errors;
28 uint max_user_connections= 0;
29@@ -179,10 +180,11 @@
30 /**
31 Limit of the total number of prepared statements in the server.
32 Is necessary to protect the server against out-of-memory attacks.
33-@@ -4370,6 +4379,95 @@
34+@@ -4370,6 +4380,97 @@
35 }
36 #endif//DBUG_OFF
37-
38+
39++#if defined(__linux__)
40 +/*
41 + * Auto detect if we support flash cache on the host system.
42 + * This needs to be called before we setuid away from root
43@@ -272,26 +274,31 @@
44 + cachedev_fd = -1;
45 + }
46 +}
47++#endif//__linux__
48
49 #ifdef __WIN__
50 int win_main(int argc, char **argv)
51-@@ -4474,6 +4572,8 @@
52+@@ -4474,6 +4575,10 @@
53 test_lc_time_sz();
54 #endif
55-
56+
57++#if defined(__linux__)
58 + init_cachedev();
59-+
60++#endif//__linux__
61++
62 /*
63 We have enough space for fiddling with the argv, continue
64 */
65-@@ -4675,6 +4775,8 @@
66+@@ -4675,6 +4780,10 @@
67 clean_up_mutexes();
68 my_end(opt_endinfo ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
69-
70+
71++#if defined(__linux__)
72 + cleanup_cachedev();
73++#endif//__linux__
74 +
75 exit(0);
76- return(0); /* purecov: deadcode */
77+ return(0); /* purecov: deadcode */
78 }
79 @@ -7827,6 +7929,7 @@
80 {"Delayed_errors", (char*) &delayed_insert_errors, SHOW_LONG},
81@@ -338,42 +345,48 @@
82 diff -Nur a/sql/sql_select.cc b/sql/sql_select.cc
83 --- a/sql/sql_select.cc 2010-07-28 16:47:58.555318714 +0400
84 +++ b/sql/sql_select.cc 2010-07-28 16:48:13.414069437 +0400
85-@@ -37,6 +37,10 @@
86+@@ -37,6 +37,12 @@
87 #include <hash.h>
88 #include <ft_global.h>
89-
90+
91 +#include <sys/syscall.h>
92 +#include <sys/ioctl.h>
93++#if defined(__linux__)
94 +#include "flashcache_ioctl.h"
95++#endif//__linux__
96 +
97 const char *join_type_str[]={ "UNKNOWN","system","const","eq_ref","ref",
98 "MAYBE_REF","ALL","range","index","fulltext",
99 "ref_or_null","unique_subquery","index_subquery",
100-@@ -239,9 +243,16 @@
101+@@ -239,9 +245,18 @@
102 ulong setup_tables_done_option)
103 {
104 bool res;
105 + pid_t pid;
106 register SELECT_LEX *select_lex = &lex->select_lex;
107 DBUG_ENTER("handle_select");
108-
109+
110++#if defined(__linux__)
111 + if(lex->disable_flashcache && cachedev_fd > 0)
112 + {
113 + pid = syscall(SYS_gettid);
114 + ioctl(cachedev_fd, FLASHCACHEADDNCPID, &pid);
115 + }
116-+
117++#endif//__linux__
118++
119 if (select_lex->master_unit()->is_union() ||
120 select_lex->master_unit()->fake_select_lex)
121 res= mysql_union(thd, lex, result, &lex->unit, setup_tables_done_option);
122-@@ -274,6 +285,10 @@
123+@@ -274,6 +289,12 @@
124 if (unlikely(res))
125 result->abort();
126-
127+
128++#if defined(__linux__)
129 + if (lex->disable_flashcache && cachedev_fd > 0)
130 + {
131 + ioctl(cachedev_fd, FLASHCACHEDELNCPID, &pid);
132 + }
133++#endif//__linux__
134 DBUG_RETURN(res);
135 }
136

Subscribers

People subscribed via source and target branches

to all changes: