Skip to content

Commit

Permalink
MDEV-27256 Delete spider_use_handler and related code (2/3)
Browse files Browse the repository at this point in the history
Delete the deprecated variable, spider_use_handler and related code.

Spider now does not supports accessing data nodes via handler
statements. Thus, the notion of SQL kinds are no longer useful.
We too discard it.
  • Loading branch information
nayuta-yanagisawa committed Jun 9, 2022
1 parent 48409dd commit 57d233e
Show file tree
Hide file tree
Showing 19 changed files with 38 additions and 1,981 deletions.
584 changes: 22 additions & 562 deletions storage/spider/ha_spider.cc

Large diffs are not rendered by default.

26 changes: 0 additions & 26 deletions storage/spider/ha_spider.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ class ha_spider final : public handler
const char *mem_calc_func_name;
const char *mem_calc_file_name;
ulong mem_calc_line_no;
uint sql_kinds;
uint *sql_kind;
ulonglong *connection_ids;
uint conn_kinds;
uint *conn_kind;
Expand Down Expand Up @@ -138,9 +136,6 @@ class ha_spider final : public handler

ulonglong *db_request_id;
uchar *db_request_phase;
uchar *m_handler_opened;
uint *m_handler_id;
char **m_handler_cid;
bool do_direct_update;
uint direct_update_kinds;
spider_index_rnd_init prev_index_rnd_init;
Expand Down Expand Up @@ -551,25 +546,7 @@ class ha_spider final : public handler
bool is_sole_projection_field(
uint16 field_index
);
int check_ha_range_eof();
int drop_tmp_tables();
bool handler_opened(
int link_idx,
uint tgt_conn_kind
);
void set_handler_opened(
int link_idx
);
void clear_handler_opened(
int link_idx,
uint tgt_conn_kind
);
int close_opened_handler(
int link_idx,
bool release_conn
);
int index_handler_init();
int rnd_handler_init();
void set_error_mode();
void backup_error_status();
int check_error_mode(
Expand Down Expand Up @@ -813,9 +790,6 @@ class ha_spider final : public handler
const char *alias,
uint alias_length
);
bool support_use_handler_sql(
int use_handler
);
int init_union_table_name_pos_sql();
int set_union_table_name_pos_sql();
int append_lock_tables_list();
Expand Down
9 changes: 0 additions & 9 deletions storage/spider/mysql-test/spider/bugfix/r/index.result
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,6 @@ create table auto_test_local.t (a int, b char(1), primary key(a desc));
insert into auto_test_local.t VALUES (1,'f'),(2,'g'),(3,'j'), (4,'i'),(5,'h');
create table ts (a int, b char(1), primary key(a desc))
engine=spider comment='wrapper "mysql", srv "s_1", table "t"';
set spider_use_handler=3;
Warnings:
Warning 1287 '@@spider_use_handler' is deprecated and will be removed in a future release
select a, b from ts where a > 0 and b = 'g' order by a;
a b
2 g
set spider_use_handler=default;
Warnings:
Warning 1287 '@@spider_use_handler' is deprecated and will be removed in a future release
select a, b from ts where a > 0 and b = 'g' order by a;
a b
2 g
Expand Down
3 changes: 0 additions & 3 deletions storage/spider/mysql-test/spider/bugfix/t/index.test
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ create table auto_test_local.t (a int, b char(1), primary key(a desc));
insert into auto_test_local.t VALUES (1,'f'),(2,'g'),(3,'j'), (4,'i'),(5,'h');
create table ts (a int, b char(1), primary key(a desc))
engine=spider comment='wrapper "mysql", srv "s_1", table "t"';
set spider_use_handler=3;
select a, b from ts where a > 0 and b = 'g' order by a;
set spider_use_handler=default;
select a, b from ts where a > 0 and b = 'g' order by a;
drop table ts, auto_test_local.t;

