]> git.pld-linux.org Git - packages/mysql.git/blob - sphinx-mysql.patch
- rel 2; update percona patches
[packages/mysql.git] / sphinx-mysql.patch
1 Index: mysqlse/ha_sphinx.cc
2 ===================================================================
3 --- mysqlse/ha_sphinx.cc        (wersja 2920)
4 +++ mysqlse/ha_sphinx.cc        (wersja 2921)
5 @@ -24,7 +24,10 @@
6  
7  #include <mysql_version.h>
8  
9 -#if MYSQL_VERSION_ID>50100
10 +#if MYSQL_VERSION_ID>=50515
11 +#include "sql_class.h"
12 +#include "sql_array.h"
13 +#elif MYSQL_VERSION_ID>50100
14  #include "mysql_priv.h"
15  #include <mysql/plugin.h>
16  #else
17 @@ -119,6 +122,22 @@
18  
19  #endif
20  
21 +#if MYSQL_VERSION_ID>=50515
22 +
23 +#define sphinx_hash_init my_hash_init
24 +#define sphinx_hash_free my_hash_free
25 +#define sphinx_hash_search my_hash_search
26 +#define sphinx_hash_delete my_hash_delete
27 +
28 +#else
29 +
30 +#define sphinx_hash_init hash_init
31 +#define sphinx_hash_free hash_free
32 +#define sphinx_hash_search hash_search
33 +#define sphinx_hash_delete hash_delete
34 +
35 +#endif
36 +
37  /////////////////////////////////////////////////////////////////////////////
38  
39  // FIXME! make this all dynamic
40 @@ -675,8 +694,8 @@
41         if ( !sphinx_init )
42         {
43                 sphinx_init = 1;
44 -               VOID ( pthread_mutex_init ( &sphinx_mutex, MY_MUTEX_INIT_FAST ) );
45 -               hash_init ( &sphinx_open_tables, system_charset_info, 32, 0, 0,
46 +               void ( pthread_mutex_init ( &sphinx_mutex, MY_MUTEX_INIT_FAST ) );
47 +               sphinx_hash_init ( &sphinx_open_tables, system_charset_info, 32, 0, 0,
48                         sphinx_get_key, 0, 0 );
49  
50                 #if MYSQL_VERSION_ID > 50100
51 @@ -726,7 +745,7 @@
52                 sphinx_init = 0;
53                 if ( sphinx_open_tables.records )
54                         error = 1;
55 -               hash_free ( &sphinx_open_tables );
56 +               sphinx_hash_free ( &sphinx_open_tables );
57                 pthread_mutex_destroy ( &sphinx_mutex );
58         }
59  
60 @@ -1131,12 +1150,12 @@
61         {
62                 // check if we already have this share
63  #if MYSQL_VERSION_ID>=50120
64 -               pShare = (CSphSEShare*) hash_search ( &sphinx_open_tables, (const uchar *) table_name, strlen(table_name) );
65 +               pShare = (CSphSEShare*) sphinx_hash_search ( &sphinx_open_tables, (const uchar *) table_name, strlen(table_name) );
66  #else
67  #ifdef __WIN__
68 -               pShare = (CSphSEShare*) hash_search ( &sphinx_open_tables, (const byte *) table_name, strlen(table_name) );
69 +               pShare = (CSphSEShare*) sphinx_hash_search ( &sphinx_open_tables, (const byte *) table_name, strlen(table_name) );
70  #else
71 -               pShare = (CSphSEShare*) hash_search ( &sphinx_open_tables, table_name, strlen(table_name) );
72 +               pShare = (CSphSEShare*) sphinx_hash_search ( &sphinx_open_tables, table_name, strlen(table_name) );
73  #endif // win
74  #endif // pre-5.1.20
75  
76 @@ -1188,7 +1207,7 @@
77  
78         if ( !--pShare->m_iUseCount )
79         {
80 -               hash_delete ( &sphinx_open_tables, (byte *)pShare );
81 +               sphinx_hash_delete ( &sphinx_open_tables, (byte *)pShare );
82                 SafeDelete ( pShare );
83         }
84  
85 @@ -2073,15 +2092,29 @@
86                 } else
87                 {
88                         int tmp_errno;
89 +                       bool bError = false;
90 +
91 +#if MYSQL_VERSION_ID>=50515
92 +                       struct addrinfo tmp_hostent, *hp;
93 +                       tmp_errno = getaddrinfo ( sHost, NULL, &tmp_hostent, &hp );
94 +                       if ( !tmp_errno )
95 +                       {
96 +                               freeaddrinfo ( hp );
97 +                               bError = true;
98 +                       }
99 +#else
100                         struct hostent tmp_hostent, *hp;
101                         char buff2 [ GETHOSTBYNAME_BUFF_SIZE ];
102 -
103 -                       hp = my_gethostbyname_r ( sHost, &tmp_hostent,
104 -                               buff2, sizeof(buff2), &tmp_errno );
105 +                       hp = my_gethostbyname_r ( sHost, &tmp_hostent, buff2, sizeof(buff2), &tmp_errno );
106                         if ( !hp )
107                         {
108                                 my_gethostbyname_r_free();
109 +                               bError = true;
110 +                       }
111 +#endif
112  
113 +                       if ( bError )
114 +                       {
115                                 char sError[256];
116                                 my_snprintf ( sError, sizeof(sError), "failed to resolve searchd host (name=%s)", sHost );
117  
118 @@ -2089,9 +2122,13 @@
119                                 SPH_RET(-1);
120                         }
121  
122 -                       memcpy ( &sin.sin_addr, hp->h_addr,
123 -                               Min ( sizeof(sin.sin_addr), (size_t)hp->h_length ) );
124 +#if MYSQL_VERSION_ID>=50515
125 +                       memcpy ( &sin.sin_addr, hp->ai_addr, Min ( sizeof(sin.sin_addr), (size_t)hp->ai_addrlen ) );
126 +                       freeaddrinfo ( hp );
127 +#else
128 +                       memcpy ( &sin.sin_addr, hp->h_addr, Min ( sizeof(sin.sin_addr), (size_t)hp->h_length ) );
129                         my_gethostbyname_r_free();
130 +#endif
131                 }
132         } else
133         {
134 @@ -2932,7 +2969,7 @@
135  
136         for ( uint32 i=0; i<m_iAttrs; i++ )
137         {
138 -               longlong iValue64;
139 +               longlong iValue64 = 0;
140                 uint32 uValue = UnpackDword ();
141                 if ( m_dAttrs[i].m_uType==SPH_ATTR_BIGINT )
142                         iValue64 = ( (longlong)uValue<<32 ) | UnpackDword();
143 Index: mysqlse/ha_sphinx.h
144 ===================================================================
145 --- mysqlse/ha_sphinx.h (wersja 2920)
146 +++ mysqlse/ha_sphinx.h (wersja 2921)
147 @@ -7,7 +7,9 @@
148  #endif
149  
150  
151 -#if MYSQL_VERSION_ID>50100
152 +#if MYSQL_VERSION_ID>=50515
153 +#define TABLE_ARG      TABLE_SHARE
154 +#elif MYSQL_VERSION_ID>50100
155  #define TABLE_ARG      st_table_share
156  #else
157  #define TABLE_ARG      st_table
158 @@ -47,7 +49,7 @@
159  
160  public:
161  #if MYSQL_VERSION_ID<50100
162 -                                       ha_sphinx ( TABLE_ARG * table_arg );
163 +                                       ha_sphinx ( TABLE_ARG * table_arg ); // NOLINT
164  #else
165                                         ha_sphinx ( handlerton * hton, TABLE_ARG * table_arg );
166  #endif
167 @@ -90,7 +92,7 @@
168         int                             index_init ( uint keynr, bool sorted ); // 5.1.x
169         int                             index_init ( uint keynr ) { return index_init ( keynr, false ); } // 5.0.x
170  
171 -       int                             index_end (); 
172 +       int                             index_end ();
173         int                             index_read ( byte * buf, const byte * key, uint key_len, enum ha_rkey_function find_flag );
174         int                             index_read_idx ( byte * buf, uint idx, const byte * key, uint key_len, enum ha_rkey_function find_flag );
175         int                             index_next ( byte * buf );
176 Index: mysqlse/CMakeLists.txt
177 ===================================================================
178 --- mysqlse/CMakeLists.txt      (wersja 2920)
179 +++ mysqlse/CMakeLists.txt      (wersja 2921)
180 @@ -8,4 +8,9 @@
181                      ${CMAKE_SOURCE_DIR}/regex)
182  
183  SET(SPHINX_SOURCES ha_sphinx.cc)
184 +IF(MYSQL_VERSION_ID LESS 50515) 
185  ADD_LIBRARY(sphinx ha_sphinx.cc)
186 +ELSE()
187 +SET(SPHINX_PLUGIN_DYNAMIC "ha_sphinx")
188 +MYSQL_ADD_PLUGIN(sphinx ${SPHINX_SOURCES} STORAGE_ENGINE MODULE_ONLY LINK_LIBRARIES mysys)
189 +ENDIF()
This page took 0.039753 seconds and 3 git commands to generate.