1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-27637 Spider: remove #if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= ${VERSION}

This commit is contained in:
Nayuta Yanagisawa
2022-01-28 00:06:09 +09:00
parent 802e3b616c
commit 06bd93c377
14 changed files with 0 additions and 518 deletions

View File

@@ -48,15 +48,9 @@
#include "spd_ping_table.h" #include "spd_ping_table.h"
#include "spd_malloc.h" #include "spd_malloc.h"
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100002
#define SPIDER_CAN_BG_SEARCH (1LL << 37) #define SPIDER_CAN_BG_SEARCH (1LL << 37)
#define SPIDER_CAN_BG_INSERT (1LL << 38) #define SPIDER_CAN_BG_INSERT (1LL << 38)
#define SPIDER_CAN_BG_UPDATE (1LL << 39) #define SPIDER_CAN_BG_UPDATE (1LL << 39)
#else
#define SPIDER_CAN_BG_SEARCH (LL(1) << 37)
#define SPIDER_CAN_BG_INSERT (LL(1) << 38)
#define SPIDER_CAN_BG_UPDATE (LL(1) << 39)
#endif
extern handlerton *spider_hton_ptr; extern handlerton *spider_hton_ptr;
extern SPIDER_DBTON spider_dbton[SPIDER_DBTON_SIZE]; extern SPIDER_DBTON spider_dbton[SPIDER_DBTON_SIZE];
@@ -3853,7 +3847,6 @@ bool ha_spider::check_no_where_cond()
} }
#ifdef HA_MRR_USE_DEFAULT_IMPL #ifdef HA_MRR_USE_DEFAULT_IMPL
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
ha_rows ha_spider::multi_range_read_info_const( ha_rows ha_spider::multi_range_read_info_const(
uint keyno, uint keyno,
RANGE_SEQ_IF *seq, RANGE_SEQ_IF *seq,
@@ -3863,17 +3856,6 @@ ha_rows ha_spider::multi_range_read_info_const(
uint *flags, uint *flags,
Cost_estimate *cost Cost_estimate *cost
) )
#else
ha_rows ha_spider::multi_range_read_info_const(
uint keyno,
RANGE_SEQ_IF *seq,
void *seq_init_param,
uint n_ranges,
uint *bufsz,
uint *flags,
COST_VECT *cost
)
#endif
{ {
DBUG_ENTER("ha_spider::multi_range_read_info_const"); DBUG_ENTER("ha_spider::multi_range_read_info_const");
DBUG_PRINT("info",("spider this=%p", this)); DBUG_PRINT("info",("spider this=%p", this));
@@ -3918,7 +3900,6 @@ ha_rows ha_spider::multi_range_read_info_const(
DBUG_RETURN(rows); DBUG_RETURN(rows);
} }
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
ha_rows ha_spider::multi_range_read_info( ha_rows ha_spider::multi_range_read_info(
uint keyno, uint keyno,
uint n_ranges, uint n_ranges,
@@ -3928,17 +3909,6 @@ ha_rows ha_spider::multi_range_read_info(
uint *flags, uint *flags,
Cost_estimate *cost Cost_estimate *cost
) )
#else
ha_rows ha_spider::multi_range_read_info(
uint keyno,
uint n_ranges,
uint keys,
uint key_parts,
uint *bufsz,
uint *flags,
COST_VECT *cost
)
#endif
{ {
DBUG_ENTER("ha_spider::multi_range_read_info"); DBUG_ENTER("ha_spider::multi_range_read_info");
DBUG_PRINT("info",("spider this=%p", this)); DBUG_PRINT("info",("spider this=%p", this));
@@ -4011,16 +3981,10 @@ int ha_spider::multi_range_read_init(
#endif #endif
#ifdef HA_MRR_USE_DEFAULT_IMPL #ifdef HA_MRR_USE_DEFAULT_IMPL
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
int ha_spider::multi_range_read_next_first( int ha_spider::multi_range_read_next_first(
range_id_t *range_info range_id_t *range_info
) )
#else #else
int ha_spider::multi_range_read_next_first(
char **range_info
)
#endif
#else
int ha_spider::read_multi_range_first_internal( int ha_spider::read_multi_range_first_internal(
uchar *buf, uchar *buf,
KEY_MULTI_RANGE **found_range_p, KEY_MULTI_RANGE **found_range_p,
@@ -4503,19 +4467,11 @@ int ha_spider::read_multi_range_first_internal(
DBUG_PRINT("info",("spider free multi_range_keys=%p", multi_range_keys)); DBUG_PRINT("info",("spider free multi_range_keys=%p", multi_range_keys));
spider_free(spider_current_trx, multi_range_keys, MYF(0)); spider_free(spider_current_trx, multi_range_keys, MYF(0));
} }
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
if (!(multi_range_keys = (range_id_t *) if (!(multi_range_keys = (range_id_t *)
spider_malloc(spider_current_trx, 1, sizeof(range_id_t) * spider_malloc(spider_current_trx, 1, sizeof(range_id_t) *
(multi_range_num < result_list.multi_split_read ? (multi_range_num < result_list.multi_split_read ?
multi_range_num : result_list.multi_split_read), MYF(MY_WME))) multi_range_num : result_list.multi_split_read), MYF(MY_WME)))
) )
#else
if (!(multi_range_keys = (char **)
spider_malloc(spider_current_trx, 1, sizeof(char *) *
(multi_range_num < result_list.multi_split_read ?
multi_range_num : result_list.multi_split_read), MYF(MY_WME)))
)
#endif
DBUG_RETURN(HA_ERR_OUT_OF_MEM); DBUG_RETURN(HA_ERR_OUT_OF_MEM);
DBUG_PRINT("info",("spider alloc multi_range_keys=%p", multi_range_keys)); DBUG_PRINT("info",("spider alloc multi_range_keys=%p", multi_range_keys));
if (!mrr_key_buff) if (!mrr_key_buff)
@@ -4730,11 +4686,7 @@ int ha_spider::read_multi_range_first_internal(
} }
#ifdef HA_MRR_USE_DEFAULT_IMPL #ifdef HA_MRR_USE_DEFAULT_IMPL
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
multi_range_keys[multi_range_cnt] = mrr_cur_range.ptr; multi_range_keys[multi_range_cnt] = mrr_cur_range.ptr;
#else
multi_range_keys[multi_range_cnt] = (char *) mrr_cur_range.ptr;
#endif
#endif #endif
if (bka_mode == 2) if (bka_mode == 2)
{ {
@@ -4857,11 +4809,7 @@ int ha_spider::read_multi_range_first_internal(
{ {
#ifdef HA_MRR_USE_DEFAULT_IMPL #ifdef HA_MRR_USE_DEFAULT_IMPL
DBUG_PRINT("info",("spider range_res7=%d", range_res)); DBUG_PRINT("info",("spider range_res7=%d", range_res));
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
multi_range_keys[multi_range_cnt] = mrr_cur_range.ptr; multi_range_keys[multi_range_cnt] = mrr_cur_range.ptr;
#else
multi_range_keys[multi_range_cnt] = (char *) mrr_cur_range.ptr;
#endif
#endif #endif
if ((error_num = spider_db_append_select(this))) if ((error_num = spider_db_append_select(this)))
DBUG_RETURN(error_num); DBUG_RETURN(error_num);
@@ -5402,15 +5350,9 @@ int ha_spider::pre_multi_range_read_next(
DBUG_RETURN(0); DBUG_RETURN(0);
} }
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
int ha_spider::multi_range_read_next( int ha_spider::multi_range_read_next(
range_id_t *range_info range_id_t *range_info
) )
#else
int ha_spider::multi_range_read_next(
char **range_info
)
#endif
{ {
int error_num; int error_num;
DBUG_ENTER("ha_spider::multi_range_read_next"); DBUG_ENTER("ha_spider::multi_range_read_next");
@@ -5488,16 +5430,10 @@ int ha_spider::read_multi_range_first(
#endif #endif
#ifdef HA_MRR_USE_DEFAULT_IMPL #ifdef HA_MRR_USE_DEFAULT_IMPL
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
int ha_spider::multi_range_read_next_next( int ha_spider::multi_range_read_next_next(
range_id_t *range_info range_id_t *range_info
) )
#else #else
int ha_spider::multi_range_read_next_next(
char **range_info
)
#endif
#else
int ha_spider::read_multi_range_next( int ha_spider::read_multi_range_next(
KEY_MULTI_RANGE **found_range_p KEY_MULTI_RANGE **found_range_p
) )
@@ -6207,11 +6143,7 @@ int ha_spider::read_multi_range_next(
} }
#ifdef HA_MRR_USE_DEFAULT_IMPL #ifdef HA_MRR_USE_DEFAULT_IMPL
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
multi_range_keys[multi_range_cnt] = mrr_cur_range.ptr; multi_range_keys[multi_range_cnt] = mrr_cur_range.ptr;
#else
multi_range_keys[multi_range_cnt] = (char *) mrr_cur_range.ptr;
#endif
#endif #endif
if (bka_mode == 2) if (bka_mode == 2)
{ {
@@ -6332,11 +6264,7 @@ int ha_spider::read_multi_range_next(
#endif #endif
{ {
#ifdef HA_MRR_USE_DEFAULT_IMPL #ifdef HA_MRR_USE_DEFAULT_IMPL
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
multi_range_keys[multi_range_cnt] = mrr_cur_range.ptr; multi_range_keys[multi_range_cnt] = mrr_cur_range.ptr;
#else
multi_range_keys[multi_range_cnt] = (char *) mrr_cur_range.ptr;
#endif
#endif #endif
if ((error_num = spider_db_append_select(this))) if ((error_num = spider_db_append_select(this)))
DBUG_RETURN(error_num); DBUG_RETURN(error_num);
@@ -9468,11 +9396,6 @@ int ha_spider::write_row(
} }
#ifndef SPIDER_WITHOUT_HA_STATISTIC_INCREMENT #ifndef SPIDER_WITHOUT_HA_STATISTIC_INCREMENT
ha_statistic_increment(&SSV::ha_write_count); ha_statistic_increment(&SSV::ha_write_count);
#endif
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
#else
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT)
table->timestamp_field->set_time();
#endif #endif
if (!bulk_insert) if (!bulk_insert)
store_last_insert_id = 0; store_last_insert_id = 0;
@@ -9705,11 +9628,6 @@ int ha_spider::update_row(
#endif #endif
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS #ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
do_direct_update = FALSE; do_direct_update = FALSE;
#endif
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
#else
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
table->timestamp_field->set_time();
#endif #endif
if ((error_num = spider_db_update(this, table, old_data))) if ((error_num = spider_db_update(this, table, old_data)))
DBUG_RETURN(check_error_mode(error_num)); DBUG_RETURN(check_error_mode(error_num));
@@ -14805,13 +14723,8 @@ int ha_spider::bulk_tmp_table_rnd_next()
if (tmp_table[roop_count]) if (tmp_table[roop_count])
{ {
if ( if (
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 50200
!(error_num = tmp_table[roop_count]->file->ha_rnd_next( !(error_num = tmp_table[roop_count]->file->ha_rnd_next(
tmp_table[roop_count]->record[0])) tmp_table[roop_count]->record[0]))
#else
!(error_num = tmp_table[roop_count]->file->rnd_next(
tmp_table[roop_count]->record[0]))
#endif
) { ) {
DBUG_RETURN(error_num); DBUG_RETURN(error_num);
} }

View File

@@ -128,11 +128,7 @@ public:
bool have_second_range; bool have_second_range;
KEY_MULTI_RANGE mrr_second_range; KEY_MULTI_RANGE mrr_second_range;
spider_string *mrr_key_buff; spider_string *mrr_key_buff;
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
range_id_t *multi_range_keys; range_id_t *multi_range_keys;
#else
char **multi_range_keys;
#endif
#else #else
KEY_MULTI_RANGE *multi_range_ranges; KEY_MULTI_RANGE *multi_range_ranges;
#endif #endif
@@ -301,7 +297,6 @@ public:
void reset_no_where_cond(); void reset_no_where_cond();
bool check_no_where_cond(); bool check_no_where_cond();
#ifdef HA_MRR_USE_DEFAULT_IMPL #ifdef HA_MRR_USE_DEFAULT_IMPL
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
ha_rows multi_range_read_info_const( ha_rows multi_range_read_info_const(
uint keyno, uint keyno,
RANGE_SEQ_IF *seq, RANGE_SEQ_IF *seq,
@@ -320,26 +315,6 @@ public:
uint *flags, uint *flags,
Cost_estimate *cost Cost_estimate *cost
); );
#else
ha_rows multi_range_read_info_const(
uint keyno,
RANGE_SEQ_IF *seq,
void *seq_init_param,
uint n_ranges,
uint *bufsz,
uint *flags,
COST_VECT *cost
);
ha_rows multi_range_read_info(
uint keyno,
uint n_ranges,
uint keys,
uint key_parts,
uint *bufsz,
uint *flags,
COST_VECT *cost
);
#endif
int multi_range_read_init( int multi_range_read_init(
RANGE_SEQ_IF *seq, RANGE_SEQ_IF *seq,
void *seq_init_param, void *seq_init_param,
@@ -347,7 +322,6 @@ public:
uint mode, uint mode,
HANDLER_BUFFER *buf HANDLER_BUFFER *buf
); );
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
int multi_range_read_next( int multi_range_read_next(
range_id_t *range_info range_id_t *range_info
); );
@@ -357,17 +331,6 @@ public:
int multi_range_read_next_next( int multi_range_read_next_next(
range_id_t *range_info range_id_t *range_info
); );
#else
int multi_range_read_next(
char **range_info
);
int multi_range_read_next_first(
char **range_info
);
int multi_range_read_next_next(
char **range_info
);
#endif
#else #else
int read_multi_range_first( int read_multi_range_first(
KEY_MULTI_RANGE **found_range_p, KEY_MULTI_RANGE **found_range_p,

View File

@@ -4081,17 +4081,9 @@ int spider_conn_first_link_idx(
my_afree(link_idxs); my_afree(link_idxs);
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100002
DBUG_PRINT("info",("spider server_id=%lu", thd->variables.server_id)); DBUG_PRINT("info",("spider server_id=%lu", thd->variables.server_id));
#else
DBUG_PRINT("info",("spider server_id=%u", thd->server_id));
#endif
DBUG_PRINT("info",("spider thread_id=%lu", thd_get_thread_id(thd))); DBUG_PRINT("info",("spider thread_id=%lu", thd_get_thread_id(thd)));
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100002
rand_val = spider_rand(thd->variables.server_id + thd_get_thread_id(thd)); rand_val = spider_rand(thd->variables.server_id + thd_get_thread_id(thd));
#else
rand_val = spider_rand(thd->server_id + thd_get_thread_id(thd));
#endif
DBUG_PRINT("info",("spider rand_val=%f", rand_val)); DBUG_PRINT("info",("spider rand_val=%f", rand_val));
balance_val = (longlong) (rand_val * balance_total); balance_val = (longlong) (rand_val * balance_total);
DBUG_PRINT("info",("spider balance_val=%lld", balance_val)); DBUG_PRINT("info",("spider balance_val=%lld", balance_val));

View File

@@ -1837,10 +1837,8 @@ int spider_db_append_key_where_internal(
DBUG_PRINT("info", ("spider start_key->flag=%d", start_key->flag)); DBUG_PRINT("info", ("spider start_key->flag=%d", start_key->flag));
switch (start_key->flag) switch (start_key->flag)
{ {
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
case HA_READ_PREFIX_LAST: case HA_READ_PREFIX_LAST:
result_list->desc_flg = TRUE; result_list->desc_flg = TRUE;
#endif
/* fall through */ /* fall through */
case HA_READ_KEY_EXACT: case HA_READ_KEY_EXACT:
if (sql_kind == SPIDER_SQL_KIND_SQL) if (sql_kind == SPIDER_SQL_KIND_SQL)
@@ -2041,12 +2039,6 @@ int spider_db_append_key_where_internal(
} }
} }
break; break;
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
#else
case HA_READ_PREFIX_LAST:
result_list->limit_num = 1;
/* fall through */
#endif
case HA_READ_KEY_OR_PREV: case HA_READ_KEY_OR_PREV:
case HA_READ_PREFIX_LAST_OR_PREV: case HA_READ_PREFIX_LAST_OR_PREV:
result_list->desc_flg = TRUE; result_list->desc_flg = TRUE;
@@ -2876,13 +2868,8 @@ int spider_db_get_row_from_tmp_tbl(
current->result_tmp_tbl_inited = 1; current->result_tmp_tbl_inited = 1;
} }
if ( if (
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 50200
(error_num = current->result_tmp_tbl->file->ha_rnd_next( (error_num = current->result_tmp_tbl->file->ha_rnd_next(
current->result_tmp_tbl->record[0])) current->result_tmp_tbl->record[0]))
#else
(error_num = current->result_tmp_tbl->file->rnd_next(
current->result_tmp_tbl->record[0]))
#endif
) { ) {
DBUG_RETURN(error_num); DBUG_RETURN(error_num);
} }
@@ -2910,13 +2897,8 @@ int spider_db_get_row_from_tmp_tbl_pos(
result->result_tmp_tbl_inited = 2; result->result_tmp_tbl_inited = 2;
} }
if ( if (
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 50200
(error_num = tmp_tbl->file->ha_rnd_pos(tmp_tbl->record[0], (error_num = tmp_tbl->file->ha_rnd_pos(tmp_tbl->record[0],
(uchar *) &pos->tmp_tbl_pos)) (uchar *) &pos->tmp_tbl_pos))
#else
(error_num = tmp_tbl->file->rnd_pos(tmp_tbl->record[0],
(uchar *) &pos->tmp_tbl_pos))
#endif
) { ) {
DBUG_RETURN(error_num); DBUG_RETURN(error_num);
} }
@@ -6911,9 +6893,7 @@ int spider_db_update(
) { ) {
conn = spider->conns[roop_count]; conn = spider->conns[roop_count];
spider_db_handler *dbton_hdl = spider->dbton_handler[conn->dbton_id]; spider_db_handler *dbton_hdl = spider->dbton_handler[conn->dbton_id];
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
conn->ignore_dup_key = spider->wide_handler->ignore_dup_key; conn->ignore_dup_key = spider->wide_handler->ignore_dup_key;
#endif
pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
if (dbton_hdl->need_lock_before_set_sql_for_exec( if (dbton_hdl->need_lock_before_set_sql_for_exec(
SPIDER_SQL_TYPE_UPDATE_SQL)) SPIDER_SQL_TYPE_UPDATE_SQL))

View File

@@ -28,56 +28,22 @@
#define SPIDER_DB_WRAPPER_MYSQL "mysql" #define SPIDER_DB_WRAPPER_MYSQL "mysql"
#define SPIDER_DB_WRAPPER_MARIADB "mariadb" #define SPIDER_DB_WRAPPER_MARIADB "mariadb"
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100204
#define PLUGIN_VAR_CAN_MEMALLOC #define PLUGIN_VAR_CAN_MEMALLOC
/*
#define ITEM_FUNC_CASE_PARAMS_ARE_PUBLIC
#define HASH_UPDATE_WITH_HASH_VALUE
*/
#else
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
#define HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
#endif
#endif
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100002
#define SPIDER_HAS_DISCOVER_TABLE_STRUCTURE #define SPIDER_HAS_DISCOVER_TABLE_STRUCTURE
#define SPIDER_HAS_APPEND_FOR_SINGLE_QUOTE #define SPIDER_HAS_APPEND_FOR_SINGLE_QUOTE
#define SPIDER_HAS_SHOW_SIMPLE_FUNC #define SPIDER_HAS_SHOW_SIMPLE_FUNC
#define SPIDER_HAS_JT_HASH_INDEX_MERGE #define SPIDER_HAS_JT_HASH_INDEX_MERGE
#define SPIDER_HAS_EXPR_CACHE_ITEM #define SPIDER_HAS_EXPR_CACHE_ITEM
#else
#define SPIDER_NEED_CHECK_CONDITION_AT_CHECKING_DIRECT_ORDER_LIMIT
#endif
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100007
#define SPIDER_ITEM_HAS_CMP_TYPE #define SPIDER_ITEM_HAS_CMP_TYPE
#endif
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100004
#define SPIDER_HAS_TIME_STATUS #define SPIDER_HAS_TIME_STATUS
#define SPIDER_HAS_DECIMAL_OPERATION_RESULTS_VALUE_TYPE #define SPIDER_HAS_DECIMAL_OPERATION_RESULTS_VALUE_TYPE
#endif
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100014
#define SPIDER_ITEM_STRING_WITHOUT_SET_STR_WITH_COPY #define SPIDER_ITEM_STRING_WITHOUT_SET_STR_WITH_COPY
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100100
#define SPIDER_ITEM_STRING_WITHOUT_SET_STR_WITH_COPY_AND_THDPTR #define SPIDER_ITEM_STRING_WITHOUT_SET_STR_WITH_COPY_AND_THDPTR
#endif
#endif
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100108
#define SPIDER_HAS_GROUP_BY_HANDLER #define SPIDER_HAS_GROUP_BY_HANDLER
#endif
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100200
#define SPIDER_ORDER_HAS_ENUM_ORDER #define SPIDER_ORDER_HAS_ENUM_ORDER
#endif
#if defined(MARIADB_BASE_VERSION)
#define SPIDER_ITEM_GEOFUNC_NAME_HAS_MBR #define SPIDER_ITEM_GEOFUNC_NAME_HAS_MBR
#define SPIDER_HANDLER_AUTO_REPAIR_HAS_ERROR #define SPIDER_HANDLER_AUTO_REPAIR_HAS_ERROR
#endif
class spider_db_conn; class spider_db_conn;
typedef spider_db_conn SPIDER_DB_CONN; typedef spider_db_conn SPIDER_DB_CONN;

View File

@@ -13670,11 +13670,7 @@ int spider_mbase_handler::bulk_tmp_table_rnd_next()
int error_num; int error_num;
DBUG_ENTER("spider_mbase_handler::bulk_tmp_table_rnd_next"); DBUG_ENTER("spider_mbase_handler::bulk_tmp_table_rnd_next");
DBUG_PRINT("info",("spider this=%p", this)); DBUG_PRINT("info",("spider this=%p", this));
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 50200
error_num = upd_tmp_tbl->file->ha_rnd_next(upd_tmp_tbl->record[0]); error_num = upd_tmp_tbl->file->ha_rnd_next(upd_tmp_tbl->record[0]);
#else
error_num = upd_tmp_tbl->file->rnd_next(upd_tmp_tbl->record[0]);
#endif
if (!error_num) if (!error_num)
{ {
error_num = restore_sql_from_bulk_tmp_table(&insert_sql, upd_tmp_tbl); error_num = restore_sql_from_bulk_tmp_table(&insert_sql, upd_tmp_tbl);

View File

@@ -44,9 +44,7 @@
#include "spd_udf.h" #include "spd_udf.h"
#include "spd_malloc.h" #include "spd_malloc.h"
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100004
#define SPIDER_NEED_INIT_ONE_TABLE_FOR_FIND_TEMPORARY_TABLE #define SPIDER_NEED_INIT_ONE_TABLE_FOR_FIND_TEMPORARY_TABLE
#endif
extern const char **spd_defaults_extra_file; extern const char **spd_defaults_extra_file;
extern const char **spd_defaults_file; extern const char **spd_defaults_file;

View File

@@ -20,16 +20,9 @@
#ifndef SPD_ENVIRON_INCLUDED #ifndef SPD_ENVIRON_INCLUDED
#if (defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000)
#define SPIDER_HANDLER_START_BULK_INSERT_HAS_FLAGS #define SPIDER_HANDLER_START_BULK_INSERT_HAS_FLAGS
#endif
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100100
#define SPIDER_SUPPORT_CREATE_OR_REPLACE_TABLE #define SPIDER_SUPPORT_CREATE_OR_REPLACE_TABLE
#define SPIDER_NET_HAS_THD #define SPIDER_NET_HAS_THD
#endif
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100211
#define HANDLER_HAS_TOP_TABLE_FIELDS #define HANDLER_HAS_TOP_TABLE_FIELDS
#define HANDLER_HAS_DIRECT_UPDATE_ROWS #define HANDLER_HAS_DIRECT_UPDATE_ROWS
#define HANDLER_HAS_DIRECT_AGGREGATE #define HANDLER_HAS_DIRECT_AGGREGATE
@@ -38,24 +31,11 @@
#define HA_EXTRA_HAS_STARTING_ORDERED_INDEX_SCAN #define HA_EXTRA_HAS_STARTING_ORDERED_INDEX_SCAN
#define HANDLER_HAS_NEED_INFO_FOR_AUTO_INC #define HANDLER_HAS_NEED_INFO_FOR_AUTO_INC
#define HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT #define HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT
#endif
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100300
#define SPIDER_UPDATE_ROW_HAS_CONST_NEW_DATA #define SPIDER_UPDATE_ROW_HAS_CONST_NEW_DATA
#endif
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100309
#define SPIDER_MDEV_16246 #define SPIDER_MDEV_16246
#endif
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100400
#define SPIDER_USE_CONST_ITEM_FOR_STRING_INT_REAL_DECIMAL_DATE_ITEM #define SPIDER_USE_CONST_ITEM_FOR_STRING_INT_REAL_DECIMAL_DATE_ITEM
#define SPIDER_SQL_CACHE_IS_IN_LEX #define SPIDER_SQL_CACHE_IS_IN_LEX
#define SPIDER_LIKE_FUNC_HAS_GET_NEGATED #define SPIDER_LIKE_FUNC_HAS_GET_NEGATED
#define HA_HAS_CHECKSUM_EXTENDED #define HA_HAS_CHECKSUM_EXTENDED
#endif
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100500
#define SPIDER_I_S_USE_SHOW_FOR_COLUMN #define SPIDER_I_S_USE_SHOW_FOR_COLUMN
#endif
#endif /* SPD_ENVIRON_INCLUDED */ #endif /* SPD_ENVIRON_INCLUDED */

View File

@@ -72,8 +72,6 @@
#define my_sprintf(A,B) sprintf B #define my_sprintf(A,B) sprintf B
#endif #endif
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100004
#define spider_stmt_da_message(A) thd_get_error_message(A) #define spider_stmt_da_message(A) thd_get_error_message(A)
#define spider_stmt_da_sql_errno(A) thd_get_error_number(A) #define spider_stmt_da_sql_errno(A) thd_get_error_number(A)
#define spider_user_defined_key_parts(A) (A)->user_defined_key_parts #define spider_user_defined_key_parts(A) (A)->user_defined_key_parts
@@ -97,76 +95,27 @@
#define SPIDER_WARN_LEVEL_WARN Sql_condition::WARN_LEVEL_WARN #define SPIDER_WARN_LEVEL_WARN Sql_condition::WARN_LEVEL_WARN
#define SPIDER_WARN_LEVEL_NOTE Sql_condition::WARN_LEVEL_NOTE #define SPIDER_WARN_LEVEL_NOTE Sql_condition::WARN_LEVEL_NOTE
#define SPIDER_THD_KILL_CONNECTION KILL_CONNECTION #define SPIDER_THD_KILL_CONNECTION KILL_CONNECTION
#else
#if MYSQL_VERSION_ID < 50500
#define spider_stmt_da_message(A) (A)->main_da.message()
#define spider_stmt_da_sql_errno(A) (A)->main_da.sql_errno()
#else
#if MYSQL_VERSION_ID < 50600
#define spider_stmt_da_message(A) (A)->stmt_da->message()
#define spider_stmt_da_sql_errno(A) (A)->stmt_da->sql_errno()
#else
#define spider_stmt_da_message(A) (A)->get_stmt_da()->message()
#define spider_stmt_da_sql_errno(A) (A)->get_stmt_da()->sql_errno()
#endif
#endif
#define spider_user_defined_key_parts(A) (A)->key_parts
#define spider_join_table_count(A) (A)->tables
#define SPIDER_ALTER_PARTITION_ADD ALTER_ADD_PARTITION
#define SPIDER_ALTER_PARTITION_DROP ALTER_DROP_PARTITION
#define SPIDER_ALTER_PARTITION_COALESCE ALTER_COALESCE_PARTITION
#define SPIDER_ALTER_PARTITION_REORGANIZE ALTER_REORGANIZE_PARTITION
#define SPIDER_ALTER_PARTITION_TABLE_REORG ALTER_TABLE_REORG
#define SPIDER_ALTER_PARTITION_REBUILD ALTER_REBUILD_PARTITION
#define SPIDER_WARN_LEVEL_WARN MYSQL_ERROR::WARN_LEVEL_WARN
#define SPIDER_WARN_LEVEL_NOTE MYSQL_ERROR::WARN_LEVEL_NOTE
#define SPIDER_THD_KILL_CONNECTION THD::KILL_CONNECTION
#endif
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100005
#define SPIDER_HAS_EXPLAIN_QUERY #define SPIDER_HAS_EXPLAIN_QUERY
#endif
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100009
#define SPIDER_TEST(A) MY_TEST(A) #define SPIDER_TEST(A) MY_TEST(A)
#else
#define SPIDER_TEST(A) test(A)
#endif
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100100
#define SPIDER_FIELD_FIELDPTR_REQUIRES_THDPTR #define SPIDER_FIELD_FIELDPTR_REQUIRES_THDPTR
#define SPIDER_ENGINE_CONDITION_PUSHDOWN_IS_ALWAYS_ON #define SPIDER_ENGINE_CONDITION_PUSHDOWN_IS_ALWAYS_ON
#define SPIDER_XID_USES_xid_cache_iterate #define SPIDER_XID_USES_xid_cache_iterate
#else
#define SPIDER_XID_STATE_HAS_in_thd
#endif
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100108
#define SPIDER_Item_args_arg_count_IS_PROTECTED #define SPIDER_Item_args_arg_count_IS_PROTECTED
#endif
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100112
#define SPIDER_Item_func_conv_charset_conv_charset collation.collation #define SPIDER_Item_func_conv_charset_conv_charset collation.collation
#else
#define SPIDER_Item_func_conv_charset_conv_charset conv_charset
#endif
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100200
#define SPIDER_WITHOUT_HA_STATISTIC_INCREMENT #define SPIDER_WITHOUT_HA_STATISTIC_INCREMENT
#define SPIDER_init_read_record(A,B,C,D,E,F,G,H) init_read_record(A,B,C,D,E,F,G,H) #define SPIDER_init_read_record(A,B,C,D,E,F,G,H) init_read_record(A,B,C,D,E,F,G,H)
#define SPIDER_HAS_NEXT_THREAD_ID #define SPIDER_HAS_NEXT_THREAD_ID
#define SPIDER_new_THD(A) (new THD(A)) #define SPIDER_new_THD(A) (new THD(A))
#define SPIDER_order_direction_is_asc(A) (A->direction == ORDER::ORDER_ASC) #define SPIDER_order_direction_is_asc(A) (A->direction == ORDER::ORDER_ASC)
#else
#define SPIDER_init_read_record(A,B,C,D,E,F,G,H) init_read_record(A,B,C,D,F,G,H)
#define SPIDER_new_THD(A) (new THD())
#define SPIDER_order_direction_is_asc(A) (A->asc)
#endif
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100201
#define SPIDER_HAS_MY_CHARLEN #define SPIDER_HAS_MY_CHARLEN
#define SPIDER_open_temporary_table #define SPIDER_open_temporary_table
#endif
#if defined(MARIADB_BASE_VERSION) #if defined(MARIADB_BASE_VERSION)
#if MYSQL_VERSION_ID >= 100209 #if MYSQL_VERSION_ID >= 100209
@@ -182,17 +131,10 @@
#define SPIDER_generate_partition_syntax(A,B,C,D,E,F,G,H) #define SPIDER_generate_partition_syntax(A,B,C,D,E,F,G,H)
#endif #endif
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100209
#define SPIDER_create_partition_name(A,B,C,D,E,F) create_partition_name(A,B,C,D,E,F) #define SPIDER_create_partition_name(A,B,C,D,E,F) create_partition_name(A,B,C,D,E,F)
#define SPIDER_create_subpartition_name(A,B,C,D,E,F) create_subpartition_name(A,B,C,D,E,F) #define SPIDER_create_subpartition_name(A,B,C,D,E,F) create_subpartition_name(A,B,C,D,E,F)
#define SPIDER_free_part_syntax(A,B) #define SPIDER_free_part_syntax(A,B)
#else
#define SPIDER_create_partition_name(A,B,C,D,E,F) create_partition_name(A,C,D,E,F)
#define SPIDER_create_subpartition_name(A,B,C,D,E,F) create_subpartition_name(A,C,D,E,F)
#define SPIDER_free_part_syntax(A,B) spider_my_free(A,B)
#endif
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100306
#define SPIDER_read_record_read_record(A) read_record() #define SPIDER_read_record_read_record(A) read_record()
#define SPIDER_has_Item_with_subquery #define SPIDER_has_Item_with_subquery
#define SPIDER_use_LEX_CSTRING_for_KEY_Field_name #define SPIDER_use_LEX_CSTRING_for_KEY_Field_name
@@ -211,46 +153,17 @@
#define SPIDER_item_name_str(A) (A)->name.str #define SPIDER_item_name_str(A) (A)->name.str
#define SPIDER_item_name_length(A) (A)->name.length #define SPIDER_item_name_length(A) (A)->name.length
const LEX_CSTRING SPIDER_empty_string = {"", 0}; const LEX_CSTRING SPIDER_empty_string = {"", 0};
#else
#define SPIDER_read_record_read_record(A) read_record(A)
#define SPIDER_THD_db_str(A) (A)->db
#define SPIDER_THD_db_length(A) (A)->db_length
#define SPIDER_TABLE_LIST_db_str(A) (A)->db
#define SPIDER_TABLE_LIST_db_length(A) (A)->db_length
#define SPIDER_TABLE_LIST_table_name_str(A) (A)->table_name
#define SPIDER_TABLE_LIST_table_name_length(A) (A)->table_name_length
#define SPIDER_TABLE_LIST_alias_str(A) (A)->alias
#define SPIDER_TABLE_LIST_alias_length(A) strlen((A)->alias)
#define SPIDER_field_name_str(A) (A)->field_name
#define SPIDER_field_name_length(A) strlen((A)->field_name)
#define SPIDER_item_name_str(A) (A)->name
#define SPIDER_item_name_length(A) strlen((A)->name)
const char SPIDER_empty_string = "";
#endif
#if MYSQL_VERSION_ID >= 50500 #if MYSQL_VERSION_ID >= 50500
#define SPIDER_HAS_HASH_VALUE_TYPE #define SPIDER_HAS_HASH_VALUE_TYPE
#endif #endif
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100400
#define SPIDER_date_mode_t(A) date_mode_t(A) #define SPIDER_date_mode_t(A) date_mode_t(A)
#define SPIDER_str_to_datetime(A,B,C,D,E) str_to_datetime_or_date(A,B,C,D,E) #define SPIDER_str_to_datetime(A,B,C,D,E) str_to_datetime_or_date(A,B,C,D,E)
#define SPIDER_get_linkage(A) A->get_linkage() #define SPIDER_get_linkage(A) A->get_linkage()
#else
#define SPIDER_date_mode_t(A) A
#define SPIDER_str_to_datetime(A,B,C,D,E) str_to_datetime(A,B,C,D,E)
#define SPIDER_get_linkage(A) A->linkage
#endif
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100500
typedef start_new_trans *SPIDER_Open_tables_backup; typedef start_new_trans *SPIDER_Open_tables_backup;
#elif MYSQL_VERSION_ID < 50500
typedef Open_tables_state SPIDER_Open_tables_backup;
#else
typedef Open_tables_backup SPIDER_Open_tables_backup;
#endif
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100500
#define SPIDER_reset_n_backup_open_tables_state(A,B,C) do { \ #define SPIDER_reset_n_backup_open_tables_state(A,B,C) do { \
if (!(*(B) = new start_new_trans(A))) \ if (!(*(B) = new start_new_trans(A))) \
{ \ { \
@@ -262,12 +175,6 @@ typedef Open_tables_backup SPIDER_Open_tables_backup;
delete *(B); \ delete *(B); \
} while (0) } while (0)
#define SPIDER_sys_close_thread_tables(A) (A)->commit_whole_transaction_and_close_tables() #define SPIDER_sys_close_thread_tables(A) (A)->commit_whole_transaction_and_close_tables()
#else
#define SPIDER_REQUIRE_DEFINE_FOR_SECONDARY_OPEN_TABLES_BACKUP
#define SPIDER_reset_n_backup_open_tables_state(A,B,C) (A)->reset_n_backup_open_tables_state(B)
#define SPIDER_restore_backup_open_tables_state(A,B) (A)->restore_backup_open_tables_state(B)
#define SPIDER_sys_close_thread_tables(A) close_thread_tables(A)
#endif
#define spider_bitmap_size(A) ((A + 7) / 8) #define spider_bitmap_size(A) ((A + 7) / 8)
#define spider_set_bit(BITMAP, BIT) \ #define spider_set_bit(BITMAP, BIT) \

View File

@@ -2074,7 +2074,6 @@ int spider_param_udf_ds_table_loop_mode(
static char *spider_remote_access_charset; static char *spider_remote_access_charset;
/* /*
*/ */
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
static MYSQL_SYSVAR_STR( static MYSQL_SYSVAR_STR(
remote_access_charset, remote_access_charset,
spider_remote_access_charset, spider_remote_access_charset,
@@ -2085,30 +2084,6 @@ static MYSQL_SYSVAR_STR(
NULL, NULL,
NULL NULL
); );
#else
#ifdef PLUGIN_VAR_CAN_MEMALLOC
static MYSQL_SYSVAR_STR(
remote_access_charset,
spider_remote_access_charset,
PLUGIN_VAR_MEMALLOC |
PLUGIN_VAR_RQCMDARG,
"Set remote access charset at connecting for improvement performance of connection if you know",
NULL,
NULL,
NULL
);
#else
static MYSQL_SYSVAR_STR(
remote_access_charset,
spider_remote_access_charset,
PLUGIN_VAR_RQCMDARG,
"Set remote access charset at connecting for improvement performance of connection if you know",
NULL,
NULL,
NULL
);
#endif
#endif
char *spider_param_remote_access_charset() char *spider_param_remote_access_charset()
{ {
@@ -2144,7 +2119,6 @@ int spider_param_remote_autocommit()
static char *spider_remote_time_zone; static char *spider_remote_time_zone;
/* /*
*/ */
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
static MYSQL_SYSVAR_STR( static MYSQL_SYSVAR_STR(
remote_time_zone, remote_time_zone,
spider_remote_time_zone, spider_remote_time_zone,
@@ -2155,30 +2129,6 @@ static MYSQL_SYSVAR_STR(
NULL, NULL,
NULL NULL
); );
#else
#ifdef PLUGIN_VAR_CAN_MEMALLOC
static MYSQL_SYSVAR_STR(
remote_time_zone,
spider_remote_time_zone,
PLUGIN_VAR_MEMALLOC |
PLUGIN_VAR_RQCMDARG,
"Set remote time_zone at connecting for improvement performance of connection if you know",
NULL,
NULL,
NULL
);
#else
static MYSQL_SYSVAR_STR(
remote_time_zone,
spider_remote_time_zone,
PLUGIN_VAR_RQCMDARG,
"Set remote time_zone at connecting for improvement performance of connection if you know",
NULL,
NULL,
NULL
);
#endif
#endif
char *spider_param_remote_time_zone() char *spider_param_remote_time_zone()
{ {
@@ -2241,7 +2191,6 @@ int spider_param_remote_trx_isolation()
static char *spider_remote_default_database; static char *spider_remote_default_database;
/* /*
*/ */
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
static MYSQL_SYSVAR_STR( static MYSQL_SYSVAR_STR(
remote_default_database, remote_default_database,
spider_remote_default_database, spider_remote_default_database,
@@ -2252,30 +2201,6 @@ static MYSQL_SYSVAR_STR(
NULL, NULL,
NULL NULL
); );
#else
#ifdef PLUGIN_VAR_CAN_MEMALLOC
static MYSQL_SYSVAR_STR(
remote_default_database,
spider_remote_default_database,
PLUGIN_VAR_MEMALLOC |
PLUGIN_VAR_RQCMDARG,
"Set remote database at connecting for improvement performance of connection if you know",
NULL,
NULL,
NULL
);
#else
static MYSQL_SYSVAR_STR(
remote_default_database,
spider_remote_default_database,
PLUGIN_VAR_RQCMDARG,
"Set remote database at connecting for improvement performance of connection if you know",
NULL,
NULL,
NULL
);
#endif
#endif
char *spider_param_remote_default_database() char *spider_param_remote_default_database()
{ {
@@ -2333,7 +2258,6 @@ int spider_param_connect_retry_count(
/* /*
*/ */
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
static MYSQL_THDVAR_STR( static MYSQL_THDVAR_STR(
bka_engine, /* name */ bka_engine, /* name */
PLUGIN_VAR_MEMALLOC | PLUGIN_VAR_MEMALLOC |
@@ -2343,28 +2267,6 @@ static MYSQL_THDVAR_STR(
NULL, /* update */ NULL, /* update */
NULL /* def */ NULL /* def */
); );
#else
#ifdef PLUGIN_VAR_CAN_MEMALLOC
static MYSQL_THDVAR_STR(
bka_engine, /* name */
PLUGIN_VAR_MEMALLOC |
PLUGIN_VAR_RQCMDARG,
"Temporary table's engine for BKA", /* comment */
NULL, /* check */
NULL, /* update */
NULL /* def */
);
#else
static MYSQL_THDVAR_STR(
bka_engine, /* name */
PLUGIN_VAR_RQCMDARG,
"Temporary table's engine for BKA", /* comment */
NULL, /* check */
NULL, /* update */
NULL /* def */
);
#endif
#endif
char *spider_param_bka_engine( char *spider_param_bka_engine(
THD *thd, THD *thd,

View File

@@ -1085,11 +1085,7 @@ long long spider_ping_table_body(
conv_name.init_calc_mem(135); conv_name.init_calc_mem(135);
tmp_str.init_calc_mem(247); tmp_str.init_calc_mem(247);
conv_name.length(0); conv_name.length(0);
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100002
server_id = global_system_variables.server_id; server_id = global_system_variables.server_id;
#else
server_id = thd->server_id;
#endif
if ( if (
thd->open_tables != 0 || thd->open_tables != 0 ||
thd->handler_tables_hash.records != 0 || thd->handler_tables_hash.records != 0 ||

View File

@@ -737,15 +737,9 @@ int spider_check_sys_table(
table->key_info, table->key_info,
table->key_info->key_length); table->key_info->key_length);
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 50200
DBUG_RETURN(table->file->ha_index_read_idx_map( DBUG_RETURN(table->file->ha_index_read_idx_map(
table->record[0], 0, (uchar *) table_key, table->record[0], 0, (uchar *) table_key,
HA_WHOLE_KEY, HA_READ_KEY_EXACT)); HA_WHOLE_KEY, HA_READ_KEY_EXACT));
#else
DBUG_RETURN(table->file->index_read_idx_map(
table->record[0], 0, (uchar *) table_key,
HA_WHOLE_KEY, HA_READ_KEY_EXACT));
#endif
} }
int spider_check_sys_table_with_find_flag( int spider_check_sys_table_with_find_flag(
@@ -761,15 +755,9 @@ int spider_check_sys_table_with_find_flag(
table->key_info, table->key_info,
table->key_info->key_length); table->key_info->key_length);
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 50200
DBUG_RETURN(table->file->ha_index_read_idx_map( DBUG_RETURN(table->file->ha_index_read_idx_map(
table->record[0], 0, (uchar *) table_key, table->record[0], 0, (uchar *) table_key,
HA_WHOLE_KEY, find_flag)); HA_WHOLE_KEY, find_flag));
#else
DBUG_RETURN(table->file->index_read_idx_map(
table->record[0], 0, (uchar *) table_key,
HA_WHOLE_KEY, find_flag));
#endif
} }
int spider_check_sys_table_for_update_all_columns( int spider_check_sys_table_for_update_all_columns(
@@ -784,15 +772,9 @@ int spider_check_sys_table_for_update_all_columns(
table->key_info, table->key_info,
table->key_info->key_length); table->key_info->key_length);
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 50200
DBUG_RETURN(table->file->ha_index_read_idx_map( DBUG_RETURN(table->file->ha_index_read_idx_map(
table->record[1], 0, (uchar *) table_key, table->record[1], 0, (uchar *) table_key,
HA_WHOLE_KEY, HA_READ_KEY_EXACT)); HA_WHOLE_KEY, HA_READ_KEY_EXACT));
#else
DBUG_RETURN(table->file->index_read_idx_map(
table->record[1], 0, (uchar *) table_key,
HA_WHOLE_KEY, HA_READ_KEY_EXACT));
#endif
} }
int spider_get_sys_table_by_idx( int spider_get_sys_table_by_idx(
@@ -827,26 +809,9 @@ int spider_get_sys_table_by_idx(
key_length); key_length);
if ( if (
/*
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 50200
(error_num = table->file->ha_index_read_idx_map(
table->record[0], idx, (uchar *) table_key,
make_prev_keypart_map(col_count), HA_READ_KEY_EXACT))
#else
(error_num = table->file->index_read_idx_map(
table->record[0], idx, (uchar *) table_key,
make_prev_keypart_map(col_count), HA_READ_KEY_EXACT))
#endif
*/
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 50200
(error_num = table->file->ha_index_read_map( (error_num = table->file->ha_index_read_map(
table->record[0], (uchar *) table_key, table->record[0], (uchar *) table_key,
make_prev_keypart_map(col_count), HA_READ_KEY_EXACT)) make_prev_keypart_map(col_count), HA_READ_KEY_EXACT))
#else
(error_num = table->file->index_read_map(
table->record[0], (uchar *) table_key,
make_prev_keypart_map(col_count), HA_READ_KEY_EXACT))
#endif
) { ) {
spider_sys_index_end(table); spider_sys_index_end(table);
DBUG_RETURN(error_num); DBUG_RETURN(error_num);
@@ -859,17 +824,10 @@ int spider_sys_index_next_same(
char *table_key char *table_key
) { ) {
DBUG_ENTER("spider_sys_index_next_same"); DBUG_ENTER("spider_sys_index_next_same");
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 50200
DBUG_RETURN(table->file->ha_index_next_same( DBUG_RETURN(table->file->ha_index_next_same(
table->record[0], table->record[0],
(const uchar*) table_key, (const uchar*) table_key,
table->key_info->key_length)); table->key_info->key_length));
#else
DBUG_RETURN(table->file->index_next_same(
table->record[0],
(const uchar*) table_key,
table->key_info->key_length));
#endif
} }
int spider_sys_index_first( int spider_sys_index_first(
@@ -882,11 +840,7 @@ int spider_sys_index_first(
DBUG_RETURN(error_num); DBUG_RETURN(error_num);
if ( if (
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 50200
(error_num = table->file->ha_index_first(table->record[0])) (error_num = table->file->ha_index_first(table->record[0]))
#else
(error_num = table->file->index_first(table->record[0]))
#endif
) { ) {
spider_sys_index_end(table); spider_sys_index_end(table);
DBUG_RETURN(error_num); DBUG_RETURN(error_num);
@@ -904,11 +858,7 @@ int spider_sys_index_last(
DBUG_RETURN(error_num); DBUG_RETURN(error_num);
if ( if (
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 50200
(error_num = table->file->ha_index_last(table->record[0])) (error_num = table->file->ha_index_last(table->record[0]))
#else
(error_num = table->file->index_last(table->record[0]))
#endif
) { ) {
spider_sys_index_end(table); spider_sys_index_end(table);
DBUG_RETURN(error_num); DBUG_RETURN(error_num);
@@ -920,11 +870,7 @@ int spider_sys_index_next(
TABLE *table TABLE *table
) { ) {
DBUG_ENTER("spider_sys_index_next"); DBUG_ENTER("spider_sys_index_next");
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 50200
DBUG_RETURN(table->file->ha_index_next(table->record[0])); DBUG_RETURN(table->file->ha_index_next(table->record[0]));
#else
DBUG_RETURN(table->file->index_next(table->record[0]));
#endif
} }
void spider_store_xa_pk( void spider_store_xa_pk(
@@ -1832,12 +1778,6 @@ int spider_log_tables_link_failed(
table->use_all_columns(); table->use_all_columns();
spider_store_tables_name(table, name, name_length); spider_store_tables_name(table, name, name_length);
spider_store_tables_link_idx(table, link_idx); spider_store_tables_link_idx(table, link_idx);
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
#else
if (table->field[SPIDER_LINK_FAILED_LOG_FAILED_TIME_POS] ==
table->timestamp_field)
table->timestamp_field->set_time();
#endif
if ((error_num = spider_write_sys_table_row(table))) if ((error_num = spider_write_sys_table_row(table)))
{ {
DBUG_RETURN(error_num); DBUG_RETURN(error_num);
@@ -1871,12 +1811,6 @@ int spider_log_xa_failed(
(uint) strlen(status), (uint) strlen(status),
system_charset_info); system_charset_info);
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
#else
if (table->field[SPIDER_XA_FAILED_LOG_FAILED_TIME_POS] ==
table->timestamp_field)
table->timestamp_field->set_time();
#endif
if ((error_num = spider_write_sys_table_row(table))) if ((error_num = spider_write_sys_table_row(table)))
{ {
DBUG_RETURN(error_num); DBUG_RETURN(error_num);
@@ -3664,12 +3598,8 @@ int spider_sys_replace(
if (table->file->ha_table_flags() & HA_DUPLICATE_POS) if (table->file->ha_table_flags() & HA_DUPLICATE_POS)
{ {
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 50200
error_num = table->file->ha_rnd_pos(table->record[1], error_num = table->file->ha_rnd_pos(table->record[1],
table->file->dup_ref); table->file->dup_ref);
#else
error_num = table->file->rnd_pos(table->record[1], table->file->dup_ref);
#endif
if (error_num) if (error_num)
{ {
if (error_num == HA_ERR_RECORD_DELETED) if (error_num == HA_ERR_RECORD_DELETED)
@@ -3682,13 +3612,8 @@ int spider_sys_replace(
key_copy((uchar*)table_key, table->record[0], key_copy((uchar*)table_key, table->record[0],
table->key_info + key_num, 0); table->key_info + key_num, 0);
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 50200
error_num = table->file->ha_index_read_idx_map(table->record[1], key_num, error_num = table->file->ha_index_read_idx_map(table->record[1], key_num,
(const uchar*)table_key, HA_WHOLE_KEY, HA_READ_KEY_EXACT); (const uchar*)table_key, HA_WHOLE_KEY, HA_READ_KEY_EXACT);
#else
error_num = table->file->index_read_idx_map(table->record[1], key_num,
(const uchar*)table_key, HA_WHOLE_KEY, HA_READ_KEY_EXACT);
#endif
if (error_num) if (error_num)
{ {
if (error_num == HA_ERR_RECORD_DELETED) if (error_num == HA_ERR_RECORD_DELETED)

View File

@@ -3902,11 +3902,7 @@ int spider_set_connect_info_default(
if (share->monitoring_limit[roop_count] == -1) if (share->monitoring_limit[roop_count] == -1)
share->monitoring_limit[roop_count] = 1; share->monitoring_limit[roop_count] = 1;
if (share->monitoring_sid[roop_count] == -1) if (share->monitoring_sid[roop_count] == -1)
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100002
share->monitoring_sid[roop_count] = global_system_variables.server_id; share->monitoring_sid[roop_count] = global_system_variables.server_id;
#else
share->monitoring_sid[roop_count] = current_thd->server_id;
#endif
if (share->use_handlers[roop_count] == -1) if (share->use_handlers[roop_count] == -1)
share->use_handlers[roop_count] = 0; share->use_handlers[roop_count] = 0;
@@ -8545,10 +8541,8 @@ bool spider_check_direct_order_limit(
spider_get_select_limit(spider, &select_lex, &select_limit, &offset_limit); spider_get_select_limit(spider, &select_lex, &select_limit, &offset_limit);
bool first_check = TRUE; bool first_check = TRUE;
DBUG_PRINT("info",("spider select_lex=%p", select_lex)); DBUG_PRINT("info",("spider select_lex=%p", select_lex));
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
DBUG_PRINT("info",("spider leaf_tables.elements=%u", DBUG_PRINT("info",("spider leaf_tables.elements=%u",
select_lex ? select_lex->leaf_tables.elements : 0)); select_lex ? select_lex->leaf_tables.elements : 0));
#endif
if (select_lex && (select_lex->options & SELECT_DISTINCT)) if (select_lex && (select_lex->options & SELECT_DISTINCT))
{ {
@@ -8574,9 +8568,7 @@ bool spider_check_direct_order_limit(
!spider->condition || !spider->condition ||
#endif #endif
!select_lex || !select_lex ||
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
select_lex->leaf_tables.elements != 1 || select_lex->leaf_tables.elements != 1 ||
#endif
select_lex->table_list.elements != 1 select_lex->table_list.elements != 1
) { ) {
DBUG_PRINT("info",("spider first_check is FALSE")); DBUG_PRINT("info",("spider first_check is FALSE"));
@@ -8997,20 +8989,11 @@ ulong spider_calc_for_sort(
double spider_rand( double spider_rand(
uint32 rand_source uint32 rand_source
) { ) {
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
struct my_rnd_struct rand; struct my_rnd_struct rand;
#else
struct rand_struct rand;
#endif
DBUG_ENTER("spider_rand"); DBUG_ENTER("spider_rand");
/* generate same as rand function for applications */ /* generate same as rand function for applications */
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
my_rnd_init(&rand, (uint32) (rand_source * 65537L + 55555555L), my_rnd_init(&rand, (uint32) (rand_source * 65537L + 55555555L),
(uint32) (rand_source * 268435457L)); (uint32) (rand_source * 268435457L));
#else
randominit(&rand, (uint32) (rand_source * 65537L + 55555555L),
(uint32) (rand_source * 268435457L));
#endif
DBUG_RETURN(my_rnd(&rand)); DBUG_RETURN(my_rnd(&rand));
} }

View File

@@ -1831,17 +1831,10 @@ int spider_internal_start_trx(
(trx->xid.data, "%lx%016llx", thd_get_thread_id(thd), (trx->xid.data, "%lx%016llx", thd_get_thread_id(thd),
thd->query_id)); thd->query_id));
} }
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100002
trx->xid.bqual_length trx->xid.bqual_length
= my_sprintf(trx->xid.data + trx->xid.gtrid_length, = my_sprintf(trx->xid.data + trx->xid.gtrid_length,
(trx->xid.data + trx->xid.gtrid_length, "%lx", (trx->xid.data + trx->xid.gtrid_length, "%lx",
thd->variables.server_id)); thd->variables.server_id));
#else
trx->xid.bqual_length
= my_sprintf(trx->xid.data + trx->xid.gtrid_length,
(trx->xid.data + trx->xid.gtrid_length, "%x",
thd->server_id));
#endif
#ifdef SPIDER_XID_STATE_HAS_in_thd #ifdef SPIDER_XID_STATE_HAS_in_thd
trx->internal_xid_state.in_thd = 1; trx->internal_xid_state.in_thd = 1;
@@ -3852,19 +3845,11 @@ THD *spider_create_tmp_thd()
DBUG_ENTER("spider_create_tmp_thd"); DBUG_ENTER("spider_create_tmp_thd");
if (!(thd = SPIDER_new_THD((my_thread_id) 0))) if (!(thd = SPIDER_new_THD((my_thread_id) 0)))
DBUG_RETURN(NULL); DBUG_RETURN(NULL);
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
thd->killed = NOT_KILLED; thd->killed = NOT_KILLED;
#else
thd->killed = THD::NOT_KILLED;
#endif
#if MYSQL_VERSION_ID < 50500 #if MYSQL_VERSION_ID < 50500
thd->locked_tables = FALSE; thd->locked_tables = FALSE;
#endif #endif
thd->proc_info = ""; thd->proc_info = "";
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100200
#else
thd->thread_id = thd->variables.pseudo_thread_id = 0;
#endif
thd->thread_stack = (char*) &thd; thd->thread_stack = (char*) &thd;
thd->store_globals(); thd->store_globals();
lex_start(thd); lex_start(thd);
@@ -3876,11 +3861,7 @@ void spider_free_tmp_thd(
) { ) {
DBUG_ENTER("spider_free_tmp_thd"); DBUG_ENTER("spider_free_tmp_thd");
thd->cleanup(); thd->cleanup();
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
thd->reset_globals(); thd->reset_globals();
#else
thd->restore_globals();
#endif
delete thd; delete thd;
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }