]> git.pld-linux.org Git - packages/percona-server.git/blob - mysql-sphinx.patch
- from sphinx-0.9.9/mysqlse/sphinx.5.0.37.diff
[packages/percona-server.git] / mysql-sphinx.patch
1 --- mysql-5.0.67/config/ac-macros/ha_sphinx.m4  1970-01-01 10:00:00.000000000 +1000
2 +++ mysql-5.0.67-sphinx/config/ac-macros/ha_sphinx.m4   2009-02-14 09:15:48.000000000 +1000
3 @@ -0,0 +1,30 @@
4 +dnl ---------------------------------------------------------------------------
5 +dnl Macro: MYSQL_CHECK_EXAMPLEDB
6 +dnl Sets HAVE_SPHINX_DB if --with-sphinx-storage-engine is used
7 +dnl ---------------------------------------------------------------------------
8 +AC_DEFUN([MYSQL_CHECK_SPHINXDB], [
9 +  AC_ARG_WITH([sphinx-storage-engine],
10 +              [
11 +  --with-sphinx-storage-engine
12 +                          Enable the Sphinx Storage Engine],
13 +              [sphinxdb="$withval"],
14 +              [sphinxdb=no])
15 +  AC_MSG_CHECKING([for example storage engine])
16 +
17 +  case "$sphinxdb" in
18 +    yes )
19 +      AC_DEFINE([HAVE_SPHINX_DB], [1], [Builds Sphinx Engine])
20 +      AC_MSG_RESULT([yes])
21 +      [sphinxdb=yes]
22 +      ;;
23 +    * )
24 +      AC_MSG_RESULT([no])
25 +      [sphinxdb=no]
26 +      ;;
27 +  esac
28 +
29 +])
30 +dnl ---------------------------------------------------------------------------
31 +dnl END OF MYSQL_CHECK_EXAMPLE SECTION
32 +dnl ---------------------------------------------------------------------------
33 +
34 --- mysql-5.0.67/configure.in   2008-08-04 23:19:07.000000000 +1100
35 +++ mysql-5.0.67-sphinx/configure.in    2009-02-14 09:15:48.000000000 +1000
36 @@ -58,6 +58,7 @@
37  sinclude(config/ac-macros/ha_berkeley.m4)
38  sinclude(config/ac-macros/ha_blackhole.m4)
39  sinclude(config/ac-macros/ha_example.m4)
40 +sinclude(config/ac-macros/ha_sphinx.m4)
41  sinclude(config/ac-macros/ha_federated.m4)
42  sinclude(config/ac-macros/ha_innodb.m4)
43  sinclude(config/ac-macros/ha_ndbcluster.m4)
44 @@ -2625,6 +2626,7 @@
45  MYSQL_CHECK_BDB
46  MYSQL_CHECK_INNODB
47  MYSQL_CHECK_EXAMPLEDB
48 +MYSQL_CHECK_SPHINXDB
49  MYSQL_CHECK_ARCHIVEDB
50  MYSQL_CHECK_CSVDB
51  MYSQL_CHECK_BLACKHOLEDB
52 --- mysql-5.0.67/libmysqld/Makefile.am  2008-08-04 23:19:18.000000000 +1100
53 +++ mysql-5.0.67-sphinx/libmysqld/Makefile.am   2009-02-14 09:15:48.000000000 +1000
54 @@ -29,6 +29,7 @@
55                         -I$(top_builddir)/include -I$(top_srcdir)/include \
56                         -I$(top_builddir)/sql -I$(top_srcdir)/sql \
57                         -I$(top_srcdir)/sql/examples \
58 +                       -I$(top_srcdir)/sql/sphinx \
59                         -I$(top_srcdir)/regex \
60                         $(openssl_includes) @ZLIB_INCLUDES@
61  
62 @@ -39,6 +40,7 @@
63  libmysqlsources =      errmsg.c get_password.c libmysql.c client.c pack.c \
64                          my_time.c
65  sqlexamplessources =   ha_example.cc ha_tina.cc
66 +sqlsphinxsources =     ha_sphinx.cc
67  
68  noinst_HEADERS =       embedded_priv.h emb_qcache.h
69  
70 @@ -67,7 +69,7 @@
71         parse_file.cc sql_view.cc sql_trigger.cc my_decimal.cc \
72         ha_blackhole.cc ha_archive.cc my_user.c
73  
74 -libmysqld_int_a_SOURCES= $(libmysqld_sources) $(libmysqlsources) $(sqlsources) $(sqlexamplessources)
75 +libmysqld_int_a_SOURCES= $(libmysqld_sources) $(libmysqlsources) $(sqlsources) $(sqlexamplessources) $(sqlsphinxsources)
76  libmysqld_a_SOURCES=
77  
78  # automake misses these
79 @@ -147,12 +149,16 @@
80             rm -f $$f; \
81             @LN_CP_F@ $(top_srcdir)/sql/examples/$$f $$f; \
82           done; \
83 +         for f in $(sqlsphinxsources); do \
84 +           rm -f $$f; \
85 +           @LN_CP_F@ $(top_srcdir)/sql/sphinx/$$f $$f; \
86 +         done; \
87           rm -f client_settings.h; \
88           @LN_CP_F@ $(top_srcdir)/libmysql/client_settings.h client_settings.h
89  
90  
91  clean-local:
92 -       rm -f `echo $(sqlsources) $(libmysqlsources) $(sqlexamplessources) | sed "s;\.lo;.c;g"` \
93 +       rm -f `echo $(sqlsources) $(libmysqlsources) $(sqlexamplessources) $(sqlsphinxsources) | sed "s;\.lo;.c;g"` \
94                $(top_srcdir)/linked_libmysqld_sources; \
95         rm -f client_settings.h
96  
97 --- mysql-5.0.67/sql/handler.cc 2008-08-04 23:20:04.000000000 +1100
98 +++ mysql-5.0.67-sphinx/sql/handler.cc  2009-02-14 09:15:48.000000000 +1000
99 @@ -77,6 +77,15 @@
100    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
101    HTON_NO_FLAGS };
102  #endif
103 +#ifdef HAVE_SPHINX_DB
104 +#include "sphinx/ha_sphinx.h"
105 +extern handlerton sphinx_hton;
106 +#else
107 +handlerton sphinx_hton = { "SPHINX", SHOW_OPTION_NO, "SPHINX storage engine",
108 +  DB_TYPE_SPHINX_DB, NULL, 0, 0, NULL, NULL,
109 +  NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
110 +  HTON_NO_FLAGS };
111 +#endif
112  #ifdef HAVE_INNOBASE_DB
113  #include "ha_innodb.h"
114  extern handlerton innobase_hton;
115 @@ -141,6 +150,7 @@
116    &example_hton,
117    &archive_hton,
118    &tina_hton,
119 +  &sphinx_hton,
120    &ndbcluster_hton,
121    &federated_hton,
122    &myisammrg_hton,
123 @@ -341,6 +351,12 @@
124        return new (alloc) ha_tina(table);
125      return NULL;
126  #endif
127 +#ifdef HAVE_SPHINX_DB
128 +  case DB_TYPE_SPHINX_DB:
129 +    if (have_sphinx_db == SHOW_OPTION_YES)
130 +      return new (alloc) ha_sphinx(table);
131 +    return NULL;
132 +#endif
133  #ifdef HAVE_NDBCLUSTER_DB
134    case DB_TYPE_NDBCLUSTER:
135      if (have_ndbcluster == SHOW_OPTION_YES)
136 --- mysql-5.0.67/sql/handler.h  2008-08-04 23:20:04.000000000 +1100
137 +++ mysql-5.0.67-sphinx/sql/handler.h   2009-02-14 09:15:48.000000000 +1000
138 @@ -186,8 +186,9 @@
139    DB_TYPE_BERKELEY_DB, DB_TYPE_INNODB,
140    DB_TYPE_GEMINI, DB_TYPE_NDBCLUSTER,
141    DB_TYPE_EXAMPLE_DB, DB_TYPE_ARCHIVE_DB, DB_TYPE_CSV_DB,
142 -  DB_TYPE_FEDERATED_DB,
143 +  DB_TYPE_FEDERATED_DB, 
144    DB_TYPE_BLACKHOLE_DB,
145 +  DB_TYPE_SPHINX_DB,
146    DB_TYPE_DEFAULT // Must be last
147  };
148  
149 --- mysql-5.0.67/sql/Makefile.am        2008-08-04 23:20:02.000000000 +1100
150 +++ mysql-5.0.67-sphinx/sql/Makefile.am 2009-02-14 09:23:28.000000000 +1000
151 @@ -68,6 +68,7 @@
152                         sql_array.h sql_cursor.h \
153                         examples/ha_example.h ha_archive.h \
154                         examples/ha_tina.h ha_blackhole.h  \
155 +                       sphinx/ha_sphinx.h \
156                         ha_federated.h
157  mysqld_SOURCES =       sql_lex.cc sql_handler.cc \
158                         item.cc item_sum.cc item_buff.cc item_func.cc \
159 @@ -105,6 +106,7 @@
160                         sp_cache.cc parse_file.cc sql_trigger.cc \
161                         examples/ha_example.cc ha_archive.cc \
162                         examples/ha_tina.cc ha_blackhole.cc \
163 +                       sphinx/ha_sphinx.cc \
164                         ha_federated.cc
165  
166  gen_lex_hash_SOURCES = gen_lex_hash.cc
167 @@ -174,6 +176,10 @@
168  udf_example_la_SOURCES= udf_example.c
169  udf_example_la_LDFLAGS= -module -rpath $(pkglibdir)
170  
171 +pkglib_LTLIBRARIES = sphinx/sphinx.la
172 +sphinx_sphinx_la_SOURCES = sphinx/snippets_udf.cc
173 +sphinx_sphinx_la_LDFLAGS = -module
174 +
175  
176  # Don't update the files from bitkeeper
177  %::SCCS/s.%
178 --- mysql-5.0.67/sql/mysqld.cc  2008-08-04 23:20:07.000000000 +1100
179 +++ mysql-5.0.67-sphinx/sql/mysqld.cc   2009-02-14 09:15:48.000000000 +1000
180 @@ -36,6 +36,10 @@
181  #include <sys/prctl.h>
182  #endif
183  
184 +#ifdef HAVE_SPHINX_DB
185 +#include "sphinx/ha_sphinx.h"
186 +#endif
187 +
188  #ifdef HAVE_INNOBASE_DB
189  #define OPT_INNODB_DEFAULT 1
190  #else
191 @@ -6633,6 +6637,13 @@
192    {"Threads_running",          (char*) &thread_running,         SHOW_INT_CONST},
193    {"Uptime",                   (char*) 0,                       SHOW_STARTTIME},
194    {"Uptime_since_flush_status",(char*) 0,                       SHOW_FLUSHTIME},
195 +#ifdef HAVE_SPHINX_DB
196 +  {"sphinx_total",                     (char *)sphinx_showfunc_total,                  SHOW_SPHINX_FUNC},
197 +  {"sphinx_total_found",       (char *)sphinx_showfunc_total_found,    SHOW_SPHINX_FUNC},
198 +  {"sphinx_time",                      (char *)sphinx_showfunc_time,                   SHOW_SPHINX_FUNC},
199 +  {"sphinx_word_count",                (char *)sphinx_showfunc_word_count,             SHOW_SPHINX_FUNC},
200 +  {"sphinx_words",                     (char *)sphinx_showfunc_words,                  SHOW_SPHINX_FUNC},
201 +#endif
202    {NullS, NullS, SHOW_LONG}
203  };
204  
205 @@ -6875,6 +6886,11 @@
206  #else
207    have_csv_db= SHOW_OPTION_NO;
208  #endif
209 +#ifdef HAVE_SPHINX_DB
210 +  have_sphinx_db= SHOW_OPTION_YES;
211 +#else
212 +  have_sphinx_db= SHOW_OPTION_NO;
213 +#endif
214  #ifdef HAVE_NDBCLUSTER_DB
215    have_ndbcluster=SHOW_OPTION_DISABLED;
216  #else
217 @@ -7983,6 +7999,7 @@
218  #undef have_example_db
219  #undef have_archive_db
220  #undef have_csv_db
221 +#undef have_sphinx_db
222  #undef have_federated_db
223  #undef have_partition_db
224  #undef have_blackhole_db
225 @@ -7993,6 +8010,7 @@
226  SHOW_COMP_OPTION have_example_db= SHOW_OPTION_NO;
227  SHOW_COMP_OPTION have_archive_db= SHOW_OPTION_NO;
228  SHOW_COMP_OPTION have_csv_db= SHOW_OPTION_NO;
229 +SHOW_COMP_OPTION have_sphinx_db= SHOW_OPTION_NO;
230  SHOW_COMP_OPTION have_federated_db= SHOW_OPTION_NO;
231  SHOW_COMP_OPTION have_partition_db= SHOW_OPTION_NO;
232  SHOW_COMP_OPTION have_blackhole_db= SHOW_OPTION_NO;
233 --- mysql-5.0.67/sql/mysql_priv.h       2008-08-04 23:20:07.000000000 +1100
234 +++ mysql-5.0.67-sphinx/sql/mysql_priv.h        2009-02-14 09:15:48.000000000 +1000
235 @@ -1439,6 +1439,12 @@
236  #else
237  extern SHOW_COMP_OPTION have_csv_db;
238  #endif
239 +#ifdef HAVE_SPHINX_DB
240 +extern handlerton sphinx_hton;
241 +#define have_sphinx_db sphinx_hton.state
242 +#else
243 +extern SHOW_COMP_OPTION have_sphinx_db;
244 +#endif
245  #ifdef HAVE_FEDERATED_DB
246  extern handlerton federated_hton;
247  #define have_federated_db federated_hton.state
248 --- mysql-5.0.67/sql/set_var.cc 2008-08-04 23:20:08.000000000 +1100
249 +++ mysql-5.0.67-sphinx/sql/set_var.cc  2009-02-14 09:15:48.000000000 +1000
250 @@ -888,6 +888,7 @@
251    {"have_compress",          (char*) &have_compress,               SHOW_HAVE},
252    {"have_crypt",             (char*) &have_crypt,                  SHOW_HAVE},
253    {"have_csv",               (char*) &have_csv_db,                 SHOW_HAVE},
254 +  {"have_sphinx",             (char*) &have_sphinx_db,              SHOW_HAVE},
255    {"have_dynamic_loading",    (char*) &have_dlopen,                SHOW_HAVE},
256    {"have_example_engine",     (char*) &have_example_db,                    SHOW_HAVE},
257    {"have_federated_engine",   (char*) &have_federated_db,           SHOW_HAVE},
258 --- mysql-5.0.67/sql/sql_lex.h  2008-08-04 23:20:10.000000000 +1100
259 +++ mysql-5.0.67-sphinx/sql/sql_lex.h   2009-02-14 09:15:48.000000000 +1000
260 @@ -57,6 +57,7 @@
261    SQLCOM_SHOW_DATABASES, SQLCOM_SHOW_TABLES, SQLCOM_SHOW_FIELDS,
262    SQLCOM_SHOW_KEYS, SQLCOM_SHOW_VARIABLES, SQLCOM_SHOW_LOGS, SQLCOM_SHOW_STATUS,
263    SQLCOM_SHOW_INNODB_STATUS, SQLCOM_SHOW_NDBCLUSTER_STATUS, SQLCOM_SHOW_MUTEX_STATUS,
264 +  SQLCOM_SHOW_SPHINX_STATUS,
265    SQLCOM_SHOW_PROCESSLIST, SQLCOM_SHOW_MASTER_STAT, SQLCOM_SHOW_SLAVE_STAT,
266    SQLCOM_SHOW_GRANTS, SQLCOM_SHOW_CREATE, SQLCOM_SHOW_CHARSETS,
267    SQLCOM_SHOW_COLLATIONS, SQLCOM_SHOW_CREATE_DB, SQLCOM_SHOW_TABLE_STATUS,
268 --- mysql-5.0.67/sql/sql_parse.cc       2008-08-04 23:20:10.000000000 +1100
269 +++ mysql-5.0.67-sphinx/sql/sql_parse.cc        2009-02-14 09:15:48.000000000 +1000
270 @@ -24,6 +24,9 @@
271  #ifdef HAVE_INNOBASE_DB
272  #include "ha_innodb.h"
273  #endif
274 +#ifdef HAVE_SPHINX_DB
275 +#include "sphinx/ha_sphinx.h"
276 +#endif
277  
278  #ifdef HAVE_NDBCLUSTER_DB
279  #include "ha_ndbcluster.h"
280 @@ -3006,6 +3009,15 @@
281        break;
282      }
283  #endif
284 +#ifdef HAVE_SPHINX_DB
285 +  case SQLCOM_SHOW_SPHINX_STATUS:
286 +    {
287 +      if (check_global_access(thd, SUPER_ACL))
288 +       goto error;
289 +      res = sphinx_show_status(thd);
290 +      break;
291 +    }
292 +#endif
293  #ifdef HAVE_REPLICATION
294    case SQLCOM_LOAD_MASTER_TABLE:
295    {
296 --- mysql-5.0.67/sql/sql_yacc.yy        2008-08-04 23:20:12.000000000 +1100
297 +++ mysql-5.0.67-sphinx/sql/sql_yacc.yy 2009-02-14 09:15:48.000000000 +1000
298 @@ -7393,6 +7393,9 @@
299             case DB_TYPE_INNODB:
300               Lex->sql_command = SQLCOM_SHOW_INNODB_STATUS;
301               break;
302 +           case DB_TYPE_SPHINX_DB:
303 +             Lex->sql_command = SQLCOM_SHOW_SPHINX_STATUS;
304 +             break;
305             default:
306               my_error(ER_NOT_SUPPORTED_YET, MYF(0), "STATUS");
307               MYSQL_YYABORT;
308 --- mysql-5.0.67/sql/structs.h  2008-08-04 23:20:12.000000000 +1100
309 +++ mysql-5.0.67-sphinx/sql/structs.h   2009-02-14 09:15:48.000000000 +1000
310 @@ -188,6 +188,9 @@
311    SHOW_SSL_CTX_SESS_TIMEOUTS, SHOW_SSL_CTX_SESS_CACHE_FULL,
312    SHOW_SSL_GET_CIPHER_LIST,
313  #endif /* HAVE_OPENSSL */
314 +#ifdef HAVE_SPHINX_DB
315 +  SHOW_SPHINX_FUNC,
316 +#endif
317    SHOW_NET_COMPRESSION,
318    SHOW_RPL_STATUS, SHOW_SLAVE_RUNNING, SHOW_SLAVE_RETRIED_TRANS,
319    SHOW_KEY_CACHE_LONG, SHOW_KEY_CACHE_CONST_LONG, SHOW_KEY_CACHE_LONGLONG,
320 --- mysql-5.0.67/sql/sql_show.cc        2008-08-04 23:20:11.000000000 +1100
321 +++ mysql-5.0.67-sphinx/sql/sql_show.cc 2009-02-14 09:15:48.000000000 +1000
322 @@ -1473,6 +1473,16 @@
323            value=     (char*) ((sys_var*) value)->value_ptr(thd, value_type,
324                                                             &null_lex_str);
325          }
326 +               #ifdef HAVE_SPHINX_DB
327 +               else if (show_type == SHOW_SPHINX_FUNC)
328 +               {
329 +                       SHOW_VAR var;
330 +                       ((int (*)(THD *, SHOW_VAR *, char *))value)(thd, &var, buff);
331 +
332 +                       value = var.value;
333 +                       show_type = var.type;
334 +               }
335 +               #endif /* HAVE_SPHINX_DB */
336  
337          pos= end= buff;
338          switch (show_type) {
This page took 0.048299 seconds and 4 git commands to generate.