diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc index 5cf67a091dbc0..d17bb83de3982 100644 --- a/storage/spider/ha_spider.cc +++ b/storage/spider/ha_spider.cc @@ -8597,7 +8597,6 @@ int ha_spider::create( SPIDER_TRX *trx; TABLE *table_tables = NULL; SPIDER_Open_tables_backup open_tables_backup; - bool need_lock = FALSE; DBUG_ENTER("ha_spider::create"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_PRINT("info",("spider name=%s", name)); @@ -8675,7 +8674,7 @@ int ha_spider::create( if ( !(table_tables = spider_open_sys_table( current_thd, SPIDER_SYS_TABLES_TABLE_NAME_STR, - SPIDER_SYS_TABLES_TABLE_NAME_LEN, TRUE, &open_tables_backup, FALSE, + SPIDER_SYS_TABLES_TABLE_NAME_LEN, TRUE, &open_tables_backup, &error_num)) ) { goto error; @@ -8692,8 +8691,7 @@ int ha_spider::create( ) { goto error; } - spider_close_sys_table(current_thd, table_tables, - &open_tables_backup, FALSE); + spider_sys_close_table(current_thd, &open_tables_backup); table_tables = NULL; } else if ( sql_command == SQLCOM_ALTER_TABLE @@ -8726,11 +8724,10 @@ int ha_spider::create( ) && memcmp(name + strlen(name) - 5, "#TMP#", 5) ) { - need_lock = TRUE; if ( !(table_tables = spider_open_sys_table( current_thd, SPIDER_SYS_TABLES_TABLE_NAME_STR, - SPIDER_SYS_TABLES_TABLE_NAME_LEN, TRUE, &open_tables_backup, TRUE, + SPIDER_SYS_TABLES_TABLE_NAME_LEN, TRUE, &open_tables_backup, &error_num)) ) { goto error; @@ -8740,8 +8737,7 @@ int ha_spider::create( ) { goto error; } - spider_close_sys_table(current_thd, table_tables, - &open_tables_backup, TRUE); + spider_sys_close_table(current_thd, &open_tables_backup); table_tables = NULL; } } @@ -8770,8 +8766,7 @@ int ha_spider::create( error: if (table_tables) - spider_close_sys_table(current_thd, table_tables, - &open_tables_backup, need_lock); + spider_sys_close_table(current_thd, &open_tables_backup); if (tmp_share.lgtm_tblhnd_share) spider_free_lgtm_tblhnd_share_alloc(tmp_share.lgtm_tblhnd_share, FALSE); if (tmp_share.static_key_cardinality) @@ -8843,7 +8838,6 @@ int ha_spider::rename_table( SPIDER_ALTER_TABLE *alter_table_from, *alter_table_to; SPIDER_LGTM_TBLHND_SHARE *from_lgtm_tblhnd_share, *to_lgtm_tblhnd_share; SPIDER_Open_tables_backup open_tables_backup; - bool need_lock = FALSE; DBUG_ENTER("ha_spider::rename_table"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_PRINT("info",("spider from=%s", from)); @@ -8875,7 +8869,7 @@ int ha_spider::rename_table( if ( !(table_tables = spider_open_sys_table( current_thd, SPIDER_SYS_TABLES_TABLE_NAME_STR, - SPIDER_SYS_TABLES_TABLE_NAME_LEN, TRUE, &open_tables_backup, FALSE, + SPIDER_SYS_TABLES_TABLE_NAME_LEN, TRUE, &open_tables_backup, &error_num)) ) { goto error; @@ -8886,8 +8880,7 @@ int ha_spider::rename_table( ) { goto error; } - spider_close_sys_table(current_thd, table_tables, - &open_tables_backup, FALSE); + spider_sys_close_table(current_thd, &open_tables_backup); table_tables = NULL; /* release table mon list */ @@ -8929,21 +8922,10 @@ int ha_spider::rename_table( DBUG_PRINT("info", ("spider alter_info.flags: %llu alter_info.partition_flags: %lu", thd->lex->alter_info.flags, thd->lex->alter_info.partition_flags)); - if ( - (thd->lex->alter_info.partition_flags & - ( - SPIDER_ALTER_PARTITION_ADD | SPIDER_ALTER_PARTITION_DROP | - SPIDER_ALTER_PARTITION_COALESCE | SPIDER_ALTER_PARTITION_REORGANIZE | - SPIDER_ALTER_PARTITION_TABLE_REORG | SPIDER_ALTER_PARTITION_REBUILD - ) - ) - ) - need_lock = TRUE; - if ( !(table_tables = spider_open_sys_table( current_thd, SPIDER_SYS_TABLES_TABLE_NAME_STR, - SPIDER_SYS_TABLES_TABLE_NAME_LEN, TRUE, &open_tables_backup, need_lock, + SPIDER_SYS_TABLES_TABLE_NAME_LEN, TRUE, &open_tables_backup, &error_num)) ) { goto error; @@ -8972,8 +8954,7 @@ int ha_spider::rename_table( goto error; } } - spider_close_sys_table(current_thd, table_tables, - &open_tables_backup, need_lock); + spider_sys_close_table(current_thd, &open_tables_backup); table_tables = NULL; if (!alter_table_from->now_create) @@ -9031,8 +9012,7 @@ int ha_spider::rename_table( error: if (table_tables) - spider_close_sys_table(current_thd, table_tables, - &open_tables_backup, need_lock); + spider_sys_close_table(current_thd, &open_tables_backup); pthread_mutex_lock(&spider_lgtm_tblhnd_share_mutex); to_lgtm_tblhnd_share = spider_get_lgtm_tblhnd_share( to, to_len, to_hash_value, TRUE, FALSE, &tmp_error_num); @@ -9052,7 +9032,6 @@ int ha_spider::delete_table( uint sql_command = thd_sql_command(thd); SPIDER_ALTER_TABLE *alter_table; SPIDER_Open_tables_backup open_tables_backup; - bool need_lock = FALSE; DBUG_ENTER("ha_spider::delete_table"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_PRINT("info",("spider name=%s", name)); @@ -9098,28 +9077,16 @@ int ha_spider::delete_table( DBUG_PRINT("info", ("spider alter_info.flags: %llu alter_info.partition_flags: %lu", thd->lex->alter_info.flags, thd->lex->alter_info.partition_flags)); - if ( - sql_command == SQLCOM_ALTER_TABLE && - (thd->lex->alter_info.partition_flags & - ( - SPIDER_ALTER_PARTITION_ADD | SPIDER_ALTER_PARTITION_DROP | - SPIDER_ALTER_PARTITION_COALESCE | SPIDER_ALTER_PARTITION_REORGANIZE | - SPIDER_ALTER_PARTITION_TABLE_REORG | SPIDER_ALTER_PARTITION_REBUILD - ) - ) - ) - need_lock = TRUE; - if ((error_num = spider_sys_delete_table_sts( - current_thd, name, name_len, need_lock))) + current_thd, name, name_len))) goto error; if ((error_num = spider_sys_delete_table_crd( - current_thd, name, name_len, need_lock))) + current_thd, name, name_len))) goto error; if ( !(table_tables = spider_open_sys_table( current_thd, SPIDER_SYS_TABLES_TABLE_NAME_STR, - SPIDER_SYS_TABLES_TABLE_NAME_LEN, TRUE, &open_tables_backup, need_lock, + SPIDER_SYS_TABLES_TABLE_NAME_LEN, TRUE, &open_tables_backup, &error_num)) ) { goto error; @@ -9130,8 +9097,7 @@ int ha_spider::delete_table( ) { goto error; } - spider_close_sys_table(current_thd, table_tables, - &open_tables_backup, need_lock); + spider_sys_close_table(current_thd, &open_tables_backup); table_tables = NULL; /* release table mon list */ @@ -9155,8 +9121,7 @@ int ha_spider::delete_table( error: if (table_tables) - spider_close_sys_table(current_thd, table_tables, - &open_tables_backup, need_lock); + spider_sys_close_table(current_thd, &open_tables_backup); DBUG_RETURN(error_num); } diff --git a/storage/spider/spd_copy_tables.cc b/storage/spider/spd_copy_tables.cc index 5e28b5903092a..0d6f05dfdbdf9 100644 --- a/storage/spider/spd_copy_tables.cc +++ b/storage/spider/spd_copy_tables.cc @@ -355,7 +355,7 @@ int spider_udf_get_copy_tgt_tables( !(table_tables = spider_open_sys_table( thd, SPIDER_SYS_TABLES_TABLE_NAME_STR, SPIDER_SYS_TABLES_TABLE_NAME_LEN, FALSE, &open_tables_backup, - need_lock, &error_num)) + &error_num)) ) { my_error(error_num, MYF(0)); goto error; @@ -543,8 +543,7 @@ int spider_udf_get_copy_tgt_tables( error_num = spider_sys_index_next_same(table_tables, table_key); } while (error_num == 0); spider_sys_index_end(table_tables); - spider_close_sys_table(thd, table_tables, - &open_tables_backup, need_lock); + spider_sys_close_table(thd, &open_tables_backup); table_tables = NULL; if (!copy_tables->table_conn[0]) @@ -566,8 +565,7 @@ int spider_udf_get_copy_tgt_tables( error: if (table_tables) - spider_close_sys_table(thd, table_tables, - &open_tables_backup, need_lock); + spider_sys_close_table(thd, &open_tables_backup); if (table_conn) { spider_free_tmp_dbton_share(tmp_share); diff --git a/storage/spider/spd_ping_table.cc b/storage/spider/spd_ping_table.cc index e82a5925265e6..3de30e6a80b71 100644 --- a/storage/spider/spd_ping_table.cc +++ b/storage/spider/spd_ping_table.cc @@ -267,7 +267,7 @@ int spider_get_ping_table_mon( !(table_link_mon = spider_open_sys_table( thd, SPIDER_SYS_LINK_MON_TABLE_NAME_STR, SPIDER_SYS_LINK_MON_TABLE_NAME_LEN, FALSE, &open_tables_backup, - need_lock, &error_num)) + &error_num)) ) { my_error(error_num, MYF(0)); goto error; @@ -386,8 +386,7 @@ int spider_get_ping_table_mon( error_num = spider_sys_index_next_same(table_link_mon, table_key); } while (error_num == 0); spider_sys_index_end(table_link_mon); - spider_close_sys_table(thd, table_link_mon, - &open_tables_backup, need_lock); + spider_sys_close_table(thd, &open_tables_backup); table_link_mon = NULL; table_mon_list->list_size = list_size; @@ -403,8 +402,7 @@ int spider_get_ping_table_mon( error: if (table_link_mon) - spider_close_sys_table(thd, table_link_mon, - &open_tables_backup, need_lock); + spider_sys_close_table(thd, &open_tables_backup); table_mon = table_mon_list->first; table_mon_list->first = NULL; table_mon_list->current = NULL; @@ -474,7 +472,7 @@ SPIDER_TABLE_MON_LIST *spider_get_ping_table_tgt( if ( !(table_tables = spider_open_sys_table( thd, SPIDER_SYS_TABLES_TABLE_NAME_STR, - SPIDER_SYS_TABLES_TABLE_NAME_LEN, FALSE, &open_tables_backup, need_lock, + SPIDER_SYS_TABLES_TABLE_NAME_LEN, FALSE, &open_tables_backup, error_num)) ) { my_error(*error_num, MYF(0)); @@ -512,8 +510,7 @@ SPIDER_TABLE_MON_LIST *spider_get_ping_table_tgt( table_tables->file->print_error(*error_num, MYF(0)); goto error; } - spider_close_sys_table(thd, table_tables, - &open_tables_backup, need_lock); + spider_sys_close_table(thd, &open_tables_backup); table_tables = NULL; if ( @@ -576,8 +573,7 @@ SPIDER_TABLE_MON_LIST *spider_get_ping_table_tgt( error_caller_mutex_init: error: if (table_tables) - spider_close_sys_table(thd, table_tables, - &open_tables_backup, need_lock); + spider_sys_close_table(thd, &open_tables_backup); free_root(&mem_root, MYF(0)); if (table_mon_list) { @@ -791,11 +787,10 @@ int spider_get_ping_table_gtid_pos( goto error_sys_index_end; } #ifdef SPIDER_REQUIRE_DEFINE_FOR_SECONDARY_OPEN_TABLES_BACKUP - spider_close_sys_table(thd, table_gtid_pos, + spider_sys_close_table(thd, table_gtid_pos, &open_tables_backup_gtid_pos, need_lock); #endif - spider_close_sys_table(thd, table_tables, &open_tables_backup_tables, - need_lock); + spider_sys_close_table(thd, &open_tables_backup_tables); DBUG_RETURN(0); @@ -806,13 +801,12 @@ int spider_get_ping_table_gtid_pos( error_sys_index_end: error_get_sys_table_by_idx: #ifdef SPIDER_REQUIRE_DEFINE_FOR_SECONDARY_OPEN_TABLES_BACKUP - spider_close_sys_table(thd, table_gtid_pos, + spider_sys_close_table(thd, table_gtid_pos, &open_tables_backup_gtid_pos, need_lock); error_open_table_gtid_pos: #endif - spider_close_sys_table(thd, table_tables, &open_tables_backup_tables, - need_lock); + spider_sys_close_table(thd, &open_tables_backup_tables); error_open_table_tables: DBUG_RETURN(error_num); } @@ -833,7 +827,7 @@ int spider_init_ping_table_mon_cache( !(table_link_mon = spider_open_sys_table( thd, SPIDER_SYS_LINK_MON_TABLE_NAME_STR, SPIDER_SYS_LINK_MON_TABLE_NAME_LEN, FALSE, &open_tables_backup, - need_lock, &error_num)) + &error_num)) ) { my_error(error_num, MYF(0)); goto error_open_sys_table; @@ -921,7 +915,7 @@ int spider_init_ping_table_mon_cache( spider_mon_table_cache_version = spider_mon_table_cache_version_req; } pthread_mutex_unlock(&spider_mon_table_cache_mutex); - spider_close_sys_table(thd, table_link_mon, &open_tables_backup, need_lock); + spider_sys_close_table(thd, &open_tables_backup); DBUG_RETURN(0); error_push_dynamic: @@ -930,7 +924,7 @@ int spider_init_ping_table_mon_cache( spider_sys_index_end(table_link_mon); error_sys_index_first: pthread_mutex_unlock(&spider_mon_table_cache_mutex); - spider_close_sys_table(thd, table_link_mon, &open_tables_backup, need_lock); + spider_sys_close_table(thd, &open_tables_backup); error_open_sys_table: DBUG_RETURN(error_num); } @@ -1223,9 +1217,9 @@ long long spider_ping_table_body( conv_name_length, link_idx, SPIDER_LINK_STATUS_NG); spider_sys_update_tables_link_status(trx->thd, conv_name.c_ptr(), conv_name_length, link_idx, - SPIDER_LINK_STATUS_NG, TRUE); + SPIDER_LINK_STATUS_NG); spider_sys_log_tables_link_failed(trx->thd, - conv_name.c_ptr(), conv_name_length, link_idx, TRUE); + conv_name.c_ptr(), conv_name_length, link_idx); status_changed_to_ng = TRUE; } /* @@ -1296,9 +1290,9 @@ long long spider_ping_table_body( conv_name_length, link_idx, SPIDER_LINK_STATUS_NG); spider_sys_update_tables_link_status(trx->thd, conv_name.c_ptr(), conv_name_length, link_idx, - SPIDER_LINK_STATUS_NG, TRUE); + SPIDER_LINK_STATUS_NG); spider_sys_log_tables_link_failed(trx->thd, - conv_name.c_ptr(), conv_name_length, link_idx, TRUE); + conv_name.c_ptr(), conv_name_length, link_idx); status_changed_to_ng = TRUE; } /* @@ -1359,9 +1353,9 @@ long long spider_ping_table_body( conv_name_length, link_idx, SPIDER_LINK_STATUS_NG); spider_sys_update_tables_link_status(trx->thd, conv_name.c_ptr(), conv_name_length, link_idx, - SPIDER_LINK_STATUS_NG, TRUE); + SPIDER_LINK_STATUS_NG); spider_sys_log_tables_link_failed(trx->thd, - conv_name.c_ptr(), conv_name_length, link_idx, TRUE); + conv_name.c_ptr(), conv_name_length, link_idx); status_changed_to_ng = TRUE; } /* @@ -1715,9 +1709,9 @@ int spider_ping_table_mon_from_table( link_idx)); share->link_statuses[link_idx] = SPIDER_LINK_STATUS_NG; spider_sys_update_tables_link_status(thd, conv_name, - conv_name_length, link_idx, SPIDER_LINK_STATUS_NG, need_lock); + conv_name_length, link_idx, SPIDER_LINK_STATUS_NG); spider_sys_log_tables_link_failed(thd, conv_name, - conv_name_length, link_idx, need_lock); + conv_name_length, link_idx); } /* pthread_mutex_unlock(&table_mon_list->update_status_mutex); diff --git a/storage/spider/spd_sys_table.cc b/storage/spider/spd_sys_table.cc index df95336cc191d..fdab66161d515 100644 --- a/storage/spider/spd_sys_table.cc +++ b/storage/spider/spd_sys_table.cc @@ -235,7 +235,6 @@ TABLE *spider_open_sys_table( int table_name_length, bool write, SPIDER_Open_tables_backup *open_tables_backup, - bool need_lock, int *error_num ) { TABLE *table; @@ -277,7 +276,7 @@ TABLE *spider_open_sys_table( DBUG_PRINT("info",("spider checking for SYS_XA")); if (table->s->fields != SPIDER_SYS_XA_COL_CNT) { - spider_close_sys_table(thd, table, open_tables_backup, need_lock); + spider_sys_close_table(thd, open_tables_backup); table = NULL; my_printf_error(ER_SPIDER_SYS_TABLE_VERSION_NUM, ER_SPIDER_SYS_TABLE_VERSION_STR, MYF(0), @@ -296,7 +295,7 @@ TABLE *spider_open_sys_table( DBUG_PRINT("info",("spider checking for SYS_TABLES")); if (table->s->fields != SPIDER_SYS_TABLES_COL_CNT) { - spider_close_sys_table(thd, table, open_tables_backup, need_lock); + spider_sys_close_table(thd, open_tables_backup); table = NULL; my_printf_error(ER_SPIDER_SYS_TABLE_VERSION_NUM, ER_SPIDER_SYS_TABLE_VERSION_STR, MYF(0), @@ -315,7 +314,7 @@ TABLE *spider_open_sys_table( DBUG_PRINT("info",("spider checking for SYS_XA_MEMBER")); if (table->s->fields != SPIDER_SYS_XA_MEMBER_COL_CNT) { - spider_close_sys_table(thd, table, open_tables_backup, need_lock); + spider_sys_close_table(thd, open_tables_backup); table = NULL; my_printf_error(ER_SPIDER_SYS_TABLE_VERSION_NUM, ER_SPIDER_SYS_TABLE_VERSION_STR, MYF(0), @@ -331,7 +330,7 @@ TABLE *spider_open_sys_table( DBUG_PRINT("info",("spider checking for SYS_TABLE_STS")); if (table->s->fields != SPIDER_SYS_TABLE_STS_COL_CNT) { - spider_close_sys_table(thd, table, open_tables_backup, need_lock); + spider_sys_close_table(thd, open_tables_backup); table = NULL; my_printf_error(ER_SPIDER_SYS_TABLE_VERSION_NUM, ER_SPIDER_SYS_TABLE_VERSION_STR, MYF(0), @@ -347,7 +346,7 @@ TABLE *spider_open_sys_table( DBUG_PRINT("info",("spider checking for SYS_TABLE_CRD")); if (table->s->fields != SPIDER_SYS_TABLE_CRD_COL_CNT) { - spider_close_sys_table(thd, table, open_tables_backup, need_lock); + spider_sys_close_table(thd, open_tables_backup); table = NULL; my_printf_error(ER_SPIDER_SYS_TABLE_VERSION_NUM, ER_SPIDER_SYS_TABLE_VERSION_STR, MYF(0), @@ -366,7 +365,7 @@ TABLE *spider_open_sys_table( DBUG_PRINT("info",("spider checking for SYS_XA_FAILED")); if (table->s->fields != SPIDER_SYS_XA_FAILED_TABLE_COL_CNT) { - spider_close_sys_table(thd, table, open_tables_backup, need_lock); + spider_sys_close_table(thd, open_tables_backup); table = NULL; my_printf_error(ER_SPIDER_SYS_TABLE_VERSION_NUM, ER_SPIDER_SYS_TABLE_VERSION_STR, MYF(0), @@ -385,7 +384,7 @@ TABLE *spider_open_sys_table( DBUG_PRINT("info",("spider checking for SYS_RW_TBLS")); if (table->s->fields != SPIDER_SYS_RW_TBLS_COL_CNT) { - spider_close_sys_table(thd, table, open_tables_backup, need_lock); + spider_sys_close_table(thd, open_tables_backup); table = NULL; my_printf_error(ER_SPIDER_SYS_TABLE_VERSION_NUM, ER_SPIDER_SYS_TABLE_VERSION_STR, MYF(0), @@ -403,7 +402,7 @@ TABLE *spider_open_sys_table( DBUG_PRINT("info",("spider checking for SYS_LINK_FAILED")); if (table->s->fields != SPIDER_SYS_LINK_FAILED_TABLE_COL_CNT) { - spider_close_sys_table(thd, table, open_tables_backup, need_lock); + spider_sys_close_table(thd, open_tables_backup); table = NULL; my_printf_error(ER_SPIDER_SYS_TABLE_VERSION_NUM, ER_SPIDER_SYS_TABLE_VERSION_STR, MYF(0), @@ -422,7 +421,7 @@ TABLE *spider_open_sys_table( DBUG_PRINT("info",("spider checking for SYS_LINK_MON")); if (table->s->fields != SPIDER_SYS_LINK_MON_TABLE_COL_CNT) { - spider_close_sys_table(thd, table, open_tables_backup, need_lock); + spider_sys_close_table(thd, open_tables_backup); table = NULL; my_printf_error(ER_SPIDER_SYS_TABLE_VERSION_NUM, ER_SPIDER_SYS_TABLE_VERSION_STR, MYF(0), @@ -438,7 +437,7 @@ TABLE *spider_open_sys_table( DBUG_PRINT("info",("spider checking for SYS_RWN_TBLS")); if (table->s->fields != SPIDER_SYS_RWN_TBLS_COL_CNT) { - spider_close_sys_table(thd, table, open_tables_backup, need_lock); + spider_sys_close_table(thd, open_tables_backup); table = NULL; my_printf_error(ER_SPIDER_SYS_TABLE_VERSION_NUM, ER_SPIDER_SYS_TABLE_VERSION_STR, MYF(0), @@ -457,7 +456,7 @@ TABLE *spider_open_sys_table( DBUG_PRINT("info",("spider checking for SYS_RW_TBL_TBLS")); if (table->s->fields != SPIDER_SYS_RW_TBL_TBLS_COL_CNT) { - spider_close_sys_table(thd, table, open_tables_backup, need_lock); + spider_sys_close_table(thd, open_tables_backup); table = NULL; my_printf_error(ER_SPIDER_SYS_TABLE_VERSION_NUM, ER_SPIDER_SYS_TABLE_VERSION_STR, MYF(0), @@ -476,7 +475,7 @@ TABLE *spider_open_sys_table( DBUG_PRINT("info",("spider checking for SYS_RW_TBL_PTTS")); if (table->s->fields != SPIDER_SYS_RW_TBL_PTTS_COL_CNT) { - spider_close_sys_table(thd, table, open_tables_backup, need_lock); + spider_sys_close_table(thd, open_tables_backup); table = NULL; my_printf_error(ER_SPIDER_SYS_TABLE_VERSION_NUM, ER_SPIDER_SYS_TABLE_VERSION_STR, MYF(0), @@ -495,7 +494,7 @@ TABLE *spider_open_sys_table( DBUG_PRINT("info",("spider checking for SYS_POS_FOR_RECOVERY")); if (table->s->fields != SPIDER_SYS_POS_FOR_RECOVERY_TABLE_COL_CNT) { - spider_close_sys_table(thd, table, open_tables_backup, need_lock); + spider_sys_close_table(thd, open_tables_backup); table = NULL; my_printf_error(ER_SPIDER_SYS_TABLE_VERSION_NUM, ER_SPIDER_SYS_TABLE_VERSION_STR, MYF(0), @@ -511,7 +510,7 @@ TABLE *spider_open_sys_table( DBUG_PRINT("info",("spider checking for SYS_RW_TBL_SPTTS")); if (table->s->fields != SPIDER_SYS_RW_TBL_SPTTS_COL_CNT) { - spider_close_sys_table(thd, table, open_tables_backup, need_lock); + spider_sys_close_table(thd, open_tables_backup); table = NULL; my_printf_error(ER_SPIDER_SYS_TABLE_VERSION_NUM, ER_SPIDER_SYS_TABLE_VERSION_STR, MYF(0), @@ -532,17 +531,6 @@ TABLE *spider_open_sys_table( DBUG_RETURN(NULL); } -void spider_close_sys_table( - THD *thd, - TABLE *table, - SPIDER_Open_tables_backup *open_tables_backup, - bool need_lock -) { - DBUG_ENTER("spider_close_sys_table"); - spider_sys_close_table(thd, open_tables_backup); - DBUG_VOID_RETURN; -} - bool spider_sys_open_and_lock_tables( THD *thd, TABLE_LIST **tables, @@ -2791,8 +2779,7 @@ int spider_sys_update_tables_link_status( char *name, uint name_length, int link_idx, - long link_status, - bool need_lock + long link_status ) { int error_num; TABLE *table_tables = NULL; @@ -2801,7 +2788,7 @@ int spider_sys_update_tables_link_status( if ( !(table_tables = spider_open_sys_table( thd, SPIDER_SYS_TABLES_TABLE_NAME_STR, - SPIDER_SYS_TABLES_TABLE_NAME_LEN, TRUE, &open_tables_backup, need_lock, + SPIDER_SYS_TABLES_TABLE_NAME_LEN, TRUE, &open_tables_backup, &error_num)) ) { goto error; @@ -2809,15 +2796,13 @@ int spider_sys_update_tables_link_status( if ((error_num = spider_update_tables_link_status(table_tables, name, name_length, link_idx, link_status))) goto error; - spider_close_sys_table(thd, table_tables, - &open_tables_backup, need_lock); + spider_sys_close_table(thd, &open_tables_backup); table_tables = NULL; DBUG_RETURN(0); error: if (table_tables) - spider_close_sys_table(thd, table_tables, - &open_tables_backup, need_lock); + spider_sys_close_table(thd, &open_tables_backup); DBUG_RETURN(error_num); } @@ -2825,8 +2810,7 @@ int spider_sys_log_tables_link_failed( THD *thd, char *name, uint name_length, - int link_idx, - bool need_lock + int link_idx ) { int error_num; TABLE *table_tables = NULL; @@ -2836,7 +2820,7 @@ int spider_sys_log_tables_link_failed( !(table_tables = spider_open_sys_table( thd, SPIDER_SYS_LINK_FAILED_TABLE_NAME_STR, SPIDER_SYS_LINK_FAILED_TABLE_NAME_LEN, TRUE, &open_tables_backup, - need_lock, &error_num)) + &error_num)) ) { goto error; } @@ -2844,15 +2828,13 @@ int spider_sys_log_tables_link_failed( if ((error_num = spider_log_tables_link_failed(table_tables, name, name_length, link_idx))) goto error; - spider_close_sys_table(thd, table_tables, - &open_tables_backup, need_lock); + spider_sys_close_table(thd, &open_tables_backup); table_tables = NULL; DBUG_RETURN(0); error: if (table_tables) - spider_close_sys_table(thd, table_tables, - &open_tables_backup, need_lock); + spider_sys_close_table(thd, &open_tables_backup); DBUG_RETURN(error_num); } @@ -2860,8 +2842,7 @@ int spider_sys_log_xa_failed( THD *thd, XID *xid, SPIDER_CONN *conn, - const char *status, - bool need_lock + const char *status ) { int error_num; TABLE *table_tables = NULL; @@ -2871,20 +2852,20 @@ int spider_sys_log_xa_failed( !(table_tables = spider_open_sys_table( thd, SPIDER_SYS_XA_FAILED_TABLE_NAME_STR, SPIDER_SYS_XA_FAILED_TABLE_NAME_LEN, TRUE, &open_tables_backup, - need_lock, &error_num)) + &error_num)) ) { goto error; } empty_record(table_tables); if ((error_num = spider_log_xa_failed(thd, table_tables, xid, conn, status))) goto error; - spider_close_sys_table(thd, table_tables, &open_tables_backup, need_lock); + spider_sys_close_table(thd, &open_tables_backup); table_tables = NULL; DBUG_RETURN(0); error: if (table_tables) - spider_close_sys_table(thd, table_tables, &open_tables_backup, need_lock); + spider_sys_close_table(thd, &open_tables_backup); DBUG_RETURN(error_num); } @@ -3230,8 +3211,7 @@ int spider_sys_insert_or_update_table_sts( THD *thd, const char *name, uint name_length, - ha_statistics *stat, - bool need_lock + ha_statistics *stat ) { int error_num; TABLE *table_sts = NULL; @@ -3241,7 +3221,7 @@ int spider_sys_insert_or_update_table_sts( !(table_sts = spider_open_sys_table( thd, SPIDER_SYS_TABLE_STS_TABLE_NAME_STR, SPIDER_SYS_TABLE_STS_TABLE_NAME_LEN, TRUE, - &open_tables_backup, need_lock, &error_num)) + &open_tables_backup, &error_num)) ) { goto error; } @@ -3252,13 +3232,13 @@ int spider_sys_insert_or_update_table_sts( stat ))) goto error; - spider_close_sys_table(thd, table_sts, &open_tables_backup, need_lock); + spider_sys_close_table(thd, &open_tables_backup); table_sts = NULL; DBUG_RETURN(0); error: if (table_sts) - spider_close_sys_table(thd, table_sts, &open_tables_backup, need_lock); + spider_sys_close_table(thd, &open_tables_backup); DBUG_RETURN(error_num); } @@ -3267,8 +3247,7 @@ int spider_sys_insert_or_update_table_crd( const char *name, uint name_length, longlong *cardinality, - uint number_of_keys, - bool need_lock + uint number_of_keys ) { int error_num; TABLE *table_crd = NULL; @@ -3278,7 +3257,7 @@ int spider_sys_insert_or_update_table_crd( !(table_crd = spider_open_sys_table( thd, SPIDER_SYS_TABLE_CRD_TABLE_NAME_STR, SPIDER_SYS_TABLE_CRD_TABLE_NAME_LEN, TRUE, - &open_tables_backup, need_lock, &error_num)) + &open_tables_backup, &error_num)) ) { goto error; } @@ -3290,21 +3269,20 @@ int spider_sys_insert_or_update_table_crd( number_of_keys ))) goto error; - spider_close_sys_table(thd, table_crd, &open_tables_backup, need_lock); + spider_sys_close_table(thd, &open_tables_backup); table_crd = NULL; DBUG_RETURN(0); error: if (table_crd) - spider_close_sys_table(thd, table_crd, &open_tables_backup, need_lock); + spider_sys_close_table(thd, &open_tables_backup); DBUG_RETURN(error_num); } int spider_sys_delete_table_sts( THD *thd, const char *name, - uint name_length, - bool need_lock + uint name_length ) { int error_num; TABLE *table_sts = NULL; @@ -3314,7 +3292,7 @@ int spider_sys_delete_table_sts( !(table_sts = spider_open_sys_table( thd, SPIDER_SYS_TABLE_STS_TABLE_NAME_STR, SPIDER_SYS_TABLE_STS_TABLE_NAME_LEN, TRUE, - &open_tables_backup, need_lock, &error_num)) + &open_tables_backup, &error_num)) ) { goto error; } @@ -3324,21 +3302,20 @@ int spider_sys_delete_table_sts( name_length ))) goto error; - spider_close_sys_table(thd, table_sts, &open_tables_backup, need_lock); + spider_sys_close_table(thd, &open_tables_backup); table_sts = NULL; DBUG_RETURN(0); error: if (table_sts) - spider_close_sys_table(thd, table_sts, &open_tables_backup, need_lock); + spider_sys_close_table(thd, &open_tables_backup); DBUG_RETURN(error_num); } int spider_sys_delete_table_crd( THD *thd, const char *name, - uint name_length, - bool need_lock + uint name_length ) { int error_num; TABLE *table_crd = NULL; @@ -3348,7 +3325,7 @@ int spider_sys_delete_table_crd( !(table_crd = spider_open_sys_table( thd, SPIDER_SYS_TABLE_CRD_TABLE_NAME_STR, SPIDER_SYS_TABLE_CRD_TABLE_NAME_LEN, TRUE, - &open_tables_backup, need_lock, &error_num)) + &open_tables_backup, &error_num)) ) { goto error; } @@ -3358,13 +3335,13 @@ int spider_sys_delete_table_crd( name_length ))) goto error; - spider_close_sys_table(thd, table_crd, &open_tables_backup, need_lock); + spider_sys_close_table(thd, &open_tables_backup); table_crd = NULL; DBUG_RETURN(0); error: if (table_crd) - spider_close_sys_table(thd, table_crd, &open_tables_backup, need_lock); + spider_sys_close_table(thd, &open_tables_backup); DBUG_RETURN(error_num); } @@ -3372,8 +3349,7 @@ int spider_sys_get_table_sts( THD *thd, const char *name, uint name_length, - ha_statistics *stat, - bool need_lock + ha_statistics *stat ) { int error_num; char table_key[MAX_KEY_LENGTH]; @@ -3384,7 +3360,7 @@ int spider_sys_get_table_sts( !(table_sts = spider_open_sys_table( thd, SPIDER_SYS_TABLE_STS_TABLE_NAME_STR, SPIDER_SYS_TABLE_STS_TABLE_NAME_LEN, TRUE, - &open_tables_backup, need_lock, &error_num)) + &open_tables_backup, &error_num)) ) { goto error; } @@ -3405,13 +3381,13 @@ int spider_sys_get_table_sts( ); } - spider_close_sys_table(thd, table_sts, &open_tables_backup, need_lock); + spider_sys_close_table(thd, &open_tables_backup); table_sts = NULL; DBUG_RETURN(0); error: if (table_sts) - spider_close_sys_table(thd, table_sts, &open_tables_backup, need_lock); + spider_sys_close_table(thd, &open_tables_backup); DBUG_RETURN(error_num); } @@ -3420,8 +3396,7 @@ int spider_sys_get_table_crd( const char *name, uint name_length, longlong *cardinality, - uint number_of_keys, - bool need_lock + uint number_of_keys ) { int error_num; char table_key[MAX_KEY_LENGTH]; @@ -3434,7 +3409,7 @@ int spider_sys_get_table_crd( !(table_crd = spider_open_sys_table( thd, SPIDER_SYS_TABLE_CRD_TABLE_NAME_STR, SPIDER_SYS_TABLE_CRD_TABLE_NAME_LEN, TRUE, - &open_tables_backup, need_lock, &error_num)) + &open_tables_backup, &error_num)) ) { goto error; } @@ -3467,7 +3442,7 @@ int spider_sys_get_table_crd( goto error; } - spider_close_sys_table(thd, table_crd, &open_tables_backup, need_lock); + spider_sys_close_table(thd, &open_tables_backup); table_crd = NULL; DBUG_RETURN(0); @@ -3476,7 +3451,7 @@ int spider_sys_get_table_crd( spider_sys_index_end(table_crd); if (table_crd) - spider_close_sys_table(thd, table_crd, &open_tables_backup, need_lock); + spider_sys_close_table(thd, &open_tables_backup); DBUG_RETURN(error_num); } diff --git a/storage/spider/spd_sys_table.h b/storage/spider/spd_sys_table.h index 36f72375f5a82..b26f08204cb16 100644 --- a/storage/spider/spd_sys_table.h +++ b/storage/spider/spd_sys_table.h @@ -92,17 +92,9 @@ TABLE *spider_open_sys_table( int table_name_length, bool write, SPIDER_Open_tables_backup *open_tables_backup, - bool need_lock, int *error_num ); -void spider_close_sys_table( - THD *thd, - TABLE *table, - SPIDER_Open_tables_backup *open_tables_backup, - bool need_lock -); - bool spider_sys_open_and_lock_tables( THD *thd, TABLE_LIST **tables, @@ -487,24 +479,21 @@ int spider_sys_update_tables_link_status( char *name, uint name_length, int link_idx, - long link_status, - bool need_lock + long link_status ); int spider_sys_log_tables_link_failed( THD *thd, char *name, uint name_length, - int link_idx, - bool need_lock + int link_idx ); int spider_sys_log_xa_failed( THD *thd, XID *xid, SPIDER_CONN *conn, - const char *status, - bool need_lock + const char *status ); int spider_get_sys_link_mon_key( @@ -537,8 +526,7 @@ int spider_sys_insert_or_update_table_sts( THD *thd, const char *name, uint name_length, - ha_statistics *stat, - bool need_lock + ha_statistics *stat ); int spider_sys_insert_or_update_table_crd( @@ -546,30 +534,26 @@ int spider_sys_insert_or_update_table_crd( const char *name, uint name_length, longlong *cardinality, - uint number_of_keys, - bool need_lock + uint number_of_keys ); int spider_sys_delete_table_sts( THD *thd, const char *name, - uint name_length, - bool need_lock + uint name_length ); int spider_sys_delete_table_crd( THD *thd, const char *name, - uint name_length, - bool need_lock + uint name_length ); int spider_sys_get_table_sts( THD *thd, const char *name, uint name_length, - ha_statistics *stat, - bool need_lock + ha_statistics *stat ); int spider_sys_get_table_crd( @@ -577,8 +561,7 @@ int spider_sys_get_table_crd( const char *name, uint name_length, longlong *cardinality, - uint number_of_keys, - bool need_lock + uint number_of_keys ); int spider_sys_replace( diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc index 102e0c3521c42..dfdbbf4479cd6 100644 --- a/storage/spider/spd_table.cc +++ b/storage/spider/spd_table.cc @@ -4688,7 +4688,7 @@ SPIDER_SHARE *spider_get_share( !(table_tables = spider_open_sys_table( thd, SPIDER_SYS_TABLES_TABLE_NAME_STR, SPIDER_SYS_TABLES_TABLE_NAME_LEN, FALSE, &open_tables_backup, - FALSE, error_num)) + error_num)) ) { for (roop_count = 0; roop_count < (int) spider_udf_table_mon_mutex_count; @@ -4724,8 +4724,7 @@ SPIDER_SHARE *spider_get_share( share->init_error_time = (time_t) time((time_t*) 0); share->init = TRUE; spider_free_share(share); - spider_close_sys_table(thd, table_tables, - &open_tables_backup, FALSE); + spider_sys_close_table(thd, &open_tables_backup); table_tables = NULL; goto error_open_sys_table; } @@ -4734,8 +4733,7 @@ SPIDER_SHARE *spider_get_share( sizeof(long) * share->all_link_count); share->link_status_init = TRUE; } - spider_close_sys_table(thd, table_tables, - &open_tables_backup, FALSE); + spider_sys_close_table(thd, &open_tables_backup); table_tables = NULL; } share->have_recovery_link = spider_conn_check_recovery_link(share); @@ -5157,7 +5155,7 @@ SPIDER_SHARE *spider_get_share( !(table_tables = spider_open_sys_table( thd, SPIDER_SYS_TABLES_TABLE_NAME_STR, SPIDER_SYS_TABLES_TABLE_NAME_LEN, FALSE, &open_tables_backup, - FALSE, error_num)) + error_num)) ) { for (roop_count = 0; roop_count < (int) spider_udf_table_mon_mutex_count; @@ -5187,8 +5185,7 @@ SPIDER_SHARE *spider_get_share( } pthread_mutex_unlock(&share->mutex); spider_free_share(share); - spider_close_sys_table(thd, table_tables, - &open_tables_backup, FALSE); + spider_sys_close_table(thd, &open_tables_backup); table_tables = NULL; goto error_open_sys_table; } @@ -5197,8 +5194,7 @@ SPIDER_SHARE *spider_get_share( sizeof(long) * share->all_link_count); share->link_status_init = TRUE; } - spider_close_sys_table(thd, table_tables, - &open_tables_backup, FALSE); + spider_sys_close_table(thd, &open_tables_backup); table_tables = NULL; } share->have_recovery_link = spider_conn_check_recovery_link(share); @@ -5620,8 +5616,7 @@ int spider_free_share( thd, share->lgtm_tblhnd_share->table_name, share->lgtm_tblhnd_share->table_name_length, - &share->stat, - FALSE + &share->stat ); } if ( @@ -5642,8 +5637,7 @@ int spider_free_share( share->lgtm_tblhnd_share->table_name, share->lgtm_tblhnd_share->table_name_length, share->cardinality, - share->table_share->fields, - FALSE + share->table_share->fields ); } spider_free_share_alloc(share); @@ -5950,7 +5944,7 @@ int spider_open_all_tables( if ( !(table_tables = spider_open_sys_table( thd, SPIDER_SYS_TABLES_TABLE_NAME_STR, - SPIDER_SYS_TABLES_TABLE_NAME_LEN, TRUE, &open_tables_backup, TRUE, + SPIDER_SYS_TABLES_TABLE_NAME_LEN, TRUE, &open_tables_backup, &error_num)) ) DBUG_RETURN(error_num); @@ -5960,12 +5954,10 @@ int spider_open_all_tables( if (error_num != HA_ERR_KEY_NOT_FOUND && error_num != HA_ERR_END_OF_FILE) { table_tables->file->print_error(error_num, MYF(0)); - spider_close_sys_table(thd, table_tables, - &open_tables_backup, TRUE); + spider_sys_close_table(thd, &open_tables_backup); DBUG_RETURN(error_num); } else { - spider_close_sys_table(thd, table_tables, - &open_tables_backup, TRUE); + spider_sys_close_table(thd, &open_tables_backup); DBUG_RETURN(0); } } @@ -5996,8 +5988,7 @@ int spider_open_all_tables( )) ) { spider_sys_index_end(table_tables); - spider_close_sys_table(thd, table_tables, - &open_tables_backup, TRUE); + spider_sys_close_table(thd, &open_tables_backup); spider_free_tmp_share_alloc(&tmp_share); free_root(&mem_root, MYF(0)); DBUG_RETURN(error_num); @@ -6020,8 +6011,7 @@ int spider_open_all_tables( (error_num = spider_create_tmp_dbton_share(&tmp_share)) ) { spider_sys_index_end(table_tables); - spider_close_sys_table(thd, table_tables, - &open_tables_backup, TRUE); + spider_sys_close_table(thd, &open_tables_backup); spider_free_tmp_share_alloc(&tmp_share); free_root(&mem_root, MYF(0)); DBUG_RETURN(error_num); @@ -6032,8 +6022,7 @@ int spider_open_all_tables( NULL, FALSE, FALSE, &error_num))) { spider_sys_index_end(table_tables); - spider_close_sys_table(thd, table_tables, - &open_tables_backup, TRUE); + spider_sys_close_table(thd, &open_tables_backup); spider_free_tmp_dbton_share(&tmp_share); spider_free_tmp_share_alloc(&tmp_share); free_root(&mem_root, MYF(0)); @@ -6058,8 +6047,7 @@ int spider_open_all_tables( SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); pthread_mutex_unlock(&conn->mta_conn_mutex); spider_sys_index_end(table_tables); - spider_close_sys_table(thd, table_tables, - &open_tables_backup, TRUE); + spider_sys_close_table(thd, &open_tables_backup); spider_free_tmp_dbton_share(&tmp_share); spider_free_tmp_share_alloc(&tmp_share); free_root(&mem_root, MYF(0)); @@ -6077,8 +6065,7 @@ int spider_open_all_tables( if (!(spider = new ha_spider())) { spider_sys_index_end(table_tables); - spider_close_sys_table(thd, table_tables, - &open_tables_backup, TRUE); + spider_sys_close_table(thd, &open_tables_backup); spider_free_tmp_dbton_share(&tmp_share); spider_free_tmp_share_alloc(&tmp_share); free_root(&mem_root, MYF(0)); @@ -6104,8 +6091,7 @@ int spider_open_all_tables( ) { delete spider; spider_sys_index_end(table_tables); - spider_close_sys_table(thd, table_tables, - &open_tables_backup, TRUE); + spider_sys_close_table(thd, &open_tables_backup); spider_free_tmp_dbton_share(&tmp_share); spider_free_tmp_share_alloc(&tmp_share); free_root(&mem_root, MYF(0)); @@ -6132,8 +6118,7 @@ int spider_open_all_tables( spider_free(trx, share, MYF(0)); delete spider; spider_sys_index_end(table_tables); - spider_close_sys_table(thd, table_tables, - &open_tables_backup, TRUE); + spider_sys_close_table(thd, &open_tables_backup); spider_free_tmp_dbton_share(&tmp_share); spider_free_tmp_share_alloc(&tmp_share); free_root(&mem_root, MYF(0)); @@ -6148,8 +6133,7 @@ int spider_open_all_tables( spider_free(trx, share, MYF(0)); delete spider; spider_sys_index_end(table_tables); - spider_close_sys_table(thd, table_tables, - &open_tables_backup, TRUE); + spider_sys_close_table(thd, &open_tables_backup); spider_free_tmp_dbton_share(&tmp_share); spider_free_tmp_share_alloc(&tmp_share); free_root(&mem_root, MYF(0)); @@ -6175,8 +6159,7 @@ int spider_open_all_tables( spider_free(trx, share, MYF(0)); delete spider; spider_sys_index_end(table_tables); - spider_close_sys_table(thd, table_tables, - &open_tables_backup, TRUE); + spider_sys_close_table(thd, &open_tables_backup); spider_free_tmp_dbton_share(&tmp_share); spider_free_tmp_share_alloc(&tmp_share); free_root(&mem_root, MYF(0)); @@ -6191,8 +6174,7 @@ int spider_open_all_tables( free_root(&mem_root, MYF(0)); spider_sys_index_end(table_tables); - spider_close_sys_table(thd, table_tables, - &open_tables_backup, TRUE); + spider_sys_close_table(thd, &open_tables_backup); DBUG_RETURN(0); } @@ -7144,8 +7126,7 @@ int spider_get_sts( current_thd, share->lgtm_tblhnd_share->table_name, share->lgtm_tblhnd_share->table_name_length, - &share->stat, - FALSE + &share->stat ); if ( !error_num || @@ -7279,8 +7260,7 @@ int spider_get_crd( share->lgtm_tblhnd_share->table_name, share->lgtm_tblhnd_share->table_name_length, share->cardinality, - table->s->fields, - FALSE + table->s->fields ); if ( !error_num || @@ -8521,7 +8501,7 @@ int spider_discover_table_structure( if ( (table_tables = spider_open_sys_table( thd, SPIDER_SYS_TABLES_TABLE_NAME_STR, - SPIDER_SYS_TABLES_TABLE_NAME_LEN, TRUE, &open_tables_backup, FALSE, + SPIDER_SYS_TABLES_TABLE_NAME_LEN, TRUE, &open_tables_backup, &error_num)) ) { if (thd->lex->create_info.or_replace()) @@ -8533,8 +8513,7 @@ int spider_discover_table_structure( { error_num = spider_insert_tables(table_tables, spider_share); } - spider_close_sys_table(thd, table_tables, - &open_tables_backup, FALSE); + spider_sys_close_table(thd, &open_tables_backup); } } @@ -8607,7 +8586,7 @@ int spider_discover_table_structure( if ( !(table_tables = spider_open_sys_table( thd, SPIDER_SYS_TABLES_TABLE_NAME_STR, - SPIDER_SYS_TABLES_TABLE_NAME_LEN, TRUE, &open_tables_backup, FALSE, + SPIDER_SYS_TABLES_TABLE_NAME_LEN, TRUE, &open_tables_backup, &error_num)) ) { DBUG_RETURN(error_num); @@ -8682,8 +8661,7 @@ int spider_discover_table_structure( break; } } - spider_close_sys_table(thd, table_tables, - &open_tables_backup, FALSE); + spider_sys_close_table(thd, &open_tables_backup); } } diff --git a/storage/spider/spd_trx.cc b/storage/spider/spd_trx.cc index 8e1257bad21fd..a6c5ea8f85abf 100644 --- a/storage/spider/spd_trx.cc +++ b/storage/spider/spd_trx.cc @@ -1909,7 +1909,7 @@ int spider_internal_xa_commit( if ( !(table_xa = spider_open_sys_table( thd, SPIDER_SYS_XA_TABLE_NAME_STR, SPIDER_SYS_XA_TABLE_NAME_LEN, - TRUE, &open_tables_backup, TRUE, &error_num)) + TRUE, &open_tables_backup, &error_num)) ) goto error_open_table; table_xa_opened = TRUE; @@ -1960,7 +1960,7 @@ int spider_internal_xa_commit( table_xa, &trx->xid, SPIDER_SYS_XA_COMMIT_STR)) ) goto error; - spider_close_sys_table(thd, table_xa, &open_tables_backup, TRUE); + spider_sys_close_table(thd, &open_tables_backup); table_xa_opened = FALSE; } @@ -1984,7 +1984,7 @@ int spider_internal_xa_commit( error_num = tmp_error_num; } spider_sys_log_xa_failed(thd, &trx->xid, conn, - SPIDER_SYS_XA_COMMIT_STR, TRUE); + SPIDER_SYS_XA_COMMIT_STR); } if ((tmp_error_num = spider_end_trx(trx, conn))) { @@ -2013,14 +2013,14 @@ int spider_internal_xa_commit( if ( !(table_xa_member = spider_open_sys_table( thd, SPIDER_SYS_XA_MEMBER_TABLE_NAME_STR, - SPIDER_SYS_XA_MEMBER_TABLE_NAME_LEN, TRUE, &open_tables_backup, TRUE, + SPIDER_SYS_XA_MEMBER_TABLE_NAME_LEN, TRUE, &open_tables_backup, &error_num)) ) goto error_open_table; table_xa_member_opened = TRUE; if ((error_num = spider_delete_xa_member(table_xa_member, &trx->xid))) goto error; - spider_close_sys_table(thd, table_xa_member, &open_tables_backup, TRUE); + spider_sys_close_table(thd, &open_tables_backup); table_xa_member_opened = FALSE; /* @@ -2034,13 +2034,13 @@ int spider_internal_xa_commit( if ( !(table_xa = spider_open_sys_table( thd, SPIDER_SYS_XA_TABLE_NAME_STR, SPIDER_SYS_XA_TABLE_NAME_LEN, - TRUE, &open_tables_backup, TRUE, &error_num)) + TRUE, &open_tables_backup, &error_num)) ) goto error_open_table; table_xa_opened = TRUE; if ((error_num = spider_delete_xa(table_xa, &trx->xid))) goto error; - spider_close_sys_table(thd, table_xa, &open_tables_backup, TRUE); + spider_sys_close_table(thd, &open_tables_backup); table_xa_opened = FALSE; } if (trx->internal_xa) @@ -2051,9 +2051,9 @@ int spider_internal_xa_commit( error: if (table_xa_opened) - spider_close_sys_table(thd, table_xa, &open_tables_backup, TRUE); + spider_sys_close_table(thd, &open_tables_backup); if (table_xa_member_opened) - spider_close_sys_table(thd, table_xa_member, &open_tables_backup, TRUE); + spider_sys_close_table(thd, &open_tables_backup); error_in_commit: error_open_table: if (trx->internal_xa) @@ -2099,7 +2099,7 @@ int spider_internal_xa_rollback( if ( !(table_xa = spider_open_sys_table( thd, SPIDER_SYS_XA_TABLE_NAME_STR, SPIDER_SYS_XA_TABLE_NAME_LEN, - TRUE, &open_tables_backup, TRUE, &error_num)) + TRUE, &open_tables_backup, &error_num)) ) goto error_open_table; table_xa_opened = TRUE; @@ -2150,7 +2150,7 @@ int spider_internal_xa_rollback( table_xa, &trx->xid, SPIDER_SYS_XA_ROLLBACK_STR)) ) goto error; - spider_close_sys_table(thd, table_xa, &open_tables_backup, TRUE); + spider_sys_close_table(thd, &open_tables_backup); table_xa_opened = FALSE; } @@ -2251,14 +2251,14 @@ int spider_internal_xa_rollback( if ( !(table_xa_member = spider_open_sys_table( thd, SPIDER_SYS_XA_MEMBER_TABLE_NAME_STR, - SPIDER_SYS_XA_MEMBER_TABLE_NAME_LEN, TRUE, &open_tables_backup, TRUE, + SPIDER_SYS_XA_MEMBER_TABLE_NAME_LEN, TRUE, &open_tables_backup, &error_num)) ) goto error_open_table; table_xa_member_opened = TRUE; if ((error_num = spider_delete_xa_member(table_xa_member, &trx->xid))) goto error; - spider_close_sys_table(thd, table_xa_member, &open_tables_backup, TRUE); + spider_sys_close_table(thd, &open_tables_backup); table_xa_member_opened = FALSE; /* @@ -2272,13 +2272,13 @@ int spider_internal_xa_rollback( if ( !(table_xa = spider_open_sys_table( thd, SPIDER_SYS_XA_TABLE_NAME_STR, SPIDER_SYS_XA_TABLE_NAME_LEN, - TRUE, &open_tables_backup, TRUE, &error_num)) + TRUE, &open_tables_backup, &error_num)) ) goto error_open_table; table_xa_opened = TRUE; if ((error_num = spider_delete_xa(table_xa, &trx->xid))) goto error; - spider_close_sys_table(thd, table_xa, &open_tables_backup, TRUE); + spider_sys_close_table(thd, &open_tables_backup); table_xa_opened = FALSE; } if (trx->internal_xa) @@ -2289,9 +2289,9 @@ int spider_internal_xa_rollback( error: if (table_xa_opened) - spider_close_sys_table(thd, table_xa, &open_tables_backup, TRUE); + spider_sys_close_table(thd, &open_tables_backup); if (table_xa_member_opened) - spider_close_sys_table(thd, table_xa_member, &open_tables_backup, TRUE); + spider_sys_close_table(thd, &open_tables_backup); error_in_rollback: error_open_table: if (trx->internal_xa) @@ -2326,7 +2326,7 @@ int spider_internal_xa_prepare( if ( !(table_xa = spider_open_sys_table( thd, SPIDER_SYS_XA_TABLE_NAME_STR, SPIDER_SYS_XA_TABLE_NAME_LEN, - TRUE, &open_tables_backup, TRUE, &error_num)) + TRUE, &open_tables_backup, &error_num)) ) goto error_open_table; table_xa_opened = TRUE; @@ -2335,13 +2335,13 @@ int spider_internal_xa_prepare( table_xa, &trx->xid, SPIDER_SYS_XA_NOT_YET_STR)) ) goto error; - spider_close_sys_table(thd, table_xa, &open_tables_backup, TRUE); + spider_sys_close_table(thd, &open_tables_backup); table_xa_opened = FALSE; if ( !(table_xa_member = spider_open_sys_table( thd, SPIDER_SYS_XA_MEMBER_TABLE_NAME_STR, - SPIDER_SYS_XA_MEMBER_TABLE_NAME_LEN, TRUE, &open_tables_backup, TRUE, + SPIDER_SYS_XA_MEMBER_TABLE_NAME_LEN, TRUE, &open_tables_backup, &error_num)) ) goto error_open_table; @@ -2434,7 +2434,7 @@ int spider_internal_xa_prepare( } if (trx->updated_in_this_trx || spider_param_xa_register_mode(thd) == 0) { - spider_close_sys_table(thd, table_xa_member, &open_tables_backup, TRUE); + spider_sys_close_table(thd, &open_tables_backup); table_xa_member_opened = FALSE; /* @@ -2450,7 +2450,7 @@ int spider_internal_xa_prepare( if ( !(table_xa = spider_open_sys_table( thd, SPIDER_SYS_XA_TABLE_NAME_STR, SPIDER_SYS_XA_TABLE_NAME_LEN, - TRUE, &open_tables_backup, TRUE, &error_num)) + TRUE, &open_tables_backup, &error_num)) ) goto error_open_table; table_xa_opened = TRUE; @@ -2459,16 +2459,16 @@ int spider_internal_xa_prepare( table_xa, &trx->xid, SPIDER_SYS_XA_PREPARED_STR)) ) goto error; - spider_close_sys_table(thd, table_xa, &open_tables_backup, TRUE); + spider_sys_close_table(thd, &open_tables_backup); table_xa_opened = FALSE; } DBUG_RETURN(0); error: if (table_xa_opened) - spider_close_sys_table(thd, table_xa, &open_tables_backup, TRUE); + spider_sys_close_table(thd, &open_tables_backup); if (table_xa_member_opened) - spider_close_sys_table(thd, table_xa_member, &open_tables_backup, TRUE); + spider_sys_close_table(thd, &open_tables_backup); error_open_table: DBUG_RETURN(error_num); } @@ -2498,7 +2498,7 @@ int spider_internal_xa_recover( if ( !(table_xa = spider_open_sys_table( thd, SPIDER_SYS_XA_TABLE_NAME_STR, SPIDER_SYS_XA_TABLE_NAME_LEN, - FALSE, &open_tables_backup, TRUE, &my_errno)) + FALSE, &open_tables_backup, &my_errno)) ) goto error_open_table; spider_store_xa_status(table_xa, SPIDER_SYS_XA_PREPARED_STR); @@ -2523,11 +2523,11 @@ int spider_internal_xa_recover( } while (my_errno == 0 && cnt < (int) len); free_root(&mem_root, MYF(0)); spider_sys_index_end(table_xa); - spider_close_sys_table(thd, table_xa, &open_tables_backup, TRUE); + spider_sys_close_table(thd, &open_tables_backup); DBUG_RETURN(cnt); error: - spider_close_sys_table(thd, table_xa, &open_tables_backup, TRUE); + spider_sys_close_table(thd, &open_tables_backup); error_open_table: DBUG_RETURN(0); } @@ -2568,7 +2568,7 @@ int spider_initinal_xa_recover( if ( !(table_xa = spider_open_sys_table( thd, SPIDER_SYS_XA_TABLE_NAME_STR, SPIDER_SYS_XA_TABLE_NAME_LEN, - FALSE, &open_tables_backup, TRUE, &error_num)) + FALSE, &open_tables_backup, &error_num)) ) goto error_open_table; SPIDER_init_read_record(read_record, thd, table_xa, NULL, NULL, TRUE, @@ -2583,7 +2583,7 @@ int spider_initinal_xa_recover( free_root(&mem_root, MYF(0)); end_read_record(read_record); - spider_close_sys_table(thd, table_xa, &open_tables_backup, TRUE); + spider_sys_close_table(thd, &open_tables_backup); table_xa = NULL; spider_free_tmp_thd(thd); thd = NULL; @@ -2635,7 +2635,7 @@ int spider_internal_xa_commit_by_xid( if ( !(table_xa = spider_open_sys_table( thd, SPIDER_SYS_XA_TABLE_NAME_STR, SPIDER_SYS_XA_TABLE_NAME_LEN, - TRUE, &open_tables_backup, TRUE, &error_num)) + TRUE, &open_tables_backup, &error_num)) ) goto error_open_table; table_xa_opened = TRUE; @@ -2687,7 +2687,7 @@ int spider_internal_xa_commit_by_xid( free_root(&mem_root, MYF(0)); goto error; } - spider_close_sys_table(thd, table_xa, &open_tables_backup, TRUE); + spider_sys_close_table(thd, &open_tables_backup); table_xa_opened = FALSE; /* @@ -2708,7 +2708,7 @@ int spider_internal_xa_commit_by_xid( if ( !(table_xa_member = spider_open_sys_table( thd, SPIDER_SYS_XA_MEMBER_TABLE_NAME_STR, - SPIDER_SYS_XA_MEMBER_TABLE_NAME_LEN, TRUE, &open_tables_backup, TRUE, + SPIDER_SYS_XA_MEMBER_TABLE_NAME_LEN, TRUE, &open_tables_backup, &error_num)) ) { free_root(&mem_root, MYF(0)); @@ -2727,7 +2727,7 @@ int spider_internal_xa_commit_by_xid( goto error; } else { free_root(&mem_root, MYF(0)); - spider_close_sys_table(thd, table_xa_member, &open_tables_backup, TRUE); + spider_sys_close_table(thd, &open_tables_backup); table_xa_member_opened = FALSE; goto xa_delete; } @@ -2796,7 +2796,7 @@ int spider_internal_xa_commit_by_xid( */ if ((error_num = spider_delete_xa_member(table_xa_member, xid))) goto error; - spider_close_sys_table(thd, table_xa_member, &open_tables_backup, TRUE); + spider_sys_close_table(thd, &open_tables_backup); table_xa_member_opened = FALSE; xa_delete: @@ -2811,21 +2811,21 @@ int spider_internal_xa_commit_by_xid( if ( !(table_xa = spider_open_sys_table( thd, SPIDER_SYS_XA_TABLE_NAME_STR, SPIDER_SYS_XA_TABLE_NAME_LEN, - TRUE, &open_tables_backup, TRUE, &error_num)) + TRUE, &open_tables_backup, &error_num)) ) goto error_open_table; table_xa_opened = TRUE; if ((error_num = spider_delete_xa(table_xa, xid))) goto error; - spider_close_sys_table(thd, table_xa, &open_tables_backup, TRUE); + spider_sys_close_table(thd, &open_tables_backup); table_xa_opened = FALSE; DBUG_RETURN(0); error: if (table_xa_opened) - spider_close_sys_table(thd, table_xa, &open_tables_backup, TRUE); + spider_sys_close_table(thd, &open_tables_backup); if (table_xa_member_opened) - spider_close_sys_table(thd, table_xa_member, &open_tables_backup, TRUE); + spider_sys_close_table(thd, &open_tables_backup); error_open_table: DBUG_RETURN(error_num); } @@ -2864,7 +2864,7 @@ int spider_internal_xa_rollback_by_xid( if ( !(table_xa = spider_open_sys_table( thd, SPIDER_SYS_XA_TABLE_NAME_STR, SPIDER_SYS_XA_TABLE_NAME_LEN, - TRUE, &open_tables_backup, TRUE, &error_num)) + TRUE, &open_tables_backup, &error_num)) ) goto error_open_table; table_xa_opened = TRUE; @@ -2914,7 +2914,7 @@ int spider_internal_xa_rollback_by_xid( free_root(&mem_root, MYF(0)); goto error; } - spider_close_sys_table(thd, table_xa, &open_tables_backup, TRUE); + spider_sys_close_table(thd, &open_tables_backup); table_xa_opened = FALSE; /* @@ -2935,7 +2935,7 @@ int spider_internal_xa_rollback_by_xid( if ( !(table_xa_member = spider_open_sys_table( thd, SPIDER_SYS_XA_MEMBER_TABLE_NAME_STR, - SPIDER_SYS_XA_MEMBER_TABLE_NAME_LEN, TRUE, &open_tables_backup, TRUE, + SPIDER_SYS_XA_MEMBER_TABLE_NAME_LEN, TRUE, &open_tables_backup, &error_num)) ) { free_root(&mem_root, MYF(0)); @@ -2954,7 +2954,7 @@ int spider_internal_xa_rollback_by_xid( goto error; } else { free_root(&mem_root, MYF(0)); - spider_close_sys_table(thd, table_xa_member, &open_tables_backup, TRUE); + spider_sys_close_table(thd, &open_tables_backup); table_xa_member_opened = FALSE; goto xa_delete; } @@ -3023,7 +3023,7 @@ int spider_internal_xa_rollback_by_xid( */ if ((error_num = spider_delete_xa_member(table_xa_member, xid))) goto error; - spider_close_sys_table(thd, table_xa_member, &open_tables_backup, TRUE); + spider_sys_close_table(thd, &open_tables_backup); table_xa_member_opened = FALSE; xa_delete: @@ -3038,21 +3038,21 @@ int spider_internal_xa_rollback_by_xid( if ( !(table_xa = spider_open_sys_table( thd, SPIDER_SYS_XA_TABLE_NAME_STR, SPIDER_SYS_XA_TABLE_NAME_LEN, - TRUE, &open_tables_backup, TRUE, &error_num)) + TRUE, &open_tables_backup, &error_num)) ) goto error_open_table; table_xa_opened = TRUE; if ((error_num = spider_delete_xa(table_xa, xid))) goto error; - spider_close_sys_table(thd, table_xa, &open_tables_backup, TRUE); + spider_sys_close_table(thd, &open_tables_backup); table_xa_opened = FALSE; DBUG_RETURN(0); error: if (table_xa_opened) - spider_close_sys_table(thd, table_xa, &open_tables_backup, TRUE); + spider_sys_close_table(thd, &open_tables_backup); if (table_xa_member_opened) - spider_close_sys_table(thd, table_xa_member, &open_tables_backup, TRUE); + spider_sys_close_table(thd, &open_tables_backup); error_open_table: DBUG_RETURN(error_num); }