Skip to content

Commit

Permalink
MDEV-27256 Delete spider_use_handler and related code (3/3)
Browse files Browse the repository at this point in the history
Fix indentation and format code (mostly done by clang-format-diff).
  • Loading branch information
nayuta-yanagisawa committed Jun 9, 2022
1 parent 57d233e commit 978eb61
Show file tree
Hide file tree
Showing 5 changed files with 230 additions and 311 deletions.
136 changes: 48 additions & 88 deletions storage/spider/ha_spider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ int ha_spider::open(

int ha_spider::close()
{
int error_num = 0, roop_count;
int error_num= 0, roop_count;
THD *thd = ha_thd();
backup_error_status();
DBUG_ENTER("ha_spider::close");
Expand Down Expand Up @@ -1253,8 +1253,7 @@ int ha_spider::index_init(
set_select_column_mode();
}

if ((error_num = reset_sql_sql(
SPIDER_SQL_TYPE_SELECT_SQL)))
if ((error_num= reset_sql_sql(SPIDER_SQL_TYPE_SELECT_SQL)))
DBUG_RETURN(error_num);
result_list.check_direct_order_limit = FALSE;
prev_index_rnd_init = SPD_INDEX;
Expand Down Expand Up @@ -1324,8 +1323,7 @@ int ha_spider::index_read_map_internal(
start_key.key = key;
start_key.keypart_map = keypart_map;
start_key.flag = find_flag;
if ((error_num = reset_sql_sql(
SPIDER_SQL_TYPE_SELECT_SQL)))
if ((error_num= reset_sql_sql(SPIDER_SQL_TYPE_SELECT_SQL)))
DBUG_RETURN(error_num);
if ((error_num = spider_set_conn_bg_param(this)))
DBUG_RETURN(error_num);
Expand Down Expand Up @@ -1457,10 +1455,8 @@ int ha_spider::index_read_map_internal(
}
} else {
ulong sql_type;
conn = conns[roop_count];
{
sql_type = SPIDER_SQL_TYPE_SELECT_SQL;
}
conn= conns[roop_count];
sql_type= SPIDER_SQL_TYPE_SELECT_SQL;
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))
Expand Down Expand Up @@ -1688,8 +1684,7 @@ int ha_spider::index_read_last_map_internal(
start_key.key = key;
start_key.keypart_map = keypart_map;
start_key.flag = HA_READ_KEY_EXACT;
if ((error_num = reset_sql_sql(
SPIDER_SQL_TYPE_SELECT_SQL)))
if ((error_num= reset_sql_sql(SPIDER_SQL_TYPE_SELECT_SQL)))
DBUG_RETURN(error_num);
if ((error_num = spider_set_conn_bg_param(this)))
DBUG_RETURN(error_num);
Expand Down Expand Up @@ -1809,10 +1804,8 @@ int ha_spider::index_read_last_map_internal(
}
} else {
ulong sql_type;
conn = conns[roop_count];
{
sql_type = SPIDER_SQL_TYPE_SELECT_SQL;
}
conn= conns[roop_count];
sql_type= SPIDER_SQL_TYPE_SELECT_SQL;
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))
Expand Down Expand Up @@ -2077,16 +2070,14 @@ int ha_spider::index_first_internal(
pt_clone_source_handler));
pt_clone_source_handler->pt_clone_last_searcher = this;
}
if (
sql_is_empty(SPIDER_SQL_TYPE_SELECT_SQL)
) {
/*
spider_db_free_one_result_for_start_next(this);
*/
if (sql_is_empty(SPIDER_SQL_TYPE_SELECT_SQL))
{
/*
spider_db_free_one_result_for_start_next(this);
*/
if ((error_num = spider_db_free_result(this, FALSE)))
DBUG_RETURN(error_num);
if ((error_num = reset_sql_sql(
SPIDER_SQL_TYPE_SELECT_SQL)))
if ((error_num= reset_sql_sql(SPIDER_SQL_TYPE_SELECT_SQL)))
DBUG_RETURN(error_num);

check_direct_order_limit();
Expand Down Expand Up @@ -2209,10 +2200,8 @@ int ha_spider::index_first_internal(
}
} else {
ulong sql_type;
conn = conns[roop_count];
{
sql_type = SPIDER_SQL_TYPE_SELECT_SQL;
}
conn= conns[roop_count];
sql_type= SPIDER_SQL_TYPE_SELECT_SQL;
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))
Expand Down Expand Up @@ -2425,16 +2414,14 @@ int ha_spider::index_last_internal(
pt_clone_source_handler));
pt_clone_source_handler->pt_clone_last_searcher = this;
}
if (
sql_is_empty(SPIDER_SQL_TYPE_SELECT_SQL)
) {
/*
spider_db_free_one_result_for_start_next(this);
*/
if (sql_is_empty(SPIDER_SQL_TYPE_SELECT_SQL))
{
/*
spider_db_free_one_result_for_start_next(this);
*/
if ((error_num = spider_db_free_result(this, FALSE)))
DBUG_RETURN(error_num);
if ((error_num = reset_sql_sql(
SPIDER_SQL_TYPE_SELECT_SQL)))
if ((error_num= reset_sql_sql(SPIDER_SQL_TYPE_SELECT_SQL)))
DBUG_RETURN(error_num);

check_direct_order_limit();
Expand Down Expand Up @@ -2557,10 +2544,8 @@ int ha_spider::index_last_internal(
}
} else {
ulong sql_type;
conn = conns[roop_count];
{
sql_type = SPIDER_SQL_TYPE_SELECT_SQL;
}
conn= conns[roop_count];
sql_type= SPIDER_SQL_TYPE_SELECT_SQL;
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))
Expand Down Expand Up @@ -2827,8 +2812,7 @@ int ha_spider::read_range_first_internal(
}
spider_db_free_one_result_for_start_next(this);
check_direct_order_limit();
if ((error_num = reset_sql_sql(
SPIDER_SQL_TYPE_SELECT_SQL)))
if ((error_num= reset_sql_sql(SPIDER_SQL_TYPE_SELECT_SQL)))
DBUG_RETURN(error_num);
if ((error_num = spider_set_conn_bg_param(this)))
DBUG_RETURN(error_num);
Expand Down Expand Up @@ -2949,10 +2933,8 @@ int ha_spider::read_range_first_internal(
}
} else {
ulong sql_type;
conn = conns[roop_count];
{
sql_type = SPIDER_SQL_TYPE_SELECT_SQL;
}
conn= conns[roop_count];
sql_type= SPIDER_SQL_TYPE_SELECT_SQL;
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))
Expand Down Expand Up @@ -3363,16 +3345,13 @@ int ha_spider::multi_range_read_next_first(
DBUG_PRINT("info",("spider result_list.finish_flg = FALSE"));
result_list.finish_flg = FALSE;
result_list.record_num = 0;
if ((error_num = reset_sql_sql(
SPIDER_SQL_TYPE_SELECT_SQL)))
if ((error_num= reset_sql_sql(SPIDER_SQL_TYPE_SELECT_SQL)))
DBUG_RETURN(error_num);
result_list.desc_flg = FALSE;
result_list.sorted = mrr_is_output_sorted;
result_list.key_info = &table->key_info[active_index];
if (
multi_range_num == 1 ||
result_list.multi_split_read <= 1
) {
if (multi_range_num == 1 || result_list.multi_split_read <= 1)
{
if (wide_handler->keyread)
result_list.keyread = TRUE;
else
Expand Down Expand Up @@ -3489,10 +3468,8 @@ int ha_spider::multi_range_read_next_first(
}
} else {
ulong sql_type;
conn = conns[roop_count];
{
sql_type = SPIDER_SQL_TYPE_SELECT_SQL;
}
conn= conns[roop_count];
sql_type= SPIDER_SQL_TYPE_SELECT_SQL;
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))
Expand Down Expand Up @@ -4119,10 +4096,8 @@ int ha_spider::multi_range_read_next_first(
}
} else {
ulong sql_type;
conn = conns[roop_count];
{
sql_type = SPIDER_SQL_TYPE_SELECT_SQL | SPIDER_SQL_TYPE_TMP_SQL;
}
conn= conns[roop_count];
sql_type= SPIDER_SQL_TYPE_SELECT_SQL | SPIDER_SQL_TYPE_TMP_SQL;
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))
Expand Down Expand Up @@ -4396,8 +4371,7 @@ int ha_spider::multi_range_read_next_first(
DBUG_RETURN(check_error_mode_eof(0));
}
multi_range_cnt = 0;
if ((error_num = reset_sql_sql(
SPIDER_SQL_TYPE_SELECT_SQL)))
if ((error_num= reset_sql_sql(SPIDER_SQL_TYPE_SELECT_SQL)))
DBUG_RETURN(error_num);
} while (!error_num);
}
Expand Down Expand Up @@ -4470,10 +4444,8 @@ int ha_spider::multi_range_read_next_next(
pt_clone_source_handler));
pt_clone_source_handler->pt_clone_last_searcher = this;
}
if (
multi_range_num == 1 ||
result_list.multi_split_read <= 1
) {
if (multi_range_num == 1 || result_list.multi_split_read <= 1)
{
if (!(error_num = spider_db_seek_next(table->record[0], this,
search_link_idx, table)))
{
Expand Down Expand Up @@ -4607,10 +4579,8 @@ int ha_spider::multi_range_read_next_next(
}
} else {
ulong sql_type;
conn = conns[roop_count];
{
sql_type = SPIDER_SQL_TYPE_SELECT_SQL;
}
conn= conns[roop_count];
sql_type= SPIDER_SQL_TYPE_SELECT_SQL;
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))
Expand Down Expand Up @@ -4882,8 +4852,7 @@ int ha_spider::multi_range_read_next_next(
}
result_list.record_num = 0;

if ((error_num = reset_sql_sql(
SPIDER_SQL_TYPE_SELECT_SQL)))
if ((error_num= reset_sql_sql(SPIDER_SQL_TYPE_SELECT_SQL)))
DBUG_RETURN(error_num);

bool tmp_high_priority = wide_handler->high_priority;
Expand Down Expand Up @@ -5231,10 +5200,8 @@ int ha_spider::multi_range_read_next_next(
}
} else {
ulong sql_type;
conn = conns[roop_count];
{
sql_type = SPIDER_SQL_TYPE_SELECT_SQL | SPIDER_SQL_TYPE_TMP_SQL;
}
conn= conns[roop_count];
sql_type= SPIDER_SQL_TYPE_SELECT_SQL | SPIDER_SQL_TYPE_TMP_SQL;
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))
Expand Down Expand Up @@ -5506,8 +5473,7 @@ int ha_spider::multi_range_read_next_next(
DBUG_RETURN(check_error_mode_eof(0));
}
multi_range_cnt = 0;
if ((error_num = reset_sql_sql(
SPIDER_SQL_TYPE_SELECT_SQL)))
if ((error_num= reset_sql_sql(SPIDER_SQL_TYPE_SELECT_SQL)))
DBUG_RETURN(error_num);
} while (!error_num);
}
Expand Down Expand Up @@ -5612,8 +5578,7 @@ int ha_spider::rnd_init(
result_list.keyread = FALSE;

init_rnd_handler = FALSE;
if ((error_num = reset_sql_sql(
SPIDER_SQL_TYPE_SELECT_SQL)))
if ((error_num= reset_sql_sql(SPIDER_SQL_TYPE_SELECT_SQL)))
DBUG_RETURN(error_num);
result_list.check_direct_order_limit = FALSE;
}
Expand Down Expand Up @@ -5815,9 +5780,7 @@ int ha_spider::rnd_next_internal(
} else {
SPIDER_CONN *conn = conns[roop_count];
ulong sql_type;
{
sql_type = SPIDER_SQL_TYPE_SELECT_SQL;
}
sql_type= SPIDER_SQL_TYPE_SELECT_SQL;
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))
Expand Down Expand Up @@ -8342,9 +8305,8 @@ int ha_spider::direct_update_rows(
table_share->db.str, table_share->table_name.str);
DBUG_RETURN(ER_SPIDER_READ_ONLY_NUM);
}
if (
(error_num = spider_db_direct_update(this, table, update_rows, found_rows))
)
if ((error_num=
spider_db_direct_update(this, table, update_rows, found_rows)))
DBUG_RETURN(check_error_mode(error_num));

DBUG_RETURN(0);
Expand Down Expand Up @@ -8486,9 +8448,7 @@ int ha_spider::direct_delete_rows(
table_share->db.str, table_share->table_name.str);
DBUG_RETURN(ER_SPIDER_READ_ONLY_NUM);
}
if (
(error_num = spider_db_direct_delete(this, table, delete_rows))
)
if ((error_num= spider_db_direct_delete(this, table, delete_rows)))
DBUG_RETURN(check_error_mode(error_num));

DBUG_RETURN(0);
Expand Down
4 changes: 1 addition & 3 deletions storage/spider/spd_conn.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2516,9 +2516,7 @@ void *spider_bg_conn_action(
!result_list->bgs_current->result
) {
ulong sql_type;
{
sql_type = SPIDER_SQL_TYPE_SELECT_SQL | SPIDER_SQL_TYPE_TMP_SQL;
}
sql_type= SPIDER_SQL_TYPE_SELECT_SQL | SPIDER_SQL_TYPE_TMP_SQL;
pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
if (dbton_handler->need_lock_before_set_sql_for_exec(sql_type))
{
Expand Down
Loading

0 comments on commit 978eb61

Please sign in to comment.