Expand Down
15 changes: 0 additions & 15 deletions storage/spider/mysql-test/spider/r/variable_deprecation.result
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,6 @@ child3_3
connection master_1;
CREATE DATABASE auto_test_local;
USE auto_test_local;
# MDEV-27923 Deprecate spider_use_handler
SET spider_use_handler = 3;
Warnings:
Warning 1287 '@@spider_use_handler' is deprecated and will be removed in a future release
SHOW VARIABLES LIKE "spider_use_handler";
Variable_name Value
spider_use_handler 3
CREATE TABLE tbl_a (a INT) ENGINE=Spider COMMENT='uhd "3"';
Warnings:
Warning 1287 The table parameter 'uhd' is deprecated and will be removed in a future release
CREATE TABLE tbl_b (a INT) ENGINE=Spider COMMENT='use_handler "3"';
Warnings:
Warning 1287 The table parameter 'use_handler' is deprecated and will be removed in a future release
DROP TABLE tbl_a;
DROP TABLE tbl_b;
# MDEV-28297 Deprecate spider_internal_offset
SET spider_internal_offset = 1;
Warnings:
Expand Down
8 changes: 0 additions & 8 deletions storage/spider/mysql-test/spider/t/variable_deprecation.test
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,6 @@
CREATE DATABASE auto_test_local;
USE auto_test_local;

--echo # MDEV-27923 Deprecate spider_use_handler
SET spider_use_handler = 3;
SHOW VARIABLES LIKE "spider_use_handler";
eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='uhd "3"';
eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='use_handler "3"';
DROP TABLE tbl_a;
DROP TABLE tbl_b;

