mirror of
https://github.com/MariaDB/server.git
synced 2025-04-08 08:15:33 +02:00
Upgraded sphinx to version 2.0.4
Fixed memory leaks and compiler warnings in ha_sphinx.cc Added HA_MUST_USE_TABLE_CONDITION_PUSHDOWN so that an engine can force index condition to be used mysql-test/suite/sphinx/sphinx.result: Added testing of pushdown conditions and sphinx status variables. mysql-test/suite/sphinx/sphinx.test: Added testing of pushdown conditions and sphinx status variables. mysql-test/suite/sphinx/suite.pm: Print version number if sphinx version is too old. sql/handler.h: Added HA_MUST_USE_TABLE_CONDITION_PUSHDOWN so that an engine can force index condition to be used sql/sql_base.cc: Added 'thd' argument to check_unused() to be able to set 'entry->in_use' if we call handler->extra(). This was needed as sphinx (and possible other storage engines) assumes that 'in_use' is set if handler functions are called. sql/sql_select.cc: Test if handler is forcing pushdown condition to be used. storage/sphinx/ha_sphinx.cc: Updated to version 2.0.4 Fixed memory leaks and compiler warnings. storage/sphinx/ha_sphinx.h: Updated to version 2.0.4 storage/sphinx/snippets_udf.cc: Updated to version 2.0.4
This commit is contained in:
parent
18c51eee35
commit
aba6d06c34
12 changed files with 1137 additions and 1435 deletions
mysql-test/suite/sphinx
sql
storage/sphinx
|
@ -36,4 +36,24 @@ select * from ts where q=';groupby=attr:gid';
|
|||
id w q gid _sph_count
|
||||
3 1 ;groupby=attr:gid 2 2
|
||||
1 1 ;groupby=attr:gid 1 2
|
||||
explain select * from ts where q=';groupby=attr:gid';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE ts ref q q 257 const 3 Using where with pushed condition
|
||||
SET @save_optimizer_switch=@@optimizer_switch;
|
||||
SET optimizer_switch='index_condition_pushdown=off';
|
||||
explain select * from ts where q=';groupby=attr:gid';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE ts ref q q 257 const 3 Using where with pushed condition
|
||||
SET optimizer_switch=@save_optimizer_switch;
|
||||
drop table ts;
|
||||
show status like "sphinx_%";
|
||||
Variable_name Value
|
||||
sphinx_error_commits 0
|
||||
sphinx_error_group_commits 0
|
||||
sphinx_error_snapshot_file
|
||||
sphinx_error_snapshot_position 0
|
||||
sphinx_time 0
|
||||
sphinx_total 2
|
||||
sphinx_total_found 2
|
||||
sphinx_word_count 0
|
||||
sphinx_words
|
||||
|
|
|
@ -19,5 +19,11 @@ eval create table ts ( id bigint unsigned not null, w int not null, q varchar(25
|
|||
select * from ts;
|
||||
select * from ts where q='';
|
||||
select * from ts where q=';groupby=attr:gid';
|
||||
explain select * from ts where q=';groupby=attr:gid';
|
||||
SET @save_optimizer_switch=@@optimizer_switch;
|
||||
SET optimizer_switch='index_condition_pushdown=off';
|
||||
explain select * from ts where q=';groupby=attr:gid';
|
||||
SET optimizer_switch=@save_optimizer_switch;
|
||||
drop table ts;
|
||||
|
||||
show status like "sphinx_%";
|
||||
|
|
|
@ -34,11 +34,11 @@ return "No SphinxSE" unless $ENV{HA_SPHINX_SO} or
|
|||
if ($ver eq "0000.0000.0000")
|
||||
{
|
||||
$ver = sprintf "%04d.%04d", (/([0-9]+)\.([0-9]+)-(alpha|beta|gamma|RC)/);
|
||||
return "Sphinx 0.9.9 or later is needed" unless $ver ge '0001.0010';
|
||||
return "Sphinx 0.9.9 or later is needed (found $ver) " unless $ver ge '0001.0010';
|
||||
}
|
||||
else
|
||||
{
|
||||
return "Sphinx 0.9.9 or later is needed" unless $ver ge '0000.0009.0009';
|
||||
return "Sphinx 0.9.9 or later is needed (found $ver) " unless $ver ge '0000.0009.0009';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -175,6 +175,19 @@
|
|||
#define HA_MRR_CANT_SORT (LL(1) << 40)
|
||||
#define HA_RECORD_MUST_BE_CLEAN_ON_WRITE (LL(1) << 41)
|
||||
|
||||
/*
|
||||
Table condition pushdown must be performed regardless of
|
||||
'engine_condition_pushdown' setting.
|
||||
|
||||
This flag is aimed at storage engines that come with "special" predicates
|
||||
that can only be evaluated inside the storage engine.
|
||||
For example, when one does
|
||||
select * from sphinx_table where query='{fulltext_query}'
|
||||
then the "query=..." condition must be always pushed down into storage
|
||||
engine.
|
||||
*/
|
||||
#define HA_MUST_USE_TABLE_CONDITION_PUSHDOWN (LL(1) << 42)
|
||||
|
||||
/*
|
||||
Set of all binlog flags. Currently only contain the capabilities
|
||||
flags.
|
||||
|
|
|
@ -226,7 +226,7 @@ uint cached_open_tables(void)
|
|||
|
||||
|
||||
#ifdef EXTRA_DEBUG
|
||||
static void check_unused(void)
|
||||
static void check_unused(THD *thd)
|
||||
{
|
||||
uint count= 0, open_files= 0, idx= 0;
|
||||
TABLE *cur_link, *start_link, *entry;
|
||||
|
@ -255,15 +255,20 @@ static void check_unused(void)
|
|||
I_P_List_iterator<TABLE, TABLE_share> it(share->free_tables);
|
||||
while ((entry= it++))
|
||||
{
|
||||
/* We must not have TABLEs in the free list that have their file closed. */
|
||||
/*
|
||||
We must not have TABLEs in the free list that have their file closed.
|
||||
*/
|
||||
DBUG_ASSERT(entry->db_stat && entry->file);
|
||||
/* Merge children should be detached from a merge parent */
|
||||
DBUG_ASSERT(! entry->file->extra(HA_EXTRA_IS_ATTACHED_CHILDREN));
|
||||
|
||||
if (entry->in_use)
|
||||
{
|
||||
DBUG_PRINT("error",("Used table is in share's list of unused tables")); /* purecov: inspected */
|
||||
}
|
||||
/* extra() may assume that in_use is set */
|
||||
entry->in_use= thd;
|
||||
DBUG_ASSERT(! entry->file->extra(HA_EXTRA_IS_ATTACHED_CHILDREN));
|
||||
entry->in_use= 0;
|
||||
|
||||
count--;
|
||||
open_files++;
|
||||
}
|
||||
|
@ -284,7 +289,7 @@ static void check_unused(void)
|
|||
}
|
||||
}
|
||||
#else
|
||||
#define check_unused()
|
||||
#define check_unused(A)
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -473,7 +478,7 @@ static void table_def_remove_table(TABLE *table)
|
|||
if (table == unused_tables)
|
||||
unused_tables=0;
|
||||
}
|
||||
check_unused();
|
||||
check_unused(current_thd);
|
||||
}
|
||||
table_cache_count--;
|
||||
}
|
||||
|
@ -498,7 +503,7 @@ static void table_def_use_table(THD *thd, TABLE *table)
|
|||
}
|
||||
table->prev->next=table->next; /* Remove from unused list */
|
||||
table->next->prev=table->prev;
|
||||
check_unused();
|
||||
check_unused(thd);
|
||||
/* Add table to list of used tables for this share. */
|
||||
table->s->used_tables.push_front(table);
|
||||
table->in_use= thd;
|
||||
|
@ -515,6 +520,7 @@ static void table_def_use_table(THD *thd, TABLE *table)
|
|||
|
||||
static void table_def_unuse_table(TABLE *table)
|
||||
{
|
||||
THD *thd= table->in_use;
|
||||
DBUG_ASSERT(table->in_use);
|
||||
|
||||
/* We shouldn't put the table to 'unused' list if the share is old. */
|
||||
|
@ -535,7 +541,7 @@ static void table_def_unuse_table(TABLE *table)
|
|||
}
|
||||
else
|
||||
unused_tables=table->next=table->prev=table;
|
||||
check_unused();
|
||||
check_unused(thd);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -8364,8 +8364,10 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
|
|||
if (tab->table)
|
||||
{
|
||||
tab->table->file->pushed_cond= NULL;
|
||||
if ((thd->variables.optimizer_switch &
|
||||
OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN) &&
|
||||
if (((thd->variables.optimizer_switch &
|
||||
OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN) ||
|
||||
(tab->table->file->ha_table_flags() &
|
||||
HA_MUST_USE_TABLE_CONDITION_PUSHDOWN)) &&
|
||||
!first_inner_tab)
|
||||
{
|
||||
COND *push_cond=
|
||||
|
@ -21270,8 +21272,11 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
|
|||
{
|
||||
const COND *pushed_cond= tab->table->file->pushed_cond;
|
||||
|
||||
if ((thd->variables.optimizer_switch &
|
||||
OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN) && pushed_cond)
|
||||
if (((thd->variables.optimizer_switch &
|
||||
OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN) ||
|
||||
(tab->table->file->ha_table_flags() &
|
||||
HA_MUST_USE_TABLE_CONDITION_PUSHDOWN)) &&
|
||||
pushed_cond)
|
||||
{
|
||||
extra.append(STRING_WITH_LEN("; Using where with pushed "
|
||||
"condition"));
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// $Id: ha_sphinx.h 1428 2008-09-05 18:06:30Z xale $
|
||||
// $Id: ha_sphinx.h 2921 2011-08-21 21:35:02Z tomat $
|
||||
//
|
||||
|
||||
#ifdef USE_PRAGMA_INTERFACE
|
||||
|
@ -7,8 +7,10 @@
|
|||
#endif
|
||||
|
||||
|
||||
#if MYSQL_VERSION_ID>50100
|
||||
#if MYSQL_VERSION_ID>=50515
|
||||
#define TABLE_ARG TABLE_SHARE
|
||||
#elif MYSQL_VERSION_ID>50100
|
||||
#define TABLE_ARG st_table_share
|
||||
#else
|
||||
#define TABLE_ARG st_table
|
||||
#endif
|
||||
|
@ -18,7 +20,6 @@
|
|||
typedef uchar byte;
|
||||
#endif
|
||||
|
||||
#include "handler.h"
|
||||
|
||||
/// forward decls
|
||||
class THD;
|
||||
|
@ -48,18 +49,19 @@ protected:
|
|||
|
||||
public:
|
||||
#if MYSQL_VERSION_ID<50100
|
||||
ha_sphinx ( TABLE_ARG * table_arg );
|
||||
ha_sphinx ( TABLE_ARG * table_arg ); // NOLINT
|
||||
#else
|
||||
ha_sphinx ( handlerton * hton, TABLE_ARG * table_arg );
|
||||
#endif
|
||||
~ha_sphinx () {}
|
||||
~ha_sphinx ();
|
||||
|
||||
const char * table_type () const { return "SPHINX"; } ///< SE name for display purposes
|
||||
const char * index_type ( uint ) { return "HASH"; } ///< index type name for display purposes
|
||||
const char ** bas_ext () const; ///< my file extensions
|
||||
|
||||
#if MYSQL_VERSION_ID>50100
|
||||
ulonglong table_flags () const { return HA_CAN_INDEX_BLOBS; } ///< bitmap of implemented flags (see handler.h for more info)
|
||||
ulonglong table_flags () const { return HA_CAN_INDEX_BLOBS |
|
||||
HA_MUST_USE_TABLE_CONDITION_PUSHDOWN; } ///< bitmap of implemented flags (see handler.h for more info)
|
||||
#else
|
||||
ulong table_flags () const { return HA_CAN_INDEX_BLOBS; } ///< bitmap of implemented flags (see handler.h for more info)
|
||||
#endif
|
||||
|
@ -77,21 +79,22 @@ public:
|
|||
virtual double scan_time () { return (double)( records+deleted )/20.0 + 10; } ///< called in test_quick_select to determine if indexes should be used
|
||||
#endif
|
||||
|
||||
virtual double read_time(uint index, uint ranges, ha_rows rows)
|
||||
{ return (double)rows/20.0 + 1; } ///< index read time estimate
|
||||
virtual double read_time(uint index, uint ranges, ha_rows rows)
|
||||
{ return ranges + (double)rows/20.0 + 1; } ///< index read time estimate
|
||||
|
||||
public:
|
||||
int open ( const char * name, int mode, uint test_if_locked );
|
||||
int close ();
|
||||
|
||||
int write_row ( uchar * buf );
|
||||
int update_row ( const uchar * old_data, uchar * new_data );
|
||||
int delete_row ( const uchar * buf );
|
||||
int write_row ( byte * buf );
|
||||
int update_row ( const byte * old_data, byte * new_data );
|
||||
int delete_row ( const byte * buf );
|
||||
int extra ( enum ha_extra_function op );
|
||||
|
||||
int index_init ( uint keynr, bool sorted ); // 5.1.x
|
||||
int index_init ( uint keynr ) { return index_init ( keynr, false ); } // 5.0.x
|
||||
|
||||
int index_end ();
|
||||
int index_end ();
|
||||
int index_read ( byte * buf, const byte * key, uint key_len, enum ha_rkey_function find_flag );
|
||||
int index_read_idx ( byte * buf, uint idx, const byte * key, uint key_len, enum ha_rkey_function find_flag );
|
||||
int index_next ( byte * buf );
|
||||
|
@ -123,7 +126,7 @@ public:
|
|||
int rename_table ( const char * from, const char * to );
|
||||
int create ( const char * name, TABLE * form, HA_CREATE_INFO * create_info );
|
||||
|
||||
THR_LOCK_DATA **store_lock ( THD * thd, THR_LOCK_DATA ** to, enum thr_lock_type lock_type );
|
||||
THR_LOCK_DATA ** store_lock ( THD * thd, THR_LOCK_DATA ** to, enum thr_lock_type lock_type );
|
||||
|
||||
public:
|
||||
virtual const COND * cond_push ( const COND *cond );
|
||||
|
@ -140,12 +143,15 @@ private:
|
|||
int * m_dUnboundFields;
|
||||
|
||||
private:
|
||||
int ConnectToSearchd ( const char * sQueryHost, int iQueryPort );
|
||||
int Connect ( const char * sQueryHost, ushort uPort );
|
||||
int ConnectAPI ( const char * sQueryHost, int iQueryPort );
|
||||
int HandleMysqlError ( struct st_mysql * pConn, int iErrCode );
|
||||
|
||||
uint32 UnpackDword ();
|
||||
char * UnpackString ();
|
||||
bool UnpackSchema ();
|
||||
bool UnpackStats ( CSphSEStats * pStats );
|
||||
bool CheckResponcePtr ( int iLen );
|
||||
|
||||
CSphSEThreadData * GetTls ();
|
||||
};
|
||||
|
@ -155,6 +161,12 @@ private:
|
|||
bool sphinx_show_status ( THD * thd );
|
||||
#endif
|
||||
|
||||
int sphinx_showfunc_total_found ( THD *, SHOW_VAR *, char * );
|
||||
int sphinx_showfunc_total ( THD *, SHOW_VAR *, char * );
|
||||
int sphinx_showfunc_time ( THD *, SHOW_VAR *, char * );
|
||||
int sphinx_showfunc_word_count ( THD *, SHOW_VAR *, char * );
|
||||
int sphinx_showfunc_words ( THD *, SHOW_VAR *, char * );
|
||||
|
||||
//
|
||||
// $Id: ha_sphinx.h 1428 2008-09-05 18:06:30Z xale $
|
||||
// $Id: ha_sphinx.h 2921 2011-08-21 21:35:02Z tomat $
|
||||
//
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
//
|
||||
// $Id: snippets_udf.cc 2058 2009-11-07 04:01:57Z shodan $
|
||||
// $Id: snippets_udf.cc 3087 2012-01-30 23:07:35Z shodan $
|
||||
//
|
||||
|
||||
//
|
||||
// Copyright (c) 2001-2008, Andrew Aksyonoff. All rights reserved.
|
||||
// Copyright (c) 2001-2012, Andrew Aksyonoff
|
||||
// Copyright (c) 2008-2012, Sphinx Technologies Inc
|
||||
// All rights reserved
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License. You should have
|
||||
|
@ -11,14 +13,6 @@
|
|||
// did not, you can find it at http://www.gnu.org/
|
||||
//
|
||||
|
||||
#include <mysql_version.h>
|
||||
|
||||
#if MYSQL_VERSION_ID>50100
|
||||
#include <mysql/plugin.h>
|
||||
#else
|
||||
#include "../mysql_priv.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
@ -26,14 +20,18 @@
|
|||
#include <sys/un.h>
|
||||
#include <netdb.h>
|
||||
|
||||
#include <mysql_version.h>
|
||||
|
||||
#if MYSQL_VERSION_ID>50100
|
||||
#include "mysql_priv.h"
|
||||
#include <mysql/plugin.h>
|
||||
#else
|
||||
#include "../mysql_priv.h"
|
||||
#endif
|
||||
|
||||
#include <mysys_err.h>
|
||||
#include <my_sys.h>
|
||||
|
||||
#include <mysqld_error.h>
|
||||
|
||||
#include <my_net.h>
|
||||
#include <mysql_com.h>
|
||||
|
||||
#if MYSQL_VERSION_ID>=50120
|
||||
typedef uchar byte;
|
||||
#endif
|
||||
|
@ -120,7 +118,7 @@ static bool sphSend ( int iFd, const char * pBuffer, int iSize, bool bReportErro
|
|||
assert ( iSize > 0 );
|
||||
|
||||
const int iResult = send ( iFd, pBuffer, iSize, 0 );
|
||||
if ( iResult != iSize )
|
||||
if ( iResult!=iSize )
|
||||
{
|
||||
if ( bReportErrors ) sphShowErrno("send");
|
||||
return false;
|
||||
|
@ -132,7 +130,7 @@ static bool sphRecv ( int iFd, char * pBuffer, int iSize, bool bReportErrors = f
|
|||
{
|
||||
assert ( pBuffer );
|
||||
assert ( iSize > 0 );
|
||||
|
||||
|
||||
while ( iSize )
|
||||
{
|
||||
const int iResult = recv ( iFd, pBuffer, iSize, 0 );
|
||||
|
@ -140,14 +138,12 @@ static bool sphRecv ( int iFd, char * pBuffer, int iSize, bool bReportErrors = f
|
|||
{
|
||||
iSize -= iResult;
|
||||
pBuffer += iSize;
|
||||
}
|
||||
else if ( iResult == 0 )
|
||||
} else if ( iResult==0 )
|
||||
{
|
||||
if ( bReportErrors )
|
||||
my_error ( ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), "recv() failed: disconnected" );
|
||||
return false;
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
if ( bReportErrors ) sphShowErrno("recv");
|
||||
return false;
|
||||
|
@ -160,11 +156,9 @@ enum
|
|||
{
|
||||
SPHINX_SEARCHD_PROTO = 1,
|
||||
|
||||
SEARCHD_COMMAND_SEARCH = 0,
|
||||
SEARCHD_COMMAND_EXCERPT = 1,
|
||||
|
||||
VER_COMMAND_SEARCH = 0x116,
|
||||
VER_COMMAND_EXCERPT = 0x100,
|
||||
VER_COMMAND_EXCERPT = 0x103,
|
||||
};
|
||||
|
||||
/// known answers
|
||||
|
@ -191,7 +185,7 @@ private:
|
|||
char * m_pCurrent;
|
||||
|
||||
public:
|
||||
CSphBuffer ( const int iSize )
|
||||
explicit CSphBuffer ( const int iSize )
|
||||
: m_bOverrun ( false )
|
||||
, m_iSize ( iSize )
|
||||
, m_iLeft ( iSize )
|
||||
|
@ -203,22 +197,22 @@ public:
|
|||
|
||||
~CSphBuffer ()
|
||||
{
|
||||
SafeDelete ( m_pBuffer );
|
||||
SafeDeleteArray ( m_pBuffer );
|
||||
}
|
||||
|
||||
const char * Ptr() const { return m_pBuffer; }
|
||||
|
||||
bool Finalize()
|
||||
{
|
||||
return !( m_bOverrun || m_iLeft != 0 || m_pCurrent - m_pBuffer != m_iSize );
|
||||
return !( m_bOverrun || m_iLeft!=0 || ( m_pCurrent - m_pBuffer )!=m_iSize );
|
||||
}
|
||||
|
||||
|
||||
void SendBytes ( const void * pBytes, int iBytes );
|
||||
|
||||
void SendWord ( short int v ) { v = ntohs(v); SendBytes ( &v, sizeof(v) ); }
|
||||
|
||||
void SendWord ( short int v ) { v = ntohs(v); SendBytes ( &v, sizeof(v) ); } // NOLINT
|
||||
void SendInt ( int v ) { v = ntohl(v); SendBytes ( &v, sizeof(v) ); }
|
||||
void SendDword ( DWORD v ) { v = ntohl(v) ;SendBytes ( &v, sizeof(v) ); }
|
||||
void SendUint64 ( ulonglong v ) { SendDword ( uint(v>>32) ); SendDword ( uint(v&0xFFFFFFFFUL) ); }
|
||||
void SendUint64 ( ulonglong v ) { SendDword ( uint ( v>>32 ) ); SendDword ( uint ( v&0xFFFFFFFFUL ) ); }
|
||||
void SendString ( const char * v ) { SendString ( v, strlen(v) ); }
|
||||
void SendString ( const char * v, int iLen ) { SendDword(iLen); SendBytes ( v, iLen ); }
|
||||
void SendFloat ( float v ) { SendDword ( sphF2DW(v) ); }
|
||||
|
@ -242,28 +236,28 @@ struct CSphUrl
|
|||
{
|
||||
char * m_sBuffer;
|
||||
char * m_sFormatted;
|
||||
|
||||
|
||||
char * m_sScheme;
|
||||
char * m_sHost;
|
||||
char * m_sIndex;
|
||||
|
||||
|
||||
int m_iPort;
|
||||
|
||||
|
||||
CSphUrl()
|
||||
: m_sBuffer ( NULL )
|
||||
, m_sFormatted ( NULL )
|
||||
, m_sScheme ( (char*) SPHINXSE_DEFAULT_SCHEME )
|
||||
, m_sHost ( (char*) SPHINXSE_DEFAULT_HOST )
|
||||
, m_sIndex ( (char*) SPHINXSE_DEFAULT_INDEX )
|
||||
, m_sScheme ( SPHINXSE_DEFAULT_SCHEME )
|
||||
, m_sHost ( SPHINXSE_DEFAULT_HOST )
|
||||
, m_sIndex ( SPHINXSE_DEFAULT_INDEX )
|
||||
, m_iPort ( SPHINXSE_DEFAULT_PORT )
|
||||
{}
|
||||
|
||||
|
||||
~CSphUrl()
|
||||
{
|
||||
SafeDeleteArray ( m_sFormatted );
|
||||
SafeDeleteArray ( m_sBuffer );
|
||||
}
|
||||
|
||||
|
||||
bool Parse ( const char * sUrl, int iLen );
|
||||
int Connect();
|
||||
const char * Format();
|
||||
|
@ -295,32 +289,32 @@ bool CSphUrl::Parse ( const char * sUrl, int iLen )
|
|||
while ( iLen )
|
||||
{
|
||||
bOk = false;
|
||||
|
||||
|
||||
m_sBuffer = sphDup ( sUrl, iLen );
|
||||
m_sScheme = m_sBuffer;
|
||||
|
||||
|
||||
m_sHost = strstr ( m_sBuffer, "://" );
|
||||
if ( !m_sHost )
|
||||
break;
|
||||
m_sHost[0] = '\0';
|
||||
m_sHost += 2;
|
||||
|
||||
|
||||
if ( !strcmp ( m_sScheme, "unix" ) )
|
||||
{
|
||||
// unix-domain socket
|
||||
m_iPort = 0;
|
||||
if (!( m_sIndex = strrchr ( m_sHost, ':' ) ))
|
||||
m_sIndex = (char*) SPHINXSE_DEFAULT_INDEX;
|
||||
m_sIndex = SPHINXSE_DEFAULT_INDEX;
|
||||
else
|
||||
{
|
||||
*m_sIndex++ = '\0';
|
||||
if ( !*m_sIndex )
|
||||
m_sIndex = (char*) SPHINXSE_DEFAULT_INDEX;
|
||||
m_sIndex = SPHINXSE_DEFAULT_INDEX;
|
||||
}
|
||||
bOk = true;
|
||||
break;
|
||||
}
|
||||
if( strcmp ( m_sScheme, "sphinx" ) != 0 && strcmp ( m_sScheme, "inet" ) != 0 )
|
||||
if ( strcmp ( m_sScheme, "sphinx" )!=0 && strcmp ( m_sScheme, "inet" )!=0 )
|
||||
break;
|
||||
|
||||
// inet
|
||||
|
@ -333,10 +327,10 @@ bool CSphUrl::Parse ( const char * sUrl, int iLen )
|
|||
{
|
||||
m_sIndex = strchr ( sPort, '/' );
|
||||
if ( m_sIndex )
|
||||
*m_sIndex++ = '\0';
|
||||
*m_sIndex++ = '\0';
|
||||
else
|
||||
m_sIndex = (char*) SPHINXSE_DEFAULT_INDEX;
|
||||
|
||||
m_sIndex = SPHINXSE_DEFAULT_INDEX;
|
||||
|
||||
m_iPort = atoi(sPort);
|
||||
if ( !m_iPort )
|
||||
m_iPort = SPHINXSE_DEFAULT_PORT;
|
||||
|
@ -347,13 +341,13 @@ bool CSphUrl::Parse ( const char * sUrl, int iLen )
|
|||
if ( m_sIndex )
|
||||
*m_sIndex++ = '\0';
|
||||
else
|
||||
m_sIndex = (char*) SPHINXSE_DEFAULT_INDEX;
|
||||
m_sIndex = SPHINXSE_DEFAULT_INDEX;
|
||||
}
|
||||
|
||||
bOk = true;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return bOk;
|
||||
}
|
||||
|
||||
|
@ -378,35 +372,33 @@ int CSphUrl::Connect()
|
|||
|
||||
memset ( &sin, 0, sizeof(sin) );
|
||||
sin.sin_family = AF_INET;
|
||||
sin.sin_port = htons(m_iPort);
|
||||
|
||||
sin.sin_port = htons ( m_iPort );
|
||||
|
||||
// resolve address
|
||||
if ( (int)( ip_addr=inet_addr(m_sHost) ) != (int)INADDR_NONE )
|
||||
if ( (int)( ip_addr = inet_addr ( m_sHost ) )!=(int)INADDR_NONE )
|
||||
memcpy ( &sin.sin_addr, &ip_addr, sizeof(ip_addr) );
|
||||
else
|
||||
{
|
||||
int tmp_errno;
|
||||
struct hostent tmp_hostent, *hp;
|
||||
char buff2 [ GETHOSTBYNAME_BUFF_SIZE ];
|
||||
|
||||
hp = my_gethostbyname_r ( m_sHost, &tmp_hostent,
|
||||
buff2, sizeof(buff2), &tmp_errno );
|
||||
|
||||
hp = my_gethostbyname_r ( m_sHost, &tmp_hostent, buff2, sizeof(buff2), &tmp_errno );
|
||||
if ( !hp )
|
||||
{
|
||||
{
|
||||
my_gethostbyname_r_free();
|
||||
|
||||
|
||||
char sError[256];
|
||||
snprintf ( sError, sizeof(sError), "failed to resolve searchd host (name=%s)", m_sHost );
|
||||
|
||||
|
||||
my_error ( ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), sError );
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
memcpy ( &sin.sin_addr, hp->h_addr, Min ( sizeof(sin.sin_addr), (size_t)hp->h_length ) );
|
||||
my_gethostbyname_r_free();
|
||||
}
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
#ifndef __WIN__
|
||||
iDomain = AF_UNIX;
|
||||
|
@ -426,17 +418,17 @@ int CSphUrl::Connect()
|
|||
uint uServerVersion;
|
||||
uint uClientVersion = htonl ( SPHINX_SEARCHD_PROTO );
|
||||
int iSocket = -1;
|
||||
const char * pError = NULL;
|
||||
char * pError = NULL;
|
||||
do
|
||||
{
|
||||
iSocket = socket ( iDomain, SOCK_STREAM, 0 );
|
||||
if ( iSocket == -1 )
|
||||
if ( iSocket==-1 )
|
||||
{
|
||||
pError = "Failed to create client socket";
|
||||
break;
|
||||
}
|
||||
|
||||
if ( connect ( iSocket, pSockaddr, iSockaddrSize ) == -1)
|
||||
|
||||
if ( connect ( iSocket, pSockaddr, iSockaddrSize )==-1 )
|
||||
{
|
||||
pError = "Failed to connect to searchd";
|
||||
break;
|
||||
|
@ -447,7 +439,7 @@ int CSphUrl::Connect()
|
|||
pError = "Failed to receive searchd version";
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if ( !sphSend ( iSocket, (char *)&uClientVersion, sizeof(uClientVersion) ) )
|
||||
{
|
||||
pError = "Failed to send client version";
|
||||
|
@ -464,9 +456,9 @@ int CSphUrl::Connect()
|
|||
snprintf ( sError, sizeof(sError), "%s [%d] %s", Format(), errno, strerror(errno) );
|
||||
my_error ( ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), sError );
|
||||
|
||||
if ( iSocket != -1 )
|
||||
if ( iSocket!=-1 )
|
||||
close ( iSocket );
|
||||
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -483,7 +475,7 @@ struct CSphResponse
|
|||
, m_pBody ( NULL )
|
||||
{}
|
||||
|
||||
CSphResponse ( DWORD uSize )
|
||||
explicit CSphResponse ( DWORD uSize )
|
||||
: m_pBody ( NULL )
|
||||
{
|
||||
m_pBuffer = new char[uSize];
|
||||
|
@ -493,7 +485,7 @@ struct CSphResponse
|
|||
{
|
||||
SafeDeleteArray ( m_pBuffer );
|
||||
}
|
||||
|
||||
|
||||
static CSphResponse * Read ( int iSocket, int iClientVersion );
|
||||
};
|
||||
|
||||
|
@ -504,14 +496,14 @@ CSphResponse::Read ( int iSocket, int iClientVersion )
|
|||
if ( !sphRecv ( iSocket, sHeader, sizeof(sHeader) ) )
|
||||
return NULL;
|
||||
|
||||
int iStatus = ntohs ( sphUnalignedRead ( *(short int *) &sHeader[0] ) );
|
||||
int iVersion = ntohs ( sphUnalignedRead ( *(short int *) &sHeader[2] ) );
|
||||
DWORD uLength = ntohl ( sphUnalignedRead ( *(DWORD *) &sHeader[4] ) );
|
||||
int iStatus = ntohs ( sphUnalignedRead ( *(short int *) &sHeader[0] ) );
|
||||
int iVersion = ntohs ( sphUnalignedRead ( *(short int *) &sHeader[2] ) );
|
||||
DWORD uLength = ntohl ( sphUnalignedRead ( *(DWORD *) &sHeader[4] ) );
|
||||
|
||||
if ( iVersion < iClientVersion ) // fixme: warn
|
||||
{}
|
||||
if ( iVersion<iClientVersion )
|
||||
return NULL;
|
||||
|
||||
if ( uLength <= SPHINXSE_MAX_ALLOC )
|
||||
if ( uLength<=SPHINXSE_MAX_ALLOC )
|
||||
{
|
||||
CSphResponse * pResponse = new CSphResponse ( uLength );
|
||||
if ( !sphRecv ( iSocket, pResponse->m_pBuffer, uLength ) )
|
||||
|
@ -521,16 +513,17 @@ CSphResponse::Read ( int iSocket, int iClientVersion )
|
|||
}
|
||||
|
||||
pResponse->m_pBody = pResponse->m_pBuffer;
|
||||
if ( iStatus != SEARCHD_OK )
|
||||
if ( iStatus!=SEARCHD_OK )
|
||||
{
|
||||
DWORD uSize = ntohl ( *(DWORD *)pResponse->m_pBuffer );
|
||||
if ( iStatus == SEARCHD_WARNING )
|
||||
if ( iStatus==SEARCHD_WARNING )
|
||||
{
|
||||
pResponse->m_pBody += uSize; // fixme: report the warning somehow
|
||||
else
|
||||
} else
|
||||
{
|
||||
char * sMessage = sphDup ( pResponse->m_pBuffer + sizeof(DWORD), uSize );
|
||||
my_error ( ER_QUERY_ON_FOREIGN_DATA_SOURCE, MYF(0), sMessage );
|
||||
SafeDelete ( sMessage );
|
||||
SafeDeleteArray ( sMessage );
|
||||
SafeDelete ( pResponse );
|
||||
return NULL;
|
||||
}
|
||||
|
@ -560,8 +553,13 @@ struct CSphSnippets
|
|||
int m_iBeforeMatch;
|
||||
int m_iAfterMatch;
|
||||
int m_iChunkSeparator;
|
||||
int m_iStripMode;
|
||||
int m_iPassageBoundary;
|
||||
int m_iLimit;
|
||||
int m_iLimitWords;
|
||||
int m_iLimitPassages;
|
||||
int m_iAround;
|
||||
int m_iPassageId;
|
||||
int m_iFlags;
|
||||
|
||||
CSphSnippets()
|
||||
|
@ -569,9 +567,14 @@ struct CSphSnippets
|
|||
, m_iBeforeMatch(0)
|
||||
, m_iAfterMatch(0)
|
||||
, m_iChunkSeparator(0)
|
||||
// defaults
|
||||
, m_iStripMode(0)
|
||||
, m_iPassageBoundary(0)
|
||||
// defaults
|
||||
, m_iLimit(256)
|
||||
, m_iLimitWords(0)
|
||||
, m_iLimitPassages(0)
|
||||
, m_iAround(5)
|
||||
, m_iPassageId(1)
|
||||
, m_iFlags(1)
|
||||
{
|
||||
}
|
||||
|
@ -582,24 +585,24 @@ struct CSphSnippets
|
|||
}
|
||||
};
|
||||
|
||||
#define KEYWORD(NAME) else if ( strncmp ( NAME, pArgs->attributes[i], pArgs->attribute_lengths[i] ) == 0 )
|
||||
#define KEYWORD(NAME) else if ( strncmp ( NAME, pArgs->attributes[i], pArgs->attribute_lengths[i] )==0 )
|
||||
|
||||
#define CHECK_TYPE(TYPE) \
|
||||
if ( pArgs->arg_type[i] != TYPE ) \
|
||||
if ( pArgs->arg_type[i]!=TYPE ) \
|
||||
{ \
|
||||
snprintf ( sMessage, MAX_MESSAGE_LENGTH, \
|
||||
"%.*s argument must be a string", \
|
||||
(int)pArgs->attribute_lengths[i], \
|
||||
pArgs->attributes[i] ); \
|
||||
"%.*s argument must be a string", \
|
||||
(int)pArgs->attribute_lengths[i], \
|
||||
pArgs->attributes[i] ); \
|
||||
bFail = true; \
|
||||
break; \
|
||||
} \
|
||||
if ( TYPE == STRING_RESULT && !pArgs->args[i] ) \
|
||||
if ( TYPE==STRING_RESULT && !pArgs->args[i] ) \
|
||||
{ \
|
||||
snprintf ( sMessage, MAX_MESSAGE_LENGTH, \
|
||||
"%.*s argument must be constant (and not NULL)", \
|
||||
(int)pArgs->attribute_lengths[i], \
|
||||
pArgs->attributes[i] ); \
|
||||
"%.*s argument must be constant (and not NULL)", \
|
||||
(int)pArgs->attribute_lengths[i], \
|
||||
pArgs->attributes[i] ); \
|
||||
bFail = true; \
|
||||
break; \
|
||||
}
|
||||
|
@ -621,7 +624,7 @@ my_bool sphinx_snippets_init ( UDF_INIT * pUDF, UDF_ARGS * pArgs, char * sMessag
|
|||
{
|
||||
if ( i < 3 )
|
||||
{
|
||||
if ( pArgs->arg_type[i] != STRING_RESULT )
|
||||
if ( pArgs->arg_type[i]!=STRING_RESULT )
|
||||
{
|
||||
strncpy ( sMessage, "first three arguments must be of string type", MAX_MESSAGE_LENGTH );
|
||||
bFail = true;
|
||||
|
@ -641,21 +644,33 @@ my_bool sphinx_snippets_init ( UDF_INIT * pUDF, UDF_ARGS * pArgs, char * sMessag
|
|||
KEYWORD("before_match") { STRING; pOpts->m_iBeforeMatch = i; }
|
||||
KEYWORD("after_match") { STRING; pOpts->m_iAfterMatch = i; }
|
||||
KEYWORD("chunk_separator") { STRING; pOpts->m_iChunkSeparator = i; }
|
||||
KEYWORD("html_strip_mode") { STRING; pOpts->m_iStripMode = i; }
|
||||
KEYWORD("passage_boundary") { STRING; pOpts->m_iPassageBoundary = i; }
|
||||
|
||||
KEYWORD("limit") { INT; pOpts->m_iLimit = iValue; }
|
||||
KEYWORD("limit_words") { INT; pOpts->m_iLimitWords = iValue; }
|
||||
KEYWORD("limit_passages") { INT; pOpts->m_iLimitPassages = iValue; }
|
||||
KEYWORD("around") { INT; pOpts->m_iAround = iValue; }
|
||||
KEYWORD("start_passage_id") { INT; pOpts->m_iPassageId = iValue; }
|
||||
|
||||
KEYWORD("exact_phrase") { INT; if ( iValue ) pOpts->m_iFlags |= 2; }
|
||||
KEYWORD("single_passage") { INT; if ( iValue ) pOpts->m_iFlags |= 4; }
|
||||
KEYWORD("use_boundaries") { INT; if ( iValue ) pOpts->m_iFlags |= 8; }
|
||||
KEYWORD("weight_order") { INT; if ( iValue ) pOpts->m_iFlags |= 16; }
|
||||
KEYWORD("query_mode") { INT; if ( iValue ) pOpts->m_iFlags |= 32; }
|
||||
KEYWORD("force_all_words") { INT; if ( iValue ) pOpts->m_iFlags |= 64; }
|
||||
KEYWORD("load_files") { INT; if ( iValue ) pOpts->m_iFlags |= 128; }
|
||||
KEYWORD("allow_empty") { INT; if ( iValue ) pOpts->m_iFlags |= 256; }
|
||||
KEYWORD("emit_zones") { INT; if ( iValue ) pOpts->m_iFlags |= 512; }
|
||||
else
|
||||
{
|
||||
snprintf ( sMessage, MAX_MESSAGE_LENGTH, "unrecognized argument: %.*s",
|
||||
(int)pArgs->attribute_lengths[i], pArgs->attributes[i] );
|
||||
(int)pArgs->attribute_lengths[i], pArgs->attributes[i] );
|
||||
bFail = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( bFail )
|
||||
{
|
||||
SafeDelete ( pOpts );
|
||||
|
@ -691,15 +706,14 @@ char * sphinx_snippets ( UDF_INIT * pUDF, UDF_ARGS * pArgs, char * sResult, unsi
|
|||
return sResult;
|
||||
}
|
||||
|
||||
const int iSize =
|
||||
8 + // header
|
||||
8 +
|
||||
4 + pArgs->lengths[1] + // index
|
||||
4 + pArgs->lengths[2] + // words
|
||||
4 + ARG_LEN ( pOpts->m_iBeforeMatch, 3 ) +
|
||||
4 + ARG_LEN ( pOpts->m_iAfterMatch, 4 ) +
|
||||
4 + ARG_LEN ( pOpts->m_iChunkSeparator, 5 ) +
|
||||
12 +
|
||||
const int iSize = 68 +
|
||||
pArgs->lengths[1] + // index
|
||||
pArgs->lengths[2] + // words
|
||||
ARG_LEN ( pOpts->m_iBeforeMatch, 3 ) +
|
||||
ARG_LEN ( pOpts->m_iAfterMatch, 4 ) +
|
||||
ARG_LEN ( pOpts->m_iChunkSeparator, 5 ) +
|
||||
ARG_LEN ( pOpts->m_iStripMode, 5 ) +
|
||||
ARG_LEN ( pOpts->m_iPassageBoundary, 0 ) +
|
||||
4 + pArgs->lengths[0]; // document
|
||||
|
||||
CSphBuffer tBuffer(iSize);
|
||||
|
@ -721,6 +735,13 @@ char * sphinx_snippets ( UDF_INIT * pUDF, UDF_ARGS * pArgs, char * sResult, unsi
|
|||
tBuffer.SendInt ( pOpts->m_iLimit );
|
||||
tBuffer.SendInt ( pOpts->m_iAround );
|
||||
|
||||
tBuffer.SendInt ( pOpts->m_iLimitPassages );
|
||||
tBuffer.SendInt ( pOpts->m_iLimitWords );
|
||||
tBuffer.SendInt ( pOpts->m_iPassageId );
|
||||
|
||||
SEND_STRING ( pOpts->m_iStripMode, "index" );
|
||||
SEND_STRING ( pOpts->m_iPassageBoundary, "" );
|
||||
|
||||
// single document
|
||||
tBuffer.SendInt ( 1 );
|
||||
tBuffer.SendString ( ARG(0) );
|
||||
|
@ -733,22 +754,22 @@ char * sphinx_snippets ( UDF_INIT * pUDF, UDF_ARGS * pArgs, char * sResult, unsi
|
|||
my_error ( ER_QUERY_ON_FOREIGN_DATA_SOURCE, MYF(0), "INTERNAL ERROR: failed to build request" );
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
iSocket = pOpts->m_tUrl.Connect();
|
||||
if ( iSocket == -1 ) break;
|
||||
if ( iSocket==-1 ) break;
|
||||
if ( !sphSend ( iSocket, tBuffer.Ptr(), iSize, sphReportErrors ) ) break;
|
||||
|
||||
CSphResponse * pResponse = CSphResponse::Read ( iSocket, 0x100 );
|
||||
CSphResponse * pResponse = CSphResponse::Read ( iSocket, VER_COMMAND_EXCERPT );
|
||||
if ( !pResponse ) break;
|
||||
|
||||
close ( iSocket );
|
||||
pOpts->m_pResponse = pResponse;
|
||||
*pLength = ntohl( *(DWORD *)pResponse->m_pBody );
|
||||
*pLength = ntohl ( *(DWORD *)pResponse->m_pBody );
|
||||
return pResponse->m_pBody + sizeof(DWORD);
|
||||
}
|
||||
while(0);
|
||||
|
||||
if ( iSocket != -1 )
|
||||
if ( iSocket!=-1 )
|
||||
close ( iSocket );
|
||||
|
||||
*pError = 1;
|
||||
|
@ -756,7 +777,7 @@ char * sphinx_snippets ( UDF_INIT * pUDF, UDF_ARGS * pArgs, char * sResult, unsi
|
|||
}
|
||||
|
||||
#undef SEND_STRING
|
||||
#undef ARG_LEN
|
||||
#undef ARG_LEN
|
||||
#undef ARG
|
||||
|
||||
void sphinx_snippets_deinit ( UDF_INIT * pUDF )
|
||||
|
@ -766,5 +787,5 @@ void sphinx_snippets_deinit ( UDF_INIT * pUDF )
|
|||
}
|
||||
|
||||
//
|
||||
// $Id: snippets_udf.cc 2058 2009-11-07 04:01:57Z shodan $
|
||||
// $Id: snippets_udf.cc 3087 2012-01-30 23:07:35Z shodan $
|
||||
//
|
||||
|
|
|
@ -1,284 +0,0 @@
|
|||
diff -B -N -r -u mysql-5.0.22/config/ac-macros/ha_sphinx.m4 mysql-5.0.22.sx/config/ac-macros/ha_sphinx.m4
|
||||
--- mysql-5.0.22/config/ac-macros/ha_sphinx.m4 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ mysql-5.0.22.sx/config/ac-macros/ha_sphinx.m4 2006-06-06 19:49:38.000000000 +0200
|
||||
@@ -0,0 +1,30 @@
|
||||
+dnl ---------------------------------------------------------------------------
|
||||
+dnl Macro: MYSQL_CHECK_EXAMPLEDB
|
||||
+dnl Sets HAVE_SPHINX_DB if --with-sphinx-storage-engine is used
|
||||
+dnl ---------------------------------------------------------------------------
|
||||
+AC_DEFUN([MYSQL_CHECK_SPHINXDB], [
|
||||
+ AC_ARG_WITH([sphinx-storage-engine],
|
||||
+ [
|
||||
+ --with-sphinx-storage-engine
|
||||
+ Enable the Sphinx Storage Engine],
|
||||
+ [sphinxdb="$withval"],
|
||||
+ [sphinxdb=no])
|
||||
+ AC_MSG_CHECKING([for example storage engine])
|
||||
+
|
||||
+ case "$sphinxdb" in
|
||||
+ yes )
|
||||
+ AC_DEFINE([HAVE_SPHINX_DB], [1], [Builds Sphinx Engine])
|
||||
+ AC_MSG_RESULT([yes])
|
||||
+ [sphinxdb=yes]
|
||||
+ ;;
|
||||
+ * )
|
||||
+ AC_MSG_RESULT([no])
|
||||
+ [sphinxdb=no]
|
||||
+ ;;
|
||||
+ esac
|
||||
+
|
||||
+])
|
||||
+dnl ---------------------------------------------------------------------------
|
||||
+dnl END OF MYSQL_CHECK_EXAMPLE SECTION
|
||||
+dnl ---------------------------------------------------------------------------
|
||||
+
|
||||
diff -B -N -r -u mysql-5.0.22/configure.in mysql-5.0.22.sx/configure.in
|
||||
--- mysql-5.0.22/configure.in 2006-05-25 10:56:45.000000000 +0200
|
||||
+++ mysql-5.0.22.sx/configure.in 2006-06-06 19:49:38.000000000 +0200
|
||||
@@ -41,6 +41,7 @@
|
||||
sinclude(config/ac-macros/ha_berkeley.m4)
|
||||
sinclude(config/ac-macros/ha_blackhole.m4)
|
||||
sinclude(config/ac-macros/ha_example.m4)
|
||||
+sinclude(config/ac-macros/ha_sphinx.m4)
|
||||
sinclude(config/ac-macros/ha_federated.m4)
|
||||
sinclude(config/ac-macros/ha_innodb.m4)
|
||||
sinclude(config/ac-macros/ha_ndbcluster.m4)
|
||||
@@ -2450,6 +2451,7 @@
|
||||
MYSQL_CHECK_BDB
|
||||
MYSQL_CHECK_INNODB
|
||||
MYSQL_CHECK_EXAMPLEDB
|
||||
+MYSQL_CHECK_SPHINXDB
|
||||
MYSQL_CHECK_ARCHIVEDB
|
||||
MYSQL_CHECK_CSVDB
|
||||
MYSQL_CHECK_BLACKHOLEDB
|
||||
diff -B -N -r -u mysql-5.0.22/libmysqld/Makefile.am mysql-5.0.22.sx/libmysqld/Makefile.am
|
||||
--- mysql-5.0.22/libmysqld/Makefile.am 2006-05-25 10:56:55.000000000 +0200
|
||||
+++ mysql-5.0.22.sx/libmysqld/Makefile.am 2006-06-06 19:49:38.000000000 +0200
|
||||
@@ -27,7 +27,7 @@
|
||||
-DSHAREDIR="\"$(MYSQLSHAREdir)\""
|
||||
INCLUDES= @bdb_includes@ \
|
||||
-I$(top_builddir)/include -I$(top_srcdir)/include \
|
||||
- -I$(top_srcdir)/sql -I$(top_srcdir)/sql/examples \
|
||||
+ -I$(top_srcdir)/sql -I$(top_srcdir)/sql/examples -I$(top_srcdir)/sql/sphinx \
|
||||
-I$(top_srcdir)/regex \
|
||||
$(openssl_includes) $(yassl_includes) @ZLIB_INCLUDES@
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
libmysqlsources = errmsg.c get_password.c libmysql.c client.c pack.c \
|
||||
my_time.c
|
||||
sqlexamplessources = ha_example.cc ha_tina.cc
|
||||
+sqlsphinxsources = ha_sphinx.cc
|
||||
|
||||
noinst_HEADERS = embedded_priv.h emb_qcache.h
|
||||
|
||||
@@ -65,7 +66,7 @@
|
||||
parse_file.cc sql_view.cc sql_trigger.cc my_decimal.cc \
|
||||
ha_blackhole.cc ha_archive.cc my_user.c
|
||||
|
||||
-libmysqld_int_a_SOURCES= $(libmysqld_sources) $(libmysqlsources) $(sqlsources) $(sqlexamplessources)
|
||||
+libmysqld_int_a_SOURCES= $(libmysqld_sources) $(libmysqlsources) $(sqlsources) $(sqlexamplessources) $(sqlsphinxsources)
|
||||
libmysqld_a_SOURCES=
|
||||
|
||||
# automake misses these
|
||||
@@ -133,12 +134,16 @@
|
||||
rm -f $$f; \
|
||||
@LN_CP_F@ $(top_srcdir)/sql/examples/$$f $$f; \
|
||||
done; \
|
||||
+ for f in $(sqlsphinxsources); do \
|
||||
+ rm -f $$f; \
|
||||
+ @LN_CP_F@ $(top_srcdir)/sql/sphinx/$$f $$f; \
|
||||
+ done; \
|
||||
rm -f client_settings.h; \
|
||||
@LN_CP_F@ $(top_srcdir)/libmysql/client_settings.h client_settings.h
|
||||
|
||||
|
||||
clean-local:
|
||||
- rm -f `echo $(sqlsources) $(libmysqlsources) $(sqlexamplessources) | sed "s;\.lo;.c;g"` \
|
||||
+ rm -f `echo $(sqlsources) $(libmysqlsources) $(sqlexamplessources) $(sqlsphinxsources) | sed "s;\.lo;.c;g"` \
|
||||
$(top_srcdir)/linked_libmysqld_sources; \
|
||||
rm -f client_settings.h
|
||||
|
||||
diff -B -N -r -u mysql-5.0.22/sql/handler.cc mysql-5.0.22.sx/sql/handler.cc
|
||||
--- mysql-5.0.22/sql/handler.cc 2006-05-25 10:56:42.000000000 +0200
|
||||
+++ mysql-5.0.22.sx/sql/handler.cc 2006-06-06 19:49:38.000000000 +0200
|
||||
@@ -78,6 +78,15 @@
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
HTON_NO_FLAGS };
|
||||
#endif
|
||||
+#ifdef HAVE_SPHINX_DB
|
||||
+#include "sphinx/ha_sphinx.h"
|
||||
+extern handlerton sphinx_hton;
|
||||
+#else
|
||||
+handlerton sphinx_hton = { "SPHINX", SHOW_OPTION_NO, "SPHINX storage engine",
|
||||
+ DB_TYPE_SPHINX_DB, NULL, 0, 0, NULL, NULL,
|
||||
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
+ HTON_NO_FLAGS };
|
||||
+#endif
|
||||
#ifdef HAVE_INNOBASE_DB
|
||||
#include "ha_innodb.h"
|
||||
extern handlerton innobase_hton;
|
||||
@@ -147,6 +156,7 @@
|
||||
&example_hton,
|
||||
&archive_hton,
|
||||
&tina_hton,
|
||||
+ &sphinx_hton,
|
||||
&ndbcluster_hton,
|
||||
&federated_hton,
|
||||
&myisammrg_hton,
|
||||
@@ -345,6 +355,12 @@
|
||||
return new (alloc) ha_tina(table);
|
||||
return NULL;
|
||||
#endif
|
||||
+#ifdef HAVE_SPHINX_DB
|
||||
+ case DB_TYPE_SPHINX_DB:
|
||||
+ if (have_sphinx_db == SHOW_OPTION_YES)
|
||||
+ return new (alloc) ha_sphinx(table);
|
||||
+ return NULL;
|
||||
+#endif
|
||||
#ifdef HAVE_NDBCLUSTER_DB
|
||||
case DB_TYPE_NDBCLUSTER:
|
||||
if (have_ndbcluster == SHOW_OPTION_YES)
|
||||
diff -B -N -r -u mysql-5.0.22/sql/handler.h mysql-5.0.22.sx/sql/handler.h
|
||||
--- mysql-5.0.22/sql/handler.h 2006-05-25 10:56:55.000000000 +0200
|
||||
+++ mysql-5.0.22.sx/sql/handler.h 2006-06-06 19:49:38.000000000 +0200
|
||||
@@ -183,8 +183,9 @@
|
||||
DB_TYPE_BERKELEY_DB, DB_TYPE_INNODB,
|
||||
DB_TYPE_GEMINI, DB_TYPE_NDBCLUSTER,
|
||||
DB_TYPE_EXAMPLE_DB, DB_TYPE_ARCHIVE_DB, DB_TYPE_CSV_DB,
|
||||
- DB_TYPE_FEDERATED_DB,
|
||||
+ DB_TYPE_FEDERATED_DB,
|
||||
DB_TYPE_BLACKHOLE_DB,
|
||||
+ DB_TYPE_SPHINX_DB,
|
||||
DB_TYPE_DEFAULT // Must be last
|
||||
};
|
||||
|
||||
diff -B -N -r -u mysql-5.0.22/sql/Makefile.am mysql-5.0.22.sx/sql/Makefile.am
|
||||
--- mysql-5.0.22/sql/Makefile.am 2006-05-25 10:56:41.000000000 +0200
|
||||
+++ mysql-5.0.22.sx/sql/Makefile.am 2006-06-06 19:49:38.000000000 +0200
|
||||
@@ -66,6 +66,7 @@
|
||||
sql_array.h sql_cursor.h \
|
||||
examples/ha_example.h ha_archive.h \
|
||||
examples/ha_tina.h ha_blackhole.h \
|
||||
+ sphinx/ha_sphinx.h \
|
||||
ha_federated.h
|
||||
mysqld_SOURCES = sql_lex.cc sql_handler.cc \
|
||||
item.cc item_sum.cc item_buff.cc item_func.cc \
|
||||
@@ -102,6 +103,7 @@
|
||||
sp_cache.cc parse_file.cc sql_trigger.cc \
|
||||
examples/ha_example.cc ha_archive.cc \
|
||||
examples/ha_tina.cc ha_blackhole.cc \
|
||||
+ sphinx/ha_sphinx.cc \
|
||||
ha_federated.cc
|
||||
|
||||
gen_lex_hash_SOURCES = gen_lex_hash.cc
|
||||
diff -B -N -r -u mysql-5.0.22/sql/mysqld.cc mysql-5.0.22.sx/sql/mysqld.cc
|
||||
--- mysql-5.0.22/sql/mysqld.cc 2006-05-25 10:56:41.000000000 +0200
|
||||
+++ mysql-5.0.22.sx/sql/mysqld.cc 2006-06-06 19:49:38.000000000 +0200
|
||||
@@ -6420,6 +6420,11 @@
|
||||
#else
|
||||
have_csv_db= SHOW_OPTION_NO;
|
||||
#endif
|
||||
+#ifdef HAVE_SPHINX_DB
|
||||
+ have_sphinx_db= SHOW_OPTION_YES;
|
||||
+#else
|
||||
+ have_sphinx_db= SHOW_OPTION_NO;
|
||||
+#endif
|
||||
#ifdef HAVE_NDBCLUSTER_DB
|
||||
have_ndbcluster=SHOW_OPTION_DISABLED;
|
||||
#else
|
||||
@@ -7457,6 +7462,7 @@
|
||||
#undef have_example_db
|
||||
#undef have_archive_db
|
||||
#undef have_csv_db
|
||||
+#undef have_sphinx_db
|
||||
#undef have_federated_db
|
||||
#undef have_partition_db
|
||||
#undef have_blackhole_db
|
||||
@@ -7467,6 +7473,7 @@
|
||||
SHOW_COMP_OPTION have_example_db= SHOW_OPTION_NO;
|
||||
SHOW_COMP_OPTION have_archive_db= SHOW_OPTION_NO;
|
||||
SHOW_COMP_OPTION have_csv_db= SHOW_OPTION_NO;
|
||||
+SHOW_COMP_OPTION have_sphinx_db= SHOW_OPTION_NO;
|
||||
SHOW_COMP_OPTION have_federated_db= SHOW_OPTION_NO;
|
||||
SHOW_COMP_OPTION have_partition_db= SHOW_OPTION_NO;
|
||||
SHOW_COMP_OPTION have_blackhole_db= SHOW_OPTION_NO;
|
||||
diff -B -N -r -u mysql-5.0.22/sql/mysql_priv.h mysql-5.0.22.sx/sql/mysql_priv.h
|
||||
--- mysql-5.0.22/sql/mysql_priv.h 2006-05-25 10:56:43.000000000 +0200
|
||||
+++ mysql-5.0.22.sx/sql/mysql_priv.h 2006-06-06 19:49:38.000000000 +0200
|
||||
@@ -1279,6 +1279,12 @@
|
||||
#else
|
||||
extern SHOW_COMP_OPTION have_csv_db;
|
||||
#endif
|
||||
+#ifdef HAVE_SPHINX_DB
|
||||
+extern handlerton sphinx_hton;
|
||||
+#define have_sphinx_db sphinx_hton.state
|
||||
+#else
|
||||
+extern SHOW_COMP_OPTION have_sphinx_db;
|
||||
+#endif
|
||||
#ifdef HAVE_FEDERATED_DB
|
||||
extern handlerton federated_hton;
|
||||
#define have_federated_db federated_hton.state
|
||||
diff -B -N -r -u mysql-5.0.22/sql/set_var.cc mysql-5.0.22.sx/sql/set_var.cc
|
||||
--- mysql-5.0.22/sql/set_var.cc 2006-05-25 10:56:41.000000000 +0200
|
||||
+++ mysql-5.0.22.sx/sql/set_var.cc 2006-06-06 19:49:38.000000000 +0200
|
||||
@@ -809,6 +809,7 @@
|
||||
{"have_compress", (char*) &have_compress, SHOW_HAVE},
|
||||
{"have_crypt", (char*) &have_crypt, SHOW_HAVE},
|
||||
{"have_csv", (char*) &have_csv_db, SHOW_HAVE},
|
||||
+ {"have_sphinx", (char*) &have_sphinx_db, SHOW_HAVE},
|
||||
{"have_example_engine", (char*) &have_example_db, SHOW_HAVE},
|
||||
{"have_federated_engine", (char*) &have_federated_db, SHOW_HAVE},
|
||||
{"have_geometry", (char*) &have_geometry, SHOW_HAVE},
|
||||
diff -B -N -r -u mysql-5.0.22/sql/sql_lex.h mysql-5.0.22.sx/sql/sql_lex.h
|
||||
--- mysql-5.0.22/sql/sql_lex.h 2006-05-25 10:56:41.000000000 +0200
|
||||
+++ mysql-5.0.22.sx/sql/sql_lex.h 2006-06-06 19:49:38.000000000 +0200
|
||||
@@ -58,6 +58,7 @@
|
||||
SQLCOM_SHOW_DATABASES, SQLCOM_SHOW_TABLES, SQLCOM_SHOW_FIELDS,
|
||||
SQLCOM_SHOW_KEYS, SQLCOM_SHOW_VARIABLES, SQLCOM_SHOW_LOGS, SQLCOM_SHOW_STATUS,
|
||||
SQLCOM_SHOW_INNODB_STATUS, SQLCOM_SHOW_NDBCLUSTER_STATUS, SQLCOM_SHOW_MUTEX_STATUS,
|
||||
+ SQLCOM_SHOW_SPHINX_STATUS,
|
||||
SQLCOM_SHOW_PROCESSLIST, SQLCOM_SHOW_MASTER_STAT, SQLCOM_SHOW_SLAVE_STAT,
|
||||
SQLCOM_SHOW_GRANTS, SQLCOM_SHOW_CREATE, SQLCOM_SHOW_CHARSETS,
|
||||
SQLCOM_SHOW_COLLATIONS, SQLCOM_SHOW_CREATE_DB, SQLCOM_SHOW_TABLE_STATUS,
|
||||
diff -B -N -r -u mysql-5.0.22/sql/sql_parse.cc mysql-5.0.22.sx/sql/sql_parse.cc
|
||||
--- mysql-5.0.22/sql/sql_parse.cc 2006-05-25 10:56:41.000000000 +0200
|
||||
+++ mysql-5.0.22.sx/sql/sql_parse.cc 2006-06-06 19:49:38.000000000 +0200
|
||||
@@ -25,6 +25,9 @@
|
||||
#ifdef HAVE_INNOBASE_DB
|
||||
#include "ha_innodb.h"
|
||||
#endif
|
||||
+#ifdef HAVE_SPHINX_DB
|
||||
+#include "sphinx/ha_sphinx.h"
|
||||
+#endif
|
||||
|
||||
#ifdef HAVE_NDBCLUSTER_DB
|
||||
#include "ha_ndbcluster.h"
|
||||
@@ -2722,6 +2725,15 @@
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
+#ifdef HAVE_SPHINX_DB
|
||||
+ case SQLCOM_SHOW_SPHINX_STATUS:
|
||||
+ {
|
||||
+ if (check_global_access(thd, SUPER_ACL))
|
||||
+ goto error;
|
||||
+ res = sphinx_show_status(thd);
|
||||
+ break;
|
||||
+ }
|
||||
+#endif
|
||||
#ifdef HAVE_REPLICATION
|
||||
case SQLCOM_LOAD_MASTER_TABLE:
|
||||
{
|
||||
diff -B -N -r -u mysql-5.0.22/sql/sql_yacc.yy mysql-5.0.22.sx/sql/sql_yacc.yy
|
||||
--- mysql-5.0.22/sql/sql_yacc.yy 2006-05-25 10:56:43.000000000 +0200
|
||||
+++ mysql-5.0.22.sx/sql/sql_yacc.yy 2006-06-06 19:49:38.000000000 +0200
|
||||
@@ -6584,6 +6584,9 @@
|
||||
case DB_TYPE_INNODB:
|
||||
Lex->sql_command = SQLCOM_SHOW_INNODB_STATUS;
|
||||
break;
|
||||
+ case DB_TYPE_SPHINX_DB:
|
||||
+ Lex->sql_command = SQLCOM_SHOW_SPHINX_STATUS;
|
||||
+ break;
|
||||
default:
|
||||
my_error(ER_NOT_SUPPORTED_YET, MYF(0), "STATUS");
|
||||
YYABORT;
|
|
@ -1,284 +0,0 @@
|
|||
diff -B -N -r -u mysql-5.0.22/config/ac-macros/ha_sphinx.m4 mysql-5.0.22.sx/config/ac-macros/ha_sphinx.m4
|
||||
--- mysql-5.0.22/config/ac-macros/ha_sphinx.m4 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ mysql-5.0.22.sx/config/ac-macros/ha_sphinx.m4 2006-06-06 19:49:38.000000000 +0200
|
||||
@@ -0,0 +1,30 @@
|
||||
+dnl ---------------------------------------------------------------------------
|
||||
+dnl Macro: MYSQL_CHECK_EXAMPLEDB
|
||||
+dnl Sets HAVE_SPHINX_DB if --with-sphinx-storage-engine is used
|
||||
+dnl ---------------------------------------------------------------------------
|
||||
+AC_DEFUN([MYSQL_CHECK_SPHINXDB], [
|
||||
+ AC_ARG_WITH([sphinx-storage-engine],
|
||||
+ [
|
||||
+ --with-sphinx-storage-engine
|
||||
+ Enable the Sphinx Storage Engine],
|
||||
+ [sphinxdb="$withval"],
|
||||
+ [sphinxdb=no])
|
||||
+ AC_MSG_CHECKING([for example storage engine])
|
||||
+
|
||||
+ case "$sphinxdb" in
|
||||
+ yes )
|
||||
+ AC_DEFINE([HAVE_SPHINX_DB], [1], [Builds Sphinx Engine])
|
||||
+ AC_MSG_RESULT([yes])
|
||||
+ [sphinxdb=yes]
|
||||
+ ;;
|
||||
+ * )
|
||||
+ AC_MSG_RESULT([no])
|
||||
+ [sphinxdb=no]
|
||||
+ ;;
|
||||
+ esac
|
||||
+
|
||||
+])
|
||||
+dnl ---------------------------------------------------------------------------
|
||||
+dnl END OF MYSQL_CHECK_EXAMPLE SECTION
|
||||
+dnl ---------------------------------------------------------------------------
|
||||
+
|
||||
diff -B -N -r -u mysql-5.0.22/configure.in mysql-5.0.22.sx/configure.in
|
||||
--- mysql-5.0.22/configure.in 2006-05-25 10:56:45.000000000 +0200
|
||||
+++ mysql-5.0.22.sx/configure.in 2006-06-06 19:49:38.000000000 +0200
|
||||
@@ -41,6 +41,7 @@
|
||||
sinclude(config/ac-macros/ha_berkeley.m4)
|
||||
sinclude(config/ac-macros/ha_blackhole.m4)
|
||||
sinclude(config/ac-macros/ha_example.m4)
|
||||
+sinclude(config/ac-macros/ha_sphinx.m4)
|
||||
sinclude(config/ac-macros/ha_federated.m4)
|
||||
sinclude(config/ac-macros/ha_innodb.m4)
|
||||
sinclude(config/ac-macros/ha_ndbcluster.m4)
|
||||
@@ -2450,6 +2451,7 @@
|
||||
MYSQL_CHECK_BDB
|
||||
MYSQL_CHECK_INNODB
|
||||
MYSQL_CHECK_EXAMPLEDB
|
||||
+MYSQL_CHECK_SPHINXDB
|
||||
MYSQL_CHECK_ARCHIVEDB
|
||||
MYSQL_CHECK_CSVDB
|
||||
MYSQL_CHECK_BLACKHOLEDB
|
||||
diff -B -N -r -u mysql-5.0.22/libmysqld/Makefile.am mysql-5.0.22.sx/libmysqld/Makefile.am
|
||||
--- mysql-5.0.22/libmysqld/Makefile.am 2006-05-25 10:56:55.000000000 +0200
|
||||
+++ mysql-5.0.22.sx/libmysqld/Makefile.am 2006-06-06 19:49:38.000000000 +0200
|
||||
@@ -27,7 +27,7 @@
|
||||
-DSHAREDIR="\"$(MYSQLSHAREdir)\""
|
||||
INCLUDES= @bdb_includes@ \
|
||||
-I$(top_builddir)/include -I$(top_srcdir)/include \
|
||||
- -I$(top_srcdir)/sql -I$(top_srcdir)/sql/examples \
|
||||
+ -I$(top_srcdir)/sql -I$(top_srcdir)/sql/examples -I$(top_srcdir)/sql/sphinx \
|
||||
-I$(top_srcdir)/regex \
|
||||
$(openssl_includes) $(yassl_includes) @ZLIB_INCLUDES@
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
libmysqlsources = errmsg.c get_password.c libmysql.c client.c pack.c \
|
||||
my_time.c
|
||||
sqlexamplessources = ha_example.cc ha_tina.cc
|
||||
+sqlsphinxsources = ha_sphinx.cc
|
||||
|
||||
noinst_HEADERS = embedded_priv.h emb_qcache.h
|
||||
|
||||
@@ -65,7 +66,7 @@
|
||||
parse_file.cc sql_view.cc sql_trigger.cc my_decimal.cc \
|
||||
ha_blackhole.cc ha_archive.cc my_user.c
|
||||
|
||||
-libmysqld_int_a_SOURCES= $(libmysqld_sources) $(libmysqlsources) $(sqlsources) $(sqlexamplessources)
|
||||
+libmysqld_int_a_SOURCES= $(libmysqld_sources) $(libmysqlsources) $(sqlsources) $(sqlexamplessources) $(sqlsphinxsources)
|
||||
libmysqld_a_SOURCES=
|
||||
|
||||
# automake misses these
|
||||
@@ -133,12 +134,16 @@
|
||||
rm -f $$f; \
|
||||
@LN_CP_F@ $(top_srcdir)/sql/examples/$$f $$f; \
|
||||
done; \
|
||||
+ for f in $(sqlsphinxsources); do \
|
||||
+ rm -f $$f; \
|
||||
+ @LN_CP_F@ $(top_srcdir)/sql/sphinx/$$f $$f; \
|
||||
+ done; \
|
||||
rm -f client_settings.h; \
|
||||
@LN_CP_F@ $(top_srcdir)/libmysql/client_settings.h client_settings.h
|
||||
|
||||
|
||||
clean-local:
|
||||
- rm -f `echo $(sqlsources) $(libmysqlsources) $(sqlexamplessources) | sed "s;\.lo;.c;g"` \
|
||||
+ rm -f `echo $(sqlsources) $(libmysqlsources) $(sqlexamplessources) $(sqlsphinxsources) | sed "s;\.lo;.c;g"` \
|
||||
$(top_srcdir)/linked_libmysqld_sources; \
|
||||
rm -f client_settings.h
|
||||
|
||||
diff -B -N -r -u mysql-5.0.22/sql/handler.cc mysql-5.0.22.sx/sql/handler.cc
|
||||
--- mysql-5.0.22/sql/handler.cc 2006-05-25 10:56:42.000000000 +0200
|
||||
+++ mysql-5.0.22.sx/sql/handler.cc 2006-06-06 19:49:38.000000000 +0200
|
||||
@@ -78,6 +78,15 @@
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
HTON_NO_FLAGS };
|
||||
#endif
|
||||
+#ifdef HAVE_SPHINX_DB
|
||||
+#include "sphinx/ha_sphinx.h"
|
||||
+extern handlerton sphinx_hton;
|
||||
+#else
|
||||
+handlerton sphinx_hton = { "SPHINX", SHOW_OPTION_NO, "SPHINX storage engine",
|
||||
+ DB_TYPE_SPHINX_DB, NULL, 0, 0, NULL, NULL,
|
||||
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
+ HTON_NO_FLAGS };
|
||||
+#endif
|
||||
#ifdef HAVE_INNOBASE_DB
|
||||
#include "ha_innodb.h"
|
||||
extern handlerton innobase_hton;
|
||||
@@ -147,6 +156,7 @@
|
||||
&example_hton,
|
||||
&archive_hton,
|
||||
&tina_hton,
|
||||
+ &sphinx_hton,
|
||||
&ndbcluster_hton,
|
||||
&federated_hton,
|
||||
&myisammrg_hton,
|
||||
@@ -345,6 +355,12 @@
|
||||
return new (alloc) ha_tina(table);
|
||||
return NULL;
|
||||
#endif
|
||||
+#ifdef HAVE_SPHINX_DB
|
||||
+ case DB_TYPE_SPHINX_DB:
|
||||
+ if (have_sphinx_db == SHOW_OPTION_YES)
|
||||
+ return new (alloc) ha_sphinx(table);
|
||||
+ return NULL;
|
||||
+#endif
|
||||
#ifdef HAVE_NDBCLUSTER_DB
|
||||
case DB_TYPE_NDBCLUSTER:
|
||||
if (have_ndbcluster == SHOW_OPTION_YES)
|
||||
diff -B -N -r -u mysql-5.0.22/sql/handler.h mysql-5.0.22.sx/sql/handler.h
|
||||
--- mysql-5.0.22/sql/handler.h 2006-05-25 10:56:55.000000000 +0200
|
||||
+++ mysql-5.0.22.sx/sql/handler.h 2006-06-06 19:49:38.000000000 +0200
|
||||
@@ -183,8 +183,9 @@
|
||||
DB_TYPE_BERKELEY_DB, DB_TYPE_INNODB,
|
||||
DB_TYPE_GEMINI, DB_TYPE_NDBCLUSTER,
|
||||
DB_TYPE_EXAMPLE_DB, DB_TYPE_ARCHIVE_DB, DB_TYPE_CSV_DB,
|
||||
- DB_TYPE_FEDERATED_DB,
|
||||
+ DB_TYPE_FEDERATED_DB,
|
||||
DB_TYPE_BLACKHOLE_DB,
|
||||
+ DB_TYPE_SPHINX_DB,
|
||||
DB_TYPE_DEFAULT // Must be last
|
||||
};
|
||||
|
||||
diff -B -N -r -u mysql-5.0.22/sql/Makefile.am mysql-5.0.22.sx/sql/Makefile.am
|
||||
--- mysql-5.0.22/sql/Makefile.am 2006-05-25 10:56:41.000000000 +0200
|
||||
+++ mysql-5.0.22.sx/sql/Makefile.am 2006-06-06 19:49:38.000000000 +0200
|
||||
@@ -66,6 +66,7 @@
|
||||
sql_array.h sql_cursor.h \
|
||||
examples/ha_example.h ha_archive.h \
|
||||
examples/ha_tina.h ha_blackhole.h \
|
||||
+ sphinx/ha_sphinx.h \
|
||||
ha_federated.h
|
||||
mysqld_SOURCES = sql_lex.cc sql_handler.cc \
|
||||
item.cc item_sum.cc item_buff.cc item_func.cc \
|
||||
@@ -102,6 +103,7 @@
|
||||
sp_cache.cc parse_file.cc sql_trigger.cc \
|
||||
examples/ha_example.cc ha_archive.cc \
|
||||
examples/ha_tina.cc ha_blackhole.cc \
|
||||
+ sphinx/ha_sphinx.cc \
|
||||
ha_federated.cc
|
||||
|
||||
gen_lex_hash_SOURCES = gen_lex_hash.cc
|
||||
diff -B -N -r -u mysql-5.0.22/sql/mysqld.cc mysql-5.0.22.sx/sql/mysqld.cc
|
||||
--- mysql-5.0.22/sql/mysqld.cc 2006-05-25 10:56:41.000000000 +0200
|
||||
+++ mysql-5.0.22.sx/sql/mysqld.cc 2006-06-06 19:49:38.000000000 +0200
|
||||
@@ -6420,6 +6420,11 @@
|
||||
#else
|
||||
have_csv_db= SHOW_OPTION_NO;
|
||||
#endif
|
||||
+#ifdef HAVE_SPHINX_DB
|
||||
+ have_sphinx_db= SHOW_OPTION_YES;
|
||||
+#else
|
||||
+ have_sphinx_db= SHOW_OPTION_NO;
|
||||
+#endif
|
||||
#ifdef HAVE_NDBCLUSTER_DB
|
||||
have_ndbcluster=SHOW_OPTION_DISABLED;
|
||||
#else
|
||||
@@ -7457,6 +7462,7 @@
|
||||
#undef have_example_db
|
||||
#undef have_archive_db
|
||||
#undef have_csv_db
|
||||
+#undef have_sphinx_db
|
||||
#undef have_federated_db
|
||||
#undef have_partition_db
|
||||
#undef have_blackhole_db
|
||||
@@ -7467,6 +7473,7 @@
|
||||
SHOW_COMP_OPTION have_example_db= SHOW_OPTION_NO;
|
||||
SHOW_COMP_OPTION have_archive_db= SHOW_OPTION_NO;
|
||||
SHOW_COMP_OPTION have_csv_db= SHOW_OPTION_NO;
|
||||
+SHOW_COMP_OPTION have_sphinx_db= SHOW_OPTION_NO;
|
||||
SHOW_COMP_OPTION have_federated_db= SHOW_OPTION_NO;
|
||||
SHOW_COMP_OPTION have_partition_db= SHOW_OPTION_NO;
|
||||
SHOW_COMP_OPTION have_blackhole_db= SHOW_OPTION_NO;
|
||||
diff -B -N -r -u mysql-5.0.22/sql/mysql_priv.h mysql-5.0.22.sx/sql/mysql_priv.h
|
||||
--- mysql-5.0.22/sql/mysql_priv.h 2006-05-25 10:56:43.000000000 +0200
|
||||
+++ mysql-5.0.22.sx/sql/mysql_priv.h 2006-06-06 19:49:38.000000000 +0200
|
||||
@@ -1279,6 +1279,12 @@
|
||||
#else
|
||||
extern SHOW_COMP_OPTION have_csv_db;
|
||||
#endif
|
||||
+#ifdef HAVE_SPHINX_DB
|
||||
+extern handlerton sphinx_hton;
|
||||
+#define have_sphinx_db sphinx_hton.state
|
||||
+#else
|
||||
+extern SHOW_COMP_OPTION have_sphinx_db;
|
||||
+#endif
|
||||
#ifdef HAVE_FEDERATED_DB
|
||||
extern handlerton federated_hton;
|
||||
#define have_federated_db federated_hton.state
|
||||
diff -B -N -r -u mysql-5.0.22/sql/set_var.cc mysql-5.0.22.sx/sql/set_var.cc
|
||||
--- mysql-5.0.22/sql/set_var.cc 2006-05-25 10:56:41.000000000 +0200
|
||||
+++ mysql-5.0.22.sx/sql/set_var.cc 2006-06-06 19:49:38.000000000 +0200
|
||||
@@ -864,6 +864,7 @@
|
||||
{"have_compress", (char*) &have_compress, SHOW_HAVE},
|
||||
{"have_crypt", (char*) &have_crypt, SHOW_HAVE},
|
||||
{"have_csv", (char*) &have_csv_db, SHOW_HAVE},
|
||||
+ {"have_sphinx", (char*) &have_sphinx_db, SHOW_HAVE},
|
||||
{"have_dynamic_loading", (char*) &have_dlopen, SHOW_HAVE},
|
||||
{"have_example_engine", (char*) &have_example_db, SHOW_HAVE},
|
||||
{"have_federated_engine", (char*) &have_federated_db, SHOW_HAVE},
|
||||
diff -B -N -r -u mysql-5.0.22/sql/sql_lex.h mysql-5.0.22.sx/sql/sql_lex.h
|
||||
--- mysql-5.0.22/sql/sql_lex.h 2006-05-25 10:56:41.000000000 +0200
|
||||
+++ mysql-5.0.22.sx/sql/sql_lex.h 2006-06-06 19:49:38.000000000 +0200
|
||||
@@ -58,6 +58,7 @@
|
||||
SQLCOM_SHOW_DATABASES, SQLCOM_SHOW_TABLES, SQLCOM_SHOW_FIELDS,
|
||||
SQLCOM_SHOW_KEYS, SQLCOM_SHOW_VARIABLES, SQLCOM_SHOW_LOGS, SQLCOM_SHOW_STATUS,
|
||||
SQLCOM_SHOW_INNODB_STATUS, SQLCOM_SHOW_NDBCLUSTER_STATUS, SQLCOM_SHOW_MUTEX_STATUS,
|
||||
+ SQLCOM_SHOW_SPHINX_STATUS,
|
||||
SQLCOM_SHOW_PROCESSLIST, SQLCOM_SHOW_MASTER_STAT, SQLCOM_SHOW_SLAVE_STAT,
|
||||
SQLCOM_SHOW_GRANTS, SQLCOM_SHOW_CREATE, SQLCOM_SHOW_CHARSETS,
|
||||
SQLCOM_SHOW_COLLATIONS, SQLCOM_SHOW_CREATE_DB, SQLCOM_SHOW_TABLE_STATUS,
|
||||
diff -B -N -r -u mysql-5.0.22/sql/sql_parse.cc mysql-5.0.22.sx/sql/sql_parse.cc
|
||||
--- mysql-5.0.22/sql/sql_parse.cc 2006-05-25 10:56:41.000000000 +0200
|
||||
+++ mysql-5.0.22.sx/sql/sql_parse.cc 2006-06-06 19:49:38.000000000 +0200
|
||||
@@ -25,6 +25,9 @@
|
||||
#ifdef HAVE_INNOBASE_DB
|
||||
#include "ha_innodb.h"
|
||||
#endif
|
||||
+#ifdef HAVE_SPHINX_DB
|
||||
+#include "sphinx/ha_sphinx.h"
|
||||
+#endif
|
||||
|
||||
#ifdef HAVE_NDBCLUSTER_DB
|
||||
#include "ha_ndbcluster.h"
|
||||
@@ -2722,6 +2725,15 @@
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
+#ifdef HAVE_SPHINX_DB
|
||||
+ case SQLCOM_SHOW_SPHINX_STATUS:
|
||||
+ {
|
||||
+ if (check_global_access(thd, SUPER_ACL))
|
||||
+ goto error;
|
||||
+ res = sphinx_show_status(thd);
|
||||
+ break;
|
||||
+ }
|
||||
+#endif
|
||||
#ifdef HAVE_REPLICATION
|
||||
case SQLCOM_LOAD_MASTER_TABLE:
|
||||
{
|
||||
diff -B -N -r -u mysql-5.0.22/sql/sql_yacc.yy mysql-5.0.22.sx/sql/sql_yacc.yy
|
||||
--- mysql-5.0.22/sql/sql_yacc.yy 2006-05-25 10:56:43.000000000 +0200
|
||||
+++ mysql-5.0.22.sx/sql/sql_yacc.yy 2006-06-06 19:49:38.000000000 +0200
|
||||
@@ -6584,6 +6584,9 @@
|
||||
case DB_TYPE_INNODB:
|
||||
Lex->sql_command = SQLCOM_SHOW_INNODB_STATUS;
|
||||
break;
|
||||
+ case DB_TYPE_SPHINX_DB:
|
||||
+ Lex->sql_command = SQLCOM_SHOW_SPHINX_STATUS;
|
||||
+ break;
|
||||
default:
|
||||
my_error(ER_NOT_SUPPORTED_YET, MYF(0), "STATUS");
|
||||
YYABORT;
|
|
@ -1,338 +0,0 @@
|
|||
--- mysql-5.0.67/config/ac-macros/ha_sphinx.m4 1970-01-01 10:00:00.000000000 +1000
|
||||
+++ mysql-5.0.67-sphinx/config/ac-macros/ha_sphinx.m4 2009-02-14 09:15:48.000000000 +1000
|
||||
@@ -0,0 +1,30 @@
|
||||
+dnl ---------------------------------------------------------------------------
|
||||
+dnl Macro: MYSQL_CHECK_EXAMPLEDB
|
||||
+dnl Sets HAVE_SPHINX_DB if --with-sphinx-storage-engine is used
|
||||
+dnl ---------------------------------------------------------------------------
|
||||
+AC_DEFUN([MYSQL_CHECK_SPHINXDB], [
|
||||
+ AC_ARG_WITH([sphinx-storage-engine],
|
||||
+ [
|
||||
+ --with-sphinx-storage-engine
|
||||
+ Enable the Sphinx Storage Engine],
|
||||
+ [sphinxdb="$withval"],
|
||||
+ [sphinxdb=no])
|
||||
+ AC_MSG_CHECKING([for example storage engine])
|
||||
+
|
||||
+ case "$sphinxdb" in
|
||||
+ yes )
|
||||
+ AC_DEFINE([HAVE_SPHINX_DB], [1], [Builds Sphinx Engine])
|
||||
+ AC_MSG_RESULT([yes])
|
||||
+ [sphinxdb=yes]
|
||||
+ ;;
|
||||
+ * )
|
||||
+ AC_MSG_RESULT([no])
|
||||
+ [sphinxdb=no]
|
||||
+ ;;
|
||||
+ esac
|
||||
+
|
||||
+])
|
||||
+dnl ---------------------------------------------------------------------------
|
||||
+dnl END OF MYSQL_CHECK_EXAMPLE SECTION
|
||||
+dnl ---------------------------------------------------------------------------
|
||||
+
|
||||
--- mysql-5.0.67/configure.in 2008-08-04 23:19:07.000000000 +1100
|
||||
+++ mysql-5.0.67-sphinx/configure.in 2009-02-14 09:15:48.000000000 +1000
|
||||
@@ -58,6 +58,7 @@
|
||||
sinclude(config/ac-macros/ha_berkeley.m4)
|
||||
sinclude(config/ac-macros/ha_blackhole.m4)
|
||||
sinclude(config/ac-macros/ha_example.m4)
|
||||
+sinclude(config/ac-macros/ha_sphinx.m4)
|
||||
sinclude(config/ac-macros/ha_federated.m4)
|
||||
sinclude(config/ac-macros/ha_innodb.m4)
|
||||
sinclude(config/ac-macros/ha_ndbcluster.m4)
|
||||
@@ -2625,6 +2626,7 @@
|
||||
MYSQL_CHECK_BDB
|
||||
MYSQL_CHECK_INNODB
|
||||
MYSQL_CHECK_EXAMPLEDB
|
||||
+MYSQL_CHECK_SPHINXDB
|
||||
MYSQL_CHECK_ARCHIVEDB
|
||||
MYSQL_CHECK_CSVDB
|
||||
MYSQL_CHECK_BLACKHOLEDB
|
||||
--- mysql-5.0.67/libmysqld/Makefile.am 2008-08-04 23:19:18.000000000 +1100
|
||||
+++ mysql-5.0.67-sphinx/libmysqld/Makefile.am 2009-02-14 09:15:48.000000000 +1000
|
||||
@@ -29,6 +29,7 @@
|
||||
-I$(top_builddir)/include -I$(top_srcdir)/include \
|
||||
-I$(top_builddir)/sql -I$(top_srcdir)/sql \
|
||||
-I$(top_srcdir)/sql/examples \
|
||||
+ -I$(top_srcdir)/sql/sphinx \
|
||||
-I$(top_srcdir)/regex \
|
||||
$(openssl_includes) @ZLIB_INCLUDES@
|
||||
|
||||
@@ -39,6 +40,7 @@
|
||||
libmysqlsources = errmsg.c get_password.c libmysql.c client.c pack.c \
|
||||
my_time.c
|
||||
sqlexamplessources = ha_example.cc ha_tina.cc
|
||||
+sqlsphinxsources = ha_sphinx.cc
|
||||
|
||||
noinst_HEADERS = embedded_priv.h emb_qcache.h
|
||||
|
||||
@@ -67,7 +69,7 @@
|
||||
parse_file.cc sql_view.cc sql_trigger.cc my_decimal.cc \
|
||||
ha_blackhole.cc ha_archive.cc my_user.c
|
||||
|
||||
-libmysqld_int_a_SOURCES= $(libmysqld_sources) $(libmysqlsources) $(sqlsources) $(sqlexamplessources)
|
||||
+libmysqld_int_a_SOURCES= $(libmysqld_sources) $(libmysqlsources) $(sqlsources) $(sqlexamplessources) $(sqlsphinxsources)
|
||||
libmysqld_a_SOURCES=
|
||||
|
||||
# automake misses these
|
||||
@@ -147,12 +149,16 @@
|
||||
rm -f $$f; \
|
||||
@LN_CP_F@ $(top_srcdir)/sql/examples/$$f $$f; \
|
||||
done; \
|
||||
+ for f in $(sqlsphinxsources); do \
|
||||
+ rm -f $$f; \
|
||||
+ @LN_CP_F@ $(top_srcdir)/sql/sphinx/$$f $$f; \
|
||||
+ done; \
|
||||
rm -f client_settings.h; \
|
||||
@LN_CP_F@ $(top_srcdir)/libmysql/client_settings.h client_settings.h
|
||||
|
||||
|
||||
clean-local:
|
||||
- rm -f `echo $(sqlsources) $(libmysqlsources) $(sqlexamplessources) | sed "s;\.lo;.c;g"` \
|
||||
+ rm -f `echo $(sqlsources) $(libmysqlsources) $(sqlexamplessources) $(sqlsphinxsources) | sed "s;\.lo;.c;g"` \
|
||||
$(top_srcdir)/linked_libmysqld_sources; \
|
||||
rm -f client_settings.h
|
||||
|
||||
--- mysql-5.0.67/sql/handler.cc 2008-08-04 23:20:04.000000000 +1100
|
||||
+++ mysql-5.0.67-sphinx/sql/handler.cc 2009-02-14 09:15:48.000000000 +1000
|
||||
@@ -77,6 +77,15 @@
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
HTON_NO_FLAGS };
|
||||
#endif
|
||||
+#ifdef HAVE_SPHINX_DB
|
||||
+#include "sphinx/ha_sphinx.h"
|
||||
+extern handlerton sphinx_hton;
|
||||
+#else
|
||||
+handlerton sphinx_hton = { "SPHINX", SHOW_OPTION_NO, "SPHINX storage engine",
|
||||
+ DB_TYPE_SPHINX_DB, NULL, 0, 0, NULL, NULL,
|
||||
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
+ HTON_NO_FLAGS };
|
||||
+#endif
|
||||
#ifdef HAVE_INNOBASE_DB
|
||||
#include "ha_innodb.h"
|
||||
extern handlerton innobase_hton;
|
||||
@@ -141,6 +150,7 @@
|
||||
&example_hton,
|
||||
&archive_hton,
|
||||
&tina_hton,
|
||||
+ &sphinx_hton,
|
||||
&ndbcluster_hton,
|
||||
&federated_hton,
|
||||
&myisammrg_hton,
|
||||
@@ -341,6 +351,12 @@
|
||||
return new (alloc) ha_tina(table);
|
||||
return NULL;
|
||||
#endif
|
||||
+#ifdef HAVE_SPHINX_DB
|
||||
+ case DB_TYPE_SPHINX_DB:
|
||||
+ if (have_sphinx_db == SHOW_OPTION_YES)
|
||||
+ return new (alloc) ha_sphinx(table);
|
||||
+ return NULL;
|
||||
+#endif
|
||||
#ifdef HAVE_NDBCLUSTER_DB
|
||||
case DB_TYPE_NDBCLUSTER:
|
||||
if (have_ndbcluster == SHOW_OPTION_YES)
|
||||
--- mysql-5.0.67/sql/handler.h 2008-08-04 23:20:04.000000000 +1100
|
||||
+++ mysql-5.0.67-sphinx/sql/handler.h 2009-02-14 09:15:48.000000000 +1000
|
||||
@@ -186,8 +186,9 @@
|
||||
DB_TYPE_BERKELEY_DB, DB_TYPE_INNODB,
|
||||
DB_TYPE_GEMINI, DB_TYPE_NDBCLUSTER,
|
||||
DB_TYPE_EXAMPLE_DB, DB_TYPE_ARCHIVE_DB, DB_TYPE_CSV_DB,
|
||||
- DB_TYPE_FEDERATED_DB,
|
||||
+ DB_TYPE_FEDERATED_DB,
|
||||
DB_TYPE_BLACKHOLE_DB,
|
||||
+ DB_TYPE_SPHINX_DB,
|
||||
DB_TYPE_DEFAULT // Must be last
|
||||
};
|
||||
|
||||
--- mysql-5.0.67/sql/Makefile.am 2008-08-04 23:20:02.000000000 +1100
|
||||
+++ mysql-5.0.67-sphinx/sql/Makefile.am 2009-02-14 09:23:28.000000000 +1000
|
||||
@@ -68,6 +68,7 @@
|
||||
sql_array.h sql_cursor.h \
|
||||
examples/ha_example.h ha_archive.h \
|
||||
examples/ha_tina.h ha_blackhole.h \
|
||||
+ sphinx/ha_sphinx.h \
|
||||
ha_federated.h
|
||||
mysqld_SOURCES = sql_lex.cc sql_handler.cc \
|
||||
item.cc item_sum.cc item_buff.cc item_func.cc \
|
||||
@@ -105,6 +106,7 @@
|
||||
sp_cache.cc parse_file.cc sql_trigger.cc \
|
||||
examples/ha_example.cc ha_archive.cc \
|
||||
examples/ha_tina.cc ha_blackhole.cc \
|
||||
+ sphinx/ha_sphinx.cc \
|
||||
ha_federated.cc
|
||||
|
||||
gen_lex_hash_SOURCES = gen_lex_hash.cc
|
||||
@@ -174,6 +176,10 @@
|
||||
udf_example_la_SOURCES= udf_example.c
|
||||
udf_example_la_LDFLAGS= -module -rpath $(pkglibdir)
|
||||
|
||||
+pkglib_LTLIBRARIES = sphinx/sphinx.la
|
||||
+sphinx_sphinx_la_SOURCES = sphinx/snippets_udf.cc
|
||||
+sphinx_sphinx_la_LDFLAGS = -module
|
||||
+
|
||||
|
||||
# Don't update the files from bitkeeper
|
||||
%::SCCS/s.%
|
||||
--- mysql-5.0.67/sql/mysqld.cc 2008-08-04 23:20:07.000000000 +1100
|
||||
+++ mysql-5.0.67-sphinx/sql/mysqld.cc 2009-02-14 09:15:48.000000000 +1000
|
||||
@@ -36,6 +36,10 @@
|
||||
#include <sys/prctl.h>
|
||||
#endif
|
||||
|
||||
+#ifdef HAVE_SPHINX_DB
|
||||
+#include "sphinx/ha_sphinx.h"
|
||||
+#endif
|
||||
+
|
||||
#ifdef HAVE_INNOBASE_DB
|
||||
#define OPT_INNODB_DEFAULT 1
|
||||
#else
|
||||
@@ -6633,6 +6637,13 @@
|
||||
{"Threads_running", (char*) &thread_running, SHOW_INT_CONST},
|
||||
{"Uptime", (char*) 0, SHOW_STARTTIME},
|
||||
{"Uptime_since_flush_status",(char*) 0, SHOW_FLUSHTIME},
|
||||
+#ifdef HAVE_SPHINX_DB
|
||||
+ {"sphinx_total", (char *)sphinx_showfunc_total, SHOW_SPHINX_FUNC},
|
||||
+ {"sphinx_total_found", (char *)sphinx_showfunc_total_found, SHOW_SPHINX_FUNC},
|
||||
+ {"sphinx_time", (char *)sphinx_showfunc_time, SHOW_SPHINX_FUNC},
|
||||
+ {"sphinx_word_count", (char *)sphinx_showfunc_word_count, SHOW_SPHINX_FUNC},
|
||||
+ {"sphinx_words", (char *)sphinx_showfunc_words, SHOW_SPHINX_FUNC},
|
||||
+#endif
|
||||
{NullS, NullS, SHOW_LONG}
|
||||
};
|
||||
|
||||
@@ -6875,6 +6886,11 @@
|
||||
#else
|
||||
have_csv_db= SHOW_OPTION_NO;
|
||||
#endif
|
||||
+#ifdef HAVE_SPHINX_DB
|
||||
+ have_sphinx_db= SHOW_OPTION_YES;
|
||||
+#else
|
||||
+ have_sphinx_db= SHOW_OPTION_NO;
|
||||
+#endif
|
||||
#ifdef HAVE_NDBCLUSTER_DB
|
||||
have_ndbcluster=SHOW_OPTION_DISABLED;
|
||||
#else
|
||||
@@ -7983,6 +7999,7 @@
|
||||
#undef have_example_db
|
||||
#undef have_archive_db
|
||||
#undef have_csv_db
|
||||
+#undef have_sphinx_db
|
||||
#undef have_federated_db
|
||||
#undef have_partition_db
|
||||
#undef have_blackhole_db
|
||||
@@ -7993,6 +8010,7 @@
|
||||
SHOW_COMP_OPTION have_example_db= SHOW_OPTION_NO;
|
||||
SHOW_COMP_OPTION have_archive_db= SHOW_OPTION_NO;
|
||||
SHOW_COMP_OPTION have_csv_db= SHOW_OPTION_NO;
|
||||
+SHOW_COMP_OPTION have_sphinx_db= SHOW_OPTION_NO;
|
||||
SHOW_COMP_OPTION have_federated_db= SHOW_OPTION_NO;
|
||||
SHOW_COMP_OPTION have_partition_db= SHOW_OPTION_NO;
|
||||
SHOW_COMP_OPTION have_blackhole_db= SHOW_OPTION_NO;
|
||||
--- mysql-5.0.67/sql/mysql_priv.h 2008-08-04 23:20:07.000000000 +1100
|
||||
+++ mysql-5.0.67-sphinx/sql/mysql_priv.h 2009-02-14 09:15:48.000000000 +1000
|
||||
@@ -1439,6 +1439,12 @@
|
||||
#else
|
||||
extern SHOW_COMP_OPTION have_csv_db;
|
||||
#endif
|
||||
+#ifdef HAVE_SPHINX_DB
|
||||
+extern handlerton sphinx_hton;
|
||||
+#define have_sphinx_db sphinx_hton.state
|
||||
+#else
|
||||
+extern SHOW_COMP_OPTION have_sphinx_db;
|
||||
+#endif
|
||||
#ifdef HAVE_FEDERATED_DB
|
||||
extern handlerton federated_hton;
|
||||
#define have_federated_db federated_hton.state
|
||||
--- mysql-5.0.67/sql/set_var.cc 2008-08-04 23:20:08.000000000 +1100
|
||||
+++ mysql-5.0.67-sphinx/sql/set_var.cc 2009-02-14 09:15:48.000000000 +1000
|
||||
@@ -888,6 +888,7 @@
|
||||
{"have_compress", (char*) &have_compress, SHOW_HAVE},
|
||||
{"have_crypt", (char*) &have_crypt, SHOW_HAVE},
|
||||
{"have_csv", (char*) &have_csv_db, SHOW_HAVE},
|
||||
+ {"have_sphinx", (char*) &have_sphinx_db, SHOW_HAVE},
|
||||
{"have_dynamic_loading", (char*) &have_dlopen, SHOW_HAVE},
|
||||
{"have_example_engine", (char*) &have_example_db, SHOW_HAVE},
|
||||
{"have_federated_engine", (char*) &have_federated_db, SHOW_HAVE},
|
||||
--- mysql-5.0.67/sql/sql_lex.h 2008-08-04 23:20:10.000000000 +1100
|
||||
+++ mysql-5.0.67-sphinx/sql/sql_lex.h 2009-02-14 09:15:48.000000000 +1000
|
||||
@@ -57,6 +57,7 @@
|
||||
SQLCOM_SHOW_DATABASES, SQLCOM_SHOW_TABLES, SQLCOM_SHOW_FIELDS,
|
||||
SQLCOM_SHOW_KEYS, SQLCOM_SHOW_VARIABLES, SQLCOM_SHOW_LOGS, SQLCOM_SHOW_STATUS,
|
||||
SQLCOM_SHOW_INNODB_STATUS, SQLCOM_SHOW_NDBCLUSTER_STATUS, SQLCOM_SHOW_MUTEX_STATUS,
|
||||
+ SQLCOM_SHOW_SPHINX_STATUS,
|
||||
SQLCOM_SHOW_PROCESSLIST, SQLCOM_SHOW_MASTER_STAT, SQLCOM_SHOW_SLAVE_STAT,
|
||||
SQLCOM_SHOW_GRANTS, SQLCOM_SHOW_CREATE, SQLCOM_SHOW_CHARSETS,
|
||||
SQLCOM_SHOW_COLLATIONS, SQLCOM_SHOW_CREATE_DB, SQLCOM_SHOW_TABLE_STATUS,
|
||||
--- mysql-5.0.67/sql/sql_parse.cc 2008-08-04 23:20:10.000000000 +1100
|
||||
+++ mysql-5.0.67-sphinx/sql/sql_parse.cc 2009-02-14 09:15:48.000000000 +1000
|
||||
@@ -24,6 +24,9 @@
|
||||
#ifdef HAVE_INNOBASE_DB
|
||||
#include "ha_innodb.h"
|
||||
#endif
|
||||
+#ifdef HAVE_SPHINX_DB
|
||||
+#include "sphinx/ha_sphinx.h"
|
||||
+#endif
|
||||
|
||||
#ifdef HAVE_NDBCLUSTER_DB
|
||||
#include "ha_ndbcluster.h"
|
||||
@@ -3006,6 +3009,15 @@
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
+#ifdef HAVE_SPHINX_DB
|
||||
+ case SQLCOM_SHOW_SPHINX_STATUS:
|
||||
+ {
|
||||
+ if (check_global_access(thd, SUPER_ACL))
|
||||
+ goto error;
|
||||
+ res = sphinx_show_status(thd);
|
||||
+ break;
|
||||
+ }
|
||||
+#endif
|
||||
#ifdef HAVE_REPLICATION
|
||||
case SQLCOM_LOAD_MASTER_TABLE:
|
||||
{
|
||||
--- mysql-5.0.67/sql/sql_yacc.yy 2008-08-04 23:20:12.000000000 +1100
|
||||
+++ mysql-5.0.67-sphinx/sql/sql_yacc.yy 2009-02-14 09:15:48.000000000 +1000
|
||||
@@ -7393,6 +7393,9 @@
|
||||
case DB_TYPE_INNODB:
|
||||
Lex->sql_command = SQLCOM_SHOW_INNODB_STATUS;
|
||||
break;
|
||||
+ case DB_TYPE_SPHINX_DB:
|
||||
+ Lex->sql_command = SQLCOM_SHOW_SPHINX_STATUS;
|
||||
+ break;
|
||||
default:
|
||||
my_error(ER_NOT_SUPPORTED_YET, MYF(0), "STATUS");
|
||||
MYSQL_YYABORT;
|
||||
--- mysql-5.0.67/sql/structs.h 2008-08-04 23:20:12.000000000 +1100
|
||||
+++ mysql-5.0.67-sphinx/sql/structs.h 2009-02-14 09:15:48.000000000 +1000
|
||||
@@ -188,6 +188,9 @@
|
||||
SHOW_SSL_CTX_SESS_TIMEOUTS, SHOW_SSL_CTX_SESS_CACHE_FULL,
|
||||
SHOW_SSL_GET_CIPHER_LIST,
|
||||
#endif /* HAVE_OPENSSL */
|
||||
+#ifdef HAVE_SPHINX_DB
|
||||
+ SHOW_SPHINX_FUNC,
|
||||
+#endif
|
||||
SHOW_NET_COMPRESSION,
|
||||
SHOW_RPL_STATUS, SHOW_SLAVE_RUNNING, SHOW_SLAVE_RETRIED_TRANS,
|
||||
SHOW_KEY_CACHE_LONG, SHOW_KEY_CACHE_CONST_LONG, SHOW_KEY_CACHE_LONGLONG,
|
||||
--- mysql-5.0.67/sql/sql_show.cc 2008-08-04 23:20:11.000000000 +1100
|
||||
+++ mysql-5.0.67-sphinx/sql/sql_show.cc 2009-02-14 09:15:48.000000000 +1000
|
||||
@@ -1473,6 +1473,16 @@
|
||||
value= (char*) ((sys_var*) value)->value_ptr(thd, value_type,
|
||||
&null_lex_str);
|
||||
}
|
||||
+ #ifdef HAVE_SPHINX_DB
|
||||
+ else if (show_type == SHOW_SPHINX_FUNC)
|
||||
+ {
|
||||
+ SHOW_VAR var;
|
||||
+ ((int (*)(THD *, SHOW_VAR *, char *))value)(thd, &var, buff);
|
||||
+
|
||||
+ value = var.value;
|
||||
+ show_type = var.type;
|
||||
+ }
|
||||
+ #endif /* HAVE_SPHINX_DB */
|
||||
|
||||
pos= end= buff;
|
||||
switch (show_type) {
|
Loading…
Add table
Reference in a new issue