MDEV-27646 Spider: remove #ifdef SPIDER_HAS_HASH_VALUE_TYPE

This commit is contained in:
Nayuta Yanagisawa 2022-01-28 16:03:46 +09:00
parent 3beefe8f98
commit 4f353dc013
14 changed files with 0 additions and 311 deletions

View file

@ -47,9 +47,7 @@
extern handlerton *spider_hton_ptr;
extern SPIDER_DBTON spider_dbton[SPIDER_DBTON_SIZE];
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
extern HASH spider_open_tables;
#endif
extern pthread_mutex_t spider_lgtm_tblhnd_share_mutex;
/* UTC time zone for timestamp columns */
@ -9372,16 +9370,11 @@ int ha_spider::create(
memset((void*)&tmp_share, 0, sizeof(SPIDER_SHARE));
tmp_share.table_name = (char*) name;
tmp_share.table_name_length = strlen(name);
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
tmp_share.table_name_hash_value = my_calc_hash(&trx->trx_alter_table_hash,
(uchar*) tmp_share.table_name, tmp_share.table_name_length);
tmp_share.lgtm_tblhnd_share = spider_get_lgtm_tblhnd_share(
name, tmp_share.table_name_length, tmp_share.table_name_hash_value,
FALSE, TRUE, &error_num);
#else
tmp_share.lgtm_tblhnd_share = spider_get_lgtm_tblhnd_share(
name, tmp_share.table_name_length, FALSE, TRUE, &error_num);
#endif
if (!tmp_share.lgtm_tblhnd_share)
{
goto error;
@ -9451,16 +9444,10 @@ int ha_spider::create(
spider_free_trx_alter_table(trx);
trx->query_id = thd->query_id;
}
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
if (!(alter_table =
(SPIDER_ALTER_TABLE*) my_hash_search_using_hash_value(
&trx->trx_alter_table_hash, tmp_share.table_name_hash_value,
(uchar*) tmp_share.table_name, tmp_share.table_name_length)))
#else
if (!(alter_table =
(SPIDER_ALTER_TABLE*) my_hash_search(&trx->trx_alter_table_hash,
(uchar*) tmp_share.table_name, tmp_share.table_name_length)))
#endif
{
if ((error_num = spider_create_trx_alter_table(trx, &tmp_share, TRUE)))
goto error;
@ -9584,12 +9571,10 @@ int ha_spider::rename_table(
) {
int error_num, roop_count, old_link_count, from_len = strlen(from),
to_len = strlen(to), tmp_error_num;
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type from_hash_value = my_calc_hash(&spider_open_tables,
(uchar*) from, from_len);
my_hash_value_type to_hash_value = my_calc_hash(&spider_open_tables,
(uchar*) to, to_len);
#endif
THD *thd = ha_thd();
uint sql_command = thd_sql_command(thd);
SPIDER_TRX *trx;
@ -9757,22 +9742,12 @@ int ha_spider::rename_table(
}
pthread_mutex_lock(&spider_lgtm_tblhnd_share_mutex);
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
from_lgtm_tblhnd_share = spider_get_lgtm_tblhnd_share(
from, from_len, from_hash_value, TRUE, FALSE, &error_num);
#else
from_lgtm_tblhnd_share = spider_get_lgtm_tblhnd_share(
from, from_len, TRUE, FALSE, &error_num);
#endif
if (from_lgtm_tblhnd_share)
{
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
to_lgtm_tblhnd_share = spider_get_lgtm_tblhnd_share(
to, to_len, to_hash_value, TRUE, TRUE, &error_num);
#else
to_lgtm_tblhnd_share = spider_get_lgtm_tblhnd_share(
to, to_len, TRUE, TRUE, &error_num);
#endif
if (!to_lgtm_tblhnd_share)
{
pthread_mutex_unlock(&spider_lgtm_tblhnd_share_mutex);
@ -9798,13 +9773,8 @@ error:
spider_close_sys_table(current_thd, table_tables,
&open_tables_backup, need_lock);
pthread_mutex_lock(&spider_lgtm_tblhnd_share_mutex);
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
to_lgtm_tblhnd_share = spider_get_lgtm_tblhnd_share(
to, to_len, to_hash_value, TRUE, FALSE, &tmp_error_num);
#else
to_lgtm_tblhnd_share = spider_get_lgtm_tblhnd_share(
to, to_len, TRUE, FALSE, &tmp_error_num);
#endif
if (to_lgtm_tblhnd_share)
spider_free_lgtm_tblhnd_share_alloc(to_lgtm_tblhnd_share, TRUE);
pthread_mutex_unlock(&spider_lgtm_tblhnd_share_mutex);
@ -9852,22 +9822,14 @@ int ha_spider::delete_table(
{
SPIDER_LGTM_TBLHND_SHARE *lgtm_tblhnd_share;
int roop_count, old_link_count = 0, name_len = strlen(name);
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type hash_value = my_calc_hash(&spider_open_tables,
(uchar*) name, name_len);
#endif
if (
sql_command == SQLCOM_ALTER_TABLE &&
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
(alter_table =
(SPIDER_ALTER_TABLE*) my_hash_search_using_hash_value(
&trx->trx_alter_table_hash,
hash_value, (uchar*) name, name_len)) &&
#else
(alter_table =
(SPIDER_ALTER_TABLE*) my_hash_search(&trx->trx_alter_table_hash,
(uchar*) name, name_len)) &&
#endif
alter_table->now_create
)
DBUG_RETURN(0);
@ -9920,13 +9882,8 @@ int ha_spider::delete_table(
}
pthread_mutex_lock(&spider_lgtm_tblhnd_share_mutex);
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
lgtm_tblhnd_share = spider_get_lgtm_tblhnd_share(
name, name_len, hash_value, TRUE, FALSE, &error_num);
#else
lgtm_tblhnd_share = spider_get_lgtm_tblhnd_share(
name, name_len, TRUE, FALSE, &error_num);
#endif
if (lgtm_tblhnd_share)
spider_free_lgtm_tblhnd_share_alloc(lgtm_tblhnd_share, TRUE);
pthread_mutex_unlock(&spider_lgtm_tblhnd_share_mutex);

View file

@ -470,9 +470,7 @@ SPIDER_CONN *spider_create_conn(
conn->conn_key = tmp_name;
memcpy(conn->conn_key, share->conn_keys[link_idx],
share->conn_keys_lengths[link_idx]);
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
conn->conn_key_hash_value = share->conn_keys_hash_value[link_idx];
#endif
conn->tgt_host_length = share->tgt_hosts_lengths[link_idx];
conn->tgt_host = tmp_host;
memcpy(conn->tgt_host, share->tgt_hosts[link_idx],
@ -640,14 +638,9 @@ SPIDER_CONN *spider_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);
@ -720,7 +713,6 @@ SPIDER_CONN *spider_get_conn(
#ifndef DBUG_OFF
spider_print_keys(conn_key, share->conn_keys_lengths[link_idx]);
#endif
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
if (
(another &&
!(conn = (SPIDER_CONN*) my_hash_search_using_hash_value(
@ -733,16 +725,6 @@ SPIDER_CONN *spider_get_conn(
share->conn_keys_hash_value[link_idx],
(uchar*) conn_key, share->conn_keys_lengths[link_idx])))
)
#else
if (
(another &&
!(conn = (SPIDER_CONN*) my_hash_search(&trx->trx_another_conn_hash,
(uchar*) conn_key, share->conn_keys_lengths[link_idx]))) ||
(!another &&
!(conn = (SPIDER_CONN*) my_hash_search(&trx->trx_conn_hash,
(uchar*) conn_key, share->conn_keys_lengths[link_idx])))
)
#endif
{
if (
!trx->thd ||
@ -752,16 +734,10 @@ SPIDER_CONN *spider_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, share->conn_keys_hash_value[link_idx],
(uchar*) share->conn_keys[link_idx],
share->conn_keys_lengths[link_idx])))
#else
if (!(conn = (SPIDER_CONN*) my_hash_search(&spider_open_connections,
(uchar*) share->conn_keys[link_idx],
share->conn_keys_lengths[link_idx])))
#endif
{
pthread_mutex_unlock(&spider_conn_mutex);
if (spider_param_max_connections())
@ -1149,16 +1125,10 @@ int spider_conn_queue_and_merge_loop_check(
SPIDER_CONN_LOOP_CHECK *lcqptr, *lcrptr;
DBUG_ENTER("spider_conn_queue_and_merge_loop_check");
DBUG_PRINT("info", ("spider conn=%p", conn));
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
if (unlikely(!(lcqptr = (SPIDER_CONN_LOOP_CHECK *)
my_hash_search_using_hash_value(&conn->loop_check_queue,
lcptr->hash_value_to,
(uchar *) lcptr->to_name.str, lcptr->to_name.length))))
#else
if (unlikely(!(lcqptr = (SPIDER_CONN_LOOP_CHECK *) my_hash_search(
&conn->loop_check_queue,
(uchar *) lcptr->to_name.str, lcptr->to_name.length))))
#endif
{
DBUG_PRINT("info", ("spider create merged_value and insert"));
lcptr->merged_value.length = spider_unique_id.length +
@ -1197,10 +1167,8 @@ int spider_conn_queue_and_merge_loop_check(
)) {
goto error_alloc_loop_check_replace;
}
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
lcrptr->hash_value_to = lcqptr->hash_value_to;
lcrptr->hash_value_full = lcqptr->hash_value_full;
#endif
lcrptr->from_name.str = from_name;
lcrptr->from_name.length = lcqptr->from_name.length;
memcpy(from_name, lcqptr->from_name.str, lcqptr->from_name.length + 1);
@ -1438,19 +1406,12 @@ int spider_conn_queue_loop_check(
memcpy(tmp_name, to_str.str, to_str.length);
tmp_name += to_str.length;
*tmp_name = '\0';
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type hash_value = my_calc_hash(&conn->loop_checked,
(uchar *) loop_check_buf, buf_sz - 1);
#endif
pthread_mutex_lock(&conn->loop_check_mutex);
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
lcptr = (SPIDER_CONN_LOOP_CHECK *)
my_hash_search_using_hash_value(&conn->loop_checked, hash_value,
(uchar *) loop_check_buf, buf_sz - 1);
#else
lcptr = (SPIDER_CONN_LOOP_CHECK *) my_hash_search(
&conn->loop_checked, (uchar *) loop_check_buf, buf_sz - 1);
#endif
if (unlikely(
!lcptr ||
(
@ -1505,11 +1466,9 @@ int spider_conn_queue_loop_check(
lcptr->from_value.length = lex_str.length;
memcpy(from_value, lex_str.str, lex_str.length + 1);
lcptr->merged_value.str = merged_value;
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
lcptr->hash_value_to = my_calc_hash(&conn->loop_checked,
(uchar *) to_str.str, to_str.length);
lcptr->hash_value_full = hash_value;
#endif
#ifdef HASH_UPDATE_WITH_HASH_VALUE
if (unlikely(my_hash_insert_with_hash_value(&conn->loop_checked,
lcptr->hash_value_full, (uchar *) lcptr)))
@ -4178,15 +4137,9 @@ SPIDER_CONN* spider_get_conn_from_idle_connection(
set_timespec(abstime, 0);
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, share->conn_keys_hash_value[link_idx],
(uchar*) share->conn_keys[link_idx], share->conn_keys_lengths[link_idx])))
#else
if ((ip_port_conn = (SPIDER_IP_PORT_CONN*) my_hash_search(
&spider_ipport_conns,
(uchar*) share->conn_keys[link_idx], share->conn_keys_lengths[link_idx])))
#endif
{ /* exists */
pthread_mutex_unlock(&spider_ipport_conn_mutex);
pthread_mutex_lock(&ip_port_conn->mutex);
@ -4225,16 +4178,10 @@ SPIDER_CONN* spider_get_conn_from_idle_connection(
}
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, share->conn_keys_hash_value[link_idx],
(uchar*) share->conn_keys[link_idx],
share->conn_keys_lengths[link_idx])))
#else
if ((conn = (SPIDER_CONN*) my_hash_search(&spider_open_connections,
(uchar*) share->conn_keys[link_idx],
share->conn_keys_lengths[link_idx])))
#endif
{
/* get conn from spider_open_connections, then delete conn in spider_open_connections */
#ifdef HASH_UPDATE_WITH_HASH_VALUE
@ -4327,9 +4274,7 @@ SPIDER_IP_PORT_CONN* spider_create_ipport_conn(SPIDER_CONN *conn)
ret->conn_id = conn->conn_id;
ret->ip_port_count = 1; // init
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
ret->key_hash_value = conn->conn_key_hash_value;
#endif
DBUG_RETURN(ret);
err_malloc_key:
spider_my_free(ret, MYF(0));

View file

@ -33,10 +33,8 @@
typedef struct st_spider_conn_loop_check
{
uint flag;
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type hash_value_to;
my_hash_value_type hash_value_full;
#endif
LEX_CSTRING from_name;
LEX_CSTRING cur_name;
LEX_CSTRING to_name;

View file

@ -64,9 +64,7 @@ extern SPIDER_DBTON spider_dbton[SPIDER_DBTON_SIZE];
#define SPIDER_SQL_PING_TABLE_STR "spider_ping_table("
#define SPIDER_SQL_PING_TABLE_LEN (sizeof(SPIDER_SQL_PING_TABLE_STR) - 1)
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
extern HASH spider_open_connections;
#endif
pthread_mutex_t spider_open_conn_mutex;
const char spider_dig_upper[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";

View file

@ -7685,9 +7685,7 @@ spider_mbase_share::spider_mbase_share(
table_names_str(NULL),
db_names_str(NULL),
db_table_str(NULL),
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
db_table_str_hash_value(NULL),
#endif
table_nm_max_length(0),
db_nm_max_length(0),
column_name_str(NULL),
@ -7774,10 +7772,8 @@ int spider_mbase_share::init()
__func__, __FILE__, __LINE__, MYF(MY_WME | MY_ZEROFILL),
&key_select_pos,
sizeof(int) * keys,
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
&db_table_str_hash_value,
sizeof(my_hash_value_type) * spider_share->all_link_count,
#endif
NullS))
) {
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
@ -8052,10 +8048,8 @@ int spider_mbase_share::create_table_names_str()
if ((error_num = append_table_name(str, roop_count)))
goto error;
}
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
db_table_str_hash_value[roop_count] = my_calc_hash(
&spider_open_connections, (uchar*) str->ptr(), str->length());
#endif
}
DBUG_RETURN(0);
@ -8901,10 +8895,8 @@ int spider_mbase_handler::init()
link_for_hash[roop_count].link_idx = roop_count;
link_for_hash[roop_count].db_table_str =
&mysql_share->db_table_str[roop_count];
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
link_for_hash[roop_count].db_table_str_hash_value =
mysql_share->db_table_str_hash_value[roop_count];
#endif
}
DBUG_RETURN(0);
}
@ -13714,7 +13706,6 @@ int spider_mbase_handler::append_lock_tables_list(
&mysql_share->db_table_str[conn_link_idx];
DBUG_PRINT("info",("spider db_table_str=%s",
tmp_link_for_hash2->db_table_str->c_ptr_safe()));
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
tmp_link_for_hash2->db_table_str_hash_value =
mysql_share->db_table_str_hash_value[conn_link_idx];
if (!(tmp_link_for_hash = (SPIDER_LINK_FOR_HASH *)
@ -13723,12 +13714,6 @@ int spider_mbase_handler::append_lock_tables_list(
tmp_link_for_hash2->db_table_str_hash_value,
(uchar*) tmp_link_for_hash2->db_table_str->ptr(),
tmp_link_for_hash2->db_table_str->length())))
#else
if (!(tmp_link_for_hash = (SPIDER_LINK_FOR_HASH *) my_hash_search(
&db_conn->lock_table_hash,
(uchar*) tmp_link_for_hash2->db_table_str->ptr(),
tmp_link_for_hash2->db_table_str->length())))
#endif
{
if ((error_num = insert_lock_tables_list(conn, link_idx)))
DBUG_RETURN(error_num);

View file

@ -636,9 +636,7 @@ public:
spider_string *table_names_str;
spider_string *db_names_str;
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;

View file

@ -4523,9 +4523,7 @@ spider_oracle_share::spider_oracle_share(
db_names_str(NULL),
db_table_str(NULL),
nextval_str(NULL),
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
db_table_str_hash_value(NULL),
#endif
table_nm_max_length(0),
db_nm_max_length(0),
nextval_max_length(0),
@ -4578,10 +4576,8 @@ int spider_oracle_share::init()
__func__, __FILE__, __LINE__, MYF(MY_WME | MY_ZEROFILL),
&key_select_pos,
sizeof(int) * keys,
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
&db_table_str_hash_value,
sizeof(my_hash_value_type) * spider_share->all_link_count,
#endif
NullS))
) {
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
@ -4859,10 +4855,8 @@ int spider_oracle_share::create_table_names_str()
if ((error_num = append_table_name(str, roop_count)))
goto error;
}
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
db_table_str_hash_value[roop_count] = my_calc_hash(
&spider_open_connections, (uchar*) str->ptr(), str->length());
#endif
}
DBUG_RETURN(0);
@ -5546,10 +5540,8 @@ int spider_oracle_handler::init()
link_for_hash[roop_count].link_idx = roop_count;
link_for_hash[roop_count].db_table_str =
&oracle_share->db_table_str[roop_count];
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
link_for_hash[roop_count].db_table_str_hash_value =
oracle_share->db_table_str_hash_value[roop_count];
#endif
}
DBUG_RETURN(0);
}
@ -10392,7 +10384,6 @@ int spider_oracle_handler::append_lock_tables_list(
tmp_link_for_hash2 = &link_for_hash[link_idx];
tmp_link_for_hash2->db_table_str =
&oracle_share->db_table_str[conn_link_idx];
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
tmp_link_for_hash2->db_table_str_hash_value =
oracle_share->db_table_str_hash_value[conn_link_idx];
if (!(tmp_link_for_hash = (SPIDER_LINK_FOR_HASH *)
@ -10401,12 +10392,6 @@ int spider_oracle_handler::append_lock_tables_list(
tmp_link_for_hash2->db_table_str_hash_value,
(uchar*) tmp_link_for_hash2->db_table_str->ptr(),
tmp_link_for_hash2->db_table_str->length())))
#else
if (!(tmp_link_for_hash = (SPIDER_LINK_FOR_HASH *) my_hash_search(
&db_conn->lock_table_hash,
(uchar*) tmp_link_for_hash2->db_table_str->ptr(),
tmp_link_for_hash2->db_table_str->length())))
#endif
{
if ((error_num = insert_lock_tables_list(conn, link_idx)))
DBUG_RETURN(error_num);

View file

@ -521,9 +521,7 @@ public:
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;

View file

@ -359,10 +359,8 @@ int spider_udf_direct_sql_create_conn_key(
tmp_name = strmov(tmp_name + 1, direct_sql->tgt_driver);
} else
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);
}
@ -577,14 +575,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);
@ -641,18 +634,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 (
(
@ -661,14 +647,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"));

View file

@ -228,9 +228,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 */
@ -240,9 +238,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;
@ -344,9 +340,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;
@ -534,9 +528,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;
@ -559,9 +551,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;
@ -662,9 +652,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;
@ -746,11 +734,9 @@ typedef struct st_spider_share
*/
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;
@ -909,9 +895,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;
@ -1065,9 +1049,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;
@ -1148,9 +1130,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;
@ -1188,9 +1168,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;
@ -1304,9 +1282,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;

View file

@ -83,9 +83,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");
if (spider_mon_table_cache_version != spider_mon_table_cache_version_req)
{
@ -103,27 +101,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 &&
@ -142,9 +130,7 @@ 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],
@ -251,22 +237,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);

View file

@ -4213,10 +4213,8 @@ int spider_create_conn_keys(
__func__, __FILE__, __LINE__, MYF(MY_WME | MY_ZEROFILL),
&share->conn_keys, sizeof(char *) * share->all_link_count,
&share->conn_keys_lengths, length_base,
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
&share->conn_keys_hash_value,
sizeof(my_hash_value_type) * share->all_link_count,
#endif
&tmp_name, sizeof(char) * share->conn_keys_charlen,
&share->sql_dbton_ids, length_base,
NullS))
@ -4364,11 +4362,9 @@ int spider_create_conn_keys(
tmp_name++;
tmp_name++;
tmp_name++;
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
share->conn_keys_hash_value[roop_count] = my_calc_hash(
&spider_open_connections, (uchar*) share->conn_keys[roop_count],
share->conn_keys_lengths[roop_count]);
#endif
}
for (roop_count2 = 0; roop_count2 < SPIDER_DBTON_SIZE; roop_count2++)
{
@ -4391,9 +4387,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
) {
int bitmap_size, roop_count;
@ -4442,12 +4436,10 @@ SPIDER_SHARE *spider_create_share(
share->table_mon_mutex_bitmap = tmp_table_mon_mutex_bitmap;
share->bitmap_size = bitmap_size;
share->table_share = table_share;
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
share->table_name_hash_value = hash_value;
#ifdef WITH_PARTITION_STORAGE_ENGINE
share->table_path_hash_value = my_calc_hash(&spider_open_tables,
(uchar*) table_share->path.str, table_share->path.length);
#endif
#endif
share->table.s = table_share;
share->table.field = table_share->field;
@ -4519,14 +4511,9 @@ SPIDER_SHARE *spider_create_share(
goto error_init_crd_mutex;
}
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
if (!(share->lgtm_tblhnd_share =
spider_get_lgtm_tblhnd_share(tmp_name, length, hash_value, FALSE, TRUE,
error_num)))
#else
if (!(share->lgtm_tblhnd_share =
spider_get_lgtm_tblhnd_share(tmp_name, length, FALSE, TRUE, error_num)))
#endif
{
goto error_get_lgtm_tblhnd_share;
}
@ -4641,10 +4628,8 @@ SPIDER_SHARE *spider_get_share(
DBUG_ENTER("spider_get_share");
top_share = spider->wide_handler->top_share;
length = (uint) strlen(table_name);
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type hash_value = my_calc_hash(&spider_open_tables,
(uchar*) table_name, length);
#endif
if (top_share)
{
lex_str.length = top_share->path.length + SPIDER_SQL_LOP_CHK_PRM_PRF_LEN;
@ -4689,22 +4674,15 @@ SPIDER_SHARE *spider_get_share(
my_afree(loop_check_buf);
}
pthread_mutex_lock(&spider_tbl_mutex);
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
if (!(share = (SPIDER_SHARE*) my_hash_search_using_hash_value(
&spider_open_tables, hash_value, (uchar*) table_name, length)))
#else
if (!(share = (SPIDER_SHARE*) my_hash_search(&spider_open_tables,
(uchar*) table_name, length)))
#endif
{
if (!(share = spider_create_share(
table_name, table_share,
#ifdef WITH_PARTITION_STORAGE_ENGINE
table->part_info,
#endif
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
hash_value,
#endif
error_num
))) {
goto error_alloc_share;
@ -5814,19 +5792,12 @@ void spider_update_link_status_for_share(
SPIDER_SHARE *share;
DBUG_ENTER("spider_update_link_status_for_share");
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type hash_value = my_calc_hash(&spider_open_tables,
(uchar*) table_name, table_name_length);
#endif
pthread_mutex_lock(&spider_tbl_mutex);
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
if ((share = (SPIDER_SHARE*) my_hash_search_using_hash_value(
&spider_open_tables, hash_value, (uchar*) table_name,
table_name_length)))
#else
if ((share = (SPIDER_SHARE*) my_hash_search(&spider_open_tables,
(uchar*) table_name, table_name_length)))
#endif
{
DBUG_PRINT("info", ("spider share->link_status_init=%s",
share->link_status_init ? "TRUE" : "FALSE"));
@ -5841,7 +5812,6 @@ void spider_update_link_status_for_share(
DBUG_VOID_RETURN;
}
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
SPIDER_LGTM_TBLHND_SHARE *spider_get_lgtm_tblhnd_share(
const char *table_name,
uint table_name_length,
@ -5850,15 +5820,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
{
SPIDER_LGTM_TBLHND_SHARE *lgtm_tblhnd_share;
char *tmp_name;
@ -5866,16 +5827,10 @@ SPIDER_LGTM_TBLHND_SHARE *spider_get_lgtm_tblhnd_share(
if (!locked)
pthread_mutex_lock(&spider_lgtm_tblhnd_share_mutex);
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
if (!(lgtm_tblhnd_share = (SPIDER_LGTM_TBLHND_SHARE*)
my_hash_search_using_hash_value(
&spider_lgtm_tblhnd_share_hash, hash_value,
(uchar*) table_name, table_name_length)))
#else
if (!(lgtm_tblhnd_share = (SPIDER_LGTM_TBLHND_SHARE*) my_hash_search(
&spider_lgtm_tblhnd_share_hash,
(uchar*) table_name, table_name_length)))
#endif
{
DBUG_PRINT("info",("spider create new lgtm tblhnd share"));
if (!(lgtm_tblhnd_share = (SPIDER_LGTM_TBLHND_SHARE *)
@ -5892,9 +5847,7 @@ SPIDER_LGTM_TBLHND_SHARE *spider_get_lgtm_tblhnd_share(
lgtm_tblhnd_share->table_name = tmp_name;
memcpy(lgtm_tblhnd_share->table_name, table_name,
lgtm_tblhnd_share->table_name_length);
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
lgtm_tblhnd_share->table_path_hash_value = hash_value;
#endif
if (mysql_mutex_init(spd_key_mutex_share_auto_increment,
&lgtm_tblhnd_share->auto_increment_mutex, MY_MUTEX_INIT_FAST))
@ -5970,16 +5923,10 @@ SPIDER_WIDE_SHARE *spider_get_wide_share(
DBUG_ENTER("spider_get_wide_share");
pthread_mutex_lock(&spider_wide_share_mutex);
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
if (!(wide_share = (SPIDER_WIDE_SHARE*)
my_hash_search_using_hash_value(
&spider_open_wide_share, share->table_path_hash_value,
(uchar*) table_share->path.str, table_share->path.length)))
#else
if (!(wide_share = (SPIDER_WIDE_SHARE*) my_hash_search(
&spider_open_wide_share,
(uchar*) table_share->path.str, table_share->path.length)))
#endif
{
DBUG_PRINT("info",("spider create new wide share"));
if (!(wide_share = (SPIDER_WIDE_SHARE *)
@ -5999,9 +5946,7 @@ SPIDER_WIDE_SHARE *spider_get_wide_share(
wide_share->table_name = tmp_name;
memcpy(wide_share->table_name, table_share->path.str,
wide_share->table_name_length);
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
wide_share->table_path_hash_value = share->table_path_hash_value;
#endif
wide_share->cardinality = tmp_cardinality;
wide_share->crd_get_time = wide_share->sts_get_time =
@ -7671,16 +7616,10 @@ SPIDER_INIT_ERROR_TABLE *spider_get_init_error_table(
char *tmp_name;
DBUG_ENTER("spider_get_init_error_table");
pthread_mutex_lock(&spider_init_error_tbl_mutex);
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
if (!(spider_init_error_table = (SPIDER_INIT_ERROR_TABLE *)
my_hash_search_using_hash_value(
&spider_init_error_tables, share->table_name_hash_value,
(uchar*) share->table_name, share->table_name_length)))
#else
if (!(spider_init_error_table = (SPIDER_INIT_ERROR_TABLE *) my_hash_search(
&spider_init_error_tables,
(uchar*) share->table_name, share->table_name_length)))
#endif
{
if (!create)
{
@ -7699,10 +7638,8 @@ SPIDER_INIT_ERROR_TABLE *spider_get_init_error_table(
memcpy(tmp_name, share->table_name, share->table_name_length);
spider_init_error_table->table_name = tmp_name;
spider_init_error_table->table_name_length = share->table_name_length;
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
spider_init_error_table->table_name_hash_value =
share->table_name_hash_value;
#endif
uint old_elements = spider_init_error_tables.array.max_element;
#ifdef HASH_UPDATE_WITH_HASH_VALUE
if (my_hash_insert_with_hash_value(&spider_init_error_tables,
@ -7733,20 +7670,13 @@ void spider_delete_init_error_table(
) {
SPIDER_INIT_ERROR_TABLE *spider_init_error_table;
uint length = strlen(name);
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type hash_value = my_calc_hash(&spider_open_tables,
(uchar*) name, length);
#endif
DBUG_ENTER("spider_delete_init_error_table");
pthread_mutex_lock(&spider_init_error_tbl_mutex);
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
if ((spider_init_error_table = (SPIDER_INIT_ERROR_TABLE *)
my_hash_search_using_hash_value(&spider_init_error_tables, hash_value,
(uchar*) name, length)))
#else
if ((spider_init_error_table = (SPIDER_INIT_ERROR_TABLE *) my_hash_search(
&spider_init_error_tables, (uchar*) name, length)))
#endif
{
#ifdef HASH_UPDATE_WITH_HASH_VALUE
my_hash_delete_with_hash_value(&spider_init_error_tables,
@ -8813,10 +8743,8 @@ int spider_discover_table_structure(
#ifdef WITH_PARTITION_STORAGE_ENGINE
str_len = str.length();
#endif
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type hash_value = my_calc_hash(&spider_open_tables,
(uchar*) table_name, table_name_length);
#endif
if (!(trx = spider_get_trx(thd, TRUE, &error_num)))
{
DBUG_PRINT("info",("spider spider_get_trx error"));
@ -8833,9 +8761,7 @@ int spider_discover_table_structure(
#ifdef WITH_PARTITION_STORAGE_ENGINE
NULL,
#endif
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
hash_value,
#endif
&error_num
))) {
DBUG_RETURN(error_num);
@ -8894,9 +8820,7 @@ int spider_discover_table_structure(
DBUG_PRINT("info",("spider tmp_name=%s", tmp_name));
if (!(spider_share = spider_create_share(tmp_name, share,
part_info,
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
hash_value,
#endif
&error_num
))) {
DBUG_RETURN(error_num);
@ -8922,9 +8846,7 @@ int spider_discover_table_structure(
DBUG_PRINT("info",("spider tmp_name=%s", tmp_name));
if (!(spider_share = spider_create_share(tmp_name, share,
part_info,
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
hash_value,
#endif
&error_num
))) {
DBUG_RETURN(error_num);
@ -8965,9 +8887,7 @@ int spider_discover_table_structure(
DBUG_PRINT("info",("spider tmp_name=%s", tmp_name));
if (!(spider_share = spider_create_share(tmp_name, share,
part_info,
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
hash_value,
#endif
&error_num
))) {
DBUG_RETURN(error_num);
@ -9003,9 +8923,7 @@ int spider_discover_table_structure(
DBUG_PRINT("info",("spider tmp_name=%s", tmp_name));
if (!(spider_share = spider_create_share(tmp_name, share,
part_info,
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
hash_value,
#endif
&error_num
))) {
DBUG_RETURN(error_num);

View file

@ -442,7 +442,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,
@ -451,15 +450,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,
@ -472,9 +462,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
);

View file

@ -573,11 +573,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;
@ -1259,13 +1257,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;
@ -1625,13 +1621,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
@ -1647,17 +1641,12 @@ 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;
@ -3933,14 +3922,9 @@ SPIDER_TRX_HA *spider_check_trx_ha(
SPIDER_TRX_HA *trx_ha;
SPIDER_SHARE *share = spider->share;
DBUG_ENTER("spider_check_trx_ha");
#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
{
memcpy(spider->conn_link_idx, trx_ha->conn_link_idx,
sizeof(uint) * share->link_count);