--echo # MDEV-28297 Deprecate spider_internal_offset
SET spider_internal_offset = 1;
SHOW VARIABLES LIKE "spider_internal_offset";
Expand Down
114 changes: 0 additions & 114 deletions storage/spider/spd_conn.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2161,8 +2161,6 @@ int spider_bg_conn_search(
result_list->split_read ?
result_list->split_read :
result_list->internal_limit - result_list->record_num;
DBUG_PRINT("info",("spider sql_kinds=%u", spider->sql_kinds));
if (spider->sql_kinds & SPIDER_SQL_KIND_SQL)
{
if ((error_num = spider->reappend_limit_sql_part(
result_list->internal_offset + result_list->record_num,
Expand All @@ -2181,17 +2179,6 @@ int spider_bg_conn_search(
DBUG_RETURN(error_num);
}
}
if (spider->sql_kinds & SPIDER_SQL_KIND_HANDLER)
{
spider_db_append_handler_next(spider);
if ((error_num = spider->reappend_limit_sql_part(
0, result_list->limit_num,
SPIDER_SQL_TYPE_HANDLER)))
{
pthread_mutex_unlock(&conn->bg_conn_mutex);
DBUG_RETURN(error_num);
}
}
}
result_list->bgs_phase = 2;
if (conn->db_conn->limit_mode() == 1)
Expand Down Expand Up @@ -2310,8 +2297,6 @@ int spider_bg_conn_search(
result_list->split_read ?
result_list->split_read :
result_list->internal_limit - result_list->record_num;
DBUG_PRINT("info",("spider sql_kinds=%u", spider->sql_kinds));
if (spider->sql_kinds & SPIDER_SQL_KIND_SQL)
{
if ((error_num = spider->reappend_limit_sql_part(
result_list->internal_offset + result_list->record_num,
Expand All @@ -2330,17 +2315,6 @@ int spider_bg_conn_search(
DBUG_RETURN(error_num);
}
}
if (spider->sql_kinds & SPIDER_SQL_KIND_HANDLER)
{
spider_db_append_handler_next(spider);
if ((error_num = spider->reappend_limit_sql_part(
0, result_list->limit_num,
SPIDER_SQL_TYPE_HANDLER)))
{
pthread_mutex_unlock(&conn->bg_conn_mutex);
DBUG_RETURN(error_num);
}
}
if (conn->db_conn->limit_mode() == 1)
{
conn->db_conn->set_limit(result_list->limit_num);
Expand Down Expand Up @@ -2542,11 +2516,8 @@ void *spider_bg_conn_action(
!result_list->bgs_current->result
) {
ulong sql_type;
if (spider->sql_kind[conn->link_idx] == SPIDER_SQL_KIND_SQL)
{
sql_type = SPIDER_SQL_TYPE_SELECT_SQL | SPIDER_SQL_TYPE_TMP_SQL;
} else {
sql_type = SPIDER_SQL_TYPE_HANDLER;
}
pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
if (dbton_handler->need_lock_before_set_sql_for_exec(sql_type))
Expand Down Expand Up @@ -3930,91 +3901,6 @@ bool spider_conn_check_recovery_link(
DBUG_RETURN(FALSE);
}

bool spider_conn_use_handler(
ha_spider *spider,
int lock_mode,
int link_idx
) {
THD *thd = spider->wide_handler->trx->thd;
int use_handler = spider_param_use_handler(thd,
spider->share->use_handlers[link_idx]);
DBUG_ENTER("spider_conn_use_handler");
DBUG_PRINT("info",("spider use_handler=%d", use_handler));
DBUG_PRINT("info",("spider spider->conn_kind[link_idx]=%u",
spider->conn_kind[link_idx]));
if (spider->do_direct_update)
{
spider->sql_kinds |= SPIDER_SQL_KIND_SQL;
spider->sql_kind[link_idx] = SPIDER_SQL_KIND_SQL;
spider->direct_update_kinds |= SPIDER_SQL_KIND_SQL;
DBUG_PRINT("info",("spider FALSE by using direct_update"));
DBUG_RETURN(FALSE);
}
if (spider->use_spatial_index)
{
DBUG_PRINT("info",("spider FALSE by use_spatial_index"));
spider->sql_kinds |= SPIDER_SQL_KIND_SQL;
spider->sql_kind[link_idx] = SPIDER_SQL_KIND_SQL;
DBUG_RETURN(FALSE);
}
uint dbton_id;
spider_db_handler *dbton_hdl;
dbton_id = spider->share->sql_dbton_ids[spider->conn_link_idx[link_idx]];
dbton_hdl = spider->dbton_handler[dbton_id];
if (!dbton_hdl->support_use_handler(use_handler))
{
DBUG_PRINT("info",("spider FALSE by dbton"));
spider->sql_kinds |= SPIDER_SQL_KIND_SQL;
spider->sql_kind[link_idx] = SPIDER_SQL_KIND_SQL;
DBUG_RETURN(FALSE);
}
if (
spider->wide_handler->sql_command == SQLCOM_HA_READ &&
(
!(use_handler & 2) ||
(
spider_param_sync_trx_isolation(thd) &&
thd_tx_isolation(thd) == ISO_SERIALIZABLE
)
)
) {
DBUG_PRINT("info",("spider TRUE by HA"));
spider->sql_kinds |= SPIDER_SQL_KIND_HANDLER;
spider->sql_kind[link_idx] = SPIDER_SQL_KIND_HANDLER;
DBUG_RETURN(TRUE);
}
if (
spider->wide_handler->sql_command != SQLCOM_HA_READ &&
lock_mode == SPIDER_LOCK_MODE_NO_LOCK &&
spider_param_sync_trx_isolation(thd) &&
thd_tx_isolation(thd) != ISO_SERIALIZABLE &&
(use_handler & 1)
) {
DBUG_PRINT("info",("spider TRUE by PARAM"));
spider->sql_kinds |= SPIDER_SQL_KIND_HANDLER;
spider->sql_kind[link_idx] = SPIDER_SQL_KIND_HANDLER;
DBUG_RETURN(TRUE);
}
spider->sql_kinds |= SPIDER_SQL_KIND_SQL;
spider->sql_kind[link_idx] = SPIDER_SQL_KIND_SQL;
DBUG_RETURN(FALSE);
}

bool spider_conn_need_open_handler(
ha_spider *spider,
uint idx,
int link_idx
) {
DBUG_ENTER("spider_conn_need_open_handler");
DBUG_PRINT("info",("spider spider=%p", spider));
if (spider->handler_opened(link_idx, spider->conn_kind[link_idx]))
{
DBUG_PRINT("info",("spider HA already opened"));
DBUG_RETURN(FALSE);
}
DBUG_RETURN(TRUE);
}

SPIDER_CONN* spider_get_conn_from_idle_connection(
SPIDER_SHARE *share,
int link_idx,
Expand Down
12 changes: 0 additions & 12 deletions storage/spider/spd_conn.h
Original file line number Diff line number Diff line change
Expand Up @@ -390,18 +390,6 @@ bool spider_conn_check_recovery_link(
SPIDER_SHARE *share
);

bool spider_conn_use_handler(
ha_spider *spider,
int lock_mode,
int link_idx
);

bool spider_conn_need_open_handler(
ha_spider *spider,
uint idx,
int link_idx
);

SPIDER_IP_PORT_CONN *spider_create_ipport_conn(SPIDER_CONN *conn);
SPIDER_CONN* spider_get_conn_from_idle_connection
(
Expand Down
Loading

0 comments on commit 57d233e

Please sign in to comment.