diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc index dd23e4f1354..7c5e7b86200 100644 --- a/storage/spider/ha_spider.cc +++ b/storage/spider/ha_spider.cc @@ -2332,25 +2332,12 @@ int ha_spider::index_read_map_internal( #endif spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id]; pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } if ((error_num = dbton_hdl->set_sql_for_exec(sql_type, roop_count))) { - if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type)) - { - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - } DBUG_RETURN(error_num); } - if (!dbton_hdl->need_lock_before_set_sql_for_exec(sql_type)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } + pthread_mutex_lock(&conn->mta_conn_mutex); + SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); #ifdef HA_CAN_BULK_ACCESS if ( @@ -2842,25 +2829,12 @@ int ha_spider::index_read_last_map_internal( #endif spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id]; pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } if ((error_num = dbton_hdl->set_sql_for_exec(sql_type, roop_count))) { - if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type)) - { - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - } DBUG_RETURN(error_num); } - if (!dbton_hdl->need_lock_before_set_sql_for_exec(sql_type)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } + pthread_mutex_lock(&conn->mta_conn_mutex); + SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); #ifdef HA_CAN_BULK_ACCESS if (is_bulk_access_clone) @@ -3326,26 +3300,13 @@ int ha_spider::index_first_internal( #endif spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id]; pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } if ((error_num = dbton_hdl->set_sql_for_exec(sql_type, roop_count))) { - if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type)) - { - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - } DBUG_RETURN(error_num); } - if (!dbton_hdl->need_lock_before_set_sql_for_exec(sql_type)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } + pthread_mutex_lock(&conn->mta_conn_mutex); + SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); #ifdef HA_CAN_BULK_ACCESS if (is_bulk_access_clone) @@ -3728,26 +3689,13 @@ int ha_spider::index_last_internal( #endif spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id]; pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } if ((error_num = dbton_hdl->set_sql_for_exec(sql_type, roop_count))) { - if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type)) - { - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - } DBUG_RETURN(error_num); } - if (!dbton_hdl->need_lock_before_set_sql_for_exec(sql_type)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } + pthread_mutex_lock(&conn->mta_conn_mutex); + SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); #ifdef HA_CAN_BULK_ACCESS if (is_bulk_access_clone) @@ -4190,25 +4138,12 @@ int ha_spider::read_range_first_internal( #endif spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id]; pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } if ((error_num = dbton_hdl->set_sql_for_exec(sql_type, roop_count))) { - if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type)) - { - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - } DBUG_RETURN(error_num); } - if (!dbton_hdl->need_lock_before_set_sql_for_exec(sql_type)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } + pthread_mutex_lock(&conn->mta_conn_mutex); + SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); #ifdef HA_CAN_BULK_ACCESS if (is_bulk_access_clone) @@ -4893,26 +4828,13 @@ int ha_spider::read_multi_range_first_internal( #endif spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id]; pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } if ((error_num = dbton_hdl->set_sql_for_exec(sql_type, roop_count))) { - if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type)) - { - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - } DBUG_RETURN(error_num); } - if (!dbton_hdl->need_lock_before_set_sql_for_exec(sql_type)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } + pthread_mutex_lock(&conn->mta_conn_mutex); + SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); #ifdef HA_CAN_BULK_ACCESS if (is_bulk_access_clone) @@ -5717,26 +5639,13 @@ int ha_spider::read_multi_range_first_internal( #endif spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id]; pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } if ((error_num = dbton_hdl->set_sql_for_exec(sql_type, roop_count))) { - if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type)) - { - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - } DBUG_RETURN(error_num); } - if (!dbton_hdl->need_lock_before_set_sql_for_exec(sql_type)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } + pthread_mutex_lock(&conn->mta_conn_mutex); + SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); sql_type &= ~SPIDER_SQL_TYPE_TMP_SQL; DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); #ifdef HA_CAN_BULK_ACCESS @@ -6393,26 +6302,13 @@ int ha_spider::read_multi_range_next( #endif spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id]; pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } if ((error_num = dbton_hdl->set_sql_for_exec(sql_type, roop_count))) { - if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type)) - { - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - } DBUG_RETURN(error_num); } - if (!dbton_hdl->need_lock_before_set_sql_for_exec(sql_type)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } + pthread_mutex_lock(&conn->mta_conn_mutex); + SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); #ifdef HA_CAN_BULK_ACCESS if (is_bulk_access_clone) @@ -7212,26 +7108,13 @@ int ha_spider::read_multi_range_next( #endif spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id]; pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } if ((error_num = dbton_hdl->set_sql_for_exec(sql_type, roop_count))) { - if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type)) - { - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - } DBUG_RETURN(error_num); } - if (!dbton_hdl->need_lock_before_set_sql_for_exec(sql_type)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } + pthread_mutex_lock(&conn->mta_conn_mutex); + SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); sql_type &= ~SPIDER_SQL_TYPE_TMP_SQL; DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); #ifdef HA_CAN_BULK_ACCESS @@ -7894,26 +7777,13 @@ int ha_spider::rnd_next_internal( } spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id]; pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } if ((error_num = dbton_hdl->set_sql_for_exec(sql_type, roop_count))) { - if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type)) - { - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - } DBUG_RETURN(error_num); } - if (!dbton_hdl->need_lock_before_set_sql_for_exec(sql_type)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } + pthread_mutex_lock(&conn->mta_conn_mutex); + SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); conn->need_mon = &need_mons[roop_count]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); @@ -8524,29 +8394,13 @@ int ha_spider::ft_read_internal( spider_db_handler *dbton_hdl = dbton_handler[dbton_id]; SPIDER_CONN *conn = conns[roop_count]; pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - if (dbton_hdl->need_lock_before_set_sql_for_exec( - SPIDER_SQL_TYPE_SELECT_SQL)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } if ((error_num = dbton_hdl->set_sql_for_exec( SPIDER_SQL_TYPE_SELECT_SQL, roop_count))) { - if (dbton_hdl->need_lock_before_set_sql_for_exec( - SPIDER_SQL_TYPE_SELECT_SQL)) - { - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - } DBUG_RETURN(error_num); } - if (!dbton_hdl->need_lock_before_set_sql_for_exec( - SPIDER_SQL_TYPE_SELECT_SQL)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } + pthread_mutex_lock(&conn->mta_conn_mutex); + SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &need_mons[roop_count]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -13313,29 +13167,13 @@ int ha_spider::drop_tmp_tables() spider_db_handler *dbton_hdl = dbton_handler[dbton_id]; SPIDER_CONN *conn = conns[roop_count]; pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - if (dbton_hdl->need_lock_before_set_sql_for_exec( - SPIDER_SQL_TYPE_TMP_SQL)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } if ((error_num = dbton_hdl->set_sql_for_exec( SPIDER_SQL_TYPE_TMP_SQL, roop_count))) { - if (dbton_hdl->need_lock_before_set_sql_for_exec( - SPIDER_SQL_TYPE_TMP_SQL)) - { - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - } DBUG_RETURN(error_num); } - if (!dbton_hdl->need_lock_before_set_sql_for_exec( - SPIDER_SQL_TYPE_TMP_SQL)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } + pthread_mutex_lock(&conn->mta_conn_mutex); + SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &need_mon; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); diff --git a/storage/spider/spd_conn.cc b/storage/spider/spd_conn.cc index 1faa65d0db5..85a7ccf88e2 100644 --- a/storage/spider/spd_conn.cc +++ b/storage/spider/spd_conn.cc @@ -2636,11 +2636,6 @@ void *spider_bg_conn_action( } #endif pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - if (dbton_handler->need_lock_before_set_sql_for_exec(sql_type)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } if (spider->use_fields) { if ((error_num = dbton_handler->set_sql_for_exec(sql_type, @@ -2659,11 +2654,8 @@ void *spider_bg_conn_action( strmov(result_list->bgs_error_msg, spider_stmt_da_message(thd)); } } - if (!dbton_handler->need_lock_before_set_sql_for_exec(sql_type)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } + pthread_mutex_lock(&conn->mta_conn_mutex); + SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); sql_type &= ~SPIDER_SQL_TYPE_TMP_SQL; DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); #ifdef HA_CAN_BULK_ACCESS diff --git a/storage/spider/spd_db_conn.cc b/storage/spider/spd_db_conn.cc index de85e0b99b2..c01dc21c1ce 100644 --- a/storage/spider/spd_db_conn.cc +++ b/storage/spider/spd_db_conn.cc @@ -4770,27 +4770,14 @@ int spider_db_seek_next( spider_db_handler *dbton_handler = spider->dbton_handler[conn->dbton_id]; pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - if (dbton_handler->need_lock_before_set_sql_for_exec(sql_type)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } if ((error_num = dbton_handler->set_sql_for_exec(sql_type, link_idx))) { - if (dbton_handler->need_lock_before_set_sql_for_exec(sql_type)) - { - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - } DBUG_PRINT("info",("spider error_num 6=%d", error_num)); DBUG_RETURN(error_num); } - if (!dbton_handler->need_lock_before_set_sql_for_exec(sql_type)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); + pthread_mutex_lock(&conn->mta_conn_mutex); SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } conn->need_mon = &spider->need_mons[link_idx]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -4878,27 +4865,14 @@ int spider_db_seek_next( spider_db_handler *dbton_handler = spider->dbton_handler[conn->dbton_id]; pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - if (dbton_handler->need_lock_before_set_sql_for_exec(sql_type)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } if ((error_num = dbton_handler->set_sql_for_exec(sql_type, roop_count))) { - if (dbton_handler->need_lock_before_set_sql_for_exec(sql_type)) - { - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - } DBUG_PRINT("info",("spider error_num 6=%d", error_num)); DBUG_RETURN(error_num); } - if (!dbton_handler->need_lock_before_set_sql_for_exec(sql_type)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); + pthread_mutex_lock(&conn->mta_conn_mutex); SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } conn->need_mon = &spider->need_mons[roop_count]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -5149,25 +5123,12 @@ int spider_db_seek_last( conn = spider->conns[roop_count]; spider_db_handler *dbton_handler = spider->dbton_handler[conn->dbton_id]; pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - if (dbton_handler->need_lock_before_set_sql_for_exec(sql_type)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } if ((error_num = dbton_handler->set_sql_for_exec(sql_type, roop_count))) { - if (dbton_handler->need_lock_before_set_sql_for_exec(sql_type)) - { - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - } DBUG_RETURN(error_num); } - if (!dbton_handler->need_lock_before_set_sql_for_exec(sql_type)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } + pthread_mutex_lock(&conn->mta_conn_mutex); + SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); conn->need_mon = &spider->need_mons[roop_count]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); @@ -5366,25 +5327,12 @@ int spider_db_seek_last( conn = spider->conns[roop_count]; spider_db_handler *dbton_handler = spider->dbton_handler[conn->dbton_id]; pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - if (dbton_handler->need_lock_before_set_sql_for_exec(sql_type)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } if ((error_num = dbton_handler->set_sql_for_exec(sql_type, roop_count))) { - if (dbton_handler->need_lock_before_set_sql_for_exec(sql_type)) - { - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - } DBUG_RETURN(error_num); } - if (!dbton_handler->need_lock_before_set_sql_for_exec(sql_type)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } + pthread_mutex_lock(&conn->mta_conn_mutex); + SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); DBUG_PRINT("info",("spider sql_type=%lu", sql_type)); conn->need_mon = &spider->need_mons[roop_count]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); @@ -6227,26 +6175,11 @@ int spider_db_bulk_insert( conn = spider->conns[roop_count2]; dbton_handler = spider->dbton_handler[conn->dbton_id]; pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - if (dbton_handler->need_lock_before_set_sql_for_exec(sql_type)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } if ((error_num = dbton_handler->set_sql_for_exec(sql_type, roop_count2))) - { - if (dbton_handler->need_lock_before_set_sql_for_exec(sql_type)) - { - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - } DBUG_RETURN(error_num); - } - if (!dbton_handler->need_lock_before_set_sql_for_exec(sql_type)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } + pthread_mutex_lock(&conn->mta_conn_mutex); + SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); #if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET) } else { sql_type = SPIDER_SQL_TYPE_INSERT_HS; @@ -6718,29 +6651,13 @@ int spider_db_bulk_update_size_limit( conn = spider->conns[roop_count]; spider_db_handler *dbton_hdl = spider->dbton_handler[conn->dbton_id]; pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - if (dbton_hdl->need_lock_before_set_sql_for_exec( - SPIDER_SQL_TYPE_BULK_UPDATE_SQL)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } if ((error_num = dbton_hdl->set_sql_for_exec( SPIDER_SQL_TYPE_BULK_UPDATE_SQL, roop_count))) { - if (dbton_hdl->need_lock_before_set_sql_for_exec( - SPIDER_SQL_TYPE_BULK_UPDATE_SQL)) - { - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - } DBUG_RETURN(error_num); } - if (!dbton_hdl->need_lock_before_set_sql_for_exec( - SPIDER_SQL_TYPE_BULK_UPDATE_SQL)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } + pthread_mutex_lock(&conn->mta_conn_mutex); + SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); if ((error_num = spider_db_query_for_bulk_update( spider, conn, roop_count, &dup_key_found))) { @@ -6814,33 +6731,17 @@ int spider_db_bulk_update_end( conn = spider->conns[roop_count]; spider_db_handler *dbton_hdl = spider->dbton_handler[conn->dbton_id]; pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - if (dbton_hdl->need_lock_before_set_sql_for_exec( - SPIDER_SQL_TYPE_BULK_UPDATE_SQL)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } if ((error_num = dbton_hdl->set_sql_for_exec( SPIDER_SQL_TYPE_BULK_UPDATE_SQL, roop_count))) { - if (dbton_hdl->need_lock_before_set_sql_for_exec( - SPIDER_SQL_TYPE_BULK_UPDATE_SQL)) - { - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - } if (error_num == ER_SPIDER_COND_SKIP_NUM) { continue; } DBUG_RETURN(error_num); } - if (!dbton_hdl->need_lock_before_set_sql_for_exec( - SPIDER_SQL_TYPE_BULK_UPDATE_SQL)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } + pthread_mutex_lock(&conn->mta_conn_mutex); + SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); if ((error_num = spider_db_query_for_bulk_update( spider, conn, roop_count, dup_key_found))) { @@ -6873,29 +6774,13 @@ int spider_db_bulk_update_end( conn = spider->conns[roop_count]; spider_db_handler *dbton_hdl = spider->dbton_handler[conn->dbton_id]; pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - if (dbton_hdl->need_lock_before_set_sql_for_exec( - SPIDER_SQL_TYPE_BULK_UPDATE_SQL)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } if ((error_num = dbton_hdl->set_sql_for_exec( SPIDER_SQL_TYPE_BULK_UPDATE_SQL, roop_count))) { - if (dbton_hdl->need_lock_before_set_sql_for_exec( - SPIDER_SQL_TYPE_BULK_UPDATE_SQL)) - { - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - } DBUG_RETURN(error_num); } - if (!dbton_hdl->need_lock_before_set_sql_for_exec( - SPIDER_SQL_TYPE_BULK_UPDATE_SQL)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } + pthread_mutex_lock(&conn->mta_conn_mutex); + SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); if ((error_num = spider_db_query_for_bulk_update( spider, conn, roop_count, dup_key_found))) { @@ -6971,29 +6856,13 @@ int spider_db_update( conn->ignore_dup_key = spider->ignore_dup_key; #endif pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - if (dbton_hdl->need_lock_before_set_sql_for_exec( - SPIDER_SQL_TYPE_UPDATE_SQL)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } if ((error_num = dbton_hdl->set_sql_for_exec( SPIDER_SQL_TYPE_UPDATE_SQL, roop_count))) { - if (dbton_hdl->need_lock_before_set_sql_for_exec( - SPIDER_SQL_TYPE_UPDATE_SQL)) - { - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - } DBUG_RETURN(error_num); } - if (!dbton_hdl->need_lock_before_set_sql_for_exec( - SPIDER_SQL_TYPE_UPDATE_SQL)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } + pthread_mutex_lock(&conn->mta_conn_mutex); + SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &spider->need_mons[roop_count]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); @@ -7320,25 +7189,12 @@ int spider_db_direct_update( #endif spider_db_handler *dbton_hdl = spider->dbton_handler[conn->dbton_id]; pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } if ((error_num = dbton_hdl->set_sql_for_exec(sql_type, roop_count))) { - if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type)) - { - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - } DBUG_RETURN(error_num); } - if (!dbton_hdl->need_lock_before_set_sql_for_exec(sql_type)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } + pthread_mutex_lock(&conn->mta_conn_mutex); + SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); #ifdef HA_CAN_BULK_ACCESS if (spider->is_bulk_access_clone) { @@ -7596,25 +7452,12 @@ int spider_db_direct_update( sql_type = SPIDER_SQL_TYPE_UPDATE_SQL; spider_db_handler *dbton_hdl = spider->dbton_handler[conn->dbton_id]; pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } if ((error_num = dbton_hdl->set_sql_for_exec(sql_type, roop_count))) { - if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type)) - { - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - } DBUG_RETURN(error_num); } - if (!dbton_hdl->need_lock_before_set_sql_for_exec(sql_type)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } + pthread_mutex_lock(&conn->mta_conn_mutex); + SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); #ifdef HA_CAN_BULK_ACCESS if (spider->is_bulk_access_clone) { @@ -7879,29 +7722,13 @@ int spider_db_delete( conn = spider->conns[roop_count]; spider_db_handler *dbton_hdl = spider->dbton_handler[conn->dbton_id]; pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - if (dbton_hdl->need_lock_before_set_sql_for_exec( - SPIDER_SQL_TYPE_DELETE_SQL)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } if ((error_num = dbton_hdl->set_sql_for_exec( SPIDER_SQL_TYPE_DELETE_SQL, roop_count))) { - if (dbton_hdl->need_lock_before_set_sql_for_exec( - SPIDER_SQL_TYPE_DELETE_SQL)) - { - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - } DBUG_RETURN(error_num); } - if (!dbton_hdl->need_lock_before_set_sql_for_exec( - SPIDER_SQL_TYPE_DELETE_SQL)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } + pthread_mutex_lock(&conn->mta_conn_mutex); + SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); conn->mta_conn_mutex_lock_already = TRUE; @@ -8036,25 +7863,12 @@ int spider_db_direct_delete( #endif spider_db_handler *dbton_hdl = spider->dbton_handler[conn->dbton_id]; pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } if ((error_num = dbton_hdl->set_sql_for_exec(sql_type, roop_count))) { - if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type)) - { - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - } DBUG_RETURN(error_num); } - if (!dbton_hdl->need_lock_before_set_sql_for_exec(sql_type)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } + pthread_mutex_lock(&conn->mta_conn_mutex); + SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); #ifdef HA_CAN_BULK_ACCESS if (spider->is_bulk_access_clone) { @@ -8272,25 +8086,12 @@ int spider_db_direct_delete( sql_type = SPIDER_SQL_TYPE_DELETE_SQL; spider_db_handler *dbton_hdl = spider->dbton_handler[conn->dbton_id]; pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } if ((error_num = dbton_hdl->set_sql_for_exec(sql_type, roop_count))) { - if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type)) - { - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - } DBUG_RETURN(error_num); } - if (!dbton_hdl->need_lock_before_set_sql_for_exec(sql_type)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } + pthread_mutex_lock(&conn->mta_conn_mutex); + SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); #ifdef HA_CAN_BULK_ACCESS if (spider->is_bulk_access_clone) { @@ -8421,29 +8222,13 @@ int spider_db_delete_all_rows( spider_db_handler *dbton_hdl = spider->dbton_handler[dbton_id]; conn = spider->conns[roop_count]; pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - if (dbton_hdl->need_lock_before_set_sql_for_exec( - SPIDER_SQL_TYPE_DELETE_SQL)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } if ((error_num = dbton_hdl->set_sql_for_exec( SPIDER_SQL_TYPE_DELETE_SQL, roop_count))) { - if (dbton_hdl->need_lock_before_set_sql_for_exec( - SPIDER_SQL_TYPE_DELETE_SQL)) - { - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - } DBUG_RETURN(error_num); } - if (!dbton_hdl->need_lock_before_set_sql_for_exec( - SPIDER_SQL_TYPE_DELETE_SQL)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } + pthread_mutex_lock(&conn->mta_conn_mutex); + SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &spider->need_mons[roop_count]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later); diff --git a/storage/spider/spd_db_include.h b/storage/spider/spd_db_include.h index eaddddc6d72..307c6638c3a 100644 --- a/storage/spider/spd_db_include.h +++ b/storage/spider/spd_db_include.h @@ -1633,9 +1633,6 @@ public: SPIDER_HS_STRING_REF &info ) = 0; #endif - virtual bool need_lock_before_set_sql_for_exec( - ulong sql_type - ) = 0; #ifdef SPIDER_HAS_GROUP_BY_HANDLER virtual int set_sql_for_exec( ulong sql_type, diff --git a/storage/spider/spd_db_mysql.cc b/storage/spider/spd_db_mysql.cc index e2f31b537e9..eb85c80e525 100644 --- a/storage/spider/spd_db_mysql.cc +++ b/storage/spider/spd_db_mysql.cc @@ -13538,14 +13538,6 @@ int spider_mbase_handler::push_back_upds( } #endif -bool spider_mbase_handler::need_lock_before_set_sql_for_exec( - ulong sql_type -) { - DBUG_ENTER("spider_mbase_handler::need_lock_before_set_sql_for_exec"); - DBUG_PRINT("info",("spider this=%p", this)); - DBUG_RETURN(FALSE); -} - #ifdef SPIDER_HAS_GROUP_BY_HANDLER int spider_mbase_handler::set_sql_for_exec( ulong sql_type, diff --git a/storage/spider/spd_db_mysql.h b/storage/spider/spd_db_mysql.h index c866376095a..7305aec5d82 100644 --- a/storage/spider/spd_db_mysql.h +++ b/storage/spider/spd_db_mysql.h @@ -1476,9 +1476,6 @@ public: SPIDER_HS_STRING_REF &info ); #endif - bool need_lock_before_set_sql_for_exec( - ulong sql_type - ); #ifdef SPIDER_HAS_GROUP_BY_HANDLER int set_sql_for_exec( ulong sql_type, diff --git a/storage/spider/spd_group_by_handler.cc b/storage/spider/spd_group_by_handler.cc index 635bff3d415..5a0c30bd790 100644 --- a/storage/spider/spd_group_by_handler.cc +++ b/storage/spider/spd_group_by_handler.cc @@ -1411,30 +1411,14 @@ int spider_group_by_handler::init_scan() } else { #endif pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); - if (dbton_hdl->need_lock_before_set_sql_for_exec( - SPIDER_SQL_TYPE_SELECT_SQL)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } if ((error_num = dbton_hdl->set_sql_for_exec(SPIDER_SQL_TYPE_SELECT_SQL, link_idx, link_idx_chain))) { - if (dbton_hdl->need_lock_before_set_sql_for_exec( - SPIDER_SQL_TYPE_SELECT_SQL)) - { - SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos); - pthread_mutex_unlock(&conn->mta_conn_mutex); - } DBUG_RETURN(error_num); } - if (!dbton_hdl->need_lock_before_set_sql_for_exec( - SPIDER_SQL_TYPE_SELECT_SQL)) - { - pthread_mutex_lock(&conn->mta_conn_mutex); - SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); - } + pthread_mutex_lock(&conn->mta_conn_mutex); + SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos); conn->need_mon = &spider->need_mons[link_idx]; DBUG_ASSERT(!conn->mta_conn_mutex_lock_already); DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);