From 7358cbe6277da9ce749d179b01a2d46a5c699bd9 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Fri, 17 Jan 2025 18:15:04 +1100 Subject: [PATCH] MDEV-28526 Spider: remove conn_kind member variables The conn_kind, which stands for "connection kind", is no longer useful because the HandlerSocket support is deleted and Spider now has only one connection kind, SPIDER_CONN_KIND_MYSQL. Remove conn_kind and related code. Signed-off-by: Yuchen Pei Reviewed-by: Nayuta Yanagisawa --- storage/spider/ha_spider.cc | 44 +++++++------------------------ storage/spider/ha_spider.h | 8 ++---- storage/spider/spd_conn.cc | 37 ++++++++++---------------- storage/spider/spd_conn.h | 3 --- storage/spider/spd_copy_tables.cc | 9 +++---- storage/spider/spd_db_conn.cc | 14 +++++----- storage/spider/spd_db_conn.h | 3 +-- storage/spider/spd_db_include.h | 2 -- storage/spider/spd_db_mysql.cc | 4 +-- storage/spider/spd_direct_sql.cc | 2 -- storage/spider/spd_include.h | 1 - storage/spider/spd_ping_table.cc | 8 +++--- storage/spider/spd_table.cc | 32 +++++++--------------- storage/spider/spd_trx.cc | 36 +++++++++---------------- storage/spider/spd_trx.h | 6 +---- 15 files changed, 65 insertions(+), 144 deletions(-) diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc index 8aff2858c3a..54a2fd110f3 100644 --- a/storage/spider/ha_spider.cc +++ b/storage/spider/ha_spider.cc @@ -209,7 +209,6 @@ int ha_spider::open( DBUG_PRINT("info",("spider this=%p", this)); dup_key_idx = (uint) -1; - conn_kinds = SPIDER_CONN_KIND_MYSQL; #ifdef WITH_PARTITION_STORAGE_ENGINE table->file->get_no_parts("", &part_num); if (part_num) @@ -639,22 +638,7 @@ int ha_spider::check_access_kind_for_connection( int error_num, roop_count; DBUG_ENTER("ha_spider::check_access_kind_for_connection"); DBUG_PRINT("info",("spider this=%p", this)); - conn_kinds = 0; - switch (wide_handler->sql_command) - { - case SQLCOM_UPDATE: - case SQLCOM_UPDATE_MULTI: - case SQLCOM_DELETE: - case SQLCOM_DELETE_MULTI: - default: - conn_kinds |= SPIDER_CONN_KIND_MYSQL; - for (roop_count = 0; roop_count < (int) share->link_count; roop_count++) - { - conn_kind[roop_count] = SPIDER_CONN_KIND_MYSQL; - } - break; - } - if ((error_num = spider_check_trx_and_get_conn(thd, this, TRUE))) + if ((error_num= spider_check_trx_and_get_conn(thd, this))) { DBUG_RETURN(error_num); } @@ -980,7 +964,7 @@ int ha_spider::external_lock( } } - if ((error_num= spider_check_trx_and_get_conn(thd, this, FALSE))) + if ((error_num= spider_check_trx_and_get_conn(thd, this))) DBUG_RETURN(error_num); if (!partition_handler || !partition_handler->handlers) { @@ -1113,8 +1097,6 @@ int ha_spider::reset() if (check_error_mode(error_num2)) error_num = error_num2; } - - conn_kind[roop_count] = SPIDER_CONN_KIND_MYSQL; } result_list.bulk_update_mode = 0; result_list.bulk_update_size = 0; @@ -1140,7 +1122,6 @@ int ha_spider::reset() result_list.use_union = FALSE; result_list.use_both_key = FALSE; pt_clone_last_searcher = NULL; - conn_kinds = SPIDER_CONN_KIND_MYSQL; use_index_merge = FALSE; init_rnd_handler = FALSE; #ifdef HA_MRR_USE_DEFAULT_IMPL @@ -5232,7 +5213,7 @@ int ha_spider::rnd_next( DBUG_RETURN(error_num); use_pre_call = FALSE; } - if ((error_num= spider_check_trx_and_get_conn(ha_thd(), this, FALSE))) + if ((error_num= spider_check_trx_and_get_conn(ha_thd(), this))) DBUG_RETURN(error_num); DBUG_RETURN(rnd_next_internal(buf)); } @@ -5797,8 +5778,7 @@ int ha_spider::info( pthread_mutex_lock(&share->sts_mutex); if (difftime(tmp_time, share->sts_get_time) >= sts_interval) { - if ((error_num = spider_check_trx_and_get_conn(ha_thd(), this, - FALSE))) + if ((error_num= spider_check_trx_and_get_conn(ha_thd(), this))) { pthread_mutex_unlock(&share->sts_mutex); if (!share->sts_init) @@ -6361,7 +6341,7 @@ int ha_spider::check_crd() } if (crd_mode == 3) crd_mode = 1; - if ((error_num = spider_check_trx_and_get_conn(ha_thd(), this, FALSE))) + if ((error_num= spider_check_trx_and_get_conn(ha_thd(), this))) { DBUG_RETURN(check_error_mode(error_num)); } @@ -7748,7 +7728,7 @@ int ha_spider::truncate() DBUG_RETURN(ER_SPIDER_READ_ONLY_NUM); } wide_handler->sql_command = SQLCOM_TRUNCATE; - if ((error_num = spider_check_trx_and_get_conn(thd, this, FALSE))) + if ((error_num= spider_check_trx_and_get_conn(thd, this))) { DBUG_RETURN(error_num); } @@ -9334,13 +9314,11 @@ int ha_spider::drop_tmp_tables() } bool ha_spider::handler_opened( - int link_idx, - uint tgt_conn_kind + int link_idx ) { DBUG_ENTER("ha_spider::handler_opened"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_PRINT("info",("spider link_idx=%d", link_idx)); - DBUG_PRINT("info",("spider tgt_conn_kind=%u", tgt_conn_kind)); if ( spider_bit_is_set(m_handler_opened, link_idx) ) { @@ -9361,8 +9339,7 @@ void ha_spider::set_handler_opened( } void ha_spider::clear_handler_opened( - int link_idx, - uint tgt_conn_kind + int link_idx ) { DBUG_ENTER("ha_spider::clear_handler_opened"); DBUG_PRINT("info",("spider this=%p", this)); @@ -9381,7 +9358,7 @@ int ha_spider::close_opened_handler( if (spider_bit_is_set(m_handler_opened, link_idx)) { if ((error_num = spider_db_close_handler(this, - conns[link_idx], link_idx, SPIDER_CONN_KIND_MYSQL)) + conns[link_idx], link_idx)) ) { error_num= spider_maybe_ping_1(this, link_idx, error_num); } @@ -11568,8 +11545,7 @@ int ha_spider::append_lock_tables_list() if (!(wide_handler->trx = spider_get_trx(ha_thd(), TRUE, &error_num))) DBUG_RETURN(error_num); - if ((error_num = spider_check_trx_and_get_conn(wide_handler->trx->thd, this, - FALSE))) + if ((error_num = spider_check_trx_and_get_conn(wide_handler->trx->thd, this))) { DBUG_RETURN(error_num); } diff --git a/storage/spider/ha_spider.h b/storage/spider/ha_spider.h index 34fad7eee96..d794bfa0cc4 100644 --- a/storage/spider/ha_spider.h +++ b/storage/spider/ha_spider.h @@ -62,8 +62,6 @@ public: uint sql_kinds; uint *sql_kind; ulonglong *connection_ids; - uint conn_kinds; - uint *conn_kind; char *conn_keys_first_ptr; char **conn_keys; SPIDER_CONN **conns; @@ -632,15 +630,13 @@ public: int check_ha_range_eof(); int drop_tmp_tables(); bool handler_opened( - int link_idx, - uint tgt_conn_kind + int link_idx ); void set_handler_opened( int link_idx ); void clear_handler_opened( - int link_idx, - uint tgt_conn_kind + int link_idx ); int close_opened_handler( int link_idx, diff --git a/storage/spider/spd_conn.cc b/storage/spider/spd_conn.cc index 2faeba56b23..e37df5027bd 100644 --- a/storage/spider/spd_conn.cc +++ b/storage/spider/spd_conn.cc @@ -112,7 +112,6 @@ const uchar *spider_conn_get_key( auto conn= static_cast(conn_); DBUG_ENTER("spider_conn_get_key"); *length = conn->conn_key_length; - DBUG_PRINT("info",("spider conn_kind=%u", conn->conn_kind)); #ifdef DBUG_TRACE spider_print_keys(conn->conn_key, conn->conn_key_length); #endif @@ -402,7 +401,6 @@ SPIDER_CONN *spider_create_conn( ha_spider *spider, int link_idx, int base_link_idx, - uint conn_kind, int *error_num ) { int *need_mon; @@ -556,7 +554,6 @@ SPIDER_CONN *spider_create_conn( conn->semi_trx_isolation_chk = FALSE; conn->semi_trx_chk = FALSE; conn->link_idx = base_link_idx; - conn->conn_kind = conn_kind; conn->conn_need_mon = need_mon; if (spider) conn->need_mon = &spider->need_mons[base_link_idx]; @@ -643,13 +640,11 @@ SPIDER_CONN *spider_get_conn( ha_spider *spider, bool another, bool thd_chg, - uint conn_kind, int *error_num ) { SPIDER_CONN *conn = NULL; int base_link_idx = link_idx; DBUG_ENTER("spider_get_conn"); - DBUG_PRINT("info",("spider conn_kind=%u", conn_kind)); if (spider) link_idx = spider->conn_link_idx[base_link_idx]; @@ -688,7 +683,8 @@ SPIDER_CONN *spider_get_conn( pthread_mutex_unlock(&spider_conn_mutex); if (spider_param_max_connections()) { /* enable connection pool */ - conn = spider_get_conn_from_idle_connection(share, link_idx, conn_key, spider, conn_kind, base_link_idx, error_num); + conn= spider_get_conn_from_idle_connection( + share, link_idx, conn_key, spider, base_link_idx, error_num); /* failed get conn, goto error */ if (!conn) goto error; @@ -697,8 +693,8 @@ SPIDER_CONN *spider_get_conn( else { /* did not enable conncetion pool , create_conn */ DBUG_PRINT("info",("spider create new conn")); - if (!(conn = spider_create_conn(share, spider, link_idx, - base_link_idx, conn_kind, error_num))) + if (!(conn= spider_create_conn(share, spider, link_idx, + base_link_idx, error_num))) goto error; *conn->conn_key = *conn_key; if (spider) @@ -722,8 +718,8 @@ SPIDER_CONN *spider_get_conn( } else { DBUG_PRINT("info",("spider create new conn")); /* conn_recycle_strict = 0 and conn_recycle_mode = 0 or 2 */ - if (!(conn = spider_create_conn(share, spider, link_idx, base_link_idx, - conn_kind, error_num))) + if (!(conn= spider_create_conn(share, spider, link_idx, base_link_idx, + error_num))) goto error; *conn->conn_key = *conn_key; if (spider) @@ -872,8 +868,7 @@ int spider_check_and_get_casual_read_conn( '0' + spider->result_list.casual_read[link_idx]; if (!(spider->conns[link_idx]= spider_get_conn( spider->share, link_idx, spider->conn_keys[link_idx], - spider->wide_handler->trx, spider, FALSE, TRUE, - SPIDER_CONN_KIND_MYSQL, &error_num))) + spider->wide_handler->trx, spider, FALSE, TRUE, &error_num))) { *spider->conn_keys[link_idx] = first_byte_bak; DBUG_RETURN(error_num); @@ -3023,9 +3018,8 @@ void *spider_bg_sts_action( if (!conns[spider.search_link_idx]) { spider_get_conn(share, spider.search_link_idx, - share->conn_keys[spider.search_link_idx], - trx, &spider, FALSE, FALSE, SPIDER_CONN_KIND_MYSQL, - &error_num); + share->conn_keys[spider.search_link_idx], trx, + &spider, FALSE, FALSE, &error_num); conns[spider.search_link_idx]->error_mode = 0; spider.search_link_idx = -1; } @@ -3298,9 +3292,8 @@ void *spider_bg_crd_action( if (!conns[spider.search_link_idx]) { spider_get_conn(share, spider.search_link_idx, - share->conn_keys[spider.search_link_idx], - trx, &spider, FALSE, FALSE, SPIDER_CONN_KIND_MYSQL, - &error_num); + share->conn_keys[spider.search_link_idx], trx, + &spider, FALSE, FALSE, &error_num); conns[spider.search_link_idx]->error_mode = 0; spider.search_link_idx = -1; } @@ -3854,8 +3847,6 @@ bool spider_conn_use_handler( spider->share->use_handlers[link_idx]); DBUG_ENTER("spider_conn_use_handler"); DBUG_PRINT("info",("spider use_handler=%d", use_handler)); - DBUG_PRINT("info",("spider spider->conn_kind[link_idx]=%u", - spider->conn_kind[link_idx])); if (spider->do_direct_update) { spider->sql_kinds |= SPIDER_SQL_KIND_SQL; @@ -3921,7 +3912,7 @@ bool spider_conn_need_open_handler( ) { DBUG_ENTER("spider_conn_need_open_handler"); DBUG_PRINT("info",("spider spider=%p", spider)); - if (spider->handler_opened(link_idx, spider->conn_kind[link_idx])) + if (spider->handler_opened(link_idx)) { DBUG_PRINT("info",("spider HA already opened")); DBUG_RETURN(FALSE); @@ -3934,7 +3925,6 @@ SPIDER_CONN* spider_get_conn_from_idle_connection( int link_idx, char *conn_key, ha_spider *spider, - uint conn_kind, int base_link_idx, int *error_num ) @@ -4022,7 +4012,8 @@ SPIDER_CONN* spider_get_conn_from_idle_connection( if (ip_port_conn) pthread_mutex_unlock(&ip_port_conn->mutex); DBUG_PRINT("info",("spider create new conn")); - if (!(conn = spider_create_conn(share, spider, link_idx, base_link_idx, conn_kind, error_num))) + if (!(conn= spider_create_conn(share, spider, link_idx, base_link_idx, + error_num))) DBUG_RETURN(conn); *conn->conn_key = *conn_key; if (spider) diff --git a/storage/spider/spd_conn.h b/storage/spider/spd_conn.h index ba02178a608..ba3ca0ab62c 100644 --- a/storage/spider/spd_conn.h +++ b/storage/spider/spd_conn.h @@ -124,7 +124,6 @@ SPIDER_CONN *spider_create_conn( ha_spider *spider, int link_id, int base_link_id, - uint conn_kind, int *error_num ); @@ -136,7 +135,6 @@ SPIDER_CONN *spider_get_conn( ha_spider *spider, bool another, bool thd_chg, - uint conn_kind, int *error_num ); @@ -451,7 +449,6 @@ SPIDER_CONN* spider_get_conn_from_idle_connection int link_idx, char *conn_key, ha_spider *spider, - uint conn_kind, int base_link_idx, int *error_num ); diff --git a/storage/spider/spd_copy_tables.cc b/storage/spider/spd_copy_tables.cc index d9cf32b3923..0ea7b0dcf0c 100644 --- a/storage/spider/spd_copy_tables.cc +++ b/storage/spider/spd_copy_tables.cc @@ -501,11 +501,10 @@ int spider_udf_get_copy_tgt_conns( while (table_conn) { share = table_conn->share; - if ( - !(table_conn->conn = spider_get_conn( - share, 0, share->conn_keys[0], trx, NULL, FALSE, FALSE, - SPIDER_CONN_KIND_MYSQL, &error_num)) - ) { + if (!(table_conn->conn= + spider_get_conn(share, 0, share->conn_keys[0], trx, NULL, + FALSE, FALSE, &error_num))) + { my_error(ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), share->server_names[0]); DBUG_RETURN(ER_CONNECT_TO_FOREIGN_DATA_SOURCE); } diff --git a/storage/spider/spd_db_conn.cc b/storage/spider/spd_db_conn.cc index 72489a1777e..1c1aa308e82 100644 --- a/storage/spider/spd_db_conn.cc +++ b/storage/spider/spd_db_conn.cc @@ -73,7 +73,7 @@ int spider_db_connect( THD* thd = current_thd; longlong connect_retry_interval; DBUG_ENTER("spider_db_connect"); - DBUG_ASSERT(conn->conn_kind != SPIDER_CONN_KIND_MYSQL || conn->need_mon); + DBUG_ASSERT(conn->need_mon); DBUG_PRINT("info",("spider link_idx=%d", link_idx)); DBUG_PRINT("info",("spider conn=%p", conn)); @@ -221,7 +221,6 @@ void spider_db_disconnect( ) { DBUG_ENTER("spider_db_disconnect"); DBUG_PRINT("info",("spider conn=%p", conn)); - DBUG_PRINT("info",("spider conn->conn_kind=%u", conn->conn_kind)); if (conn->db_conn->is_connected()) { conn->db_conn->disconnect(); @@ -10361,9 +10360,9 @@ int spider_db_open_handler( spider_db_handler *dbton_hdl = spider->dbton_handler[conn->dbton_id]; DBUG_ENTER("spider_db_open_handler"); spider_lock_before_query(conn, &spider->need_mons[link_idx]); - if (!spider->handler_opened(link_idx, conn->conn_kind)) + if (!spider->handler_opened(link_idx)) *handler_id_ptr = conn->opened_handlers; - if (!spider->handler_opened(link_idx, conn->conn_kind)) + if (!spider->handler_opened(link_idx)) my_sprintf(spider->m_handler_cid[link_idx], (spider->m_handler_cid[link_idx], SPIDER_SQL_HANDLER_CID_FORMAT, @@ -10388,7 +10387,7 @@ int spider_db_open_handler( goto error; } dbton_hdl->reset_sql(SPIDER_SQL_TYPE_HANDLER); - if (!spider->handler_opened(link_idx, conn->conn_kind)) + if (!spider->handler_opened(link_idx)) { if ((error_num = dbton_hdl->insert_opened_handler(conn, link_idx))) goto error; @@ -10405,15 +10404,14 @@ error: int spider_db_close_handler( ha_spider *spider, SPIDER_CONN *conn, - int link_idx, - uint tgt_conn_kind + int link_idx ) { int error_num= 0; spider_db_handler *dbton_hdl = spider->dbton_handler[conn->dbton_id]; DBUG_ENTER("spider_db_close_handler"); DBUG_PRINT("info",("spider conn=%p", conn)); spider_lock_before_query(conn, &spider->need_mons[link_idx]); - if (spider->handler_opened(link_idx, tgt_conn_kind)) + if (spider->handler_opened(link_idx)) { dbton_hdl->reset_sql(SPIDER_SQL_TYPE_HANDLER); if ((error_num = dbton_hdl->append_close_handler_part( diff --git a/storage/spider/spd_db_conn.h b/storage/spider/spd_db_conn.h index 6e94e2d1517..b9e06e3f219 100644 --- a/storage/spider/spd_db_conn.h +++ b/storage/spider/spd_db_conn.h @@ -1175,8 +1175,7 @@ int spider_db_open_handler( int spider_db_close_handler( ha_spider *spider, SPIDER_CONN *conn, - int link_idx, - uint tgt_conn_kind + int link_idx ); diff --git a/storage/spider/spd_db_include.h b/storage/spider/spd_db_include.h index 430cd8479be..bcb16ab391b 100644 --- a/storage/spider/spd_db_include.h +++ b/storage/spider/spd_db_include.h @@ -174,8 +174,6 @@ typedef st_spider_result SPIDER_RESULT; #define SPIDER_SQL_LOP_CHK_PRM_PRF_STR "spider_lc_" #define SPIDER_SQL_LOP_CHK_PRM_PRF_LEN (sizeof(SPIDER_SQL_LOP_CHK_PRM_PRF_STR) - 1) -#define SPIDER_CONN_KIND_MYSQL (1 << 0) - #define SPIDER_SQL_KIND_SQL (1 << 0) #define SPIDER_SQL_KIND_HANDLER (1 << 1) diff --git a/storage/spider/spd_db_mysql.cc b/storage/spider/spd_db_mysql.cc index 5fd215de341..b0c56b0376a 100644 --- a/storage/spider/spd_db_mysql.cc +++ b/storage/spider/spd_db_mysql.cc @@ -3193,7 +3193,7 @@ void spider_db_mbase::reset_opened_handler() { tmp_spider = (*tmp_link_for_hash)->spider; tmp_link_idx = (*tmp_link_for_hash)->link_idx; - tmp_spider->clear_handler_opened(tmp_link_idx, conn->conn_kind); + tmp_spider->clear_handler_opened(tmp_link_idx); } DBUG_VOID_RETURN; } @@ -7377,7 +7377,7 @@ int spider_mbase_share::discover_table_structure( int *need_mon= &need_mon_deref; if (!(conn = spider_get_conn( spider_share, 0, spider_share->conn_keys[roop_count], trx, NULL, FALSE, - FALSE, SPIDER_CONN_KIND_MYSQL, &error_num)) + FALSE, &error_num)) ) { DBUG_RETURN(error_num); } diff --git a/storage/spider/spd_direct_sql.cc b/storage/spider/spd_direct_sql.cc index 5aabb5c07fc..f0661bdd4c0 100644 --- a/storage/spider/spd_direct_sql.cc +++ b/storage/spider/spd_direct_sql.cc @@ -416,7 +416,6 @@ SPIDER_CONN *spider_udf_direct_sql_create_conn( conn->semi_trx_isolation = -2; conn->semi_trx_isolation_chk = FALSE; conn->semi_trx_chk = FALSE; - conn->conn_kind = SPIDER_CONN_KIND_MYSQL; if (mysql_mutex_init(spd_key_mutex_mta_conn, &conn->mta_conn_mutex, MY_MUTEX_INIT_FAST)) @@ -561,7 +560,6 @@ SPIDER_CONN *spider_udf_direct_sql_get_conn( conn->queued_ping = FALSE; DBUG_PRINT("info",("spider conn=%p", conn)); - DBUG_PRINT("info",("spider conn->conn_kind=%u", conn->conn_kind)); DBUG_RETURN(conn); error: diff --git a/storage/spider/spd_include.h b/storage/spider/spd_include.h index bb3dc92ed3a..17877040358 100644 --- a/storage/spider/spd_include.h +++ b/storage/spider/spd_include.h @@ -589,7 +589,6 @@ typedef struct st_spider_conn_loop_check SPIDER_CONN_LOOP_CHECK; /* database connection */ typedef struct st_spider_conn { - uint conn_kind; char *conn_key; uint conn_key_length; my_hash_value_type conn_key_hash_value; diff --git a/storage/spider/spd_ping_table.cc b/storage/spider/spd_ping_table.cc index 8e4f8a2214b..68254a636e5 100644 --- a/storage/spider/spd_ping_table.cc +++ b/storage/spider/spd_ping_table.cc @@ -648,11 +648,9 @@ SPIDER_CONN *spider_get_ping_table_tgt_conn( ) { SPIDER_CONN *conn; DBUG_ENTER("spider_get_ping_table_tgt_conn"); - if ( - !(conn = spider_get_conn( - share, 0, share->conn_keys[0], trx, NULL, FALSE, FALSE, - SPIDER_CONN_KIND_MYSQL, error_num)) - ) { + if (!(conn= spider_get_conn(share, 0, share->conn_keys[0], trx, NULL, FALSE, + FALSE, error_num))) + { my_error(ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), share->server_names[0]); *error_num = ER_CONNECT_TO_FOREIGN_DATA_SOURCE; diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc index 9a4924c42d1..5aa49cbc327 100644 --- a/storage/spider/spd_table.cc +++ b/storage/spider/spd_table.cc @@ -4517,7 +4517,6 @@ SPIDER_SHARE *spider_get_share( &spider->conn_can_fo, sizeof(uchar) * share->link_bitmap_size, &spider->sql_kind, sizeof(uint) * share->link_count, &spider->connection_ids, sizeof(ulonglong) * share->link_count, - &spider->conn_kind, sizeof(uint) * share->link_count, &spider->db_request_id, sizeof(ulonglong) * share->link_count, &spider->db_request_phase, sizeof(uchar) * share->link_bitmap_size, &spider->m_handler_opened, sizeof(uchar) * share->link_bitmap_size, @@ -4558,7 +4557,6 @@ SPIDER_SHARE *spider_get_share( tmp_cid += SPIDER_SQL_HANDLER_CID_LEN + 1; result_list->upd_tmp_tbl_prms[roop_count].init(); result_list->upd_tmp_tbl_prms[roop_count].field_count = 1; - spider->conn_kind[roop_count] = SPIDER_CONN_KIND_MYSQL; } spider_trx_set_link_idx_for_all(spider); @@ -4613,7 +4611,6 @@ SPIDER_SHARE *spider_get_share( !(spider->conns[roop_count] = spider_get_conn(share, roop_count, spider->conn_keys[roop_count], spider->wide_handler->trx, spider, FALSE, TRUE, - SPIDER_CONN_KIND_MYSQL, error_num)) ) { if ( @@ -4993,7 +4990,6 @@ SPIDER_SHARE *spider_get_share( &spider->conn_can_fo, sizeof(uchar) * share->link_bitmap_size, &spider->sql_kind, sizeof(uint) * share->link_count, &spider->connection_ids, sizeof(ulonglong) * share->link_count, - &spider->conn_kind, sizeof(uint) * share->link_count, &spider->db_request_id, sizeof(ulonglong) * share->link_count, &spider->db_request_phase, sizeof(uchar) * share->link_bitmap_size, &spider->m_handler_opened, sizeof(uchar) * share->link_bitmap_size, @@ -5031,7 +5027,6 @@ SPIDER_SHARE *spider_get_share( tmp_cid += SPIDER_SQL_HANDLER_CID_LEN + 1; result_list->upd_tmp_tbl_prms[roop_count].init(); result_list->upd_tmp_tbl_prms[roop_count].field_count = 1; - spider->conn_kind[roop_count] = SPIDER_CONN_KIND_MYSQL; } spider_trx_set_link_idx_for_all(spider); @@ -5083,7 +5078,6 @@ SPIDER_SHARE *spider_get_share( !(spider->conns[roop_count] = spider_get_conn(share, roop_count, spider->conn_keys[roop_count], spider->wide_handler->trx, spider, FALSE, TRUE, - SPIDER_CONN_KIND_MYSQL, error_num)) ) { if ( @@ -5703,11 +5697,9 @@ int spider_open_all_tables( } /* create conn */ - if ( - !(conn = spider_get_conn( - &tmp_share, 0, tmp_share.conn_keys[0], trx, NULL, FALSE, FALSE, - SPIDER_CONN_KIND_MYSQL, &error_num)) - ) { + if (!(conn= spider_get_conn(&tmp_share, 0, tmp_share.conn_keys[0], trx, + NULL, FALSE, FALSE, &error_num))) + { spider_sys_index_end(table_tables); spider_close_sys_table(thd, table_tables, &open_tables_backup, TRUE); @@ -5801,11 +5793,9 @@ int spider_open_all_tables( } /* create another conn */ - if ( - (!(conn = spider_get_conn( - &tmp_share, 0, tmp_share.conn_keys[0], trx, spider, TRUE, FALSE, - SPIDER_CONN_KIND_MYSQL, &error_num))) - ) { + if ((!(conn= spider_get_conn(&tmp_share, 0, tmp_share.conn_keys[0], trx, + spider, TRUE, FALSE, &error_num)))) + { spider_free_tmp_dbton_handler(spider); spider_free(trx, share, MYF(0)); delete spider; @@ -8850,9 +8840,8 @@ void *spider_table_bg_sts_action( if (!conns[spider->search_link_idx]) { spider_get_conn(share, spider->search_link_idx, - share->conn_keys[spider->search_link_idx], - trx, spider, FALSE, FALSE, SPIDER_CONN_KIND_MYSQL, - &error_num); + share->conn_keys[spider->search_link_idx], trx, + spider, FALSE, FALSE, &error_num); if (conns[spider->search_link_idx]) { conns[spider->search_link_idx]->error_mode = 0; @@ -9003,9 +8992,8 @@ void *spider_table_bg_crd_action( if (!conns[spider->search_link_idx]) { spider_get_conn(share, spider->search_link_idx, - share->conn_keys[spider->search_link_idx], - trx, spider, FALSE, FALSE, SPIDER_CONN_KIND_MYSQL, - &error_num); + share->conn_keys[spider->search_link_idx], trx, + spider, FALSE, FALSE, &error_num); if (conns[spider->search_link_idx]) { conns[spider->search_link_idx]->error_mode = 0; diff --git a/storage/spider/spd_trx.cc b/storage/spider/spd_trx.cc index 105cf7b744b..af690e7ff5f 100644 --- a/storage/spider/spd_trx.cc +++ b/storage/spider/spd_trx.cc @@ -2673,13 +2673,11 @@ int spider_internal_xa_commit_by_xid( goto error; } - if ( - !(conn = spider_get_conn( - &tmp_share, 0, tmp_share.conn_keys[0], trx, NULL, FALSE, FALSE, - SPIDER_CONN_KIND_MYSQL, &error_num)) && - (force_commit == 0 || - (force_commit == 1 && error_num != ER_XAER_NOTA)) - ) { + if (!(conn= spider_get_conn(&tmp_share, 0, tmp_share.conn_keys[0], trx, + NULL, FALSE, FALSE, &error_num)) && + (force_commit == 0 || + (force_commit == 1 && error_num != ER_XAER_NOTA))) + { spider_sys_index_end(table_xa_member); spider_free_tmp_share_alloc(&tmp_share); free_root(&mem_root, MYF(0)); @@ -2903,13 +2901,11 @@ int spider_internal_xa_rollback_by_xid( goto error; } - if ( - !(conn = spider_get_conn( - &tmp_share, 0, tmp_share.conn_keys[0], trx, NULL, FALSE, FALSE, - SPIDER_CONN_KIND_MYSQL, &error_num)) && - (force_commit == 0 || - (force_commit == 1 && error_num != ER_XAER_NOTA)) - ) { + if (!(conn= spider_get_conn(&tmp_share, 0, tmp_share.conn_keys[0], trx, + NULL, FALSE, FALSE, &error_num)) && + (force_commit == 0 || + (force_commit == 1 && error_num != ER_XAER_NOTA))) + { spider_sys_index_end(table_xa_member); spider_free_tmp_share_alloc(&tmp_share); free_root(&mem_root, MYF(0)); @@ -3409,8 +3405,7 @@ int spider_end_trx( int spider_check_trx_and_get_conn( THD *thd, - ha_spider *spider, - bool use_conn_kind + ha_spider *spider ) { int error_num, roop_count, search_link_idx; SPIDER_TRX *trx; @@ -3500,7 +3495,7 @@ int spider_check_trx_and_get_conn( *spider->conn_keys[0] = first_byte; for (roop_count = 0; roop_count < (int) share->link_count; roop_count++) { - if (!spider->handler_opened(roop_count, SPIDER_CONN_KIND_MYSQL)) + if (!spider->handler_opened(roop_count)) spider->conns[roop_count] = NULL; } bool search_link_idx_is_checked = FALSE; @@ -3513,12 +3508,9 @@ int spider_check_trx_and_get_conn( spider->conn_link_idx, roop_count, share->link_count, SPIDER_LINK_STATUS_RECOVERY) ) { - uint tgt_conn_kind = (use_conn_kind ? spider->conn_kind[roop_count] : - SPIDER_CONN_KIND_MYSQL); if (roop_count == spider->search_link_idx) search_link_idx_is_checked = TRUE; if ( - tgt_conn_kind == SPIDER_CONN_KIND_MYSQL && !spider->conns[roop_count] ) { *spider->conn_keys[roop_count] = first_byte; @@ -3527,8 +3519,6 @@ int spider_check_trx_and_get_conn( spider_get_conn(share, roop_count, spider->conn_keys[roop_count], trx, spider, FALSE, TRUE, - use_conn_kind ? spider->conn_kind[roop_count] : - SPIDER_CONN_KIND_MYSQL, &error_num)) ) { if ( @@ -3607,8 +3597,6 @@ int spider_check_trx_and_get_conn( spider_get_conn(share, roop_count, spider->conn_keys[roop_count], trx, spider, FALSE, TRUE, - use_conn_kind ? spider->conn_kind[roop_count] : - SPIDER_CONN_KIND_MYSQL, &error_num)) ) { if ( diff --git a/storage/spider/spd_trx.h b/storage/spider/spd_trx.h index 2055a49717e..93b03fcec21 100644 --- a/storage/spider/spd_trx.h +++ b/storage/spider/spd_trx.h @@ -227,11 +227,7 @@ int spider_end_trx( SPIDER_CONN *conn ); -int spider_check_trx_and_get_conn( - THD *thd, - ha_spider *spider, - bool use_conn_kind -); +int spider_check_trx_and_get_conn(THD *thd, ha_spider *spider); THD *spider_create_tmp_thd();