sphinx.5.0.91.diff 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  1. diff -r 319c65835581 CMakeLists.txt
  2. --- a/CMakeLists.txt Sun Jun 20 15:15:01 2010 +0400
  3. +++ b/CMakeLists.txt Sun Jun 20 15:59:31 2010 +0400
  4. @@ -70,6 +70,10 @@
  5. ADD_DEFINITIONS(-DHAVE_INNOBASE_DB)
  6. ENDIF(WITH_INNOBASE_STORAGE_ENGINE)
  7. +IF(WITH_SPHINX_STORAGE_ENGINE)
  8. + ADD_DEFINITIONS(-DHAVE_SPHINX_DB)
  9. +ENDIF(WITH_SPHINX_STORAGE_ENGINE)
  10. +
  11. SET(localstatedir "C:\\mysql\\data")
  12. CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/support-files/my-huge.cnf.sh
  13. ${CMAKE_SOURCE_DIR}/support-files/my-huge.ini @ONLY)
  14. diff -r 319c65835581 configure.in
  15. --- a/configure.in Sun Jun 20 15:15:01 2010 +0400
  16. +++ b/configure.in Sun Jun 20 15:59:31 2010 +0400
  17. @@ -60,6 +60,7 @@
  18. sinclude(config/ac-macros/ha_berkeley.m4)
  19. sinclude(config/ac-macros/ha_blackhole.m4)
  20. sinclude(config/ac-macros/ha_example.m4)
  21. +sinclude(config/ac-macros/ha_sphinx.m4)
  22. sinclude(config/ac-macros/ha_federated.m4)
  23. sinclude(config/ac-macros/ha_innodb.m4)
  24. sinclude(config/ac-macros/ha_ndbcluster.m4)
  25. @@ -2696,6 +2697,7 @@
  26. MYSQL_CHECK_BDB
  27. MYSQL_CHECK_INNODB
  28. MYSQL_CHECK_EXAMPLEDB
  29. +MYSQL_CHECK_SPHINXDB
  30. MYSQL_CHECK_ARCHIVEDB
  31. MYSQL_CHECK_CSVDB
  32. MYSQL_CHECK_BLACKHOLEDB
  33. diff -r 319c65835581 libmysqld/Makefile.am
  34. --- a/libmysqld/Makefile.am Sun Jun 20 15:15:01 2010 +0400
  35. +++ b/libmysqld/Makefile.am Sun Jun 20 15:59:31 2010 +0400
  36. @@ -29,6 +29,7 @@
  37. -I$(top_builddir)/include -I$(top_srcdir)/include \
  38. -I$(top_builddir)/sql -I$(top_srcdir)/sql \
  39. -I$(top_srcdir)/sql/examples \
  40. + -I$(top_srcdir)/sql/sphinx \
  41. -I$(top_srcdir)/regex \
  42. $(openssl_includes) @ZLIB_INCLUDES@
  43. @@ -39,6 +40,7 @@
  44. libmysqlsources = errmsg.c get_password.c libmysql.c client.c pack.c \
  45. my_time.c
  46. sqlexamplessources = ha_example.cc ha_tina.cc
  47. +sqlsphinxsources = ha_sphinx.cc
  48. noinst_HEADERS = embedded_priv.h emb_qcache.h
  49. @@ -67,7 +69,7 @@
  50. parse_file.cc sql_view.cc sql_trigger.cc my_decimal.cc \
  51. ha_blackhole.cc ha_archive.cc my_user.c
  52. -libmysqld_int_a_SOURCES= $(libmysqld_sources) $(libmysqlsources) $(sqlsources) $(sqlexamplessources)
  53. +libmysqld_int_a_SOURCES= $(libmysqld_sources) $(libmysqlsources) $(sqlsources) $(sqlexamplessources) $(sqlsphinxsources)
  54. libmysqld_a_SOURCES=
  55. # automake misses these
  56. @@ -147,12 +149,16 @@
  57. rm -f $$f; \
  58. @LN_CP_F@ $(top_srcdir)/sql/examples/$$f $$f; \
  59. done; \
  60. + for f in $(sqlsphinxsources); do \
  61. + rm -f $$f; \
  62. + @LN_CP_F@ $(top_srcdir)/sql/sphinx/$$f $$f; \
  63. + done; \
  64. rm -f client_settings.h; \
  65. @LN_CP_F@ $(top_srcdir)/libmysql/client_settings.h client_settings.h
  66. clean-local:
  67. - rm -f `echo $(sqlsources) $(libmysqlsources) $(sqlexamplessources) | sed "s;\.lo;.c;g"` \
  68. + rm -f `echo $(sqlsources) $(libmysqlsources) $(sqlexamplessources) $(sqlsphinxsources) | sed "s;\.lo;.c;g"` \
  69. $(top_srcdir)/linked_libmysqld_sources; \
  70. rm -f client_settings.h
  71. diff -r 319c65835581 sql/CMakeLists.txt
  72. --- a/sql/CMakeLists.txt Sun Jun 20 15:15:01 2010 +0400
  73. +++ b/sql/CMakeLists.txt Sun Jun 20 15:59:31 2010 +0400
  74. @@ -50,6 +50,7 @@
  75. filesort.cc gstream.cc ha_blackhole.cc
  76. ha_archive.cc ha_heap.cc ha_myisam.cc ha_myisammrg.cc
  77. ha_innodb.cc ha_federated.cc ha_berkeley.cc
  78. + sphinx/ha_sphinx.cc
  79. handler.cc hash_filo.cc hash_filo.h
  80. hostname.cc init.cc item.cc item_buff.cc item_cmpfunc.cc
  81. item_create.cc item_func.cc item_geofunc.cc item_row.cc
  82. diff -r 319c65835581 sql/Makefile.am
  83. --- a/sql/Makefile.am Sun Jun 20 15:15:01 2010 +0400
  84. +++ b/sql/Makefile.am Sun Jun 20 15:59:31 2010 +0400
  85. @@ -68,6 +68,7 @@
  86. sql_array.h sql_cursor.h \
  87. examples/ha_example.h ha_archive.h \
  88. examples/ha_tina.h ha_blackhole.h \
  89. + sphinx/ha_sphinx.h \
  90. ha_federated.h
  91. mysqld_SOURCES = sql_lex.cc sql_handler.cc \
  92. item.cc item_sum.cc item_buff.cc item_func.cc \
  93. @@ -105,6 +106,7 @@
  94. sp_cache.cc parse_file.cc sql_trigger.cc \
  95. examples/ha_example.cc ha_archive.cc \
  96. examples/ha_tina.cc ha_blackhole.cc \
  97. + sphinx/ha_sphinx.cc \
  98. ha_federated.cc
  99. gen_lex_hash_SOURCES = gen_lex_hash.cc
  100. @@ -175,6 +177,10 @@
  101. udf_example_la_SOURCES= udf_example.c
  102. udf_example_la_LDFLAGS= -module -rpath $(pkglibdir)
  103. +pkglib_LTLIBRARIES = sphinx/sphinx.la
  104. +sphinx_sphinx_la_SOURCES = sphinx/snippets_udf.cc
  105. +sphinx_sphinx_la_LDFLAGS = -module
  106. +
  107. # Don't update the files from bitkeeper
  108. %::SCCS/s.%
  109. diff -r 319c65835581 sql/handler.cc
  110. --- a/sql/handler.cc Sun Jun 20 15:15:01 2010 +0400
  111. +++ b/sql/handler.cc Sun Jun 20 15:59:31 2010 +0400
  112. @@ -77,6 +77,15 @@
  113. NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
  114. HTON_NO_FLAGS };
  115. #endif
  116. +#ifdef HAVE_SPHINX_DB
  117. +#include "sphinx/ha_sphinx.h"
  118. +extern handlerton sphinx_hton;
  119. +#else
  120. +handlerton sphinx_hton = { "SPHINX", SHOW_OPTION_NO, "SPHINX storage engine",
  121. + DB_TYPE_SPHINX_DB, NULL, 0, 0, NULL, NULL,
  122. + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
  123. + HTON_NO_FLAGS };
  124. +#endif
  125. #ifdef HAVE_INNOBASE_DB
  126. #include "ha_innodb.h"
  127. extern handlerton innobase_hton;
  128. @@ -141,6 +150,7 @@
  129. &example_hton,
  130. &archive_hton,
  131. &tina_hton,
  132. + &sphinx_hton,
  133. &ndbcluster_hton,
  134. &federated_hton,
  135. &myisammrg_hton,
  136. @@ -342,6 +352,12 @@
  137. return new (alloc) ha_tina(table);
  138. return NULL;
  139. #endif
  140. +#ifdef HAVE_SPHINX_DB
  141. + case DB_TYPE_SPHINX_DB:
  142. + if (have_sphinx_db == SHOW_OPTION_YES)
  143. + return new (alloc) ha_sphinx(table);
  144. + return NULL;
  145. +#endif
  146. #ifdef HAVE_NDBCLUSTER_DB
  147. case DB_TYPE_NDBCLUSTER:
  148. if (have_ndbcluster == SHOW_OPTION_YES)
  149. diff -r 319c65835581 sql/handler.h
  150. --- a/sql/handler.h Sun Jun 20 15:15:01 2010 +0400
  151. +++ b/sql/handler.h Sun Jun 20 15:59:31 2010 +0400
  152. @@ -186,8 +186,9 @@
  153. DB_TYPE_BERKELEY_DB, DB_TYPE_INNODB,
  154. DB_TYPE_GEMINI, DB_TYPE_NDBCLUSTER,
  155. DB_TYPE_EXAMPLE_DB, DB_TYPE_ARCHIVE_DB, DB_TYPE_CSV_DB,
  156. - DB_TYPE_FEDERATED_DB,
  157. + DB_TYPE_FEDERATED_DB,
  158. DB_TYPE_BLACKHOLE_DB,
  159. + DB_TYPE_SPHINX_DB,
  160. DB_TYPE_DEFAULT // Must be last
  161. };
  162. diff -r 319c65835581 sql/mysql_priv.h
  163. --- a/sql/mysql_priv.h Sun Jun 20 15:15:01 2010 +0400
  164. +++ b/sql/mysql_priv.h Sun Jun 20 15:59:31 2010 +0400
  165. @@ -1462,6 +1462,12 @@
  166. #else
  167. extern SHOW_COMP_OPTION have_csv_db;
  168. #endif
  169. +#ifdef HAVE_SPHINX_DB
  170. +extern handlerton sphinx_hton;
  171. +#define have_sphinx_db sphinx_hton.state
  172. +#else
  173. +extern SHOW_COMP_OPTION have_sphinx_db;
  174. +#endif
  175. #ifdef HAVE_FEDERATED_DB
  176. extern handlerton federated_hton;
  177. #define have_federated_db federated_hton.state
  178. diff -r 319c65835581 sql/mysqld.cc
  179. --- a/sql/mysqld.cc Sun Jun 20 15:15:01 2010 +0400
  180. +++ b/sql/mysqld.cc Sun Jun 20 15:59:31 2010 +0400
  181. @@ -36,6 +36,10 @@
  182. #include <sys/prctl.h>
  183. #endif
  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. @@ -6721,6 +6725,13 @@
  192. #ifdef COMMUNITY_SERVER
  193. {"Uptime_since_flush_status",(char*) 0, SHOW_FLUSHTIME},
  194. #endif
  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. @@ -6964,6 +6975,11 @@
  205. #else
  206. have_csv_db= SHOW_OPTION_NO;
  207. #endif
  208. +#ifdef HAVE_SPHINX_DB
  209. + have_sphinx_db= SHOW_OPTION_YES;
  210. +#else
  211. + have_sphinx_db= SHOW_OPTION_NO;
  212. +#endif
  213. #ifdef HAVE_NDBCLUSTER_DB
  214. have_ndbcluster=SHOW_OPTION_DISABLED;
  215. #else
  216. @@ -8087,6 +8103,7 @@
  217. #undef have_example_db
  218. #undef have_archive_db
  219. #undef have_csv_db
  220. +#undef have_sphinx_db
  221. #undef have_federated_db
  222. #undef have_partition_db
  223. #undef have_blackhole_db
  224. @@ -8097,6 +8114,7 @@
  225. SHOW_COMP_OPTION have_example_db= SHOW_OPTION_NO;
  226. SHOW_COMP_OPTION have_archive_db= SHOW_OPTION_NO;
  227. SHOW_COMP_OPTION have_csv_db= SHOW_OPTION_NO;
  228. +SHOW_COMP_OPTION have_sphinx_db= SHOW_OPTION_NO;
  229. SHOW_COMP_OPTION have_federated_db= SHOW_OPTION_NO;
  230. SHOW_COMP_OPTION have_partition_db= SHOW_OPTION_NO;
  231. SHOW_COMP_OPTION have_blackhole_db= SHOW_OPTION_NO;
  232. diff -r 319c65835581 sql/set_var.cc
  233. --- a/sql/set_var.cc Sun Jun 20 15:15:01 2010 +0400
  234. +++ b/sql/set_var.cc Sun Jun 20 15:59:31 2010 +0400
  235. @@ -913,6 +913,7 @@
  236. {"have_profiling", (char*) &have_profiling, SHOW_HAVE},
  237. {"have_crypt", (char*) &have_crypt, SHOW_HAVE},
  238. {"have_csv", (char*) &have_csv_db, SHOW_HAVE},
  239. + {"have_sphinx", (char*) &have_sphinx_db, SHOW_HAVE},
  240. {"have_dynamic_loading", (char*) &have_dlopen, SHOW_HAVE},
  241. {"have_example_engine", (char*) &have_example_db, SHOW_HAVE},
  242. {"have_federated_engine", (char*) &have_federated_db, SHOW_HAVE},
  243. diff -r 319c65835581 sql/sql_lex.h
  244. --- a/sql/sql_lex.h Sun Jun 20 15:15:01 2010 +0400
  245. +++ b/sql/sql_lex.h Sun Jun 20 15:59:31 2010 +0400
  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. diff -r 319c65835581 sql/sql_parse.cc
  255. --- a/sql/sql_parse.cc Sun Jun 20 15:15:01 2010 +0400
  256. +++ b/sql/sql_parse.cc Sun Jun 20 15:59:31 2010 +0400
  257. @@ -24,6 +24,9 @@
  258. #ifdef HAVE_INNOBASE_DB
  259. #include "ha_innodb.h"
  260. #endif
  261. +#ifdef HAVE_SPHINX_DB
  262. +#include "sphinx/ha_sphinx.h"
  263. +#endif
  264. #ifdef HAVE_NDBCLUSTER_DB
  265. #include "ha_ndbcluster.h"
  266. @@ -3166,6 +3169,15 @@
  267. break;
  268. }
  269. #endif
  270. +#ifdef HAVE_SPHINX_DB
  271. + case SQLCOM_SHOW_SPHINX_STATUS:
  272. + {
  273. + if (check_global_access(thd, SUPER_ACL))
  274. + goto error;
  275. + res = sphinx_show_status(thd);
  276. + break;
  277. + }
  278. +#endif
  279. #ifdef HAVE_REPLICATION
  280. case SQLCOM_LOAD_MASTER_TABLE:
  281. {
  282. diff -r 319c65835581 sql/sql_show.cc
  283. --- a/sql/sql_show.cc Sun Jun 20 15:15:01 2010 +0400
  284. +++ b/sql/sql_show.cc Sun Jun 20 15:59:31 2010 +0400
  285. @@ -1500,6 +1500,16 @@
  286. value= (char*) var->value_ptr(thd, value_type, &null_lex_str);
  287. charset= var->charset(thd);
  288. }
  289. + #ifdef HAVE_SPHINX_DB
  290. + else if (show_type == SHOW_SPHINX_FUNC)
  291. + {
  292. + SHOW_VAR var;
  293. + ((int (*)(THD *, SHOW_VAR *, char *))value)(thd, &var, buff);
  294. +
  295. + value = var.value;
  296. + show_type = var.type;
  297. + }
  298. + #endif /* HAVE_SPHINX_DB */
  299. pos= end= buff;
  300. switch (show_type) {
  301. diff -r 319c65835581 sql/sql_yacc.yy
  302. --- a/sql/sql_yacc.yy Sun Jun 20 15:15:01 2010 +0400
  303. +++ b/sql/sql_yacc.yy Sun Jun 20 15:59:31 2010 +0400
  304. @@ -8342,6 +8342,9 @@
  305. case DB_TYPE_INNODB:
  306. Lex->sql_command = SQLCOM_SHOW_INNODB_STATUS;
  307. break;
  308. + case DB_TYPE_SPHINX_DB:
  309. + Lex->sql_command = SQLCOM_SHOW_SPHINX_STATUS;
  310. + break;
  311. default:
  312. my_error(ER_NOT_SUPPORTED_YET, MYF(0), "STATUS");
  313. MYSQL_YYABORT;
  314. diff -r 319c65835581 sql/sql_yacc.cc
  315. --- a/sql/sql_yacc.cc Sun Jun 20 15:15:01 2010 +0400
  316. +++ b/sql/sql_yacc.cc Sun Jun 20 15:59:31 2010 +0400
  317. @@ -27003,6 +27003,9 @@
  318. case DB_TYPE_INNODB:
  319. Lex->sql_command = SQLCOM_SHOW_INNODB_STATUS;
  320. break;
  321. + case DB_TYPE_SPHINX_DB:
  322. + Lex->sql_command = SQLCOM_SHOW_SPHINX_STATUS;
  323. + break;
  324. default:
  325. my_error(ER_NOT_SUPPORTED_YET, MYF(0), "STATUS");
  326. MYSQL_YYABORT;
  327. diff -r 319c65835581 sql/structs.h
  328. --- a/sql/structs.h Sun Jun 20 15:15:01 2010 +0400
  329. +++ b/sql/structs.h Sun Jun 20 15:59:31 2010 +0400
  330. @@ -194,6 +194,9 @@
  331. SHOW_SSL_CTX_SESS_TIMEOUTS, SHOW_SSL_CTX_SESS_CACHE_FULL,
  332. SHOW_SSL_GET_CIPHER_LIST,
  333. #endif /* HAVE_OPENSSL */
  334. +#ifdef HAVE_SPHINX_DB
  335. + SHOW_SPHINX_FUNC,
  336. +#endif
  337. SHOW_NET_COMPRESSION,
  338. SHOW_RPL_STATUS, SHOW_SLAVE_RUNNING, SHOW_SLAVE_RETRIED_TRANS,
  339. SHOW_KEY_CACHE_LONG, SHOW_KEY_CACHE_CONST_LONG, SHOW_KEY_CACHE_LONGLONG,
  340. diff -r 319c65835581 win/configure.js
  341. --- a/win/configure.js Sun Jun 20 15:15:01 2010 +0400
  342. +++ b/win/configure.js Sun Jun 20 15:59:31 2010 +0400
  343. @@ -45,6 +45,7 @@
  344. case "WITH_EXAMPLE_STORAGE_ENGINE":
  345. case "WITH_FEDERATED_STORAGE_ENGINE":
  346. case "WITH_INNOBASE_STORAGE_ENGINE":
  347. + case "WITH_SPHINX_STORAGE_ENGINE":
  348. case "__NT__":
  349. case "DISABLE_GRANT_OPTIONS":
  350. case "EMBED_MANIFESTS":
  351. --- mysql-5.0.67/config/ac-macros/ha_sphinx.m4 1970-01-01 10:00:00.000000000 +1000
  352. +++ mysql-5.0.67-sphinx/config/ac-macros/ha_sphinx.m4 2009-02-14 09:15:48.000000000 +1000
  353. @@ -0,0 +1,30 @@
  354. +dnl ---------------------------------------------------------------------------
  355. +dnl Macro: MYSQL_CHECK_EXAMPLEDB
  356. +dnl Sets HAVE_SPHINX_DB if --with-sphinx-storage-engine is used
  357. +dnl ---------------------------------------------------------------------------
  358. +AC_DEFUN([MYSQL_CHECK_SPHINXDB], [
  359. + AC_ARG_WITH([sphinx-storage-engine],
  360. + [
  361. + --with-sphinx-storage-engine
  362. + Enable the Sphinx Storage Engine],
  363. + [sphinxdb="$withval"],
  364. + [sphinxdb=no])
  365. + AC_MSG_CHECKING([for example storage engine])
  366. +
  367. + case "$sphinxdb" in
  368. + yes )
  369. + AC_DEFINE([HAVE_SPHINX_DB], [1], [Builds Sphinx Engine])
  370. + AC_MSG_RESULT([yes])
  371. + [sphinxdb=yes]
  372. + ;;
  373. + * )
  374. + AC_MSG_RESULT([no])
  375. + [sphinxdb=no]
  376. + ;;
  377. + esac
  378. +
  379. +])
  380. +dnl ---------------------------------------------------------------------------
  381. +dnl END OF MYSQL_CHECK_EXAMPLE SECTION
  382. +dnl ---------------------------------------------------------------------------
  383. +