sphinx.5.0.37.diff 12 KB

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