Commit 4a09e743 authored by Yuchen Pei's avatar Yuchen Pei

Merge branch '10.5' into 10.6

parents 02b30044 a81f419b
This diff is collapsed.
......@@ -147,12 +147,8 @@ class ha_spider final : public handler
bool use_pre_action;
bool pre_bitmap_checked;
bool bulk_insert;
#ifdef HANDLER_HAS_NEED_INFO_FOR_AUTO_INC
bool info_auto_called;
#endif
#ifdef HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT
bool auto_inc_temporary;
#endif
int bulk_size= 0;
int direct_dup_insert;
int store_error_num;
......@@ -175,21 +171,15 @@ class ha_spider final : public handler
corresponding m_handler_cid is t00003
*/
char **m_handler_cid;
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
bool do_direct_update;
uint direct_update_kinds;
#endif
spider_index_rnd_init prev_index_rnd_init;
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
SPIDER_ITEM_HLD *direct_aggregate_item_first;
SPIDER_ITEM_HLD *direct_aggregate_item_current;
#endif
ha_rows table_rows;
#ifdef HA_HAS_CHECKSUM_EXTENDED
ha_checksum checksum_val;
bool checksum_null;
uint action_flags;
#endif
/* for fulltext search */
bool ft_init_and_first;
......@@ -436,10 +426,8 @@ class ha_spider final : public handler
int check_crd();
int pre_records() override;
ha_rows records() override;
#ifdef HA_HAS_CHECKSUM_EXTENDED
int pre_calculate_checksum() override;
int calculate_checksum() override;
#endif
const char *table_type() const override;
ulonglong table_flags() const override;
ulong table_flags_for_partition();
......@@ -457,12 +445,8 @@ class ha_spider final : public handler
uint max_supported_key_length() const override;
uint max_supported_key_part_length() const override;
uint8 table_cache_type() override;
#ifdef HANDLER_HAS_NEED_INFO_FOR_AUTO_INC
bool need_info_for_auto_inc() override;
#endif
#ifdef HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT
bool can_use_for_auto_inc_init() override;
#endif
int update_auto_increment();
void get_auto_increment(
ulonglong offset,
......@@ -475,16 +459,10 @@ class ha_spider final : public handler
ulonglong value
) override;
void release_auto_increment() override;
#ifdef SPIDER_HANDLER_START_BULK_INSERT_HAS_FLAGS
void start_bulk_insert(
ha_rows rows,
uint flags
) override;
#else
void start_bulk_insert(
ha_rows rows
);
#endif
int end_bulk_insert() override;
int write_row(
const uchar *buf
......@@ -494,18 +472,15 @@ class ha_spider final : public handler
uchar *buf
);
#endif
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
void direct_update_init(
THD *thd,
bool hs_request
);
#endif
bool start_bulk_update() override;
int exec_bulk_update(
ha_rows *dup_key_found
) override;
int end_bulk_update() override;
#ifdef SPIDER_UPDATE_ROW_HAS_CONST_NEW_DATA
int bulk_update_row(
const uchar *old_data,
const uchar *new_data,
......@@ -515,25 +490,12 @@ class ha_spider final : public handler
const uchar *old_data,
const uchar *new_data
) override;
#else
int bulk_update_row(
const uchar *old_data,
uchar *new_data,
ha_rows *dup_key_found
);
int update_row(
const uchar *old_data,
uchar *new_data
);
#endif
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
bool check_direct_update_sql_part(
st_select_lex *select_lex,
longlong select_limit,
longlong offset_limit
);
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
#ifdef SPIDER_MDEV_16246
inline int direct_update_rows_init(
List<Item> *update_fields
) {
......@@ -548,30 +510,12 @@ class ha_spider final : public handler
uchar *new_data
);
#else
inline int direct_update_rows_init()
{
return direct_update_rows_init(2, NULL, 0, FALSE, NULL);
}
int direct_update_rows_init(
uint mode,
KEY_MULTI_RANGE *ranges,
uint range_count,
bool sorted,
uchar *new_data
);
#endif
#else
#ifdef SPIDER_MDEV_16246
int direct_update_rows_init(
List<Item> *update_fields
) override;
#else
int direct_update_rows_init();
#endif
#endif
#ifdef HA_CAN_BULK_ACCESS
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
#ifdef SPIDER_MDEV_16246
inline int pre_direct_update_rows_init(
List<Item> *update_fields
) {
......@@ -586,26 +530,9 @@ class ha_spider final : public handler
uchar *new_data
);
#else
inline int pre_direct_update_rows_init()
{
return pre_direct_update_rows_init(2, NULL, 0, FALSE, NULL);
}
int pre_direct_update_rows_init(
uint mode,
KEY_MULTI_RANGE *ranges,
uint range_count,
bool sorted,
uchar *new_data
);
#endif
#else
#ifdef SPIDER_MDEV_16246
int pre_direct_update_rows_init(
List<Item> *update_fields
);
#else
int pre_direct_update_rows_init();
#endif
#endif
#endif
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
......@@ -648,14 +575,12 @@ class ha_spider final : public handler
#else
int pre_direct_update_rows();
#endif
#endif
#endif
bool start_bulk_delete() override;
int end_bulk_delete() override;
int delete_row(
const uchar *buf
) override;
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
bool check_direct_delete_sql_part(
st_select_lex *select_lex,
longlong select_limit,
......@@ -724,7 +649,6 @@ class ha_spider final : public handler
#else
int pre_direct_delete_rows();
#endif
#endif
#endif
int delete_all_rows() override;
int truncate() override;
......@@ -808,9 +732,7 @@ class ha_spider final : public handler
uint info_type,
void *info
) override;
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
void return_record_by_parent() override;
#endif
TABLE *get_table();
void set_ft_discard_bitmap();
void set_searched_bitmap();
......@@ -895,9 +817,7 @@ class ha_spider final : public handler
void check_pre_call(
bool use_parallel
);
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
void check_insert_dup_update_pushdown();
#endif
#ifdef HA_CAN_BULK_ACCESS
SPIDER_BULK_ACCESS_LINK *create_bulk_access_link();
void delete_bulk_access_link(
......@@ -926,10 +846,7 @@ class ha_spider final : public handler
int append_insert_sql_part();
int append_update_sql_part();
int append_update_set_sql_part();
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
int append_direct_update_set_sql_part();
#endif
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
int append_dup_update_pushdown_sql_part(
const char *alias,
uint alias_length
......@@ -939,7 +856,6 @@ class ha_spider final : public handler
uint alias_length
);
int check_update_columns_sql_part();
#endif
int append_delete_sql_part();
int append_select_sql_part(
ulong sql_type
......@@ -1003,13 +919,11 @@ class ha_spider final : public handler
ulong sql_type,
bool test_flg
);
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
int append_sum_select_sql_part(
ulong sql_type,
const char *alias,
uint alias_length
);
#endif
int append_match_select_sql_part(
ulong sql_type,
const char *alias,
......@@ -1021,13 +935,11 @@ class ha_spider final : public handler
void set_order_to_pos_sql(
ulong sql_type
);
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
int append_group_by_sql_part(
const char *alias,
uint alias_length,
ulong sql_type
);
#endif
int append_key_order_for_merge_with_alias_sql_part(
const char *alias,
uint alias_length,
......
This diff is collapsed.
......@@ -22,9 +22,7 @@
#define SPIDER_SIMPLE_CONNECT 1
#define SPIDER_SIMPLE_DISCONNECT 2
#define SPIDER_SIMPLE_RECORDS 3
#ifdef HA_HAS_CHECKSUM_EXTENDED
#define SPIDER_SIMPLE_CHECKSUM_TABLE 4
#endif
/*
The SPIDER_CONN_LOOP_CHECK has been added to the loop_check queue to
......@@ -50,10 +48,8 @@ typedef struct st_spider_conn_loop_check
SPIDER_LOP_CHK_IGNORED
*/
uint flag;
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
/* hash value of to_name, used for the hash conn->loop_checked */
my_hash_value_type hash_value_to;
#endif
/*
The fully qualified name of the current spider table, which will
also be used to construct the user var name to set in the data
......
......@@ -17,7 +17,6 @@
#define MYSQL_SERVER 1
#include <my_global.h>
#include "mysql_version.h"
#include "spd_environ.h"
#include "sql_priv.h"
#include "probes_mysql.h"
#include "sql_class.h"
......
This diff is collapsed.
......@@ -496,7 +496,6 @@ int spider_db_append_charset_name_before_string(
CHARSET_INFO *cs
);
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
int spider_db_refetch_for_item_sum_funcs(
ha_spider *spider
);
......@@ -511,7 +510,6 @@ int spider_db_fetch_for_item_sum_func(
Item_sum *item_sum,
ha_spider *spider
);
#endif
int spider_db_append_match_fetch(
ha_spider *spider,
......@@ -799,7 +797,6 @@ int spider_db_update(
const uchar *old_data
);
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
int spider_db_direct_update(
ha_spider *spider,
......@@ -817,7 +814,6 @@ int spider_db_direct_update(
ha_rows *found_rows
);
#endif
#endif
#ifdef HA_CAN_BULK_ACCESS
int spider_db_bulk_direct_update(
......@@ -838,7 +834,6 @@ int spider_db_delete(
const uchar *buf
);
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
int spider_db_direct_delete(
ha_spider *spider,
......@@ -854,7 +849,6 @@ int spider_db_direct_delete(
ha_rows *delete_rows
);
#endif
#endif
int spider_db_delete_all_rows(
ha_spider *spider
......@@ -944,7 +938,6 @@ int spider_db_open_item_func(
spider_fields *fields
);
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
int spider_db_open_item_sum_func(
Item_sum *item_sum,
ha_spider *spider,
......@@ -955,7 +948,6 @@ int spider_db_open_item_sum_func(
bool use_fields,
spider_fields *fields
);
#endif
int spider_db_open_item_ident(
Item_ident *item_ident,
......@@ -1056,7 +1048,6 @@ int spider_db_append_condition(
bool test_flg
);
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
int spider_db_append_update_columns(
ha_spider *spider,
spider_string *str,
......@@ -1066,14 +1057,11 @@ int spider_db_append_update_columns(
bool use_fields,
spider_fields *fields
);
#endif
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
bool spider_db_check_select_colum_in_group(
st_select_lex *select_lex,
Field *field
);
#endif
uint spider_db_check_ft_idx(
Item_func *item_func,
......
......@@ -17,7 +17,6 @@
#define MYSQL_SERVER 1
#include <my_global.h>
#include "mysql_version.h"
#include "spd_environ.h"
#include "sql_priv.h"
#include "probes_mysql.h"
#include "sql_class.h"
......@@ -40,7 +39,6 @@ spider_db_result::spider_db_result(
DBUG_VOID_RETURN;
}
#ifdef HA_HAS_CHECKSUM_EXTENDED
int spider_db_result::fetch_table_checksum(
ha_spider *spider
) {
......@@ -48,7 +46,6 @@ int spider_db_result::fetch_table_checksum(
DBUG_PRINT("info",("spider this=%p", this));
DBUG_RETURN(0);
}
#endif
uint spider_db_result::limit_mode()
{
......@@ -158,7 +155,6 @@ uint spider_db_util::limit_mode()
DBUG_RETURN(0);
}
#ifdef HA_HAS_CHECKSUM_EXTENDED
bool spider_db_share::checksum_support()
{
DBUG_ENTER("spider_db_share::checksum_support");
......@@ -173,9 +169,7 @@ int spider_db_handler::checksum_table(
DBUG_PRINT("info",("spider this=%p", this));
DBUG_RETURN(0);
}
#endif
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
bool spider_db_handler::check_direct_update(
st_select_lex *select_lex,
longlong select_limit,
......@@ -209,4 +203,3 @@ bool spider_db_handler::check_direct_delete(
}
DBUG_RETURN(FALSE);
}
#endif
......@@ -26,9 +26,6 @@
#define SPIDER_DB_WRAPPER_MARIADB "mariadb"
#define PLUGIN_VAR_CAN_MEMALLOC
/*
#define HASH_UPDATE_WITH_HASH_VALUE
*/
#define SPIDER_HAS_DISCOVER_TABLE_STRUCTURE
#define SPIDER_HAS_APPEND_FOR_SINGLE_QUOTE
......@@ -760,7 +757,6 @@ class spider_db_util
bool use_fields,
spider_fields *fields
) = 0;
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
virtual int open_item_sum_func(
Item_sum *item_sum,
ha_spider *spider,
......@@ -770,7 +766,6 @@ class spider_db_util
bool use_fields,
spider_fields *fields
) = 0;
#endif
virtual int append_escaped_util(
spider_string *to,
String *from
......@@ -872,11 +867,9 @@ class spider_db_result
int mode,
ha_rows &records
) = 0;
#ifdef HA_HAS_CHECKSUM_EXTENDED
virtual int fetch_table_checksum(
ha_spider *spider
);
#endif
virtual int fetch_table_cardinality(
int mode,
TABLE *table,
......@@ -1117,9 +1110,7 @@ class spider_db_share
spider_string *str
) = 0;
#endif
#ifdef HA_HAS_CHECKSUM_EXTENDED
virtual bool checksum_support();
#endif
};
class spider_db_handler
......@@ -1186,7 +1177,6 @@ class spider_db_handler
virtual int append_update_part() = 0;
virtual int append_delete_part() = 0;
virtual int append_update_set_part() = 0;
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
virtual int append_direct_update_set_part() = 0;
virtual int append_dup_update_pushdown_part(
const char *alias,
......@@ -1197,7 +1187,6 @@ class spider_db_handler
uint alias_length
) = 0;
virtual int check_update_columns_part() = 0;
#endif
virtual int append_select_part(
ulong sql_type
) = 0;
......@@ -1279,26 +1268,22 @@ class spider_db_handler
const char *alias,
uint alias_length
) = 0;
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
virtual int append_sum_select_part(
ulong sql_type,
const char *alias,
uint alias_length
) = 0;
#endif
virtual void set_order_pos(
ulong sql_type
) = 0;
virtual void set_order_to_pos(
ulong sql_type
) = 0;
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
virtual int append_group_by_part(
const char *alias,
uint alias_length,
ulong sql_type
) = 0;
#endif
virtual int append_key_order_for_merge_with_alias_part(
const char *alias,
uint alias_length,
......@@ -1463,11 +1448,9 @@ class spider_db_handler
virtual int show_records(
int link_idx
) = 0;
#ifdef HA_HAS_CHECKSUM_EXTENDED
virtual int checksum_table(
int link_idx
);
#endif
virtual int show_last_insert_id(
int link_idx,
ulonglong &last_insert_id
......@@ -1589,7 +1572,6 @@ class spider_db_handler
ulong sql_type
) = 0;
#endif
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
virtual bool check_direct_update(
st_select_lex *select_lex,
longlong select_limit,
......@@ -1600,7 +1582,6 @@ class spider_db_handler
longlong select_limit,
longlong offset_limit
);
#endif
};
class spider_db_copy_table
......@@ -1725,9 +1706,7 @@ typedef struct st_spider_position
uint pos_mode;
bool use_position;
bool mrr_with_cnt;
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
bool direct_aggregate;
#endif
uint sql_kind;
uchar *position_bitmap;
st_spider_ft_info *ft_first;
......@@ -1830,12 +1809,10 @@ typedef struct st_spider_result_list
/* the limit_offeset, without where condition */
bool direct_limit_offset;
bool direct_distinct;
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
bool direct_aggregate;
bool snap_mrr_with_cnt;
bool snap_direct_aggregate;
SPIDER_DB_ROW *snap_row;
#endif
bool in_cmp_ref;
bool set_split_read;
bool insert_dup_update_pushdown;
......
This diff is collapsed.
......@@ -145,7 +145,6 @@ class spider_db_mbase_util: public spider_db_util
spider_fields *fields
);
public:
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
int open_item_sum_func(
Item_sum *item_sum,
ha_spider *spider,
......@@ -155,7 +154,6 @@ class spider_db_mbase_util: public spider_db_util
bool use_fields,
spider_fields *fields
) override;
#endif
int append_escaped_util(
spider_string *to,
String *from
......@@ -324,11 +322,9 @@ class spider_db_mbase_result: public spider_db_result
int mode,
ha_rows &records
) override;
#ifdef HA_HAS_CHECKSUM_EXTENDED
int fetch_table_checksum(
ha_spider *spider
) override;
#endif
int fetch_table_cardinality(
int mode,
TABLE *table,
......@@ -628,9 +624,7 @@ class spider_mbase_share: public spider_db_share
spider_string *db_names_str;
/* fixme: this field looks useless */
spider_string *db_table_str;
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type *db_table_str_hash_value;
#endif
uint table_nm_max_length;
uint db_nm_max_length;
spider_string *column_name_str;
......@@ -677,9 +671,7 @@ class spider_mbase_share: public spider_db_share
spider_string *str
) override;
#endif
#ifdef HA_HAS_CHECKSUM_EXTENDED
bool checksum_support() override;
#endif
protected:
int create_table_names_str();
void free_table_names_str();
......@@ -866,7 +858,6 @@ class spider_mbase_handler: public spider_db_handler
int append_update_set(
spider_string *str
);
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
int append_direct_update_set_part() override;
int append_direct_update_set(
spider_string *str
......@@ -885,7 +876,6 @@ class spider_mbase_handler: public spider_db_handler
const char *alias,
uint alias_length
);
#endif
int append_select_part(
ulong sql_type
) override;
......@@ -1082,7 +1072,6 @@ class spider_mbase_handler: public spider_db_handler
const char *alias,
uint alias_length
);
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
int append_sum_select_part(
ulong sql_type,
const char *alias,
......@@ -1093,14 +1082,12 @@ class spider_mbase_handler: public spider_db_handler
const char *alias,
uint alias_length
);
#endif
void set_order_pos(
ulong sql_type
) override;
void set_order_to_pos(
ulong sql_type
) override;
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
int append_group_by_part(
const char *alias,
uint alias_length,
......@@ -1111,7 +1098,6 @@ class spider_mbase_handler: public spider_db_handler
const char *alias,
uint alias_length
);
#endif
int append_key_order_for_merge_with_alias_part(
const char *alias,
uint alias_length,
......@@ -1412,11 +1398,9 @@ class spider_mbase_handler: public spider_db_handler
int show_records(
int link_idx
) override;
#ifdef HA_HAS_CHECKSUM_EXTENDED
int checksum_table(
int link_idx
) override;
#endif
int show_last_insert_id(
int link_idx,
ulonglong &last_insert_id
......@@ -1563,7 +1547,6 @@ class spider_mbase_handler: public spider_db_handler
spider_fields *fields
);
#endif
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
bool check_direct_update(
st_select_lex *select_lex,
longlong select_limit,
......@@ -1574,7 +1557,6 @@ class spider_mbase_handler: public spider_db_handler
longlong select_limit,
longlong offset_limit
) override;
#endif
};
class spider_mysql_handler: public spider_mbase_handler
......
This diff is collapsed.
......@@ -125,7 +125,6 @@ class spider_db_oracle_util: public spider_db_util
bool use_fields,
spider_fields *fields
);
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
int open_item_sum_func(
Item_sum *item_sum,
ha_spider *spider,
......@@ -135,7 +134,6 @@ class spider_db_oracle_util: public spider_db_util
bool use_fields,
spider_fields *fields
);
#endif
size_t escape_string(
char *to,
const char *from,
......@@ -523,9 +521,7 @@ class spider_oracle_share: public spider_db_share
spider_string *db_names_str;
spider_string *db_table_str;
spider_string *nextval_str;
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type *db_table_str_hash_value;
#endif
uint table_nm_max_length;
uint db_nm_max_length;
uint nextval_max_length;
......@@ -745,7 +741,6 @@ class spider_oracle_handler: public spider_db_handler
int append_update_set(
spider_string *str
);
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
int append_direct_update_set_part();
int append_direct_update_set(
spider_string *str
......@@ -764,7 +759,6 @@ class spider_oracle_handler: public spider_db_handler
const char *alias,
uint alias_length
);
#endif
int append_select_part(
ulong sql_type
);
......@@ -961,7 +955,6 @@ class spider_oracle_handler: public spider_db_handler
const char *alias,
uint alias_length
);
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
int append_sum_select_part(
ulong sql_type,
const char *alias,
......@@ -972,14 +965,12 @@ class spider_oracle_handler: public spider_db_handler
const char *alias,
uint alias_length
);
#endif
void set_order_pos(
ulong sql_type
);
void set_order_to_pos(
ulong sql_type
);
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
int append_group_by_part(
const char *alias,
uint alias_length,
......@@ -990,7 +981,6 @@ class spider_oracle_handler: public spider_db_handler
const char *alias,
uint alias_length
);
#endif
int append_key_order_for_merge_with_alias_part(
const char *alias,
uint alias_length,
......
......@@ -17,7 +17,6 @@
#define MYSQL_SERVER 1
#include <my_global.h>
#include "mysql_version.h"
#include "spd_environ.h"
#include "sql_priv.h"
#include "probes_mysql.h"
#include "sql_class.h"
......@@ -279,10 +278,8 @@ int spider_udf_direct_sql_create_conn_key(
spider_create_conn_key_add_one(&counter, &tmp_name, direct_sql->tgt_filedsn);
spider_create_conn_key_add_one(&counter, &tmp_name, direct_sql->tgt_driver);
tmp_name++;
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
direct_sql->conn_key_hash_value = my_calc_hash(&spider_open_connections,
(uchar*) direct_sql->conn_key, direct_sql->conn_key_length);
#endif
DBUG_RETURN(0);
}
......@@ -457,14 +454,9 @@ SPIDER_CONN *spider_udf_direct_sql_create_conn(
pthread_mutex_unlock(&spider_conn_id_mutex);
pthread_mutex_lock(&spider_ipport_conn_mutex);
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
if ((ip_port_conn = (SPIDER_IP_PORT_CONN*) my_hash_search_using_hash_value(
&spider_ipport_conns, conn->conn_key_hash_value,
(uchar*)conn->conn_key, conn->conn_key_length)))
#else
if ((ip_port_conn = (SPIDER_IP_PORT_CONN*) my_hash_search(
&spider_ipport_conns, (uchar*)conn->conn_key, conn->conn_key_length)))
#endif
{ /* exists, +1 */
pthread_mutex_unlock(&spider_ipport_conn_mutex);
pthread_mutex_lock(&ip_port_conn->mutex);
......@@ -521,18 +513,11 @@ SPIDER_CONN *spider_udf_direct_sql_get_conn(
SPIDER_CONN *conn = NULL;
DBUG_ENTER("spider_udf_direct_sql_get_conn");
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
if (
!(conn = (SPIDER_CONN*) my_hash_search_using_hash_value(
&trx->trx_conn_hash, direct_sql->conn_key_hash_value,
(uchar*) direct_sql->conn_key, direct_sql->conn_key_length))
)
#else
if (
!(conn = (SPIDER_CONN*) my_hash_search(&trx->trx_conn_hash,
(uchar*) direct_sql->conn_key, direct_sql->conn_key_length))
)
#endif
{
if (
(
......@@ -541,14 +526,9 @@ SPIDER_CONN *spider_udf_direct_sql_get_conn(
)
) {
pthread_mutex_lock(&spider_conn_mutex);
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
if (!(conn = (SPIDER_CONN*) my_hash_search_using_hash_value(
&spider_open_connections, direct_sql->conn_key_hash_value,
(uchar*) direct_sql->conn_key, direct_sql->conn_key_length)))
#else
if (!(conn = (SPIDER_CONN*) my_hash_search(&spider_open_connections,
(uchar*) direct_sql->conn_key, direct_sql->conn_key_length)))
#endif
{
pthread_mutex_unlock(&spider_conn_mutex);
DBUG_PRINT("info",("spider create new conn"));
......@@ -556,12 +536,7 @@ SPIDER_CONN *spider_udf_direct_sql_get_conn(
error_num)))
goto error;
} else {
#ifdef HASH_UPDATE_WITH_HASH_VALUE
my_hash_delete_with_hash_value(&spider_open_connections,
conn->conn_key_hash_value, (uchar*) conn);
#else
my_hash_delete(&spider_open_connections, (uchar*) conn);
#endif
pthread_mutex_unlock(&spider_conn_mutex);
DBUG_PRINT("info",("spider get global conn"));
}
......@@ -575,12 +550,7 @@ SPIDER_CONN *spider_udf_direct_sql_get_conn(
conn->priority = direct_sql->priority;
uint old_elements = trx->trx_conn_hash.array.max_element;
#ifdef HASH_UPDATE_WITH_HASH_VALUE
if (my_hash_insert_with_hash_value(&trx->trx_conn_hash,
direct_sql->conn_key_hash_value, (uchar*) conn))
#else
if (my_hash_insert(&trx->trx_conn_hash, (uchar*) conn))
#endif
{
spider_free_conn(conn);
*error_num = HA_ERR_OUT_OF_MEM;
......
/* Copyright (C) 2008-2020 Kentoku Shiba
Copyright (C) 2017-2020 MariaDB corp
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/*
Define functionality offered by MySQL or MariaDB
*/
#ifndef SPD_ENVIRON_INCLUDED
#define SPIDER_HANDLER_START_BULK_INSERT_HAS_FLAGS
#define SPIDER_SUPPORT_CREATE_OR_REPLACE_TABLE
#define SPIDER_NET_HAS_THD
#define HANDLER_HAS_TOP_TABLE_FIELDS
#define HANDLER_HAS_DIRECT_UPDATE_ROWS
#define HANDLER_HAS_DIRECT_AGGREGATE
#define PARTITION_HAS_GET_PART_SPEC
#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
#define SPIDER_UPDATE_ROW_HAS_CONST_NEW_DATA
#define SPIDER_MDEV_16246
#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
#define SPIDER_I_S_USE_SHOW_FOR_COLUMN
#endif /* SPD_ENVIRON_INCLUDED */
......@@ -17,7 +17,6 @@
#define MYSQL_SERVER 1
#include <my_global.h>
#include "mysql_version.h"
#include "spd_environ.h"
#include "sql_priv.h"
#include "probes_mysql.h"
#include "sql_class.h"
......@@ -1033,10 +1032,8 @@ static int spider_prepare_init_scan(
for (link_idx = 0; link_idx < (int) share->link_count; ++link_idx)
spider->sql_kind[link_idx] = SPIDER_SQL_KIND_SQL;
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
spider->do_direct_update = FALSE;
spider->direct_update_kinds = 0;
#endif
spider_get_select_limit(spider, &select_lex, &select_limit, &offset_limit);
direct_order_limit = spider_param_direct_order_limit(thd,
share->direct_order_limit);
......
......@@ -17,7 +17,6 @@
#define MYSQL_SERVER 1
#include <my_global.h>
#include "mysql_version.h"
#include "spd_environ.h"
#include "sql_priv.h"
#include "probes_mysql.h"
#include "sql_class.h"
......@@ -42,7 +41,6 @@ static struct st_mysql_storage_engine spider_i_s_info =
{ MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION };
namespace Show {
#ifdef SPIDER_I_S_USE_SHOW_FOR_COLUMN
static ST_FIELD_INFO spider_i_s_alloc_mem_fields_info[] =
{
Column("ID", ULong(10), NOT_NULL, "id"),
......@@ -55,27 +53,6 @@ static ST_FIELD_INFO spider_i_s_alloc_mem_fields_info[] =
Column("FREE_MEM_COUNT", ULonglong(20), NULLABLE, "free_mem_count"),
CEnd()
};
#else
static ST_FIELD_INFO spider_i_s_alloc_mem_fields_info[] =
{
{"ID", 10, MYSQL_TYPE_LONG, 0, MY_I_S_UNSIGNED, "id", SKIP_OPEN_TABLE},
{"FUNC_NAME", 64, MYSQL_TYPE_STRING, 0,
MY_I_S_MAYBE_NULL, "func_name", SKIP_OPEN_TABLE},
{"FILE_NAME", 64, MYSQL_TYPE_STRING, 0,
MY_I_S_MAYBE_NULL, "file_name", SKIP_OPEN_TABLE},
{"LINE_NO", 10, MYSQL_TYPE_LONG, 0,
MY_I_S_UNSIGNED | MY_I_S_MAYBE_NULL, "line_no", SKIP_OPEN_TABLE},
{"TOTAL_ALLOC_MEM", 20, MYSQL_TYPE_LONGLONG, 0,
MY_I_S_UNSIGNED | MY_I_S_MAYBE_NULL, "total_alloc_mem", SKIP_OPEN_TABLE},
{"CURRENT_ALLOC_MEM", 20, MYSQL_TYPE_LONGLONG, 0,
MY_I_S_MAYBE_NULL, "current_alloc_mem", SKIP_OPEN_TABLE},
{"ALLOC_MEM_COUNT", 20, MYSQL_TYPE_LONGLONG, 0,
MY_I_S_UNSIGNED | MY_I_S_MAYBE_NULL, "alloc_mem_count", SKIP_OPEN_TABLE},
{"FREE_MEM_COUNT", 20, MYSQL_TYPE_LONGLONG, 0,
MY_I_S_UNSIGNED | MY_I_S_MAYBE_NULL, "free_mem_count", SKIP_OPEN_TABLE},
{NULL, 0, MYSQL_TYPE_STRING, 0, 0, NULL, 0}
};
#endif
} // namespace Show
static int spider_i_s_alloc_mem_fill_table(
......@@ -183,7 +160,6 @@ struct st_maria_plugin spider_i_s_alloc_mem_maria =
extern SPIDER_DBTON spider_dbton[SPIDER_DBTON_SIZE];
namespace Show {
#ifdef SPIDER_I_S_USE_SHOW_FOR_COLUMN
static ST_FIELD_INFO spider_i_s_wrapper_protocols_fields_info[] =
{
Column("WRAPPER_NAME", Varchar(NAME_CHAR_LEN), NOT_NULL, ""),
......@@ -192,16 +168,6 @@ static ST_FIELD_INFO spider_i_s_wrapper_protocols_fields_info[] =
Column("WRAPPER_MATURITY", Varchar(12), NOT_NULL, ""),
CEnd()
};
#else
static ST_FIELD_INFO spider_i_s_wrapper_protocols_fields_info[] =
{
{"WRAPPER_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
{"WRAPPER_VERSION", 20, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
{"WRAPPER_DESCRIPTION", 65535, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN_TABLE},
{"WRAPPER_MATURITY", 12, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
{0, 0, MYSQL_TYPE_STRING, 0, 0, 0, 0}
};
#endif
} // namespace Show
static int spider_i_s_wrapper_protocols_fill_table(
......
......@@ -90,8 +90,6 @@
#define SPIDER_ENGINE_CONDITION_PUSHDOWN_IS_ALWAYS_ON
#define SPIDER_XID_USES_xid_cache_iterate
#define SPIDER_Item_args_arg_count_IS_PROTECTED
#define SPIDER_Item_func_conv_charset_conv_charset collation.collation
#define SPIDER_WITHOUT_HA_STATISTIC_INCREMENT
......@@ -128,8 +126,6 @@
#define SPIDER_item_name_length(A) (A)->name.length
const LEX_CSTRING SPIDER_empty_string = {"", 0};
#define SPIDER_HAS_HASH_VALUE_TYPE
#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()
......@@ -498,9 +494,7 @@ typedef struct st_spider_link_for_hash
ha_spider *spider;
int link_idx;
spider_string *db_table_str;
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type db_table_str_hash_value;
#endif
} SPIDER_LINK_FOR_HASH;
/* alter table */
......@@ -510,9 +504,7 @@ typedef struct st_spider_alter_table
char *table_name;
uint table_name_length;
char *tmp_char;
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type table_name_hash_value;
#endif
longlong tmp_priority;
uint link_count;
uint all_link_count;
......@@ -614,9 +606,7 @@ typedef struct st_spider_conn
uint conn_kind;
char *conn_key;
uint conn_key_length;
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type conn_key_hash_value;
#endif
int link_idx;
spider_db_conn *db_conn;
uint opened_handlers;
......@@ -829,9 +819,7 @@ typedef struct st_spider_lgtm_tblhnd_share
{
char *table_name;
uint table_name_length;
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type table_path_hash_value;
#endif
pthread_mutex_t auto_increment_mutex;
volatile bool auto_increment_init;
volatile ulonglong auto_increment_lclval;
......@@ -854,9 +842,7 @@ typedef struct st_spider_wide_share
{
char *table_name;
uint table_name_length;
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type table_path_hash_value;
#endif
uint use_count;
THR_LOCK lock;
pthread_mutex_t sts_mutex;
......@@ -906,10 +892,8 @@ typedef struct st_spider_wide_handler
#ifdef WITH_PARTITION_STORAGE_ENGINE
SPIDER_PARTITION_HANDLER *partition_handler;
#endif
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
List<Item> *direct_update_fields;
List<Item> *direct_update_values;
#endif
TABLE_SHARE *top_share;
enum thr_lock_type lock_type;
uchar lock_table_type;
......@@ -918,11 +902,9 @@ typedef struct st_spider_wide_handler
int cond_check_error;
uint sql_command;
uint top_table_fields;
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
#ifdef INFO_KIND_FORCE_LIMIT_BEGIN
longlong info_limit;
#endif
#endif
#ifdef HA_CAN_BULK_ACCESS
ulonglong external_lock_cnt;
#endif
......@@ -963,9 +945,7 @@ typedef struct st_spider_transaction
bool updated_in_this_trx;
THD *thd;
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type thd_hash_value;
#endif
XID xid;
HASH trx_conn_hash;
uint trx_conn_hash_id;
......@@ -1060,11 +1040,9 @@ typedef struct st_spider_share
pthread_mutex_t crd_mutex;
TABLE_SHARE *table_share;
SPIDER_LGTM_TBLHND_SHARE *lgtm_tblhnd_share;
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type table_name_hash_value;
#ifdef WITH_PARTITION_STORAGE_ENGINE
my_hash_value_type table_path_hash_value;
#endif
#endif
volatile bool init;
......@@ -1239,9 +1217,7 @@ typedef struct st_spider_share
char *bka_engine;
int bka_engine_length;
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type *conn_keys_hash_value;
#endif
char **server_names;
char **tgt_table_names;
char **tgt_dbs;
......@@ -1410,9 +1386,7 @@ typedef struct st_spider_init_error_table
{
char *table_name;
uint table_name_length;
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type table_name_hash_value;
#endif
bool init_error_with_message;
char init_error_msg[MYSQL_ERRMSG_SIZE];
volatile int init_error;
......@@ -1493,9 +1467,7 @@ typedef struct st_spider_direct_sql
uint tgt_driver_length;
uint conn_key_length;
uint dbton_id;
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type conn_key_hash_value;
#endif
pthread_mutex_t *bg_mutex;
pthread_cond_t *bg_cond;
......@@ -1534,9 +1506,7 @@ typedef struct st_spider_table_mon_list
{
char *key;
uint key_length;
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type key_hash_value;
#endif
uint use_count;
uint mutex_hash;
......@@ -1691,9 +1661,7 @@ char *spider_create_string(
typedef struct st_spider_ip_port_conn {
char *key;
size_t key_len;
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type key_hash_value;
#endif
char *remote_ip_str;
long remote_port;
ulong ip_port_count;
......
......@@ -17,7 +17,6 @@
#define MYSQL_SERVER 1
#include <my_global.h>
#include "mysql_version.h"
#include "spd_environ.h"
#include "sql_priv.h"
#include "probes_mysql.h"
#include "sql_class.h"
......
......@@ -37,7 +37,6 @@
#define MYSQL_SERVER 1
#include <my_global.h>
#include "mysql_version.h"
#include "spd_environ.h"
#include "sql_priv.h"
#include "probes_mysql.h"
#include "sql_class.h"
......@@ -126,7 +125,6 @@ static void spider_trx_status_var(THD *thd, SHOW_VAR *var, void *buff,
}
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
static int spider_direct_update(THD *thd, SHOW_VAR *var, void *buff,
system_status_var *, enum_var_type)
{
......@@ -142,7 +140,6 @@ static int spider_direct_delete(THD *thd, SHOW_VAR *var, void *buff,
spider_trx_status_var(thd, var, buff, &SPIDER_TRX::direct_delete_count);
DBUG_RETURN(0);
}
#endif
static int spider_direct_order_limit(THD *thd, SHOW_VAR *var, void *buff,
system_status_var *, enum_var_type)
......@@ -174,7 +171,6 @@ struct st_mysql_show_var spider_status_variables[] =
(char *) &spider_mon_table_cache_version, SHOW_LONGLONG},
{"Spider_mon_table_cache_version_req",
(char *) &spider_mon_table_cache_version_req, SHOW_LONGLONG},
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
#ifdef SPIDER_HAS_SHOW_SIMPLE_FUNC
{"Spider_direct_update", (char *) &spider_direct_update, SHOW_SIMPLE_FUNC},
{"Spider_direct_delete", (char *) &spider_direct_delete, SHOW_SIMPLE_FUNC},
......@@ -182,7 +178,6 @@ struct st_mysql_show_var spider_status_variables[] =
{"Spider_direct_update", (char *) &spider_direct_update, SHOW_FUNC},
{"Spider_direct_delete", (char *) &spider_direct_delete, SHOW_FUNC},
#endif
#endif
#ifdef SPIDER_HAS_SHOW_SIMPLE_FUNC
{"Spider_direct_order_limit",
(char *) &spider_direct_order_limit, SHOW_SIMPLE_FUNC},
......
......@@ -17,7 +17,6 @@
#define MYSQL_SERVER 1
#include <my_global.h>
#include "mysql_version.h"
#include "spd_environ.h"
#include "sql_priv.h"
#include "probes_mysql.h"
#include "sql_class.h"
......@@ -105,9 +104,7 @@ SPIDER_TABLE_MON_LIST *spider_get_ping_table_mon_list(
SPIDER_TABLE_MON_LIST *table_mon_list;
MEM_ROOT mem_root;
ulonglong mon_table_cache_version;
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type hash_value;
#endif
DBUG_ENTER("spider_get_ping_table_mon_list");
/* Reset the cache if the version does not match the requirement */
if (spider_mon_table_cache_version != spider_mon_table_cache_version_req)
......@@ -129,27 +126,17 @@ SPIDER_TABLE_MON_LIST *spider_get_ping_table_mon_list(
spider_param_udf_table_mon_mutex_count());
DBUG_PRINT("info",("spider hash key=%s", str->c_ptr()));
DBUG_PRINT("info",("spider hash key length=%u", str->length()));
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
hash_value = my_calc_hash(
&spider_udf_table_mon_list_hash[mutex_hash],
(uchar*) str->c_ptr(), str->length());
#endif
pthread_mutex_lock(&spider_udf_table_mon_mutexes[mutex_hash]);
mon_table_cache_version = (ulonglong) spider_mon_table_cache_version;
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
if (!(table_mon_list = (SPIDER_TABLE_MON_LIST *)
my_hash_search_using_hash_value(
&spider_udf_table_mon_list_hash[mutex_hash], hash_value,
(uchar*) str->c_ptr(), str->length())) ||
table_mon_list->mon_table_cache_version != mon_table_cache_version
)
#else
if (!(table_mon_list = (SPIDER_TABLE_MON_LIST *) my_hash_search(
&spider_udf_table_mon_list_hash[mutex_hash],
(uchar*) str->c_ptr(), str->length())) ||
table_mon_list->mon_table_cache_version != mon_table_cache_version
)
#endif
{
/* If table_mon_list is found but the cache version does not
match, remove it from the hash and free it. */
......@@ -171,17 +158,9 @@ SPIDER_TABLE_MON_LIST *spider_get_ping_table_mon_list(
table_mon_list->mon_table_cache_version = mon_table_cache_version;
uint old_elements =
spider_udf_table_mon_list_hash[mutex_hash].array.max_element;
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
table_mon_list->key_hash_value = hash_value;
#endif
#ifdef HASH_UPDATE_WITH_HASH_VALUE
if (my_hash_insert_with_hash_value(
&spider_udf_table_mon_list_hash[mutex_hash],
hash_value, (uchar*) table_mon_list))
#else
if (my_hash_insert(&spider_udf_table_mon_list_hash[mutex_hash],
(uchar*) table_mon_list))
#endif
{
spider_ping_table_free_mon_list(table_mon_list);
*error_num = HA_ERR_OUT_OF_MEM;
......@@ -230,13 +209,8 @@ void spider_release_ping_table_mon_list_loop(
SPIDER_TABLE_MON_LIST *table_mon_list
) {
DBUG_ENTER("spider_release_ping_table_mon_list_loop");
#ifdef HASH_UPDATE_WITH_HASH_VALUE
my_hash_delete_with_hash_value(&spider_udf_table_mon_list_hash[mutex_hash],
table_mon_list->key_hash_value, (uchar*) table_mon_list);
#else
my_hash_delete(&spider_udf_table_mon_list_hash[mutex_hash],
(uchar*) table_mon_list);
#endif
while (TRUE)
{
if (table_mon_list->use_count)
......@@ -280,22 +254,14 @@ int spider_release_ping_table_mon_list(
mutex_hash = spider_udf_calc_hash(conv_name_str.c_ptr_safe(),
spider_param_udf_table_mon_mutex_count());
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type hash_value = my_calc_hash(
&spider_udf_table_mon_list_hash[mutex_hash],
(uchar*) conv_name_str.c_ptr(), conv_name_str.length());
#endif
pthread_mutex_lock(&spider_udf_table_mon_mutexes[mutex_hash]);
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
if ((table_mon_list = (SPIDER_TABLE_MON_LIST *)
my_hash_search_using_hash_value(
&spider_udf_table_mon_list_hash[mutex_hash], hash_value,
(uchar*) conv_name_str.c_ptr(), conv_name_str.length())))
#else
if ((table_mon_list = (SPIDER_TABLE_MON_LIST *) my_hash_search(
&spider_udf_table_mon_list_hash[mutex_hash],
(uchar*) conv_name_str.c_ptr(), conv_name_str.length())))
#endif
spider_release_ping_table_mon_list_loop(mutex_hash, table_mon_list);
pthread_mutex_unlock(&spider_udf_table_mon_mutexes[mutex_hash]);
my_afree(buf);
......
......@@ -16,7 +16,6 @@
#define MYSQL_SERVER 1
#include <my_global.h>
#include "mysql_version.h"
#include "spd_environ.h"
#include "sql_priv.h"
#include "probes_mysql.h"
#include "sql_class.h"
......
This diff is collapsed.
......@@ -175,7 +175,6 @@ int spider_create_conn_keys(
SPIDER_SHARE *share
);
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
SPIDER_LGTM_TBLHND_SHARE *spider_get_lgtm_tblhnd_share(
const char *table_name,
uint table_name_length,
......@@ -184,15 +183,6 @@ SPIDER_LGTM_TBLHND_SHARE *spider_get_lgtm_tblhnd_share(
bool need_to_create,
int *error_num
);
#else
SPIDER_LGTM_TBLHND_SHARE *spider_get_lgtm_tblhnd_share(
const char *table_name,
uint table_name_length,
bool locked,
bool need_to_create,
int *error_num
);
#endif
void spider_free_lgtm_tblhnd_share_alloc(
SPIDER_LGTM_TBLHND_SHARE *lgtm_tblhnd_share,
......@@ -205,9 +195,7 @@ SPIDER_SHARE *spider_create_share(
#ifdef WITH_PARTITION_STORAGE_ENGINE
partition_info *part_info,
#endif
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type hash_value,
#endif
int *error_num
);
......@@ -443,7 +431,6 @@ bool spider_check_direct_order_limit(
ha_spider *spider
);
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
bool spider_all_part_in_order(
ORDER *order,
TABLE *table
......@@ -453,7 +440,6 @@ Field *spider_field_exchange(
handler *handler,
Field *field
);
#endif
int spider_set_direct_limit_offset(
ha_spider *spider
......
......@@ -17,7 +17,6 @@
#define MYSQL_SERVER 1
#include <my_global.h>
#include "mysql_version.h"
#include "spd_environ.h"
#include "sql_priv.h"
#include "probes_mysql.h"
#include "sql_class.h"
......@@ -379,12 +378,7 @@ void spider_free_trx_alter_table_alloc(
SPIDER_ALTER_TABLE *alter_table
) {
DBUG_ENTER("spider_free_trx_alter_table_alloc");
#ifdef HASH_UPDATE_WITH_HASH_VALUE
my_hash_delete_with_hash_value(&trx->trx_alter_table_hash,
alter_table->table_name_hash_value, (uchar*) alter_table);
#else
my_hash_delete(&trx->trx_alter_table_hash, (uchar*) alter_table);
#endif
if (alter_table->tmp_char)
spider_free(trx, alter_table->tmp_char, MYF(0));
spider_free(trx, alter_table, MYF(0));
......@@ -601,11 +595,9 @@ int spider_create_trx_alter_table(
alter_table->table_name = tmp_name;
memcpy(alter_table->table_name, share->table_name, share->table_name_length);
alter_table->table_name_length = share->table_name_length;
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
DBUG_PRINT("info",("spider table_name_hash_value=%u",
share->table_name_hash_value));
alter_table->table_name_hash_value = share->table_name_hash_value;
#endif
alter_table->tmp_priority = share->priority;
alter_table->link_count = share->link_count;
alter_table->all_link_count = share->all_link_count;
......@@ -834,12 +826,7 @@ int spider_create_trx_alter_table(
share_alter->tmp_link_statuses_length;
old_elements = trx->trx_alter_table_hash.array.max_element;
#ifdef HASH_UPDATE_WITH_HASH_VALUE
if (my_hash_insert_with_hash_value(&trx->trx_alter_table_hash,
alter_table->table_name_hash_value, (uchar*) alter_table))
#else
if (my_hash_insert(&trx->trx_alter_table_hash, (uchar*) alter_table))
#endif
{
error_num = HA_ERR_OUT_OF_MEM;
goto error;
......@@ -1241,13 +1228,11 @@ SPIDER_TRX *spider_get_trx(
trx->trx_ha_hash.array.size_of_element);
trx->thd = (THD*) thd;
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
if (thd)
trx->thd_hash_value = my_calc_hash(&spider_allocated_thds,
(uchar*) thd, sizeof(THD *));
else
trx->thd_hash_value = 0;
#endif
pthread_mutex_lock(&spider_thread_id_mutex);
trx->spider_thread_id = spider_thread_id;
++spider_thread_id;
......@@ -1334,12 +1319,7 @@ SPIDER_TRX *spider_get_trx(
{
pthread_mutex_lock(&spider_allocated_thds_mutex);
uint old_elements = spider_allocated_thds.array.max_element;
#ifdef HASH_UPDATE_WITH_HASH_VALUE
if (my_hash_insert_with_hash_value(&spider_allocated_thds,
trx->thd_hash_value, (uchar*) thd))
#else
if (my_hash_insert(&spider_allocated_thds, (uchar*) thd))
#endif
{
pthread_mutex_unlock(&spider_allocated_thds_mutex);
goto error_allocated_thds_insert;
......@@ -1445,12 +1425,7 @@ int spider_free_trx(
{
if (need_lock)
pthread_mutex_lock(&spider_allocated_thds_mutex);
#ifdef HASH_UPDATE_WITH_HASH_VALUE
my_hash_delete_with_hash_value(&spider_allocated_thds,
trx->thd_hash_value, (uchar*) trx->thd);
#else
my_hash_delete(&spider_allocated_thds, (uchar*) trx->thd);
#endif
if (need_lock)
pthread_mutex_unlock(&spider_allocated_thds_mutex);
}
......@@ -1578,13 +1553,11 @@ static int spider_xa_lock(
DBUG_ENTER("spider_xa_lock");
#ifdef SPIDER_XID_USES_xid_cache_iterate
#else
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type hash_value = my_calc_hash(spd_db_att_xid_cache,
(uchar*) xid_state->xid.key(), xid_state->xid.key_length());
#ifdef XID_CACHE_IS_SPLITTED
uint idx = hash_value % *spd_db_att_xid_cache_split_num;
#endif
#endif
#endif
old_proc_info = thd_proc_info(thd, "Locking xid by Spider");
#ifdef SPIDER_XID_USES_xid_cache_iterate
......@@ -1600,33 +1573,18 @@ static int spider_xa_lock(
#else
pthread_mutex_lock(spd_db_att_LOCK_xid_cache);
#endif
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
#ifdef XID_CACHE_IS_SPLITTED
if (my_hash_search_using_hash_value(&spd_db_att_xid_cache[idx], hash_value,
xid_state->xid.key(), xid_state->xid.key_length()))
#else
if (my_hash_search_using_hash_value(spd_db_att_xid_cache, hash_value,
xid_state->xid.key(), xid_state->xid.key_length()))
#endif
#else
if (my_hash_search(spd_db_att_xid_cache,
xid_state->xid.key(), xid_state->xid.key_length()))
#endif
{
error_num = ER_SPIDER_XA_LOCKED_NUM;
goto error;
}
#ifdef HASH_UPDATE_WITH_HASH_VALUE
#ifdef XID_CACHE_IS_SPLITTED
if (my_hash_insert_with_hash_value(&spd_db_att_xid_cache[idx], hash_value,
(uchar*)xid_state))
#else
if (my_hash_insert_with_hash_value(spd_db_att_xid_cache, hash_value,
(uchar*)xid_state))
#endif
#else
if (my_hash_insert(spd_db_att_xid_cache, (uchar*)xid_state))
#endif
{
error_num = HA_ERR_OUT_OF_MEM;
goto error;
......@@ -1661,13 +1619,6 @@ static int spider_xa_unlock(
DBUG_ENTER("spider_xa_unlock");
#ifdef SPIDER_XID_USES_xid_cache_iterate
#else
#if defined(SPIDER_HAS_HASH_VALUE_TYPE) && defined(HASH_UPDATE_WITH_HASH_VALUE)
my_hash_value_type hash_value = my_calc_hash(spd_db_att_xid_cache,
(uchar*) xid_state->xid.key(), xid_state->xid.key_length());
#ifdef XID_CACHE_IS_SPLITTED
uint idx = hash_value % *spd_db_att_xid_cache_split_num;
#endif
#endif
#endif
old_proc_info = thd_proc_info(thd, "Unlocking xid by Spider");
#ifdef SPIDER_XID_USES_xid_cache_iterate
......@@ -1678,17 +1629,7 @@ static int spider_xa_unlock(
#else
pthread_mutex_lock(spd_db_att_LOCK_xid_cache);
#endif
#if defined(SPIDER_HAS_HASH_VALUE_TYPE) && defined(HASH_UPDATE_WITH_HASH_VALUE)
#ifdef XID_CACHE_IS_SPLITTED
my_hash_delete_with_hash_value(&spd_db_att_xid_cache[idx],
hash_value, (uchar *)xid_state);
#else
my_hash_delete_with_hash_value(spd_db_att_xid_cache,
hash_value, (uchar *)xid_state);
#endif
#else
my_hash_delete(spd_db_att_xid_cache, (uchar *)xid_state);
#endif
#ifdef XID_CACHE_IS_SPLITTED
pthread_mutex_unlock(&spd_db_att_LOCK_xid_cache[idx]);
#else
......@@ -3849,12 +3790,7 @@ int spider_create_trx_ha(
) {
DBUG_PRINT("info",("spider need recreate"));
need_create = TRUE;
#ifdef HASH_UPDATE_WITH_HASH_VALUE
my_hash_delete_with_hash_value(&trx->trx_ha_hash,
share->table_name_hash_value, (uchar*) trx_ha);
#else
my_hash_delete(&trx->trx_ha_hash, (uchar*) trx_ha);
#endif
spider_free(trx, trx_ha, MYF(0));
} else {
DBUG_PRINT("info",("spider use this"));
......@@ -3884,12 +3820,7 @@ int spider_create_trx_ha(
trx_ha->conn_can_fo = conn_can_fo;
trx_ha->wait_for_reusing = FALSE;
uint old_elements = trx->trx_ha_hash.array.max_element;
#ifdef HASH_UPDATE_WITH_HASH_VALUE
if (my_hash_insert_with_hash_value(&trx->trx_ha_hash,
share->table_name_hash_value, (uchar*) trx_ha))
#else
if (my_hash_insert(&trx->trx_ha_hash, (uchar*) trx_ha))
#endif
{
spider_free(trx, trx_ha, MYF(0));
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
......@@ -3921,14 +3852,9 @@ SPIDER_TRX_HA *spider_check_trx_ha(
link_bitmap_size, which is an indication of a share that has been
freed. Delete the trx_ha and return NULL on mismatch.
*/
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
if ((trx_ha = (SPIDER_TRX_HA *) my_hash_search_using_hash_value(
&trx->trx_ha_hash, share->table_name_hash_value,
(uchar*) share->table_name, share->table_name_length)))
#else
if ((trx_ha = (SPIDER_TRX_HA *) my_hash_search(&trx->trx_ha_hash,
(uchar*) share->table_name, share->table_name_length)))
#endif
{
if (trx_ha->share == share && trx_ha->link_count == share->link_count &&
trx_ha->link_bitmap_size == share->link_bitmap_size)
......
......@@ -15,7 +15,6 @@
#define MYSQL_SERVER 1
#include <my_global.h>
#include "spd_environ.h"
#include "mysql.h"
#include "spd_udf.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment