Commit 57d233e2 authored by Nayuta Yanagisawa's avatar Nayuta Yanagisawa

MDEV-27256 Delete spider_use_handler and related code (2/3)

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.
parent 48409dd9
This diff is collapsed.
......@@ -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;
......@@ -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;
......@@ -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(
......@@ -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();
......
......@@ -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
......
......@@ -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;
......
......@@ -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:
......
......@@ -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";
......
......@@ -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,
......@@ -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)
......@@ -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,
......@@ -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);
......@@ -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))
......@@ -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,
......
......@@ -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
(
......
This diff is collapsed.
......@@ -274,8 +274,6 @@
#define SPIDER_SQL_INDEX_FORCE_LEN (sizeof(SPIDER_SQL_INDEX_FORCE_STR) - 1)
#define SPIDER_SQL_INT_LEN 20
#define SPIDER_SQL_HANDLER_CID_LEN 6
#define SPIDER_SQL_HANDLER_CID_FORMAT "t%05u"
#define SPIDER_UDF_PING_TABLE_PING_ONLY (1 << 0)
#define SPIDER_UDF_PING_TABLE_USE_WHERE (1 << 1)
#define SPIDER_UDF_PING_TABLE_USE_ALL_MONITORING_NODES (1 << 2)
......@@ -547,10 +545,6 @@ void spider_db_free_show_index(
SPIDER_SHARE *share
);
void spider_db_append_handler_next(
ha_spider *spider
);
void spider_db_get_row_from_tmp_tbl_rec(
SPIDER_RESULT *current,
SPIDER_DB_ROW **row
......@@ -1147,20 +1141,6 @@ int spider_db_udf_copy_tables(
longlong bulk_insert_rows
);
int spider_db_open_handler(
ha_spider *spider,
SPIDER_CONN *conn,
int link_idx
);
int spider_db_close_handler(
ha_spider *spider,
SPIDER_CONN *conn,
int link_idx,
uint tgt_conn_kind
);
bool spider_db_conn_is_network_error(
int error_num
);
......@@ -167,9 +167,6 @@ typedef st_spider_result SPIDER_RESULT;
#define SPIDER_CONN_KIND_MYSQL (1 << 0)
#define SPIDER_SQL_KIND_SQL (1 << 0)
#define SPIDER_SQL_KIND_HANDLER (1 << 1)
#define SPIDER_SQL_TYPE_SELECT_SQL (1 << 0)
#define SPIDER_SQL_TYPE_INSERT_SQL (1 << 1)
#define SPIDER_SQL_TYPE_UPDATE_SQL (1 << 2)
......@@ -178,7 +175,6 @@ typedef st_spider_result SPIDER_RESULT;
#define SPIDER_SQL_TYPE_TMP_SQL (1 << 5)
#define SPIDER_SQL_TYPE_DROP_TMP_TABLE_SQL (1 << 6)
#define SPIDER_SQL_TYPE_OTHER_SQL (1 << 7)
#define SPIDER_SQL_TYPE_HANDLER (1 << 8)
#define SPIDER_SQL_TYPE_SELECT_HS (1 << 9)
#define SPIDER_SQL_TYPE_INSERT_HS (1 << 10)
#define SPIDER_SQL_TYPE_UPDATE_HS (1 << 11)
......@@ -1096,8 +1092,6 @@ class spider_db_conn
) = 0;
virtual uint get_lock_table_hash_count() = 0;
virtual void reset_lock_table_hash() = 0;
virtual uint get_opened_handler_count() = 0;
virtual void reset_opened_handler() = 0;
virtual void set_dup_key_idx(
ha_spider *spider,
int link_idx
......@@ -1363,16 +1357,6 @@ class spider_db_handler
ulong sql_type,
uint multi_range_cnt
) = 0;
virtual int append_open_handler_part(
ulong sql_type,
uint handler_id,
SPIDER_CONN *conn,
int link_idx
) = 0;
virtual int append_close_handler_part(
ulong sql_type,
int link_idx
) = 0;
virtual int append_insert_terminator_part(
ulong sql_type
) = 0;
......@@ -1535,20 +1519,9 @@ class spider_db_handler
SPIDER_CONN *conn,
int link_idx
) = 0;
virtual int insert_opened_handler(
SPIDER_CONN *conn,
int link_idx
) = 0;
virtual int delete_opened_handler(
SPIDER_CONN *conn,
int link_idx
) = 0;
virtual int sync_from_clone_source(
spider_db_handler *dbton_hdl
) = 0;
virtual bool support_use_handler(
int use_handler
) = 0;
virtual bool minimum_select_bit_is_set(
uint field_index
) = 0;
......@@ -1737,7 +1710,6 @@ typedef struct st_spider_position
bool use_position;
bool mrr_with_cnt;
bool direct_aggregate;
uint sql_kind;
uchar *position_bitmap;
st_spider_ft_info *ft_first;
st_spider_ft_info *ft_current;
......@@ -1786,9 +1758,6 @@ typedef struct st_spider_result_list
int key_order;
spider_string *sqls;
int ha_read_kind;
bool have_sql_kind_backup;
uint *sql_kind_backup;
uint sql_kinds_backup;
bool use_union;
bool use_both_key;
const key_range *end_key;
......
This diff is collapsed.
......@@ -398,12 +398,6 @@ class spider_db_mbase: public spider_db_conn
const char *lock_table_hash_func_name;
const char *lock_table_hash_file_name;
ulong lock_table_hash_line_no;
DYNAMIC_ARRAY handler_open_array;
bool handler_open_array_inited;
uint handler_open_array_id;
const char *handler_open_array_func_name;
const char *handler_open_array_file_name;
ulong handler_open_array_line_no;
spider_db_mbase(
SPIDER_CONN *conn,
spider_db_mbase_util *spider_db_mbase_utility
......@@ -585,8 +579,6 @@ class spider_db_mbase: public spider_db_conn
);
uint get_lock_table_hash_count();
void reset_lock_table_hash();
uint get_opened_handler_count();
void reset_opened_handler();
void set_dup_key_idx(
ha_spider *spider,
int link_idx
......@@ -1194,26 +1186,6 @@ class spider_mbase_handler: public spider_db_handler
spider_string *str,
uint multi_range_cnt
);
int append_open_handler_part(
ulong sql_type,
uint handler_id,
SPIDER_CONN *conn,
int link_idx
);
int append_open_handler(
spider_string *str,
uint handler_id,
SPIDER_CONN *conn,
int link_idx
);
int append_close_handler_part(
ulong sql_type,
int link_idx
);
int append_close_handler(
spider_string *str,
int link_idx
);
int append_insert_terminator_part(
ulong sql_type
);
......@@ -1480,20 +1452,9 @@ class spider_mbase_handler: public spider_db_handler
SPIDER_CONN *conn,
int link_idx
);
int insert_opened_handler(
SPIDER_CONN *conn,
int link_idx
);
int delete_opened_handler(
SPIDER_CONN *conn,
int link_idx
);
int sync_from_clone_source(
spider_db_handler *dbton_hdl
);
bool support_use_handler(
int use_handler
);
void minimum_select_bitmap_create();
bool minimum_select_bit_is_set(
uint field_index
......
......@@ -1237,10 +1237,6 @@ int spider_group_by_handler::init_scan()
spider_db_free_one_result_for_start_next(spider);
spider->sql_kinds = SPIDER_SQL_KIND_SQL;
for (link_idx = 0; link_idx < (int) share->link_count; ++link_idx)
spider->sql_kind[link_idx] = SPIDER_SQL_KIND_SQL;
spider->do_direct_update = FALSE;
spider->direct_update_kinds = 0;
spider_get_select_limit(spider, &select_lex, &select_limit, &offset_limit);
......@@ -1912,16 +1908,6 @@ group_by_handler *spider_create_group_by_handler(
spider->conn_link_idx, roop_count, share->link_count,
tgt_link_status)
) {
if (spider_param_use_handler(thd, share->use_handlers[roop_count]))
{
DBUG_PRINT("info",("spider direct_join does not support use_handler"));
if (lock_mode)
{
delete fields;
DBUG_RETURN(NULL);
}
continue;
}
conn = spider->conns[roop_count];
DBUG_PRINT("info",("spider roop_count=%d", roop_count));
DBUG_PRINT("info",("spider conn=%p", conn));
......@@ -1997,16 +1983,6 @@ group_by_handler *spider_create_group_by_handler(
tgt_link_status)
) {
DBUG_PRINT("info",("spider roop_count=%d", roop_count));
if (spider_param_use_handler(thd, share->use_handlers[roop_count]))
{
DBUG_PRINT("info",("spider direct_join does not support use_handler"));
if (lock_mode)
{
delete fields;
DBUG_RETURN(NULL);
}
continue;
}
conn = spider->conns[roop_count];
DBUG_PRINT("info",("spider conn=%p", conn));
if (!fields->check_conn_same_conn(conn))
......
......@@ -163,7 +163,7 @@ typedef start_new_trans *SPIDER_Open_tables_backup;
#define SPIDER_TMP_SHARE_CHAR_PTR_COUNT 23
#define SPIDER_TMP_SHARE_UINT_COUNT SPIDER_TMP_SHARE_CHAR_PTR_COUNT
#define SPIDER_TMP_SHARE_LONG_COUNT 20
#define SPIDER_TMP_SHARE_LONG_COUNT 19
#define SPIDER_TMP_SHARE_LONGLONG_COUNT 3
#define SPIDER_MEM_CALC_LIST_NUM 314
......@@ -900,7 +900,6 @@ typedef struct st_spider_share
longlong *monitoring_bg_interval;
longlong *monitoring_limit;
longlong *monitoring_sid;
long *use_handlers;
long *connect_timeouts;
long *net_read_timeouts;
long *net_write_timeouts;
......@@ -988,7 +987,6 @@ typedef struct st_spider_share
uint monitoring_bg_interval_length;
uint monitoring_limit_length;
uint monitoring_sid_length;
uint use_handlers_length;
uint connect_timeouts_length;
uint net_read_timeouts_length;
uint net_write_timeouts_length;
......
......@@ -2184,32 +2184,6 @@ int spider_param_bka_mode(
bka_mode : THDVAR(thd, bka_mode));
}
/*
-1 :use table parameter
0 :not use
1 :use handler
*/
static MYSQL_THDVAR_INT(
use_handler, /* name */
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */
"Use handler for reading", /* comment */
NULL, /* check */
spider_use_table_value_deprecated, /* update */
0, /* def */
-1, /* min */
3, /* max */
0 /* blk */
);
int spider_param_use_handler(
THD *thd,
int use_handler
) {
DBUG_ENTER("spider_param_use_handler");
DBUG_RETURN(THDVAR(thd, use_handler) == -1 ?
use_handler : THDVAR(thd, use_handler));
}
/*
-1 :use table parameter
0 :return error if error
......@@ -3017,7 +2991,6 @@ static struct st_mysql_sys_var* spider_system_variables[] = {
MYSQL_SYSVAR(connect_mutex),
MYSQL_SYSVAR(bka_engine),
MYSQL_SYSVAR(bka_mode),
MYSQL_SYSVAR(use_handler),
MYSQL_SYSVAR(error_read_mode),
MYSQL_SYSVAR(error_write_mode),
MYSQL_SYSVAR(skip_default_condition),
......
......@@ -286,10 +286,6 @@ int spider_param_bka_mode(
THD *thd,
int bka_mode
);
int spider_param_use_handler(
THD *thd,
int use_handler
);
int spider_param_error_read_mode(
THD *thd,
int error_read_mode
......
This diff is collapsed.
......@@ -3585,7 +3585,6 @@ int spider_check_trx_and_get_conn(
*spider->conn_keys[0] = first_byte;
for (roop_count = 0; roop_count < (int) share->link_count; roop_count++)
{
if (!spider->handler_opened(roop_count, SPIDER_CONN_KIND_MYSQL))
spider->conns[roop_count] = NULL;
}
bool search_link_idx_is_checked = FALSE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment