From f5b7c25e1e2ca9f86a4679422eff16d3e3db45f9 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Tue, 18 Jun 2024 10:21:38 +0800 Subject: [PATCH] MDEV-27643 Spider: remove #ifdef HA_CAN_BULK_ACCESS --- storage/spider/ha_spider.cc | 1242 ------------------------------- storage/spider/ha_spider.h | 141 ---- storage/spider/spd_conn.cc | 14 - storage/spider/spd_db_conn.cc | 232 ------ storage/spider/spd_db_conn.h | 26 - storage/spider/spd_db_include.h | 2 - storage/spider/spd_db_mysql.cc | 4 - storage/spider/spd_db_oracle.cc | 4 - storage/spider/spd_include.h | 27 - storage/spider/spd_param.cc | 25 - storage/spider/spd_param.h | 5 - storage/spider/spd_table.cc | 28 - storage/spider/spd_trx.cc | 41 - storage/spider/spd_trx.h | 6 - 14 files changed, 1797 deletions(-) diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc index 8fff0c5b673..e910ffcff56 100644 --- a/storage/spider/ha_spider.cc +++ b/storage/spider/ha_spider.cc @@ -94,17 +94,6 @@ ha_spider::ha_spider( use_pre_call = FALSE; use_pre_action = FALSE; do_direct_update = FALSE; -#ifdef HA_CAN_BULK_ACCESS - is_bulk_access_clone = FALSE; - synced_from_clone_source = FALSE; - bulk_access_started = FALSE; - bulk_access_executing = FALSE; - bulk_access_pre_called = FALSE; - bulk_access_link_first = NULL; -/* - init_ha_mem_root = FALSE; -*/ -#endif prev_index_rnd_init = SPD_NONE; direct_aggregate_item_first = NULL; result_link_idx = 0; @@ -173,17 +162,6 @@ ha_spider::ha_spider( use_pre_call = FALSE; use_pre_action = FALSE; do_direct_update = FALSE; -#ifdef HA_CAN_BULK_ACCESS - is_bulk_access_clone = FALSE; - synced_from_clone_source = FALSE; - bulk_access_started = FALSE; - bulk_access_executing = FALSE; - bulk_access_pre_called = FALSE; - bulk_access_link_first = NULL; -/* - init_ha_mem_root = FALSE; -*/ -#endif prev_index_rnd_init = SPD_NONE; direct_aggregate_item_first = NULL; result_link_idx = 0; @@ -514,9 +492,6 @@ int ha_spider::open( } else wide_handler->semi_table_lock = spider_param_semi_table_lock(thd, share->semi_table_lock); -#ifdef HA_CAN_BULK_ACCESS - external_lock_cnt = 0; -#endif if (reset()) { @@ -606,22 +581,6 @@ int ha_spider::close() delete [] mrr_key_buff; mrr_key_buff = NULL; } -#endif -#ifdef HA_CAN_BULK_ACCESS - if (bulk_access_link_first) - { - do { - DBUG_PRINT("info",("spider bulk_access_link->spider=%p", - bulk_access_link_first->spider)); - DBUG_PRINT("info",("spider bulk_access_link->spider->dbton_handler=%p", - bulk_access_link_first->spider->dbton_handler)); - DBUG_PRINT("info",("spider ptr bulk_access_link->spider->dbton_handler=" - "%p", &bulk_access_link_first->spider->dbton_handler)); - bulk_access_link_current = bulk_access_link_first->next; - delete_bulk_access_link(bulk_access_link_first); - bulk_access_link_first = bulk_access_link_current; - } while (bulk_access_link_first); - } #endif while (direct_aggregate_item_first) { @@ -780,33 +739,6 @@ void ha_spider::check_access_kind( DBUG_VOID_RETURN; } -#ifdef HA_CAN_BULK_ACCESS -int ha_spider::additional_lock( - THD *thd, - enum thr_lock_type lock_type -) { - DBUG_ENTER("ha_spider::additional_lock"); - DBUG_PRINT("info",("spider this=%p", this)); - if (bulk_access_executing) - { - if (is_bulk_access_clone) - { - check_access_kind(thd); - DBUG_RETURN(check_access_kind_for_connection(thd, - (lock_type >= TL_WRITE_ALLOW_WRITE))); - } else if (bulk_access_link_exec_tgt->called) - { - bulk_access_link_exec_tgt->spider->check_access_kind(thd); - DBUG_RETURN(bulk_access_link_exec_tgt->spider-> - check_access_kind_for_connection( - thd, (lock_type >= TL_WRITE_ALLOW_WRITE))); - } - } - check_access_kind(thd); - DBUG_RETURN(check_access_kind_for_connection(thd, - (lock_type >= TL_WRITE_ALLOW_WRITE))); -} -#endif THR_LOCK_DATA **ha_spider::store_lock( THD *thd, @@ -1144,40 +1076,6 @@ int ha_spider::reset() backup_error_status(); DBUG_ENTER("ha_spider::reset"); DBUG_PRINT("info",("spider this=%p", this)); -#ifdef HA_CAN_BULK_ACCESS - SPIDER_BULK_ACCESS_LINK *tmp_bulk_access_link = bulk_access_link_first; - while (tmp_bulk_access_link) - { - DBUG_PRINT("info",("spider bulk_access_link->spider->dbton_handler=%p", - tmp_bulk_access_link->spider->dbton_handler)); - DBUG_PRINT("info",("spider ptr bulk_access_link->spider->dbton_handler=%p", - &tmp_bulk_access_link->spider->dbton_handler)); - if (!tmp_bulk_access_link->used) - break; - if ((error_num2 = tmp_bulk_access_link->spider->ha_reset())) - error_num = error_num2; - tmp_bulk_access_link->used = FALSE; - tmp_bulk_access_link = tmp_bulk_access_link->next; - } - synced_from_clone_source = FALSE; - bulk_access_started = FALSE; - bulk_access_executing = FALSE; - bulk_access_pre_called = FALSE; - if ( - bulk_access_link_first && - !spider_param_bulk_access_free(share->bulk_access_free) - ) { - do { - DBUG_PRINT("info",("spider bulk_access_link->spider->dbton_handler=%p", - bulk_access_link_first->spider->dbton_handler)); - DBUG_PRINT("info",("spider ptr bulk_access_link->spider->dbton_handler=%p", - &bulk_access_link_first->spider->dbton_handler)); - bulk_access_link_current = bulk_access_link_first->next; - delete_bulk_access_link(bulk_access_link_first); - bulk_access_link_first = bulk_access_link_current; - } while (bulk_access_link_first); - } -#endif direct_aggregate_item_current = direct_aggregate_item_first; while (direct_aggregate_item_current) { @@ -1319,17 +1217,6 @@ int ha_spider::reset() use_fields = FALSE; #endif error_mode = 0; -#ifdef HA_CAN_BULK_ACCESS -#ifndef DBUG_OFF - if (bulk_access_link_first) - { - DBUG_PRINT("info",("spider bulk_access_link->spider->dbton_handler=%p", - bulk_access_link_first->spider->dbton_handler)); - DBUG_PRINT("info",("spider ptr bulk_access_link->spider->dbton_handler=%p", - &bulk_access_link_first->spider->dbton_handler)); - } -#endif -#endif DBUG_RETURN(error_num); } @@ -1438,19 +1325,6 @@ int ha_spider::index_init( DBUG_ENTER("ha_spider::index_init"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_PRINT("info",("spider idx=%u", idx)); -#ifdef HA_CAN_BULK_ACCESS - DBUG_ASSERT(!bulk_access_started); - if (bulk_access_executing) - { - if ( - !is_bulk_access_clone && - bulk_access_link_exec_tgt->called - ) { - DBUG_RETURN(bulk_access_link_exec_tgt->spider->ha_index_init( - idx, sorted)); - } - } -#endif if (!dml_inited) { if (unlikely((error_num = dml_init()))) @@ -1499,16 +1373,6 @@ int ha_spider::index_init( DBUG_RETURN(0); } -#ifdef HA_CAN_BULK_ACCESS -int ha_spider::pre_index_init( - uint idx, - bool sorted -) { - DBUG_ENTER("ha_spider::pre_index_init"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(bulk_access_link_current->spider->ha_index_init(idx, sorted)); -} -#endif int ha_spider::index_end() { @@ -1516,21 +1380,6 @@ int ha_spider::index_end() backup_error_status(); DBUG_ENTER("ha_spider::index_end"); DBUG_PRINT("info",("spider this=%p", this)); -#ifdef HA_CAN_BULK_ACCESS - DBUG_ASSERT(!bulk_access_started); - if (bulk_access_executing) - { - if ( - !is_bulk_access_clone && - bulk_access_link_exec_tgt->called - ) { - error_num = bulk_access_link_exec_tgt->spider->ha_index_end(); - if (error_num) - DBUG_RETURN(check_error_mode(error_num)); - DBUG_RETURN(0); - } - } -#endif active_index = MAX_KEY; /* #ifdef INFO_KIND_FORCE_LIMIT_BEGIN @@ -1550,14 +1399,6 @@ int ha_spider::index_end() DBUG_RETURN(0); } -#ifdef HA_CAN_BULK_ACCESS -int ha_spider::pre_index_end() -{ - DBUG_ENTER("ha_spider::pre_index_end"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(bulk_access_link_current->spider->ha_index_end()); -} -#endif int ha_spider::index_read_map_internal( uchar *buf, @@ -1762,17 +1603,6 @@ int ha_spider::index_read_map_internal( } pthread_mutex_lock(&conn->mta_conn_mutex); DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); -#ifdef HA_CAN_BULK_ACCESS - if ( - is_bulk_access_clone && - !bulk_access_executing && - conn_kind[roop_count] != SPIDER_CONN_KIND_MYSQL - ) { - connection_ids[roop_count] = conn->connection_id; - spider_trx_add_bulk_access_conn(wide_handler->trx, conn); - pthread_mutex_unlock(&conn->mta_conn_mutex); - } else { -#endif conn->need_mon = &need_mons[roop_count]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -1883,9 +1713,6 @@ int ha_spider::index_read_map_internal( spider_db_discard_result(this, roop_count, conn); pthread_mutex_unlock(&conn->mta_conn_mutex); } -#ifdef HA_CAN_BULK_ACCESS - } -#endif #ifndef WITHOUT_SPIDER_BG_SEARCH } #endif @@ -1901,42 +1728,13 @@ int ha_spider::pre_index_read_map( enum ha_rkey_function find_flag, bool use_parallel ) { -#ifdef HA_CAN_BULK_ACCESS - int error_num; -#endif DBUG_ENTER("ha_spider::pre_index_read_map"); DBUG_PRINT("info",("spider this=%p", this)); -#ifdef HA_CAN_BULK_ACCESS - if (bulk_access_started) - { - error_num = bulk_access_link_current->spider->pre_index_read_map(key, - keypart_map, find_flag, TRUE); - bulk_access_link_current->spider->bulk_access_pre_called = TRUE; - bulk_access_link_current->called = TRUE; - DBUG_RETURN(error_num); - } else if ( - bulk_access_executing && !is_bulk_access_clone && - bulk_access_link_exec_tgt->called - ) { - DBUG_RETURN(bulk_access_link_exec_tgt->spider->pre_index_read_map(key, - keypart_map, find_flag, TRUE)); - } -#endif check_pre_call(use_parallel); if (use_pre_call) { store_error_num = index_read_map_internal(NULL, key, keypart_map, find_flag); -#ifdef HA_CAN_BULK_ACCESS - if ( - !store_error_num && - bulk_access_executing && - is_bulk_access_clone && - !bulk_access_pre_called - ) { - bulk_req_exec(); - } -#endif DBUG_RETURN(store_error_num); } DBUG_RETURN(0); @@ -1951,59 +1749,6 @@ int ha_spider::index_read_map( int error_num; DBUG_ENTER("ha_spider::index_read_map"); DBUG_PRINT("info",("spider this=%p", this)); -#ifdef HA_CAN_BULK_ACCESS - DBUG_ASSERT(!bulk_access_started); - if (bulk_access_executing) - { - if (is_bulk_access_clone) - { - if (bulk_access_pre_called) - { - SPIDER_CONN *conn; - int roop_count, roop_start, roop_end, tmp_lock_mode, link_ok, - tmp_error_num; - tmp_lock_mode = spider_conn_lock_mode(this); - if (tmp_lock_mode) - { - /* "for update" or "lock in share mode" */ - link_ok = spider_conn_link_idx_next(share->link_statuses, - conn_link_idx, -1, share->link_count, - SPIDER_LINK_STATUS_OK); - roop_start = spider_conn_link_idx_next(share->link_statuses, - conn_link_idx, -1, share->link_count, - SPIDER_LINK_STATUS_RECOVERY); - roop_end = share->link_count; - } else { - link_ok = search_link_idx; - roop_start = search_link_idx; - roop_end = search_link_idx + 1; - } - for (roop_count = roop_start; roop_count < roop_end; - roop_count = spider_conn_link_idx_next(share->link_statuses, - conn_link_idx, roop_count, share->link_count, - SPIDER_LINK_STATUS_RECOVERY) - ) { - conn = conns[roop_count]; - if ((tmp_error_num = spider_db_bulk_store_result(this, conn, - roop_count, (roop_count != link_ok)))) - { - store_error_num = tmp_error_num; - } else { - result_link_idx = link_ok; - } - } - use_pre_call = TRUE; - bulk_access_pre_called = FALSE; - } else { - /* do access normally */ - } - } else if (bulk_access_link_exec_tgt->called) - { - DBUG_RETURN(bulk_access_link_exec_tgt->spider->index_read_map(buf, key, - keypart_map, find_flag)); - } - } -#endif if (use_pre_call) { if (store_error_num) @@ -2218,14 +1963,6 @@ int ha_spider::index_read_last_map_internal( } pthread_mutex_lock(&conn->mta_conn_mutex); DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); -#ifdef HA_CAN_BULK_ACCESS - if (is_bulk_access_clone) - { - connection_ids[roop_count] = conn->connection_id; - spider_trx_add_bulk_access_conn(wide_handler->trx, conn); - pthread_mutex_unlock(&conn->mta_conn_mutex); - } else { -#endif conn->need_mon = &need_mons[roop_count]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -2336,9 +2073,6 @@ int ha_spider::index_read_last_map_internal( spider_db_discard_result(this, roop_count, conn); pthread_mutex_unlock(&conn->mta_conn_mutex); } -#ifdef HA_CAN_BULK_ACCESS - } -#endif #ifndef WITHOUT_SPIDER_BG_SEARCH } #endif @@ -2401,21 +2135,6 @@ int ha_spider::index_next( my_error(ER_QUERY_INTERRUPTED, MYF(0)); DBUG_RETURN(ER_QUERY_INTERRUPTED); } -#ifdef HA_CAN_BULK_ACCESS - DBUG_ASSERT(!bulk_access_started); - if (bulk_access_executing) - { - if ( - !is_bulk_access_clone && - bulk_access_link_exec_tgt->called - ) { - error_num = bulk_access_link_exec_tgt->spider->index_next(buf); - if (error_num) - DBUG_RETURN(check_error_mode(error_num)); - DBUG_RETURN(0); - } - } -#endif if (is_clone) { DBUG_PRINT("info",("spider set pt_clone_last_searcher to %p", @@ -2447,21 +2166,6 @@ int ha_spider::index_prev( my_error(ER_QUERY_INTERRUPTED, MYF(0)); DBUG_RETURN(ER_QUERY_INTERRUPTED); } -#ifdef HA_CAN_BULK_ACCESS - DBUG_ASSERT(!bulk_access_started); - if (bulk_access_executing) - { - if ( - !is_bulk_access_clone && - bulk_access_link_exec_tgt->called - ) { - error_num = bulk_access_link_exec_tgt->spider->index_prev(buf); - if (error_num) - DBUG_RETURN(check_error_mode(error_num)); - DBUG_RETURN(0); - } - } -#endif if (is_clone) { DBUG_PRINT("info",("spider set pt_clone_last_searcher to %p", @@ -2669,14 +2373,6 @@ int ha_spider::index_first_internal( } pthread_mutex_lock(&conn->mta_conn_mutex); DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); -#ifdef HA_CAN_BULK_ACCESS - if (is_bulk_access_clone) - { - connection_ids[roop_count] = conn->connection_id; - spider_trx_add_bulk_access_conn(wide_handler->trx, conn); - pthread_mutex_unlock(&conn->mta_conn_mutex); - } else { -#endif conn->need_mon = &need_mons[roop_count]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -2787,9 +2483,6 @@ int ha_spider::index_first_internal( spider_db_discard_result(this, roop_count, conn); pthread_mutex_unlock(&conn->mta_conn_mutex); } -#ifdef HA_CAN_BULK_ACCESS - } -#endif #ifndef WITHOUT_SPIDER_BG_SEARCH } #endif @@ -3037,14 +2730,6 @@ int ha_spider::index_last_internal( } pthread_mutex_lock(&conn->mta_conn_mutex); DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); -#ifdef HA_CAN_BULK_ACCESS - if (is_bulk_access_clone) - { - connection_ids[roop_count] = conn->connection_id; - spider_trx_add_bulk_access_conn(wide_handler->trx, conn); - pthread_mutex_unlock(&conn->mta_conn_mutex); - } else { -#endif conn->need_mon = &need_mons[roop_count]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -3155,9 +2840,6 @@ int ha_spider::index_last_internal( spider_db_discard_result(this, roop_count, conn); pthread_mutex_unlock(&conn->mta_conn_mutex); } -#ifdef HA_CAN_BULK_ACCESS - } -#endif #ifndef WITHOUT_SPIDER_BG_SEARCH } #endif @@ -3231,22 +2913,6 @@ int ha_spider::index_next_same( my_error(ER_QUERY_INTERRUPTED, MYF(0)); DBUG_RETURN(ER_QUERY_INTERRUPTED); } -#ifdef HA_CAN_BULK_ACCESS - DBUG_ASSERT(!bulk_access_started); - if (bulk_access_executing) - { - if ( - !is_bulk_access_clone && - bulk_access_link_exec_tgt->called - ) { - error_num = bulk_access_link_exec_tgt->spider->index_next_same(buf, key, - keylen); - if (error_num) - DBUG_RETURN(check_error_mode(error_num)); - DBUG_RETURN(0); - } - } -#endif if (is_clone) { DBUG_PRINT("info",("spider set pt_clone_last_searcher to %p", @@ -3463,14 +3129,6 @@ int ha_spider::read_range_first_internal( } pthread_mutex_lock(&conn->mta_conn_mutex); DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); -#ifdef HA_CAN_BULK_ACCESS - if (is_bulk_access_clone) - { - connection_ids[roop_count] = conn->connection_id; - spider_trx_add_bulk_access_conn(wide_handler->trx, conn); - pthread_mutex_unlock(&conn->mta_conn_mutex); - } else { -#endif conn->need_mon = &need_mons[roop_count]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -3581,9 +3239,6 @@ int ha_spider::read_range_first_internal( spider_db_discard_result(this, roop_count, conn); pthread_mutex_unlock(&conn->mta_conn_mutex); } -#ifdef HA_CAN_BULK_ACCESS - } -#endif #ifndef WITHOUT_SPIDER_BG_SEARCH } #endif @@ -4072,20 +3727,6 @@ int ha_spider::read_multi_range_first_internal( } pthread_mutex_lock(&conn->mta_conn_mutex); DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); -#ifdef HA_CAN_BULK_ACCESS - if (is_bulk_access_clone) - { - connection_ids[roop_count] = conn->connection_id; - spider_trx_add_bulk_access_conn(wide_handler->trx, conn); - pthread_mutex_unlock(&conn->mta_conn_mutex); -#ifdef HA_MRR_USE_DEFAULT_IMPL - *range_info = (char *) mrr_cur_range.ptr; -#else - *found_range_p = multi_range_curr; -#endif - DBUG_RETURN(0); - } else { -#endif conn->need_mon = &need_mons[roop_count]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -4198,9 +3839,6 @@ int ha_spider::read_multi_range_first_internal( pthread_mutex_unlock(&conn->mta_conn_mutex); } } -#ifdef HA_CAN_BULK_ACCESS - } -#endif #ifndef WITHOUT_SPIDER_BG_SEARCH } #endif @@ -4845,20 +4483,6 @@ int ha_spider::read_multi_range_first_internal( pthread_mutex_lock(&conn->mta_conn_mutex); sql_type &= ~SPIDER_SQL_TYPE_TMP_SQL; DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); -#ifdef HA_CAN_BULK_ACCESS - if (is_bulk_access_clone) - { - connection_ids[roop_count] = conn->connection_id; - spider_trx_add_bulk_access_conn(wide_handler->trx, conn); - pthread_mutex_unlock(&conn->mta_conn_mutex); -#ifdef HA_MRR_USE_DEFAULT_IMPL - *range_info = multi_range_keys[multi_range_hit_point]; -#else - *found_range_p = &multi_range_ranges[multi_range_hit_point]; -#endif - DBUG_RETURN(0); - } else { -#endif conn->need_mon = &need_mons[roop_count]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -5014,9 +4638,6 @@ int ha_spider::read_multi_range_first_internal( spider_db_discard_result(this, roop_count, conn); pthread_mutex_unlock(&conn->mta_conn_mutex); } -#ifdef HA_CAN_BULK_ACCESS - } -#endif #ifndef WITHOUT_SPIDER_BG_SEARCH } #endif @@ -5475,20 +5096,6 @@ int ha_spider::read_multi_range_next( } pthread_mutex_lock(&conn->mta_conn_mutex); DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); -#ifdef HA_CAN_BULK_ACCESS - if (is_bulk_access_clone) - { - connection_ids[roop_count] = conn->connection_id; - spider_trx_add_bulk_access_conn(wide_handler->trx, conn); - pthread_mutex_unlock(&conn->mta_conn_mutex); -#ifdef HA_MRR_USE_DEFAULT_IMPL - *range_info = multi_range_keys[multi_range_hit_point]; -#else - *found_range_p = &multi_range_ranges[multi_range_hit_point]; -#endif - DBUG_RETURN(0); - } else { -#endif conn->need_mon = &need_mons[roop_count]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -5601,9 +5208,6 @@ int ha_spider::read_multi_range_next( pthread_mutex_unlock(&conn->mta_conn_mutex); } } -#ifdef HA_CAN_BULK_ACCESS - } -#endif #ifndef WITHOUT_SPIDER_BG_SEARCH } #endif @@ -6247,20 +5851,6 @@ int ha_spider::read_multi_range_next( pthread_mutex_lock(&conn->mta_conn_mutex); sql_type &= ~SPIDER_SQL_TYPE_TMP_SQL; DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); -#ifdef HA_CAN_BULK_ACCESS - if (is_bulk_access_clone) - { - connection_ids[roop_count] = conn->connection_id; - spider_trx_add_bulk_access_conn(wide_handler->trx, conn); - pthread_mutex_unlock(&conn->mta_conn_mutex); -#ifdef HA_MRR_USE_DEFAULT_IMPL - *range_info = multi_range_keys[multi_range_hit_point]; -#else - *found_range_p = &multi_range_ranges[multi_range_hit_point]; -#endif - DBUG_RETURN(0); - } else { -#endif conn->need_mon = &need_mons[roop_count]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -6416,9 +6006,6 @@ int ha_spider::read_multi_range_next( spider_db_discard_result(this, roop_count, conn); pthread_mutex_unlock(&conn->mta_conn_mutex); } -#ifdef HA_CAN_BULK_ACCESS - } -#endif #ifndef WITHOUT_SPIDER_BG_SEARCH } #endif @@ -6655,15 +6242,6 @@ int ha_spider::rnd_init( DBUG_RETURN(0); } -#ifdef HA_CAN_BULK_ACCESS -int ha_spider::pre_rnd_init( - bool scan -) { - DBUG_ENTER("ha_spider::pre_rnd_init"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(bulk_access_link_current->spider->ha_rnd_init(scan)); -} -#endif int ha_spider::rnd_end() { @@ -6687,14 +6265,6 @@ int ha_spider::rnd_end() DBUG_RETURN(0); } -#ifdef HA_CAN_BULK_ACCESS -int ha_spider::pre_rnd_end() -{ - DBUG_ENTER("ha_spider::pre_rnd_end"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(bulk_access_link_current->spider->ha_rnd_end()); -} -#endif int ha_spider::rnd_next_internal( uchar *buf @@ -8700,8 +8270,6 @@ ulonglong ha_spider::table_flags() const #endif #ifdef SPIDER_ENGINE_CONDITION_PUSHDOWN_IS_ALWAYS_ON HA_CAN_TABLE_CONDITION_PUSHDOWN | -#endif -#ifdef HA_CAN_BULK_ACCESS #endif SPIDER_CAN_BG_SEARCH | SPIDER_CAN_BG_INSERT | @@ -9046,30 +8614,6 @@ int ha_spider::write_row( table_share->db.str, table_share->table_name.str); DBUG_RETURN(ER_SPIDER_READ_ONLY_NUM); } -#ifdef HA_CAN_BULK_ACCESS - if ( - bulk_access_executing && - ( - ( - !is_bulk_access_clone && - bulk_access_link_exec_tgt->called - ) || - bulk_access_pre_called - ) - ) { - ulonglong option_backup = 0; - if (is_bulk_access_clone) - { - bulk_access_pre_called = FALSE; - DBUG_RETURN(spider_db_bulk_bulk_insert(this)); - } - option_backup = thd->variables.option_bits; - thd->variables.option_bits &= ~OPTION_BIN_LOG; - error_num = bulk_access_link_exec_tgt->spider->ha_write_row(buf); - thd->variables.option_bits = option_backup; - DBUG_RETURN(error_num); - } -#endif if (!dml_inited) { if (unlikely((error_num = dml_init()))) @@ -9156,35 +8700,9 @@ int ha_spider::write_row( if ((error_num = spider_db_bulk_insert(this, table, ©_info, FALSE))) DBUG_RETURN(check_error_mode(error_num)); -#ifdef HA_CAN_BULK_ACCESS - /* bulk access disabled case (like using partitioning) */ - if (bulk_access_executing && is_bulk_access_clone) - { - bulk_req_exec(); - DBUG_RETURN(spider_db_bulk_bulk_insert(this)); - } -#endif DBUG_RETURN(0); } -#ifdef HA_CAN_BULK_ACCESS -int ha_spider::pre_write_row( - uchar *buf -) { - int error_num; - ulonglong option_backup = 0; - THD *thd = wide_handler->trx->thd; - DBUG_ENTER("ha_spider::pre_write_row"); - DBUG_PRINT("info",("spider this=%p", this)); - option_backup = thd->variables.option_bits; - thd->variables.option_bits &= ~OPTION_BIN_LOG; - error_num = bulk_access_link_current->spider->ha_write_row(buf); - bulk_access_link_current->spider->bulk_access_pre_called = TRUE; - bulk_access_link_current->called = TRUE; - thd->variables.option_bits = option_backup; - DBUG_RETURN(error_num); -} -#endif void ha_spider::direct_update_init( THD *thd, @@ -9258,20 +8776,6 @@ int ha_spider::update_row( table_share->db.str, table_share->table_name.str); DBUG_RETURN(ER_SPIDER_READ_ONLY_NUM); } -#ifdef HA_CAN_BULK_ACCESS - if ( - bulk_access_executing && !is_bulk_access_clone && - bulk_access_link_exec_tgt->called - ) { - ulonglong option_backup = 0; - option_backup = thd->variables.option_bits; - thd->variables.option_bits &= ~OPTION_BIN_LOG; - error_num = bulk_access_link_exec_tgt->spider->ha_update_row( - old_data, new_data); - thd->variables.option_bits = option_backup; - DBUG_RETURN(error_num); - } -#endif #ifndef SPIDER_WITHOUT_HA_STATISTIC_INCREMENT ha_statistic_increment(&SSV::ha_update_count); #endif @@ -9357,27 +8861,6 @@ int ha_spider::direct_update_rows_init( THD *thd = wide_handler->trx->thd; DBUG_ENTER("ha_spider::direct_update_rows_init"); DBUG_PRINT("info",("spider this=%p", this)); -#ifdef HA_CAN_BULK_ACCESS - if ( - bulk_access_executing && - ( - ( - !is_bulk_access_clone && - bulk_access_link_exec_tgt->called - ) || - bulk_access_pre_called - ) - ) { - if (is_bulk_access_clone) - { - DBUG_PRINT("info",("spider return pre_direct_init_result %d", - pre_direct_init_result)); - DBUG_RETURN(pre_direct_init_result); - } - DBUG_RETURN(bulk_access_link_exec_tgt->spider->direct_update_rows_init( - update_fields, mode, ranges, range_count, sorted, new_data)); - } -#endif if (!dml_inited) { if (unlikely((error_num = dml_init()))) @@ -9495,27 +8978,6 @@ int ha_spider::direct_update_rows_init( } } } -#ifdef HA_CAN_BULK_ACCESS - if ( - bulk_access_executing && - ( - ( - !is_bulk_access_clone && - bulk_access_link_exec_tgt->called - ) || - bulk_access_pre_called - ) - ) { - if (is_bulk_access_clone) - { - DBUG_PRINT("info",("spider return pre_direct_init_result %d", - pre_direct_init_result)); - DBUG_RETURN(pre_direct_init_result); - } - DBUG_RETURN(bulk_access_link_exec_tgt->spider-> - direct_update_rows_init(update_fields)); - } -#endif if (!dml_inited) { if (unlikely(dml_init())) @@ -9586,78 +9048,6 @@ int ha_spider::direct_update_rows_init( } #endif -#ifdef HA_CAN_BULK_ACCESS -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS -int ha_spider::pre_direct_update_rows_init( - List *update_fields, - uint mode, - KEY_MULTI_RANGE *ranges, - uint range_count, - bool sorted, - uchar *new_data -) -{ - int error_num; - DBUG_ENTER("ha_spider::pre_direct_update_rows_init"); - DBUG_PRINT("info",("spider this=%p", this)); - if (bulk_access_started) - { - error_num = bulk_access_link_current->spider-> - pre_direct_update_rows_init( - update_fields, mode, ranges, range_count, sorted, new_data); - bulk_access_link_current->spider->bulk_access_pre_called = TRUE; - bulk_access_link_current->called = TRUE; - DBUG_RETURN(error_num); - } - if (!dml_inited) - { - if (unlikely((error_num = dml_init()))) - { - DBUG_RETURN(error_num); - } - } - pre_direct_init_result = direct_update_rows_init( - update_fields, mode, ranges, range_count, sorted, new_data); - DBUG_RETURN(pre_direct_init_result); -} -#else -/** - Do initialization for performing parallel direct update - for a handlersocket update request. - - @param update fields Pointer to the list of fields to update. - - @return >0 Error. - 0 Success. -*/ - -int ha_spider::pre_direct_update_rows_init( - List *update_fields -) -{ - int error_num; - DBUG_ENTER("ha_spider::pre_direct_update_rows_init"); - DBUG_PRINT("info",("spider this=%p", this)); - if (bulk_access_started) - { - error_num = bulk_access_link_current->spider-> - pre_direct_update_rows_init(update_fields); - bulk_access_link_current->spider->bulk_access_pre_called = TRUE; - bulk_access_link_current->called = TRUE; - DBUG_RETURN(error_num); - } - if (!dml_inited) - { - if (unlikely((error_num = dml_init()))) - { - DBUG_RETURN(error_num); - } - } - pre_direct_init_result = direct_update_rows_init(update_fields); - DBUG_RETURN(pre_direct_init_result); -} -#endif -#endif #ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS int ha_spider::direct_update_rows( @@ -9679,26 +9069,6 @@ int ha_spider::direct_update_rows( table_share->db.str, table_share->table_name.str); DBUG_RETURN(ER_SPIDER_READ_ONLY_NUM); } -#ifdef HA_CAN_BULK_ACCESS - if ( - bulk_access_executing && - ( - ( - !is_bulk_access_clone && - bulk_access_link_exec_tgt->called - ) || - bulk_access_pre_called - ) - ) { - if (is_bulk_access_clone) - { - bulk_access_pre_called = FALSE; - DBUG_RETURN(spider_db_bulk_direct_update(this, update_rows, found_rows)); - } - DBUG_RETURN(bulk_access_link_exec_tgt->spider->ha_direct_update_rows( - ranges, range_count, sorted, new_data, update_rows, found_rows)); - } -#endif if ( (active_index != MAX_KEY && (error_num = index_handler_init())) || (active_index == MAX_KEY && (error_num = rnd_handler_init())) || @@ -9707,13 +9077,6 @@ int ha_spider::direct_update_rows( ) DBUG_RETURN(check_error_mode(error_num)); -#ifdef HA_CAN_BULK_ACCESS - if (bulk_access_executing && is_bulk_access_clone) - { - bulk_req_exec(); - DBUG_RETURN(spider_db_bulk_direct_update(this, update_rows, found_rows)); - } -#endif DBUG_RETURN(0); } #else @@ -9732,26 +9095,6 @@ int ha_spider::direct_update_rows( table_share->db.str, table_share->table_name.str); DBUG_RETURN(ER_SPIDER_READ_ONLY_NUM); } -#ifdef HA_CAN_BULK_ACCESS - if ( - bulk_access_executing && - ( - ( - !is_bulk_access_clone && - bulk_access_link_exec_tgt->called - ) || - bulk_access_pre_called - ) - ) { - if (is_bulk_access_clone) - { - bulk_access_pre_called = FALSE; - DBUG_RETURN(spider_db_bulk_direct_update(this, update_rows, found_rows)); - } - DBUG_RETURN(bulk_access_link_exec_tgt->spider->ha_direct_update_rows( - update_rows, found_rows)); - } -#endif if ( (active_index != MAX_KEY && (error_num = index_handler_init())) || (active_index == MAX_KEY && (error_num = rnd_handler_init())) || @@ -9759,44 +9102,10 @@ int ha_spider::direct_update_rows( ) DBUG_RETURN(check_error_mode(error_num)); -#ifdef HA_CAN_BULK_ACCESS - if (bulk_access_executing && is_bulk_access_clone) - { - bulk_req_exec(); - DBUG_RETURN(spider_db_bulk_direct_update(this, update_rows, found_rows)); - } -#endif DBUG_RETURN(0); } #endif -#ifdef HA_CAN_BULK_ACCESS -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS -int ha_spider::pre_direct_update_rows( - KEY_MULTI_RANGE *ranges, - uint range_count, - bool sorted, - uchar *new_data, - ha_rows *update_rows, - ha_rows *found_rows -) { - DBUG_ENTER("ha_spider::pre_direct_update_rows"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(bulk_access_link_current->spider->ha_direct_update_rows(ranges, - range_count, sorted, new_data, update_rows, found_rows)); -} -#else -int ha_spider::pre_direct_update_rows() -{ - uint update_rows; - uint found_rows; - DBUG_ENTER("ha_spider::pre_direct_update_rows"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(bulk_access_link_current->spider->ha_direct_update_rows( - &update_rows, &found_rows)); -} -#endif -#endif bool ha_spider::start_bulk_delete( ) { @@ -9830,19 +9139,6 @@ int ha_spider::delete_row( table_share->db.str, table_share->table_name.str); DBUG_RETURN(ER_SPIDER_READ_ONLY_NUM); } -#ifdef HA_CAN_BULK_ACCESS - if ( - bulk_access_executing && !is_bulk_access_clone && - bulk_access_link_exec_tgt->called - ) { - ulonglong option_backup = 0; - option_backup = thd->variables.option_bits; - thd->variables.option_bits &= ~OPTION_BIN_LOG; - error_num = bulk_access_link_exec_tgt->spider->ha_delete_row(buf); - thd->variables.option_bits = option_backup; - DBUG_RETURN(error_num); - } -#endif #ifndef SPIDER_WITHOUT_HA_STATISTIC_INCREMENT ha_statistic_increment(&SSV::ha_delete_count); #endif @@ -9887,25 +9183,6 @@ int ha_spider::direct_delete_rows_init( THD *thd = wide_handler->trx->thd; DBUG_ENTER("ha_spider::direct_delete_rows_init"); DBUG_PRINT("info",("spider this=%p", this)); -#ifdef HA_CAN_BULK_ACCESS - if ( - bulk_access_executing && - ( - ( - !is_bulk_access_clone && - bulk_access_link_exec_tgt->called - ) || - bulk_access_pre_called - ) - ) { - if (is_bulk_access_clone) - { - DBUG_RETURN(pre_direct_init_result); - } - DBUG_RETURN(bulk_access_link_exec_tgt->spider->direct_delete_rows_init( - mode, ranges, range_count, sorted)); - } -#endif if (!dml_inited) { if (unlikely((error_num = dml_init()))) @@ -9980,24 +9257,6 @@ int ha_spider::direct_delete_rows_init() THD *thd = wide_handler->trx->thd; DBUG_ENTER("ha_spider::direct_delete_rows_init"); DBUG_PRINT("info",("spider this=%p", this)); -#ifdef HA_CAN_BULK_ACCESS - if ( - bulk_access_executing && - ( - ( - !is_bulk_access_clone && - bulk_access_link_exec_tgt->called - ) || - bulk_access_pre_called - ) - ) { - if (is_bulk_access_clone) - { - DBUG_RETURN(pre_direct_init_result); - } - DBUG_RETURN(bulk_access_link_exec_tgt->spider->direct_delete_rows_init()); - } -#endif if (!dml_inited) { if (unlikely(dml_init())) @@ -10048,63 +9307,6 @@ int ha_spider::direct_delete_rows_init() } #endif -#ifdef HA_CAN_BULK_ACCESS -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS -int ha_spider::pre_direct_delete_rows_init( - uint mode, - KEY_MULTI_RANGE *ranges, - uint range_count, - bool sorted -) { - int error_num; - DBUG_ENTER("ha_spider::pre_direct_delete_rows_init"); - DBUG_PRINT("info",("spider this=%p", this)); - if (bulk_access_started) - { - error_num = bulk_access_link_current->spider-> - pre_direct_delete_rows_init( - mode, ranges, range_count, sorted); - bulk_access_link_current->spider->bulk_access_pre_called = TRUE; - bulk_access_link_current->called = TRUE; - DBUG_RETURN(error_num); - } - if (!dml_inited) - { - if (unlikely((error_num = dml_init()))) - { - DBUG_RETURN(error_num); - } - } - pre_direct_init_result = direct_delete_rows_init( - mode, ranges, range_count, sorted); - DBUG_RETURN(pre_direct_init_result); -} -#else -int ha_spider::pre_direct_delete_rows_init() -{ - int error_num; - DBUG_ENTER("ha_spider::pre_direct_delete_rows_init"); - DBUG_PRINT("info",("spider this=%p", this)); - if (bulk_access_started) - { - error_num = bulk_access_link_current->spider-> - pre_direct_delete_rows_init(); - bulk_access_link_current->spider->bulk_access_pre_called = TRUE; - bulk_access_link_current->called = TRUE; - DBUG_RETURN(error_num); - } - if (!dml_inited) - { - if (unlikely((error_num = dml_init()))) - { - DBUG_RETURN(error_num); - } - } - pre_direct_init_result = direct_delete_rows_init(); - DBUG_RETURN(pre_direct_init_result); -} -#endif -#endif #ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS int ha_spider::direct_delete_rows( @@ -10124,26 +9326,6 @@ int ha_spider::direct_delete_rows( table_share->db.str, table_share->table_name.str); DBUG_RETURN(ER_SPIDER_READ_ONLY_NUM); } -#ifdef HA_CAN_BULK_ACCESS - if ( - bulk_access_executing && - ( - ( - !is_bulk_access_clone && - bulk_access_link_exec_tgt->called - ) || - bulk_access_pre_called - ) - ) { - if (is_bulk_access_clone) - { - bulk_access_pre_called = FALSE; - DBUG_RETURN(spider_db_bulk_direct_update(this, delete_rows)); - } - DBUG_RETURN(bulk_access_link_exec_tgt->spider->ha_direct_delete_rows( - ranges, range_count, sorted, delete_rows)); - } -#endif if ( (active_index != MAX_KEY && (error_num = index_handler_init())) || (active_index == MAX_KEY && (error_num = rnd_handler_init())) || @@ -10152,13 +9334,6 @@ int ha_spider::direct_delete_rows( ) DBUG_RETURN(check_error_mode(error_num)); -#ifdef HA_CAN_BULK_ACCESS - if (bulk_access_executing && is_bulk_access_clone) - { - bulk_req_exec(); - DBUG_RETURN(spider_db_bulk_direct_update(this, delete_rows)); - } -#endif DBUG_RETURN(0); } #else @@ -10176,26 +9351,6 @@ int ha_spider::direct_delete_rows( table_share->db.str, table_share->table_name.str); DBUG_RETURN(ER_SPIDER_READ_ONLY_NUM); } -#ifdef HA_CAN_BULK_ACCESS - if ( - bulk_access_executing && - ( - ( - !is_bulk_access_clone && - bulk_access_link_exec_tgt->called - ) || - bulk_access_pre_called - ) - ) { - if (is_bulk_access_clone) - { - bulk_access_pre_called = FALSE; - DBUG_RETURN(spider_db_bulk_direct_update(this, delete_rows)); - } - DBUG_RETURN(bulk_access_link_exec_tgt->spider->ha_direct_delete_rows( - delete_rows)); - } -#endif if ( (active_index != MAX_KEY && (error_num = index_handler_init())) || (active_index == MAX_KEY && (error_num = rnd_handler_init())) || @@ -10203,41 +9358,10 @@ int ha_spider::direct_delete_rows( ) DBUG_RETURN(check_error_mode(error_num)); -#ifdef HA_CAN_BULK_ACCESS - if (bulk_access_executing && is_bulk_access_clone) - { - bulk_req_exec(); - DBUG_RETURN(spider_db_bulk_direct_update(this, delete_rows)); - } -#endif DBUG_RETURN(0); } #endif -#ifdef HA_CAN_BULK_ACCESS -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS -int ha_spider::pre_direct_delete_rows( - KEY_MULTI_RANGE *ranges, - uint range_count, - bool sorted, - ha_rows *delete_rows -) { - DBUG_ENTER("ha_spider::pre_direct_delete_rows"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(bulk_access_link_current->spider->ha_direct_delete_rows( - ranges, range_count, sorted, delete_rows)); -} -#else -int ha_spider::pre_direct_delete_rows() -{ - uint delete_rows; - DBUG_ENTER("ha_spider::pre_direct_delete_rows"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(bulk_access_link_current->spider->ha_direct_delete_rows( - &delete_rows)); -} -#endif -#endif int ha_spider::delete_all_rows() { @@ -10289,57 +9413,6 @@ int ha_spider::truncate() DBUG_RETURN(0); } -#ifdef HA_CAN_BULK_ACCESS -void ha_spider::bulk_req_exec() -{ - int need_mon; - SPIDER_CONN *conn = wide_handler->trx->bulk_access_conn_first; - DBUG_ENTER("ha_spider::bulk_req_exec"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_PRINT("info",("spider trx=%p", wide_handler->trx)); - DBUG_PRINT("info",("spider first_conn=%p", conn)); - while (conn) - { - DBUG_PRINT("info",("spider conn=%p", conn)); - DBUG_PRINT("info",("spider conn->bulk_access_requests=%u", - conn->bulk_access_requests)); - if (conn->bulk_access_requests) - { - spider_bg_conn_wait(conn); - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &need_mon; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - /* currently only used for HS */ - conn->bulk_access_error_num = 0; - if (spider_db_query( - conn, - NULL, - 0, - -1, - &need_mon) - ) { - conn->bulk_access_error_num = spider_db_errorno(conn); - } -/* - conn->bulk_access_sended += conn->bulk_access_requests; -*/ - conn->bulk_access_requests = 0; - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - } - conn = conn->bulk_access_next; - } - wide_handler->trx->bulk_access_conn_first = NULL; - DBUG_VOID_RETURN; -} -#endif double ha_spider::scan_time() { @@ -11148,12 +10221,6 @@ Field *ha_spider::field_exchange( Field *field ) { DBUG_ENTER("ha_spider::field_exchange"); -#ifdef HA_CAN_BULK_ACCESS - if (is_bulk_access_clone) - { - DBUG_RETURN(pt_clone_source_handler->field_exchange(field)); - } -#endif DBUG_PRINT("info",("spider in field=%p", field)); DBUG_PRINT("info",("spider in field->table=%p", field->table)); DBUG_PRINT("info",("spider table=%p", table)); @@ -11231,28 +10298,6 @@ int ha_spider::info_push( wide_handler->stage = SPD_HND_STAGE_INFO_PUSH; wide_handler->stage_executor = this; #endif -#ifdef HA_CAN_BULK_ACCESS - if ( - info_type != INFO_KIND_BULK_ACCESS_BEGIN && - info_type != INFO_KIND_BULK_ACCESS_CURRENT && - info_type != INFO_KIND_BULK_ACCESS_END - ) { - if (!is_bulk_access_clone) - { - if ( - bulk_access_executing && - bulk_access_link_exec_tgt->called - ) { - DBUG_RETURN(bulk_access_link_exec_tgt->spider->info_push(info_type, - info)); - } else if (bulk_access_started) - { - DBUG_RETURN(bulk_access_link_current->spider->info_push(info_type, - info)); - } - } - } -#endif switch (info_type) { @@ -11282,65 +10327,6 @@ int ha_spider::info_push( DBUG_PRINT("info",("spider INFO_KIND_FORCE_LIMIT_END")); wide_handler->info_limit = 9223372036854775807LL; break; -#endif -#ifdef HA_CAN_BULK_ACCESS - case INFO_KIND_BULK_ACCESS_BEGIN: - DBUG_PRINT("info",("spider INFO_KIND_BULK_ACCESS_BEGIN")); - if (partition_handler && partition_handler->handlers) - { - size_t roop_count; - ha_spider **handlers = partition_handler->handlers; - for (roop_count = 0; roop_count < partition_handler->no_parts; - ++roop_count) - { - if ((error_num = handlers[roop_count]->bulk_access_begin(info))) - { - DBUG_RETURN(error_num); - } - } - } else { - if ((error_num = bulk_access_begin(info))) - { - DBUG_RETURN(error_num); - } - } - break; - case INFO_KIND_BULK_ACCESS_CURRENT: - DBUG_PRINT("info",("spider INFO_KIND_BULK_ACCESS_CURRENT")); - if (partition_handler && partition_handler->handlers) - { - size_t roop_count; - ha_spider **handlers = partition_handler->handlers; - for (roop_count = 0; roop_count < partition_handler->no_parts; - ++roop_count) - { - if ((error_num = handlers[roop_count]->bulk_access_current(info))) - { - DBUG_RETURN(error_num); - } - } - } else { - if ((error_num = bulk_access_current(info))) - { - DBUG_RETURN(error_num); - } - } - break; - case INFO_KIND_BULK_ACCESS_END: - DBUG_PRINT("info",("spider INFO_KIND_BULK_ACCESS_END")); - if (partition_handler && partition_handler->handlers) - { - size_t roop_count; - ha_spider **handlers = partition_handler->handlers; - for (roop_count = 0; roop_count < partition_handler->no_parts; - ++roop_count) - { - handlers[roop_count]->bulk_access_end(); - } - } else { - bulk_access_end(); - } - break; #endif default: break; @@ -12475,145 +11461,6 @@ void ha_spider::check_insert_dup_update_pushdown() DBUG_VOID_RETURN; } -#ifdef HA_CAN_BULK_ACCESS -SPIDER_BULK_ACCESS_LINK *ha_spider::create_bulk_access_link() -{ - uchar *ref; - ha_spider *spider; - SPIDER_BULK_ACCESS_LINK *bulk_access_link; - DBUG_ENTER("ha_spider::create_bulk_access_link"); - DBUG_PRINT("info",("spider this=%p", this)); -/* - if (!init_ha_mem_root) - { - SPD_INIT_ALLOC_ROOT(&ha_mem_root, sizeof(ha_spider) * 16, - sizeof(ha_spider) * 16, MYF(MY_WME)); - init_ha_mem_root = TRUE; - } -*/ - if (!(bulk_access_link = (SPIDER_BULK_ACCESS_LINK *) - spider_bulk_malloc(spider_current_trx, SPD_MID_HA_SPIDER_CREATE_BULK_ACCESS_LINK_1, MYF(MY_WME), - &bulk_access_link, (uint) (sizeof(SPIDER_BULK_ACCESS_LINK)), - &ref, (uint) (ALIGN_SIZE(ref_length) * 2), - NullS)) - ) { - goto error_bulk_malloc; - } - SPD_INIT_ALLOC_ROOT(&bulk_access_link->mem_root, sizeof(ha_spider), 0, - MYF(MY_WME)); -/* - if (!(spider = new ha_spider(spider_hton_ptr, table_share))) - if (!(spider = (ha_spider *) spider_create_handler( - spider_hton_ptr, table_share, &ha_mem_root))) -*/ - if (!(spider = (ha_spider *) spider_create_handler( - spider_hton_ptr, table_share, &bulk_access_link->mem_root))) - { - goto error_new_spider; - } - DBUG_PRINT("info",("spider spider=%p", spider)); - bulk_access_link->spider = spider; - spider->ref = ref; - bulk_access_link->next = NULL; - spider->is_clone = TRUE; - spider->is_bulk_access_clone = TRUE; - spider->pt_clone_source_handler = this; - if (spider->ha_open(table, share->table_name, table->db_stat, - HA_OPEN_IGNORE_IF_LOCKED)) - { - goto error_ha_open; - } - DBUG_RETURN(bulk_access_link); - -error_ha_open: - delete spider; -error_new_spider: - free_root(&bulk_access_link->mem_root, MYF(0)); - spider_free(spider_current_trx, bulk_access_link, MYF(0)); -error_bulk_malloc: - DBUG_RETURN(NULL); -} - -void ha_spider::delete_bulk_access_link( - SPIDER_BULK_ACCESS_LINK *bulk_access_link -) { - ha_spider *spider = bulk_access_link->spider; - DBUG_ENTER("ha_spider::delete_bulk_access_link"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_PRINT("info",("spider spider=%p", spider)); - DBUG_PRINT("info",("spider bulk_access_link->spider->dbton_handler=%p", - spider->dbton_handler)); - DBUG_PRINT("info",("spider ptr bulk_access_link->spider->dbton_handler=%p", - &spider->dbton_handler)); - spider->close(); - delete spider; - free_root(&bulk_access_link->mem_root, MYF(0)); - spider_free(spider_current_trx, bulk_access_link, MYF(0)); - DBUG_VOID_RETURN; -} - -int ha_spider::sync_from_clone_source( - ha_spider *spider -) { - int error_num; - DBUG_ENTER("ha_spider::sync_from_clone_source"); - sync_from_clone_source_base(spider); - if (!synced_from_clone_source) - { - DBUG_PRINT("info",("spider synced from clone source all")); - wide_handler->trx = spider->wide_handler->trx; - sql_command = spider->sql_command; - wide_handler->external_lock_type = - spider->wide_handler->external_lock_type; - selupd_lock_mode = spider->selupd_lock_mode; - update_request = spider->update_request; - lock_mode = spider->lock_mode; - high_priority = spider->high_priority; - low_priority = spider->low_priority; - memcpy(conns, spider->conns, - sizeof(SPIDER_CONN *) * share->link_count); - spider_thread_id = spider->spider_thread_id; - trx_conn_adjustment = spider->trx_conn_adjustment; - search_link_idx = spider->search_link_idx; - external_lock_cnt = spider->external_lock_cnt; - uint roop_count, dbton_id; - spider_db_handler *dbton_hdl, *dbton_hdl2; - for (roop_count = 0; roop_count < share->use_dbton_count; roop_count++) - { - dbton_id = share->use_dbton_ids[roop_count]; - dbton_hdl = dbton_handler[dbton_id]; - dbton_hdl2 = spider->dbton_handler[dbton_id]; - dbton_hdl->sync_from_clone_source(dbton_hdl2); - } - synced_from_clone_source = TRUE; - } else if (external_lock_cnt != spider->external_lock_cnt) - { - DBUG_PRINT("info",("spider synced from clone source")); - sql_command = spider->sql_command; - wide_handler->external_lock_type = - spider->wide_handler->external_lock_type; - selupd_lock_mode = spider->selupd_lock_mode; - update_request = spider->update_request; - lock_mode = spider->lock_mode; - high_priority = spider->high_priority; - low_priority = spider->low_priority; - - if ((error_num = spider_check_trx_and_get_conn( - spider->wide_handler->trx->thd, - this, TRUE))) - { - DBUG_RETURN(error_num); - } - external_lock_cnt = spider->external_lock_cnt; - } - - DBUG_PRINT("info",("spider bulk_access_link->spider->dbton_handler=%p", - dbton_handler)); - DBUG_PRINT("info",("spider ptr bulk_access_link->spider->dbton_handler=%p", - &dbton_handler)); - DBUG_RETURN(0); -} -#endif void ha_spider::sync_from_clone_source_base( ha_spider *spider @@ -14783,92 +13630,3 @@ int ha_spider::dml_init() DBUG_RETURN(0); } -#ifdef HA_CAN_BULK_ACCESS -int ha_spider::bulk_access_begin( - void *info -) { - DBUG_ENTER("ha_spider::bulk_access_begin"); - DBUG_PRINT("info",("spider this=%p", this)); - if (bulk_access_started) - { - if (!bulk_access_link_current->next) - { - if (!(bulk_access_link_current->next = create_bulk_access_link())) - { - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - bulk_access_link_current->next->sequence_num = - bulk_access_link_current->sequence_num + 1; - } - bulk_access_link_current = bulk_access_link_current->next; - } else { - if (!bulk_access_link_first) - { - if (!(bulk_access_link_first = create_bulk_access_link())) - { - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - bulk_access_link_first->sequence_num = 0; - } - bulk_access_link_current = bulk_access_link_first; - bulk_access_started = TRUE; - bulk_access_executing = FALSE; - } - bulk_access_link_current->spider-> - check_access_kind(wide_handler->trx->thd); - if ( - (error_num = bulk_access_link_current->spider-> - sync_from_clone_source(this)) || - (error_num = bulk_access_link_current->spider-> - check_access_kind_for_connection(wide_handler->trx->thd, - (lock_type >= TL_WRITE_ALLOW_WRITE))) - ) { - DBUG_RETURN(error_num); - } - bulk_access_link_current->spider->bulk_access_executing = FALSE; - bulk_access_link_current->spider->bulk_access_pre_called = FALSE; - bulk_access_link_current->used = TRUE; - bulk_access_link_current->called = FALSE; - *((void **) info) = bulk_access_link_current; - DBUG_RETURN(0); -} - -int ha_spider::bulk_access_current( - void *info -) { - DBUG_ENTER("ha_spider::bulk_access_current"); - DBUG_PRINT("info",("spider this=%p", this)); - bulk_access_executing = TRUE; - bulk_access_link_exec_tgt = (SPIDER_BULK_ACCESS_LINK *) info; - if (bulk_access_link_exec_tgt->spider->pt_clone_source_handler != this) - { - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_PRINT("info",("spider pt_clone_source_handler=%p", - bulk_access_link_exec_tgt->spider->pt_clone_source_handler)); - /* partitioned */ - uint sequence_num = bulk_access_link_exec_tgt->sequence_num; - for ( - bulk_access_link_exec_tgt = bulk_access_link_first; - bulk_access_link_exec_tgt; - bulk_access_link_exec_tgt = bulk_access_link_exec_tgt->next - ) { - if (bulk_access_link_exec_tgt->sequence_num >= sequence_num) - { - DBUG_ASSERT( - bulk_access_link_exec_tgt->sequence_num == sequence_num); - break; - } - } - } - bulk_access_link_exec_tgt->spider->bulk_access_executing = TRUE; - DBUG_RETURN(0); -} - -void ha_spider::bulk_access_end() -{ - DBUG_ENTER("ha_spider::bulk_access_end"); - DBUG_PRINT("info",("spider this=%p", this)); - bulk_access_started = FALSE; - DBUG_VOID_RETURN; -} -#endif diff --git a/storage/spider/ha_spider.h b/storage/spider/ha_spider.h index a57359ce025..446bbbc4d94 100644 --- a/storage/spider/ha_spider.h +++ b/storage/spider/ha_spider.h @@ -88,21 +88,6 @@ public: bool wide_handler_owner = FALSE; SPIDER_WIDE_HANDLER *wide_handler = NULL; -#ifdef HA_CAN_BULK_ACCESS - int pre_direct_init_result; - bool is_bulk_access_clone; - bool synced_from_clone_source; - bool bulk_access_started; - bool bulk_access_executing; - bool bulk_access_pre_called; - SPIDER_BULK_ACCESS_LINK *bulk_access_link_first; - SPIDER_BULK_ACCESS_LINK *bulk_access_link_current; - SPIDER_BULK_ACCESS_LINK *bulk_access_link_exec_tgt; -/* - bool init_ha_mem_root; - MEM_ROOT ha_mem_root; -*/ -#endif bool is_clone; ha_spider *pt_clone_source_handler; ha_spider *pt_clone_last_searcher; @@ -221,12 +206,6 @@ public: void check_access_kind( THD *thd ); -#ifdef HA_CAN_BULK_ACCESS - int additional_lock( - THD *thd, - enum thr_lock_type lock_type - ); -#endif THR_LOCK_DATA **store_lock( THD *thd, THR_LOCK_DATA **to, @@ -248,16 +227,7 @@ public: uint idx, bool sorted ) override; -#ifdef HA_CAN_BULK_ACCESS - int pre_index_init( - uint idx, - bool sorted - ); -#endif int index_end() override; -#ifdef HA_CAN_BULK_ACCESS - int pre_index_end(); -#endif int index_read_map( uchar *buf, const uchar *key, @@ -345,15 +315,7 @@ public: int rnd_init( bool scan ) override; -#ifdef HA_CAN_BULK_ACCESS - int pre_rnd_init( - bool scan - ); -#endif int rnd_end() override; -#ifdef HA_CAN_BULK_ACCESS - int pre_rnd_end(); -#endif int rnd_next( uchar *buf ) override; @@ -467,11 +429,6 @@ public: int write_row( const uchar *buf ) override; -#ifdef HA_CAN_BULK_ACCESS - int pre_write_row( - uchar *buf - ); -#endif void direct_update_init( THD *thd, bool hs_request @@ -514,27 +471,6 @@ public: List *update_fields ) override; #endif -#ifdef HA_CAN_BULK_ACCESS -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS - inline int pre_direct_update_rows_init( - List *update_fields - ) { - return pre_direct_update_rows_init(update_fields, 2, NULL, 0, FALSE, NULL); - } - int pre_direct_update_rows_init( - List *update_fields, - uint mode, - KEY_MULTI_RANGE *ranges, - uint range_count, - bool sorted, - uchar *new_data - ); -#else - int pre_direct_update_rows_init( - List *update_fields - ); -#endif -#endif #ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS inline int direct_update_rows(ha_rows *update_rows, ha_rows *found_rows) { @@ -553,28 +489,6 @@ public: ha_rows *update_rows, ha_rows *found_row ) override; -#endif -#ifdef HA_CAN_BULK_ACCESS -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS - inline int pre_direct_update_rows() - { - ha_rows update_rows; - ha_rows found_rows; - - return pre_direct_update_rows(NULL, 0, FALSE, NULL, &update_rows, - &found_rows); - } - int pre_direct_update_rows( - KEY_MULTI_RANGE *ranges, - uint range_count, - bool sorted, - uchar *new_data, - ha_rows *update_rows, - ha_rows *found_row - ); -#else - int pre_direct_update_rows(); -#endif #endif bool start_bulk_delete() override; int end_bulk_delete() override; @@ -600,22 +514,6 @@ public: #else int direct_delete_rows_init() override; #endif -#ifdef HA_CAN_BULK_ACCESS -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS - inline int pre_direct_delete_rows_init() - { - return pre_direct_delete_rows_init(2, NULL, 0, FALSE); - } - int pre_direct_delete_rows_init( - uint mode, - KEY_MULTI_RANGE *ranges, - uint range_count, - bool sorted - ); -#else - int pre_direct_delete_rows_init(); -#endif -#endif #ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS inline int direct_delete_rows(ha_rows *delete_rows) { @@ -631,24 +529,6 @@ public: int direct_delete_rows( ha_rows *delete_rows ) override; -#endif -#ifdef HA_CAN_BULK_ACCESS -#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS - inline int pre_direct_delete_rows() - { - ha_rows delete_rows; - - return pre_direct_delete_rows(NULL, 0, FALSE, &delete_rows); - } - int pre_direct_delete_rows( - KEY_MULTI_RANGE *ranges, - uint range_count, - bool sorted, - ha_rows *delete_rows - ); -#else - int pre_direct_delete_rows(); -#endif #endif int delete_all_rows() override; int truncate() override; @@ -658,9 +538,6 @@ public: uint ranges, ha_rows rows ) override; -#ifdef HA_CAN_BULK_ACCESS - void bulk_req_exec(); -#endif const key_map *keys_to_use_for_scanning() override; ha_rows estimate_rows_upper_bound() override; void print_error( @@ -818,15 +695,6 @@ public: bool use_parallel ); void check_insert_dup_update_pushdown(); -#ifdef HA_CAN_BULK_ACCESS - SPIDER_BULK_ACCESS_LINK *create_bulk_access_link(); - void delete_bulk_access_link( - SPIDER_BULK_ACCESS_LINK *bulk_access_link - ); - int sync_from_clone_source( - ha_spider *spider - ); -#endif void sync_from_clone_source_base( ha_spider *spider ); @@ -1044,15 +912,6 @@ public: int append_lock_tables_list(); int lock_tables(); int dml_init(); -#ifdef HA_CAN_BULK_ACCESS - int bulk_access_begin( - void *info - ); - int bulk_access_current( - void *info - ); - void bulk_access_end(); -#endif }; diff --git a/storage/spider/spd_conn.cc b/storage/spider/spd_conn.cc index 434a20e9e3e..cc3a6b52719 100644 --- a/storage/spider/spd_conn.cc +++ b/storage/spider/spd_conn.cc @@ -2590,13 +2590,6 @@ void *spider_bg_conn_action( pthread_mutex_lock(&conn->mta_conn_mutex); sql_type &= ~SPIDER_SQL_TYPE_TMP_SQL; DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); -#ifdef HA_CAN_BULK_ACCESS - if (spider->is_bulk_access_clone) - { - spider->connection_ids[conn->link_idx] = conn->connection_id; - spider_trx_add_bulk_access_conn(spider->trx, conn); - } -#endif if (!result_list->bgs_error) { conn->need_mon = &spider->need_mons[conn->link_idx]; @@ -2604,10 +2597,6 @@ void *spider_bg_conn_action( DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = TRUE; conn->mta_conn_mutex_unlock_later = TRUE; -#ifdef HA_CAN_BULK_ACCESS - if (!spider->is_bulk_access_clone) - { -#endif if (!(result_list->bgs_error = spider_db_set_names(spider, conn, conn->link_idx))) { @@ -2676,9 +2665,6 @@ void *spider_bg_conn_action( strmov(result_list->bgs_error_msg, spider_stmt_da_message(thd)); } -#ifdef HA_CAN_BULK_ACCESS - } -#endif DBUG_ASSERT(conn->mta_conn_mutex_lock_already); DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; diff --git a/storage/spider/spd_db_conn.cc b/storage/spider/spd_db_conn.cc index 7d786492bfe..4319616961b 100644 --- a/storage/spider/spd_db_conn.cc +++ b/storage/spider/spd_db_conn.cc @@ -4476,42 +4476,6 @@ void spider_db_discard_multiple_result( DBUG_VOID_RETURN; } -#ifdef HA_CAN_BULK_ACCESS -int spider_db_bulk_store_result( - ha_spider *spider, - SPIDER_CONN *conn, - int link_idx, - bool discard_result -) { - int error_num, tmp_error_num; - DBUG_ENTER("spider_db_bulk_store_result"); - DBUG_PRINT("info",("spider spider=%p", spider)); - DBUG_PRINT("info",("spider conn=%p", conn)); - DBUG_PRINT("info",("spider link_idx=%d", link_idx)); - if (conn->conn_kind == SPIDER_CONN_KIND_MYSQL) - { - /* already stored */ - DBUG_RETURN(0); - } - error_num = spider_db_bulk_open_handler(spider, conn, link_idx); - if (!discard_result) - { - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_unlock_later = TRUE; - if ((tmp_error_num = spider_db_store_result(spider, link_idx, - spider->get_table()))) - { - error_num = tmp_error_num; - } - conn->mta_conn_mutex_unlock_later = FALSE; - } else { - if (spider->connection_ids[link_idx] == conn->connection_id) - spider_db_discard_result(spider, link_idx, conn); - } - DBUG_RETURN(error_num); -} -#endif int spider_db_fetch( uchar *buf, @@ -6070,10 +6034,6 @@ int spider_db_bulk_insert( spider->set_insert_to_pos_sql(SPIDER_SQL_TYPE_INSERT_SQL); DBUG_RETURN(error_num); } -#ifdef HA_CAN_BULK_ACCESS - if (!spider->is_bulk_access_clone) - { -#endif bool insert_info = FALSE; for ( roop_count2 = spider_conn_link_idx_next(share->link_statuses, @@ -6254,9 +6214,6 @@ int spider_db_bulk_insert( conn->mta_conn_mutex_unlock_later = FALSE; pthread_mutex_unlock(&conn->mta_conn_mutex); spider->store_last_insert_id = 0; -#ifdef HA_CAN_BULK_ACCESS - } -#endif } if ( (bulk_end || !spider->bulk_insert) && @@ -6266,91 +6223,6 @@ int spider_db_bulk_insert( DBUG_RETURN(0); } -#ifdef HA_CAN_BULK_ACCESS -int spider_db_bulk_bulk_insert( - ha_spider *spider -) { - int error_num = 0, first_insert_link_idx = -1, tmp_error_num; - int roop_count2; - SPIDER_SHARE *share = spider->share; - SPIDER_CONN *conn, *first_insert_conn = NULL; - TABLE *table = spider->get_table(); - THD *thd = spider->wide_handler->trx->thd; - DBUG_ENTER("spider_db_bulk_bulk_insert"); - for ( - roop_count2 = spider_conn_link_idx_next(share->link_statuses, - spider->conn_link_idx, -1, share->link_count, - SPIDER_LINK_STATUS_RECOVERY); - roop_count2 < (int) share->link_count; - roop_count2 = spider_conn_link_idx_next(share->link_statuses, - spider->conn_link_idx, roop_count2, share->link_count, - SPIDER_LINK_STATUS_RECOVERY) - ) { - conn = spider->conns[roop_count2]; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if ((tmp_error_num = spider_db_bulk_open_handler(spider, conn, - roop_count2))) - { - error_num = tmp_error_num; - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - if (first_insert_link_idx == -1) - { - first_insert_link_idx = roop_count2; - first_insert_conn = conn; - } - } - - conn = first_insert_conn; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - conn->need_mon = &spider->need_mons[first_insert_link_idx]; - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if (table->next_number_field && - ( - !table->auto_increment_field_not_null || - ( - !table->next_number_field->val_int() && - !(thd->variables.sql_mode & MODE_NO_AUTO_VALUE_ON_ZERO) - ) - ) - ) { - ulonglong last_insert_id; - if (spider->store_last_insert_id) - last_insert_id = spider->store_last_insert_id; - else - last_insert_id = conn->db_conn->last_insert_id(); - table->next_number_field->set_notnull(); - if ( - (tmp_error_num = spider_db_update_auto_increment(spider, - first_insert_link_idx)) || - (tmp_error_num = table->next_number_field->store( - last_insert_id, TRUE)) - ) { - error_num = tmp_error_num; - } - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - spider->store_last_insert_id = 0; - DBUG_RETURN(error_num); -} -#endif int spider_db_update_auto_increment( ha_spider *spider, @@ -6917,13 +6789,6 @@ int spider_db_direct_update( DBUG_RETURN(error_num); } pthread_mutex_lock(&conn->mta_conn_mutex); -#ifdef HA_CAN_BULK_ACCESS - if (spider->is_bulk_access_clone) - { - spider->connection_ids[roop_count] = conn->connection_id; - spider_trx_add_bulk_access_conn(spider->wide_handler->trx, conn); - } else { -#endif conn->need_mon = &spider->need_mons[roop_count]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -7014,9 +6879,6 @@ int spider_db_direct_update( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; -#ifdef HA_CAN_BULK_ACCESS - } -#endif pthread_mutex_unlock(&conn->mta_conn_mutex); } spider->reset_sql_sql(SPIDER_SQL_TYPE_UPDATE_SQL); @@ -7125,13 +6987,6 @@ int spider_db_direct_update( DBUG_RETURN(error_num); } pthread_mutex_lock(&conn->mta_conn_mutex); -#ifdef HA_CAN_BULK_ACCESS - if (spider->is_bulk_access_clone) - { - spider->connection_ids[roop_count] = conn->connection_id; - spider_trx_add_bulk_access_conn(spider->wide_handler->trx, conn); - } else { -#endif conn->need_mon = &spider->need_mons[roop_count]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -7223,9 +7078,6 @@ int spider_db_direct_update( DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = FALSE; conn->mta_conn_mutex_unlock_later = FALSE; -#ifdef HA_CAN_BULK_ACCESS - } -#endif pthread_mutex_unlock(&conn->mta_conn_mutex); } spider->reset_sql_sql(SPIDER_SQL_TYPE_UPDATE_SQL); @@ -7233,56 +7085,6 @@ int spider_db_direct_update( } #endif -#ifdef HA_CAN_BULK_ACCESS -int spider_db_bulk_direct_update( - ha_spider *spider, - ha_rows *update_rows, - ha_rows *found_rows -) { - int error_num = 0, roop_count, tmp_error_num; - SPIDER_SHARE *share = spider->share; - SPIDER_CONN *conn; - bool counted = FALSE; - DBUG_ENTER("spider_db_bulk_direct_update"); - for ( - roop_count = spider_conn_link_idx_next(share->link_statuses, - spider->conn_link_idx, -1, share->link_count, - SPIDER_LINK_STATUS_RECOVERY); - roop_count < (int) share->link_count; - roop_count = spider_conn_link_idx_next(share->link_statuses, - spider->conn_link_idx, roop_count, share->link_count, - SPIDER_LINK_STATUS_RECOVERY) - ) { - DBUG_PRINT("info", ("spider exec sql")); - conn = spider->conns[roop_count]; - pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - pthread_mutex_lock(&conn->mta_conn_mutex); - DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = TRUE; - conn->mta_conn_mutex_unlock_later = TRUE; - if ((tmp_error_num = spider_db_bulk_open_handler(spider, conn, - roop_count))) - { - error_num = tmp_error_num; - } - if (!counted) - { - *update_rows = spider->conns[roop_count]->db_conn->affected_rows(); - DBUG_PRINT("info", ("spider update_rows = %llu", *update_rows)); - *found_rows = spider->conns[roop_count]->db_conn->matched_rows(); - DBUG_PRINT("info", ("spider found_rows = %llu", *found_rows)); - counted = TRUE; - } - DBUG_ASSERT(conn->mta_conn_mutex_lock_already); - DBUG_ASSERT(conn->mta_conn_mutex_unlock_later); - conn->mta_conn_mutex_lock_already = FALSE; - conn->mta_conn_mutex_unlock_later = FALSE; - pthread_mutex_unlock(&conn->mta_conn_mutex); - } - DBUG_RETURN(error_num); -} -#endif int spider_db_bulk_delete( ha_spider *spider, @@ -7447,13 +7249,6 @@ int spider_db_direct_delete( DBUG_RETURN(error_num); } pthread_mutex_lock(&conn->mta_conn_mutex); -#ifdef HA_CAN_BULK_ACCESS - if (spider->is_bulk_access_clone) - { - spider->connection_ids[roop_count] = conn->connection_id; - spider_trx_add_bulk_access_conn(spider->wide_handler->trx, conn); - } else { -#endif conn->need_mon = &spider->need_mons[roop_count]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -7536,9 +7331,6 @@ int spider_db_direct_delete( DBUG_PRINT("info", ("spider delete_rows = %llu", *delete_rows)); counted = TRUE; } -#ifdef HA_CAN_BULK_ACCESS - } -#endif pthread_mutex_unlock(&conn->mta_conn_mutex); } int error_num2 = 0; @@ -7623,13 +7415,6 @@ int spider_db_direct_delete( DBUG_RETURN(error_num); } pthread_mutex_lock(&conn->mta_conn_mutex); -#ifdef HA_CAN_BULK_ACCESS - if (spider->is_bulk_access_clone) - { - spider->connection_ids[roop_count] = conn->connection_id; - spider_trx_add_bulk_access_conn(spider->wide_handler->trx, conn); - } else { -#endif conn->need_mon = &spider->need_mons[roop_count]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -7712,9 +7497,6 @@ int spider_db_direct_delete( DBUG_PRINT("info", ("spider delete_rows = %llu", *delete_rows)); counted = TRUE; } -#ifdef HA_CAN_BULK_ACCESS - } -#endif pthread_mutex_unlock(&conn->mta_conn_mutex); } int error_num2 = 0; @@ -11146,20 +10928,6 @@ error: DBUG_RETURN(error_num); } -#ifdef HA_CAN_BULK_ACCESS -int spider_db_bulk_open_handler( - ha_spider *spider, - SPIDER_CONN *conn, - int link_idx -) { - int error_num = 0; - DBUG_ENTER("spider_db_bulk_open_handler"); - DBUG_PRINT("info",("spider spider=%p", spider)); - DBUG_PRINT("info",("spider conn=%p", conn)); - DBUG_PRINT("info",("spider link_idx=%d", link_idx)); - DBUG_RETURN(error_num); -} -#endif int spider_db_close_handler( ha_spider *spider, diff --git a/storage/spider/spd_db_conn.h b/storage/spider/spd_db_conn.h index aa451b861d2..6e94e2d1517 100644 --- a/storage/spider/spd_db_conn.h +++ b/storage/spider/spd_db_conn.h @@ -634,14 +634,6 @@ void spider_db_discard_multiple_result( SPIDER_CONN *conn ); -#ifdef HA_CAN_BULK_ACCESS -int spider_db_bulk_store_result( - ha_spider *spider, - SPIDER_CONN *conn, - int link_idx, - bool discard_result -); -#endif int spider_db_fetch( uchar *buf, @@ -764,11 +756,6 @@ int spider_db_bulk_insert( bool bulk_end ); -#ifdef HA_CAN_BULK_ACCESS -int spider_db_bulk_bulk_insert( - ha_spider *spider -); -#endif int spider_db_update_auto_increment( ha_spider *spider, @@ -815,12 +802,6 @@ int spider_db_direct_update( ); #endif -#ifdef HA_CAN_BULK_ACCESS -int spider_db_bulk_direct_update( - ha_spider *spider, - ha_rows *update_rows -); -#endif int spider_db_bulk_delete( ha_spider *spider, @@ -1190,13 +1171,6 @@ int spider_db_open_handler( int link_idx ); -#ifdef HA_CAN_BULK_ACCESS -int spider_db_bulk_open_handler( - ha_spider *spider, - SPIDER_CONN *conn, - int link_idx -); -#endif int spider_db_close_handler( ha_spider *spider, diff --git a/storage/spider/spd_db_include.h b/storage/spider/spd_db_include.h index 50974269e0c..ac031dfe64d 100644 --- a/storage/spider/spd_db_include.h +++ b/storage/spider/spd_db_include.h @@ -1766,8 +1766,6 @@ typedef struct st_spider_result_list SPIDER_RESULT *current; KEY *key_info; int key_order; -#ifdef HA_CAN_BULK_ACCESS -#endif spider_string *sqls; int ha_read_kind; bool have_sql_kind_backup; diff --git a/storage/spider/spd_db_mysql.cc b/storage/spider/spd_db_mysql.cc index 62fb57c8724..8c8ed349d32 100644 --- a/storage/spider/spd_db_mysql.cc +++ b/storage/spider/spd_db_mysql.cc @@ -15005,11 +15005,7 @@ void spider_mbase_handler::minimum_select_bitmap_create() memset(minimum_select_bitmap, 0, no_bytes_in_map(table->read_set)); if ( spider->use_index_merge || -#ifdef HA_CAN_BULK_ACCESS - (spider->is_clone && !spider->is_bulk_access_clone) -#else spider->is_clone -#endif ) { /* need preparing for cmp_ref */ TABLE_SHARE *table_share = table->s; diff --git a/storage/spider/spd_db_oracle.cc b/storage/spider/spd_db_oracle.cc index 9ed1aa32a96..c5bf59b8df8 100644 --- a/storage/spider/spd_db_oracle.cc +++ b/storage/spider/spd_db_oracle.cc @@ -12167,11 +12167,7 @@ void spider_oracle_handler::minimum_select_bitmap_create() memset(minimum_select_bitmap, 0, no_bytes_in_map(table->read_set)); if ( spider->use_index_merge || -#ifdef HA_CAN_BULK_ACCESS - (spider->is_clone && !spider->is_bulk_access_clone) -#else spider->is_clone -#endif ) { /* need preparing for cmp_ref */ TABLE_SHARE *table_share = table->s; diff --git a/storage/spider/spd_include.h b/storage/spider/spd_include.h index 5627f15bd4f..d06d0d7be8b 100644 --- a/storage/spider/spd_include.h +++ b/storage/spider/spd_include.h @@ -745,12 +745,6 @@ typedef struct st_spider_conn Time_zone *queued_time_zone_val; XID *queued_xa_start_xid; -#ifdef HA_CAN_BULK_ACCESS - uint bulk_access_requests; - uint bulk_access_sended; - int bulk_access_error_num; - st_spider_conn *bulk_access_next; -#endif bool disable_connect_retry; /* TRUE if it is unnecessary to retry to connect after a @@ -878,9 +872,6 @@ typedef struct st_spider_wide_handler uint top_table_fields; #ifdef INFO_KIND_FORCE_LIMIT_BEGIN longlong info_limit; -#endif -#ifdef HA_CAN_BULK_ACCESS - ulonglong external_lock_cnt; #endif bool between_flg; bool idx_bitmap_is_set; @@ -954,10 +945,6 @@ typedef struct st_spider_transaction ulonglong direct_aggregate_count; ulonglong parallel_search_count; -#ifdef HA_CAN_BULK_ACCESS - SPIDER_CONN *bulk_access_conn_first; - SPIDER_CONN *bulk_access_conn_last; -#endif pthread_mutex_t *udf_table_mutexes; CHARSET_INFO *udf_access_charset; @@ -1175,9 +1162,6 @@ typedef struct st_spider_share int error_read_mode; int error_write_mode; int active_link_count; -#ifdef HA_CAN_BULK_ACCESS - int bulk_access_free; -#endif #ifdef HA_CAN_FORCE_BULK_UPDATE int force_bulk_update; #endif @@ -1583,17 +1567,6 @@ typedef struct st_spider_trx_ha bool wait_for_reusing; } SPIDER_TRX_HA; -#ifdef HA_CAN_BULK_ACCESS -typedef struct st_spider_bulk_access_link -{ - ha_spider *spider; - uint sequence_num; - bool used; - bool called; - MEM_ROOT mem_root; - st_spider_bulk_access_link *next; -} SPIDER_BULK_ACCESS_LINK; -#endif #define SPIDER_INT_HLD_TGT_SIZE 100 typedef struct st_spider_int_hld diff --git a/storage/spider/spd_param.cc b/storage/spider/spd_param.cc index 41a065bfd29..55842682782 100644 --- a/storage/spider/spd_param.cc +++ b/storage/spider/spd_param.cc @@ -2033,28 +2033,6 @@ static MYSQL_THDVAR_INT( SPIDER_THDVAR_OVERRIDE_VALUE_FUNC(int, read_only_mode) -#ifdef HA_CAN_BULK_ACCESS -static int spider_bulk_access_free; -/* - -1 :fallback to default - 0 :in reset - 1 :in close - */ -static MYSQL_SYSVAR_INT( - bulk_access_free, - spider_bulk_access_free, - PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, - "Free mode of bulk access resources", - NULL, - NULL, - 0, - -1, - 1, - 0 -); - -SPIDER_SYSVAR_OVERRIDE_VALUE_FUN(int, bulk_access_free) -#endif /* -1 :fallback to default @@ -2657,9 +2635,6 @@ static struct st_mysql_sys_var* spider_system_variables[] = { MYSQL_SYSVAR(skip_parallel_search), MYSQL_SYSVAR(direct_order_limit), MYSQL_SYSVAR(read_only_mode), -#ifdef HA_CAN_BULK_ACCESS - MYSQL_SYSVAR(bulk_access_free), -#endif MYSQL_SYSVAR(udf_ds_use_real_table), MYSQL_SYSVAR(general_log), MYSQL_SYSVAR(index_hint_pushdown), diff --git a/storage/spider/spd_param.h b/storage/spider/spd_param.h index d7d35b17df5..c93d41022d5 100644 --- a/storage/spider/spd_param.h +++ b/storage/spider/spd_param.h @@ -337,11 +337,6 @@ int spider_param_read_only_mode( THD *thd, int read_only_mode ); -#ifdef HA_CAN_BULK_ACCESS -int spider_param_bulk_access_free( - int bulk_access_free -); -#endif int spider_param_udf_ds_use_real_table( THD *thd, int udf_ds_use_real_table diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc index 1503c61b1bb..dc30278e66c 100644 --- a/storage/spider/spd_table.cc +++ b/storage/spider/spd_table.cc @@ -1834,9 +1834,6 @@ static void spider_minus_1(SPIDER_SHARE *share, TABLE_SHARE *table_share) share->error_read_mode = -1; share->error_write_mode = -1; share->active_link_count = -1; -#ifdef HA_CAN_BULK_ACCESS - share->bulk_access_free = -1; -#endif #ifdef HA_CAN_FORCE_BULK_UPDATE share->force_bulk_update = -1; #endif @@ -2160,9 +2157,6 @@ int spider_parse_connect_info( 2147483647); SPIDER_PARAM_INT_WITH_MAX("aim", auto_increment_mode, 0, 3); SPIDER_PARAM_INT("alc", active_link_count, 1); -#ifdef HA_CAN_BULK_ACCESS - SPIDER_PARAM_INT_WITH_MAX("baf", bulk_access_free, 0, 1); -#endif SPIDER_PARAM_INT("bfz", buffer_size, 0); #ifndef WITHOUT_SPIDER_BG_SEARCH SPIDER_PARAM_LONGLONG("bfr", bgs_first_read, 0); @@ -2419,10 +2413,6 @@ int spider_parse_connect_info( net_read_timeouts, 0, 2147483647); SPIDER_PARAM_INT_WITH_MAX( "error_write_mode", error_write_mode, 0, 1); -#ifdef HA_CAN_BULK_ACCESS - SPIDER_PARAM_INT_WITH_MAX( - "bulk_access_free", bulk_access_free, 0, 1); -#endif SPIDER_PARAM_INT_WITH_MAX( "query_cache_sync", query_cache_sync, 0, 3); error_num = parse.fail(true); @@ -4549,8 +4539,6 @@ SPIDER_SHARE *spider_get_share( sizeof(uchar) * share->link_bitmap_size, &result_list->tmp_table_created, sizeof(uchar) * share->link_bitmap_size, -#ifdef HA_CAN_BULK_ACCESS -#endif &result_list->sql_kind_backup, sizeof(uint) * share->link_count, &result_list->casual_read, sizeof(int) * share->link_count, &spider->dbton_handler, @@ -5027,8 +5015,6 @@ SPIDER_SHARE *spider_get_share( sizeof(uchar) * share->link_bitmap_size, &result_list->tmp_table_created, sizeof(uchar) * share->link_bitmap_size, -#ifdef HA_CAN_BULK_ACCESS -#endif &result_list->sql_kind_backup, sizeof(uint) * share->link_count, &result_list->casual_read, sizeof(int) * share->link_count, &spider->dbton_handler, @@ -7733,18 +7719,10 @@ bool spider_check_direct_order_limit( spider->use_index_merge ? "TRUE" : "FALSE")); DBUG_PRINT("info",("spider is_clone=%s", spider->is_clone ? "TRUE" : "FALSE")); -#ifdef HA_CAN_BULK_ACCESS - DBUG_PRINT("info",("spider is_bulk_access_clone=%s", - spider->is_bulk_access_clone ? "TRUE" : "FALSE")); -#endif if ( spider->wide_handler->sql_command != SQLCOM_HA_READ && !spider->use_index_merge && -#ifdef HA_CAN_BULK_ACCESS - (!spider->is_clone || spider->is_bulk_access_clone) -#else !spider->is_clone -#endif ) { spider_get_select_limit(spider, &select_lex, &select_limit, &offset_limit); bool first_check = TRUE; @@ -7946,12 +7924,6 @@ Field *spider_field_exchange( Field *field ) { DBUG_ENTER("spider_field_exchange"); -#ifdef HA_CAN_BULK_ACCESS - if (handler->is_bulk_access_clone) - { - handler = handler->pt_clone_source_handler; - } -#endif DBUG_PRINT("info",("spider in field=%p", field)); DBUG_PRINT("info",("spider in field->table=%p", field->table)); DBUG_PRINT("info",("spider table=%p", handler->get_table())); diff --git a/storage/spider/spd_trx.cc b/storage/spider/spd_trx.cc index 11dc7a81ad8..305d8fc7327 100644 --- a/storage/spider/spd_trx.cc +++ b/storage/spider/spd_trx.cc @@ -3097,11 +3097,6 @@ int spider_commit( if (!(trx = (SPIDER_TRX*) thd_get_ha_data(thd, spider_hton_ptr))) DBUG_RETURN(0); /* transaction is not started */ -#ifdef HA_CAN_BULK_ACCESS - DBUG_PRINT("info",("spider trx->bulk_access_conn_first=%p", - trx->bulk_access_conn_first)); - trx->bulk_access_conn_first = NULL; -#endif /* We do (almost) nothing if the following two conditions are both met: @@ -3195,11 +3190,6 @@ int spider_rollback( if (!(trx = (SPIDER_TRX*) thd_get_ha_data(thd, spider_hton_ptr))) DBUG_RETURN(0); /* transaction is not started */ -#ifdef HA_CAN_BULK_ACCESS - DBUG_PRINT("info",("spider trx->bulk_access_conn_first=%p", - trx->bulk_access_conn_first)); - trx->bulk_access_conn_first = NULL; -#endif /* In case the rollback happens due to failure of LOCK TABLE, we need to clear the list of tables to lock. */ @@ -3936,34 +3926,3 @@ int spider_trx_check_link_idx_failed( DBUG_RETURN(0); } -#ifdef HA_CAN_BULK_ACCESS -void spider_trx_add_bulk_access_conn( - SPIDER_TRX *trx, - SPIDER_CONN *conn -) { - DBUG_ENTER("spider_trx_add_bulk_access_conn"); - DBUG_PRINT("info",("spider trx=%p", trx)); - DBUG_PRINT("info",("spider conn=%p", conn)); - DBUG_PRINT("info",("spider conn->bulk_access_requests=%u", - conn->bulk_access_requests)); - DBUG_PRINT("info",("spider conn->bulk_access_sended=%u", - conn->bulk_access_sended)); - DBUG_PRINT("info",("spider trx->bulk_access_conn_first=%p", - trx->bulk_access_conn_first)); - if (!conn->bulk_access_requests && !conn->bulk_access_sended) - { - if (!trx->bulk_access_conn_first) - { - trx->bulk_access_conn_first = conn; - } else { - trx->bulk_access_conn_last->bulk_access_next = conn; - } - trx->bulk_access_conn_last = conn; - conn->bulk_access_next = NULL; - } - conn->bulk_access_requests++; - DBUG_PRINT("info",("spider conn->bulk_access_requests=%u", - conn->bulk_access_requests)); - DBUG_VOID_RETURN; -} -#endif diff --git a/storage/spider/spd_trx.h b/storage/spider/spd_trx.h index 3bf93aada1a..2055a49717e 100644 --- a/storage/spider/spd_trx.h +++ b/storage/spider/spd_trx.h @@ -266,9 +266,3 @@ int spider_trx_check_link_idx_failed( ha_spider *spider ); -#ifdef HA_CAN_BULK_ACCESS -void spider_trx_add_bulk_access_conn( - SPIDER_TRX *trx, - SPIDER_CONN *conn -); -#endif