commit 52f61ee2da63d7faa7e061226cf817443aebb568
Author: Arkadiusz Miśkiewicz
Date: Sat Mar 10 20:40:33 2018 +0100
- rel 2; reenable sphinx but: SphinxSE is not supported anymore starting
from 3.0 anyway. Switching to SphinxQL is recommended.
mysql-5.7-sphinx.patch | 442 +
1 file changed, 442 insertions(+)
---
diff --git a/mysql-5.7-sphinx.patch b/mysql-5.7-sphinx.patch
new file mode 100644
index 000..4d2f088
--- /dev/null
+++ b/mysql-5.7-sphinx.patch
@@ -0,0 +1,442 @@
+From 8bc97078153cfae322a36151143f1a06196730d7 Mon Sep 17 00:00:00 2001
+From: Adrian Nuta
+Date: Tue, 27 Sep 2016 16:41:36 +0300
+Subject: [PATCH] sphinxse patches for mariadb 10.1 and mysql 5.7
+
+---
+ mysqlse/ha_sphinx.cc | 170 +--
+ mysqlse/ha_sphinx.h | 30 ++---
+ 2 files changed, 161 insertions(+), 39 deletions(-)
+
+diff --git a/mysqlse/ha_sphinx.cc b/mysqlse/ha_sphinx.cc
+index 9b0c3a8e..080f7ce0 100644
+--- a/mysqlse/ha_sphinx.cc
b/mysqlse/ha_sphinx.cc
+@@ -34,13 +34,37 @@
+ #include "../mysql_priv.h"
+ #endif
+
++#if !defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID>=50709
++#include "item_timefunc.h"
++#define sphinx_append push_back
++#define sphinx_array std::vector
++#define sphinx_elements size
++#if defined(_WIN32)
++#define __WIN__ _WIN32
++#define pthread_mutex_init(A,B) (InitializeCriticalSection(A),0)
++#define pthread_mutex_lock(A) (EnterCriticalSection(A),0)
++#define pthread_mutex_unlock(A) (LeaveCriticalSection(A), 0)
++#define pthread_mutex_destroy(A) (DeleteCriticalSection(A), 0)
++#define in_addr_t uint32
++#include
++#endif
++#else
++#define sphinx_append append
++#define sphinx_array Dynamic_array
++#define sphinx_elements elements
++#endif
++
+ #include
+ #include
+ #include // include client for INSERT table (sort of redoing
federated..)
+
+ #ifndef __WIN__
+ // UNIX-specific
+- #include
++ #if !defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID>=50709
++ #include
++ #else
++ #include
++ #endif
+ #include
+ #include
+
+@@ -286,6 +310,12 @@ inline void SPH_DEBUG ( const char *, ... ) {}
+ #define SafeDelete(_arg) { if ( _arg ) delete ( _arg );
(_arg) = NULL; }
+ #define SafeDeleteArray(_arg) { if ( _arg ) delete [] ( _arg ); (_arg)
= NULL; }
+
++#if !defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID>=50709
++#ifdef __WIN__
++typedef native_mutex_t pthread_mutex_t;
++#endif
++#endif
++
+ //
+
+ /// per-table structure that will be shared among all open Sphinx SE handlers
+@@ -602,10 +632,10 @@ struct CSphSEQuery
+ };
+ char * m_sName; ///<
points to query buffer
+ int m_iType;
+- Dynamic_arraym_dIds;
+- Dynamic_array m_dValues;
++ sphinx_array m_dIds;
++ sphinx_array m_dValues;
+ };
+- Dynamic_array m_dOverrides;
++ sphinx_array m_dOverrides;
+
+ public:
+ charm_sParseError[256];
+@@ -634,10 +664,10 @@ struct CSphSEQuery
+ voidSendString ( const char * v ) { int iLen =
strlen(v); SendDword(iLen); SendBytes ( v, iLen ); }
+ voidSendFloat ( float v ) {
SendDword ( sphF2DW(v) ); }
+ };
+-
++#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
+ template int CSphSEQuery::ParseArray ( uint32 **, const char * );
+ template int CSphSEQuery::ParseArray ( longlong **, const char * );
+-
++#endif
+ //
+
+ #if MYSQL_VERSION_ID>50100
+@@ -733,13 +763,21 @@ static int sphinx_init_func ( void * p )
+ {
+ sphinx_init = 1;
+ void ( pthread_mutex_init ( _mutex, MY_MUTEX_INIT_FAST )
);
++ #if !defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 50709
++ sphinx_hash_init ( _open_tables, system_charset_info,
32, 0, 0,
++ sphinx_get_key, 0, 0, 0 );
++ #else
+ sphinx_hash_init ( _open_tables, system_charset_info,
32, 0, 0,
+ sphinx_get_key, 0, 0 );
+-
++ #endif
+ #if MYSQL_VERSION_ID > 50100
+ handlerton * hton = (handlerton*) p;
+ hton->state = SHOW_OPTION_YES;
++ #if !defined(MARIADB_BASE_VERSION)
+ hton->db_type = DB_TYPE_FIRST_DYNAMIC;
++ #else
++ hton->db_type = DB_TYPE_AUTOASSIGN;
++ #endif
+ hton->create = sphinx_create_handler;
+ hton->close_connection = sphinx_close_connection;
+