From 06bd93c3772c7882e97ad76b4d684226644d5693 Mon Sep 17 00:00:00 2001 From: Nayuta Yanagisawa Date: Fri, 28 Jan 2022 00:06:09 +0900 Subject: [PATCH] MDEV-27637 Spider: remove #if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= ${VERSION} --- storage/spider/ha_spider.cc | 87 ---------------------------- storage/spider/ha_spider.h | 37 ------------ storage/spider/spd_conn.cc | 8 --- storage/spider/spd_db_conn.cc | 20 ------- storage/spider/spd_db_include.h | 34 ----------- storage/spider/spd_db_mysql.cc | 4 -- storage/spider/spd_direct_sql.cc | 2 - storage/spider/spd_environ.h | 20 ------- storage/spider/spd_include.h | 93 ------------------------------ storage/spider/spd_param.cc | 98 -------------------------------- storage/spider/spd_ping_table.cc | 4 -- storage/spider/spd_sys_table.cc | 75 ------------------------ storage/spider/spd_table.cc | 17 ------ storage/spider/spd_trx.cc | 19 ------- 14 files changed, 518 deletions(-) diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc index 7b4b7b9e127..b4a390c1e90 100644 --- a/storage/spider/ha_spider.cc +++ b/storage/spider/ha_spider.cc @@ -48,15 +48,9 @@ #include "spd_ping_table.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_INSERT (1LL << 38) #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 SPIDER_DBTON spider_dbton[SPIDER_DBTON_SIZE]; @@ -3853,7 +3847,6 @@ bool ha_spider::check_no_where_cond() } #ifdef HA_MRR_USE_DEFAULT_IMPL -#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000 ha_rows ha_spider::multi_range_read_info_const( uint keyno, RANGE_SEQ_IF *seq, @@ -3863,17 +3856,6 @@ ha_rows ha_spider::multi_range_read_info_const( uint *flags, 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_PRINT("info",("spider this=%p", this)); @@ -3918,7 +3900,6 @@ ha_rows ha_spider::multi_range_read_info_const( DBUG_RETURN(rows); } -#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000 ha_rows ha_spider::multi_range_read_info( uint keyno, uint n_ranges, @@ -3928,17 +3909,6 @@ ha_rows ha_spider::multi_range_read_info( uint *flags, 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_PRINT("info",("spider this=%p", this)); @@ -4011,16 +3981,10 @@ int ha_spider::multi_range_read_init( #endif #ifdef HA_MRR_USE_DEFAULT_IMPL -#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000 int ha_spider::multi_range_read_next_first( range_id_t *range_info ) #else -int ha_spider::multi_range_read_next_first( - char **range_info -) -#endif -#else int ha_spider::read_multi_range_first_internal( uchar *buf, 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)); 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 *) 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), 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_PRINT("info",("spider alloc multi_range_keys=%p", multi_range_keys)); if (!mrr_key_buff) @@ -4730,11 +4686,7 @@ int ha_spider::read_multi_range_first_internal( } #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; -#else - multi_range_keys[multi_range_cnt] = (char *) mrr_cur_range.ptr; -#endif #endif if (bka_mode == 2) { @@ -4857,11 +4809,7 @@ int ha_spider::read_multi_range_first_internal( { #ifdef HA_MRR_USE_DEFAULT_IMPL 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; -#else - multi_range_keys[multi_range_cnt] = (char *) mrr_cur_range.ptr; -#endif #endif if ((error_num = spider_db_append_select(this))) DBUG_RETURN(error_num); @@ -5402,15 +5350,9 @@ int ha_spider::pre_multi_range_read_next( DBUG_RETURN(0); } -#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000 int ha_spider::multi_range_read_next( range_id_t *range_info ) -#else -int ha_spider::multi_range_read_next( - char **range_info -) -#endif { int error_num; DBUG_ENTER("ha_spider::multi_range_read_next"); @@ -5488,16 +5430,10 @@ int ha_spider::read_multi_range_first( #endif #ifdef HA_MRR_USE_DEFAULT_IMPL -#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000 int ha_spider::multi_range_read_next_next( range_id_t *range_info ) #else -int ha_spider::multi_range_read_next_next( - char **range_info -) -#endif -#else int ha_spider::read_multi_range_next( KEY_MULTI_RANGE **found_range_p ) @@ -6207,11 +6143,7 @@ int ha_spider::read_multi_range_next( } #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; -#else - multi_range_keys[multi_range_cnt] = (char *) mrr_cur_range.ptr; -#endif #endif if (bka_mode == 2) { @@ -6332,11 +6264,7 @@ int ha_spider::read_multi_range_next( #endif { #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; -#else - multi_range_keys[multi_range_cnt] = (char *) mrr_cur_range.ptr; -#endif #endif if ((error_num = spider_db_append_select(this))) DBUG_RETURN(error_num); @@ -9468,11 +9396,6 @@ int ha_spider::write_row( } #ifndef SPIDER_WITHOUT_HA_STATISTIC_INCREMENT 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 if (!bulk_insert) store_last_insert_id = 0; @@ -9705,11 +9628,6 @@ int ha_spider::update_row( #endif #ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS 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 if ((error_num = spider_db_update(this, table, old_data))) 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 ( -#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 50200 !(error_num = tmp_table[roop_count]->file->ha_rnd_next( 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); } diff --git a/storage/spider/ha_spider.h b/storage/spider/ha_spider.h index cd847760bcf..8ef6f0aeca9 100644 --- a/storage/spider/ha_spider.h +++ b/storage/spider/ha_spider.h @@ -128,11 +128,7 @@ public: bool have_second_range; KEY_MULTI_RANGE mrr_second_range; spider_string *mrr_key_buff; -#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000 range_id_t *multi_range_keys; -#else - char **multi_range_keys; -#endif #else KEY_MULTI_RANGE *multi_range_ranges; #endif @@ -301,7 +297,6 @@ public: void reset_no_where_cond(); bool check_no_where_cond(); #ifdef HA_MRR_USE_DEFAULT_IMPL -#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000 ha_rows multi_range_read_info_const( uint keyno, RANGE_SEQ_IF *seq, @@ -320,26 +315,6 @@ public: uint *flags, 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( RANGE_SEQ_IF *seq, void *seq_init_param, @@ -347,7 +322,6 @@ public: uint mode, HANDLER_BUFFER *buf ); -#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000 int multi_range_read_next( range_id_t *range_info ); @@ -357,17 +331,6 @@ public: int multi_range_read_next_next( 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 int read_multi_range_first( KEY_MULTI_RANGE **found_range_p, diff --git a/storage/spider/spd_conn.cc b/storage/spider/spd_conn.cc index 9b040384cd6..1c0af240632 100644 --- a/storage/spider/spd_conn.cc +++ b/storage/spider/spd_conn.cc @@ -4081,17 +4081,9 @@ int spider_conn_first_link_idx( my_afree(link_idxs); DBUG_RETURN(-1); } -#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100002 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))); -#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100002 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)); balance_val = (longlong) (rand_val * balance_total); DBUG_PRINT("info",("spider balance_val=%lld", balance_val)); diff --git a/storage/spider/spd_db_conn.cc b/storage/spider/spd_db_conn.cc index 549279fb180..87a5d0aab75 100644 --- a/storage/spider/spd_db_conn.cc +++ b/storage/spider/spd_db_conn.cc @@ -1837,10 +1837,8 @@ int spider_db_append_key_where_internal( DBUG_PRINT("info", ("spider start_key->flag=%d", start_key->flag)); switch (start_key->flag) { -#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000 case HA_READ_PREFIX_LAST: result_list->desc_flg = TRUE; -#endif /* fall through */ case HA_READ_KEY_EXACT: if (sql_kind == SPIDER_SQL_KIND_SQL) @@ -2041,12 +2039,6 @@ int spider_db_append_key_where_internal( } } 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_PREFIX_LAST_OR_PREV: result_list->desc_flg = TRUE; @@ -2876,13 +2868,8 @@ int spider_db_get_row_from_tmp_tbl( current->result_tmp_tbl_inited = 1; } if ( -#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 50200 (error_num = current->result_tmp_tbl->file->ha_rnd_next( 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); } @@ -2910,13 +2897,8 @@ int spider_db_get_row_from_tmp_tbl_pos( result->result_tmp_tbl_inited = 2; } if ( -#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 50200 (error_num = tmp_tbl->file->ha_rnd_pos(tmp_tbl->record[0], (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); } @@ -6911,9 +6893,7 @@ int spider_db_update( ) { conn = spider->conns[roop_count]; 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; -#endif pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); if (dbton_hdl->need_lock_before_set_sql_for_exec( SPIDER_SQL_TYPE_UPDATE_SQL)) diff --git a/storage/spider/spd_db_include.h b/storage/spider/spd_db_include.h index bf5312be4c8..a95c7228647 100644 --- a/storage/spider/spd_db_include.h +++ b/storage/spider/spd_db_include.h @@ -28,56 +28,22 @@ #define SPIDER_DB_WRAPPER_MYSQL "mysql" #define SPIDER_DB_WRAPPER_MARIADB "mariadb" -#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100204 #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_APPEND_FOR_SINGLE_QUOTE #define SPIDER_HAS_SHOW_SIMPLE_FUNC #define SPIDER_HAS_JT_HASH_INDEX_MERGE #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 -#endif - -#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100004 #define SPIDER_HAS_TIME_STATUS #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 -#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100100 #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 -#endif - -#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100200 #define SPIDER_ORDER_HAS_ENUM_ORDER -#endif - -#if defined(MARIADB_BASE_VERSION) #define SPIDER_ITEM_GEOFUNC_NAME_HAS_MBR #define SPIDER_HANDLER_AUTO_REPAIR_HAS_ERROR -#endif class spider_db_conn; typedef spider_db_conn SPIDER_DB_CONN; diff --git a/storage/spider/spd_db_mysql.cc b/storage/spider/spd_db_mysql.cc index d8fc6d38897..3096b7bcdfe 100644 --- a/storage/spider/spd_db_mysql.cc +++ b/storage/spider/spd_db_mysql.cc @@ -13670,11 +13670,7 @@ int spider_mbase_handler::bulk_tmp_table_rnd_next() int error_num; DBUG_ENTER("spider_mbase_handler::bulk_tmp_table_rnd_next"); 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]); -#else - error_num = upd_tmp_tbl->file->rnd_next(upd_tmp_tbl->record[0]); -#endif if (!error_num) { error_num = restore_sql_from_bulk_tmp_table(&insert_sql, upd_tmp_tbl); diff --git a/storage/spider/spd_direct_sql.cc b/storage/spider/spd_direct_sql.cc index 41f7bf6d6a4..dee90772349 100644 --- a/storage/spider/spd_direct_sql.cc +++ b/storage/spider/spd_direct_sql.cc @@ -44,9 +44,7 @@ #include "spd_udf.h" #include "spd_malloc.h" -#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100004 #define SPIDER_NEED_INIT_ONE_TABLE_FOR_FIND_TEMPORARY_TABLE -#endif extern const char **spd_defaults_extra_file; extern const char **spd_defaults_file; diff --git a/storage/spider/spd_environ.h b/storage/spider/spd_environ.h index 320b0edeb30..21b60b1713f 100644 --- a/storage/spider/spd_environ.h +++ b/storage/spider/spd_environ.h @@ -20,16 +20,9 @@ #ifndef SPD_ENVIRON_INCLUDED -#if (defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000) #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_NET_HAS_THD -#endif - -#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100211 #define HANDLER_HAS_TOP_TABLE_FIELDS #define HANDLER_HAS_DIRECT_UPDATE_ROWS #define HANDLER_HAS_DIRECT_AGGREGATE @@ -38,24 +31,11 @@ #define HA_EXTRA_HAS_STARTING_ORDERED_INDEX_SCAN #define HANDLER_HAS_NEED_INFO_FOR_AUTO_INC #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 -#endif - -#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100309 #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_SQL_CACHE_IS_IN_LEX #define SPIDER_LIKE_FUNC_HAS_GET_NEGATED #define HA_HAS_CHECKSUM_EXTENDED -#endif - -#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100500 #define SPIDER_I_S_USE_SHOW_FOR_COLUMN -#endif #endif /* SPD_ENVIRON_INCLUDED */ diff --git a/storage/spider/spd_include.h b/storage/spider/spd_include.h index ecfcefa36b0..24372073c09 100644 --- a/storage/spider/spd_include.h +++ b/storage/spider/spd_include.h @@ -72,8 +72,6 @@ #define my_sprintf(A,B) sprintf B #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_sql_errno(A) thd_get_error_number(A) #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_NOTE Sql_condition::WARN_LEVEL_NOTE #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 -#endif -#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100009 #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_ENGINE_CONDITION_PUSHDOWN_IS_ALWAYS_ON #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 -#endif -#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100112 #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_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_new_THD(A) (new THD(A)) #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_open_temporary_table -#endif #if defined(MARIADB_BASE_VERSION) #if MYSQL_VERSION_ID >= 100209 @@ -182,17 +131,10 @@ #define SPIDER_generate_partition_syntax(A,B,C,D,E,F,G,H) #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_subpartition_name(A,B,C,D,E,F) create_subpartition_name(A,B,C,D,E,F) #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_has_Item_with_subquery #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_length(A) (A)->name.length 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 #define SPIDER_HAS_HASH_VALUE_TYPE #endif -#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100400 #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_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; -#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 { \ if (!(*(B) = new start_new_trans(A))) \ { \ @@ -262,12 +175,6 @@ typedef Open_tables_backup SPIDER_Open_tables_backup; delete *(B); \ } while (0) #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_set_bit(BITMAP, BIT) \ diff --git a/storage/spider/spd_param.cc b/storage/spider/spd_param.cc index 6df4dce0211..9d331c86dfa 100644 --- a/storage/spider/spd_param.cc +++ b/storage/spider/spd_param.cc @@ -2074,7 +2074,6 @@ int spider_param_udf_ds_table_loop_mode( static char *spider_remote_access_charset; /* */ -#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000 static MYSQL_SYSVAR_STR( remote_access_charset, spider_remote_access_charset, @@ -2085,30 +2084,6 @@ static MYSQL_SYSVAR_STR( 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() { @@ -2144,7 +2119,6 @@ int spider_param_remote_autocommit() static char *spider_remote_time_zone; /* */ -#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000 static MYSQL_SYSVAR_STR( remote_time_zone, spider_remote_time_zone, @@ -2155,30 +2129,6 @@ static MYSQL_SYSVAR_STR( 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() { @@ -2241,7 +2191,6 @@ int spider_param_remote_trx_isolation() static char *spider_remote_default_database; /* */ -#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000 static MYSQL_SYSVAR_STR( remote_default_database, spider_remote_default_database, @@ -2252,30 +2201,6 @@ static MYSQL_SYSVAR_STR( 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() { @@ -2333,7 +2258,6 @@ int spider_param_connect_retry_count( /* */ -#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000 static MYSQL_THDVAR_STR( bka_engine, /* name */ PLUGIN_VAR_MEMALLOC | @@ -2343,28 +2267,6 @@ static MYSQL_THDVAR_STR( NULL, /* update */ 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( THD *thd, diff --git a/storage/spider/spd_ping_table.cc b/storage/spider/spd_ping_table.cc index f220a9d97c2..fdd163e087e 100644 --- a/storage/spider/spd_ping_table.cc +++ b/storage/spider/spd_ping_table.cc @@ -1085,11 +1085,7 @@ long long spider_ping_table_body( conv_name.init_calc_mem(135); tmp_str.init_calc_mem(247); conv_name.length(0); -#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100002 server_id = global_system_variables.server_id; -#else - server_id = thd->server_id; -#endif if ( thd->open_tables != 0 || thd->handler_tables_hash.records != 0 || diff --git a/storage/spider/spd_sys_table.cc b/storage/spider/spd_sys_table.cc index 69e4d259296..0c076998678 100644 --- a/storage/spider/spd_sys_table.cc +++ b/storage/spider/spd_sys_table.cc @@ -737,15 +737,9 @@ int spider_check_sys_table( table->key_info, table->key_info->key_length); -#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 50200 DBUG_RETURN(table->file->ha_index_read_idx_map( table->record[0], 0, (uchar *) table_key, 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( @@ -761,15 +755,9 @@ int spider_check_sys_table_with_find_flag( table->key_info, table->key_info->key_length); -#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 50200 DBUG_RETURN(table->file->ha_index_read_idx_map( table->record[0], 0, (uchar *) table_key, 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( @@ -784,15 +772,9 @@ int spider_check_sys_table_for_update_all_columns( table->key_info, table->key_info->key_length); -#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 50200 DBUG_RETURN(table->file->ha_index_read_idx_map( table->record[1], 0, (uchar *) table_key, 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( @@ -827,26 +809,9 @@ int spider_get_sys_table_by_idx( key_length); 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( table->record[0], (uchar *) table_key, 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); DBUG_RETURN(error_num); @@ -859,17 +824,10 @@ int spider_sys_index_next_same( char *table_key ) { DBUG_ENTER("spider_sys_index_next_same"); -#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 50200 DBUG_RETURN(table->file->ha_index_next_same( table->record[0], (const uchar*) table_key, 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( @@ -882,11 +840,7 @@ int spider_sys_index_first( DBUG_RETURN(error_num); if ( -#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 50200 (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); DBUG_RETURN(error_num); @@ -904,11 +858,7 @@ int spider_sys_index_last( DBUG_RETURN(error_num); if ( -#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 50200 (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); DBUG_RETURN(error_num); @@ -920,11 +870,7 @@ int spider_sys_index_next( TABLE *table ) { 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])); -#else - DBUG_RETURN(table->file->index_next(table->record[0])); -#endif } void spider_store_xa_pk( @@ -1832,12 +1778,6 @@ int spider_log_tables_link_failed( table->use_all_columns(); spider_store_tables_name(table, name, name_length); 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))) { DBUG_RETURN(error_num); @@ -1871,12 +1811,6 @@ int spider_log_xa_failed( (uint) strlen(status), 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))) { DBUG_RETURN(error_num); @@ -3664,12 +3598,8 @@ int spider_sys_replace( 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], 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 == HA_ERR_RECORD_DELETED) @@ -3682,13 +3612,8 @@ int spider_sys_replace( key_copy((uchar*)table_key, table->record[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, (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 == HA_ERR_RECORD_DELETED) diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc index b9a0b582b65..3fb05b42566 100644 --- a/storage/spider/spd_table.cc +++ b/storage/spider/spd_table.cc @@ -3902,11 +3902,7 @@ int spider_set_connect_info_default( if (share->monitoring_limit[roop_count] == -1) share->monitoring_limit[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; -#else - share->monitoring_sid[roop_count] = current_thd->server_id; -#endif if (share->use_handlers[roop_count] == -1) 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); bool first_check = TRUE; 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", select_lex ? select_lex->leaf_tables.elements : 0)); -#endif if (select_lex && (select_lex->options & SELECT_DISTINCT)) { @@ -8574,9 +8568,7 @@ bool spider_check_direct_order_limit( !spider->condition || #endif !select_lex || -#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000 select_lex->leaf_tables.elements != 1 || -#endif select_lex->table_list.elements != 1 ) { DBUG_PRINT("info",("spider first_check is FALSE")); @@ -8997,20 +8989,11 @@ ulong spider_calc_for_sort( double spider_rand( uint32 rand_source ) { -#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000 struct my_rnd_struct rand; -#else - struct rand_struct rand; -#endif DBUG_ENTER("spider_rand"); /* 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), (uint32) (rand_source * 268435457L)); -#else - randominit(&rand, (uint32) (rand_source * 65537L + 55555555L), - (uint32) (rand_source * 268435457L)); -#endif DBUG_RETURN(my_rnd(&rand)); } diff --git a/storage/spider/spd_trx.cc b/storage/spider/spd_trx.cc index e3216739065..55897abaee8 100644 --- a/storage/spider/spd_trx.cc +++ b/storage/spider/spd_trx.cc @@ -1831,17 +1831,10 @@ int spider_internal_start_trx( (trx->xid.data, "%lx%016llx", thd_get_thread_id(thd), thd->query_id)); } -#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100002 trx->xid.bqual_length = my_sprintf(trx->xid.data + trx->xid.gtrid_length, (trx->xid.data + trx->xid.gtrid_length, "%lx", 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 trx->internal_xid_state.in_thd = 1; @@ -3852,19 +3845,11 @@ THD *spider_create_tmp_thd() DBUG_ENTER("spider_create_tmp_thd"); if (!(thd = SPIDER_new_THD((my_thread_id) 0))) DBUG_RETURN(NULL); -#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000 thd->killed = NOT_KILLED; -#else - thd->killed = THD::NOT_KILLED; -#endif #if MYSQL_VERSION_ID < 50500 thd->locked_tables = FALSE; #endif 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->store_globals(); lex_start(thd); @@ -3876,11 +3861,7 @@ void spider_free_tmp_thd( ) { DBUG_ENTER("spider_free_tmp_thd"); thd->cleanup(); -#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000 thd->reset_globals(); -#else - thd->restore_globals(); -#endif delete thd; DBUG_VOID_RETURN; }