Commit ae106f13 authored by Kentoku's avatar Kentoku

MDEV-19002 Partition performance optimization

Add the partition options of the following function for batch call instead o
- store_lock
- external_lock
- start_stmt
- extra
- cond_push
- info_push
- top_table
parent 8feb78ef
This diff is collapsed.
......@@ -404,6 +404,7 @@ class ha_partition :public handler
}
Partition_share *get_part_share() { return part_share; }
handler *clone(const char *name, MEM_ROOT *mem_root);
ha_partition *get_clone_source() { return m_is_clone_of; }
virtual void set_part_info(partition_info *part_info)
{
m_part_info= part_info;
......@@ -882,6 +883,7 @@ class ha_partition :public handler
handler *file, uint *n);
static const uint NO_CURRENT_PART_ID= NOT_A_PARTITION_ID;
int loop_partitions(handler_callback callback, void *param);
int first_partition(handler_callback callback, void *param);
int loop_extra_alter(enum ha_extra_function operations);
void late_extra_cache(uint partition_id);
void late_extra_no_cache(uint partition_id);
......
......@@ -2800,7 +2800,7 @@ int handler::ha_rnd_next(uchar *buf)
int result;
DBUG_ENTER("handler::ha_rnd_next");
DBUG_ASSERT(table_share->tmp_table != NO_TMP_TABLE ||
m_lock_type != F_UNLCK);
m_lock_type != F_UNLCK || table->file != this);
DBUG_ASSERT(inited == RND);
do
......@@ -2834,7 +2834,7 @@ int handler::ha_rnd_pos(uchar *buf, uchar *pos)
int result;
DBUG_ENTER("handler::ha_rnd_pos");
DBUG_ASSERT(table_share->tmp_table != NO_TMP_TABLE ||
m_lock_type != F_UNLCK);
m_lock_type != F_UNLCK || table->file != this);
DBUG_ASSERT(inited == RND);
TABLE_IO_WAIT(tracker, m_psi, PSI_TABLE_FETCH_ROW, MAX_KEY, 0,
......@@ -2859,7 +2859,7 @@ int handler::ha_index_read_map(uchar *buf, const uchar *key,
int result;
DBUG_ENTER("handler::ha_index_read_map");
DBUG_ASSERT(table_share->tmp_table != NO_TMP_TABLE ||
m_lock_type != F_UNLCK);
m_lock_type != F_UNLCK || table->file != this);
DBUG_ASSERT(inited==INDEX);
TABLE_IO_WAIT(tracker, m_psi, PSI_TABLE_FETCH_ROW, active_index, 0,
......@@ -2888,7 +2888,7 @@ int handler::ha_index_read_idx_map(uchar *buf, uint index, const uchar *key,
int result;
DBUG_ASSERT(inited==NONE);
DBUG_ASSERT(table_share->tmp_table != NO_TMP_TABLE ||
m_lock_type != F_UNLCK);
m_lock_type != F_UNLCK || table->file != this);
DBUG_ASSERT(end_range == NULL);
TABLE_IO_WAIT(tracker, m_psi, PSI_TABLE_FETCH_ROW, index, 0,
{ result= index_read_idx_map(buf, index, key, keypart_map, find_flag); })
......@@ -2909,7 +2909,7 @@ int handler::ha_index_next(uchar * buf)
int result;
DBUG_ENTER("handler::ha_index_next");
DBUG_ASSERT(table_share->tmp_table != NO_TMP_TABLE ||
m_lock_type != F_UNLCK);
m_lock_type != F_UNLCK || table->file != this);
DBUG_ASSERT(inited==INDEX);
TABLE_IO_WAIT(tracker, m_psi, PSI_TABLE_FETCH_ROW, active_index, 0,
......@@ -2930,7 +2930,7 @@ int handler::ha_index_prev(uchar * buf)
int result;
DBUG_ENTER("handler::ha_index_prev");
DBUG_ASSERT(table_share->tmp_table != NO_TMP_TABLE ||
m_lock_type != F_UNLCK);
m_lock_type != F_UNLCK || table->file != this);
DBUG_ASSERT(inited==INDEX);
TABLE_IO_WAIT(tracker, m_psi, PSI_TABLE_FETCH_ROW, active_index, 0,
......@@ -2950,7 +2950,7 @@ int handler::ha_index_first(uchar * buf)
{
int result;
DBUG_ASSERT(table_share->tmp_table != NO_TMP_TABLE ||
m_lock_type != F_UNLCK);
m_lock_type != F_UNLCK || table->file != this);
DBUG_ASSERT(inited==INDEX);
TABLE_IO_WAIT(tracker, m_psi, PSI_TABLE_FETCH_ROW, active_index, 0,
......@@ -2970,7 +2970,7 @@ int handler::ha_index_last(uchar * buf)
{
int result;
DBUG_ASSERT(table_share->tmp_table != NO_TMP_TABLE ||
m_lock_type != F_UNLCK);
m_lock_type != F_UNLCK || table->file != this);
DBUG_ASSERT(inited==INDEX);
TABLE_IO_WAIT(tracker, m_psi, PSI_TABLE_FETCH_ROW, active_index, 0,
......@@ -2990,7 +2990,7 @@ int handler::ha_index_next_same(uchar *buf, const uchar *key, uint keylen)
{
int result;
DBUG_ASSERT(table_share->tmp_table != NO_TMP_TABLE ||
m_lock_type != F_UNLCK);
m_lock_type != F_UNLCK || table->file != this);
DBUG_ASSERT(inited==INDEX);
TABLE_IO_WAIT(tracker, m_psi, PSI_TABLE_FETCH_ROW, active_index, 0,
......@@ -3589,7 +3589,7 @@ void handler::ha_release_auto_increment()
{
DBUG_ENTER("ha_release_auto_increment");
DBUG_ASSERT(table_share->tmp_table != NO_TMP_TABLE ||
m_lock_type != F_UNLCK ||
m_lock_type != F_UNLCK || table->file != this ||
(!next_insert_id && !insert_id_for_cur_row));
release_auto_increment();
insert_id_for_cur_row= 0;
......@@ -4160,7 +4160,8 @@ static bool update_frm_version(TABLE *table)
*/
uint handler::get_dup_key(int error)
{
DBUG_ASSERT(table_share->tmp_table != NO_TMP_TABLE || m_lock_type != F_UNLCK);
DBUG_ASSERT(table_share->tmp_table != NO_TMP_TABLE ||
m_lock_type != F_UNLCK || table->file != this);
DBUG_ENTER("handler::get_dup_key");
if (table->s->long_unique_table && table->file->errkey < table->s->keys)
DBUG_RETURN(table->file->errkey);
......@@ -4273,7 +4274,7 @@ int handler::ha_check(THD *thd, HA_CHECK_OPT *check_opt)
{
int error;
DBUG_ASSERT(table_share->tmp_table != NO_TMP_TABLE ||
m_lock_type != F_UNLCK);
m_lock_type != F_UNLCK || table->file != this);
if ((table->s->mysql_version >= MYSQL_VERSION_ID) &&
(check_opt->sql_flags & TT_FOR_UPGRADE))
......@@ -4359,7 +4360,7 @@ handler::ha_bulk_update_row(const uchar *old_data, const uchar *new_data,
ha_rows *dup_key_found)
{
DBUG_ASSERT(table_share->tmp_table != NO_TMP_TABLE ||
m_lock_type == F_WRLCK);
m_lock_type == F_WRLCK || table->file != this);
mark_trx_read_write();
return bulk_update_row(old_data, new_data, dup_key_found);
......@@ -4376,7 +4377,7 @@ int
handler::ha_delete_all_rows()
{
DBUG_ASSERT(table_share->tmp_table != NO_TMP_TABLE ||
m_lock_type == F_WRLCK);
m_lock_type == F_WRLCK || table->file != this);
mark_trx_read_write();
return delete_all_rows();
......@@ -4393,7 +4394,7 @@ int
handler::ha_truncate()
{
DBUG_ASSERT(table_share->tmp_table != NO_TMP_TABLE ||
m_lock_type == F_WRLCK);
m_lock_type == F_WRLCK || table->file != this);
mark_trx_read_write();
return truncate();
......@@ -4410,7 +4411,7 @@ int
handler::ha_reset_auto_increment(ulonglong value)
{
DBUG_ASSERT(table_share->tmp_table != NO_TMP_TABLE ||
m_lock_type == F_WRLCK);
m_lock_type == F_WRLCK || table->file != this);
mark_trx_read_write();
return reset_auto_increment(value);
......@@ -4427,7 +4428,7 @@ int
handler::ha_optimize(THD* thd, HA_CHECK_OPT* check_opt)
{
DBUG_ASSERT(table_share->tmp_table != NO_TMP_TABLE ||
m_lock_type == F_WRLCK);
m_lock_type == F_WRLCK || table->file != this);
mark_trx_read_write();
return optimize(thd, check_opt);
......@@ -4444,7 +4445,7 @@ int
handler::ha_analyze(THD* thd, HA_CHECK_OPT* check_opt)
{
DBUG_ASSERT(table_share->tmp_table != NO_TMP_TABLE ||
m_lock_type != F_UNLCK);
m_lock_type != F_UNLCK || table->file != this);
mark_trx_read_write();
return analyze(thd, check_opt);
......@@ -4461,7 +4462,7 @@ bool
handler::ha_check_and_repair(THD *thd)
{
DBUG_ASSERT(table_share->tmp_table != NO_TMP_TABLE ||
m_lock_type == F_UNLCK);
m_lock_type == F_UNLCK || table->file != this);
mark_trx_read_write();
return check_and_repair(thd);
......@@ -4478,7 +4479,7 @@ int
handler::ha_disable_indexes(uint mode)
{
DBUG_ASSERT(table_share->tmp_table != NO_TMP_TABLE ||
m_lock_type != F_UNLCK);
m_lock_type != F_UNLCK || table->file != this);
mark_trx_read_write();
return disable_indexes(mode);
......@@ -4495,7 +4496,7 @@ int
handler::ha_enable_indexes(uint mode)
{
DBUG_ASSERT(table_share->tmp_table != NO_TMP_TABLE ||
m_lock_type != F_UNLCK);
m_lock_type != F_UNLCK || table->file != this);
mark_trx_read_write();
return enable_indexes(mode);
......@@ -4512,7 +4513,7 @@ int
handler::ha_discard_or_import_tablespace(my_bool discard)
{
DBUG_ASSERT(table_share->tmp_table != NO_TMP_TABLE ||
m_lock_type == F_WRLCK);
m_lock_type == F_WRLCK || table->file != this);
mark_trx_read_write();
return discard_or_import_tablespace(discard);
......@@ -4523,7 +4524,7 @@ bool handler::ha_prepare_inplace_alter_table(TABLE *altered_table,
Alter_inplace_info *ha_alter_info)
{
DBUG_ASSERT(table_share->tmp_table != NO_TMP_TABLE ||
m_lock_type != F_UNLCK);
m_lock_type != F_UNLCK || table->file != this);
mark_trx_read_write();
return prepare_inplace_alter_table(altered_table, ha_alter_info);
......@@ -4759,7 +4760,7 @@ handler::ha_change_partitions(HA_CREATE_INFO *create_info,
from current partitions and write lock will be taken on new partitions.
*/
DBUG_ASSERT(table_share->tmp_table != NO_TMP_TABLE ||
m_lock_type != F_UNLCK);
m_lock_type != F_UNLCK || table->file != this);
mark_trx_read_write();
......@@ -6546,7 +6547,7 @@ int handler::ha_write_row(uchar *buf)
int error;
Log_func *log_func= Write_rows_log_event::binlog_row_logging_function;
DBUG_ASSERT(table_share->tmp_table != NO_TMP_TABLE ||
m_lock_type == F_WRLCK);
m_lock_type == F_WRLCK || table->file != this);
DBUG_ENTER("handler::ha_write_row");
DEBUG_SYNC_C("ha_write_row_start");
......@@ -6589,7 +6590,7 @@ int handler::ha_update_row(const uchar *old_data, const uchar *new_data)
int error;
Log_func *log_func= Update_rows_log_event::binlog_row_logging_function;
DBUG_ASSERT(table_share->tmp_table != NO_TMP_TABLE ||
m_lock_type == F_WRLCK);
m_lock_type == F_WRLCK || table->file != this);
/*
Some storage engines require that the new record is in record[0]
......@@ -6659,7 +6660,7 @@ int handler::ha_delete_row(const uchar *buf)
int error;
Log_func *log_func= Delete_rows_log_event::binlog_row_logging_function;
DBUG_ASSERT(table_share->tmp_table != NO_TMP_TABLE ||
m_lock_type == F_WRLCK);
m_lock_type == F_WRLCK || table->file != this);
/*
Normally table->record[0] is used, but sometimes table->record[1] is used.
*/
......
......@@ -351,6 +351,15 @@ enum enum_alter_inplace_result {
#define HA_DO_RANGE_FILTER_PUSHDOWN 1024
/* table flags for partition engine */
#define HA_PT_CALL_AT_ONCE_STORE_LOCK (1 << 0)
#define HA_PT_CALL_AT_ONCE_EXTERNAL_LOCK (1 << 1)
#define HA_PT_CALL_AT_ONCE_START_STMT (1 << 2)
#define HA_PT_CALL_AT_ONCE_EXTRA (1 << 3)
#define HA_PT_CALL_AT_ONCE_COND_PUSH (1 << 4)
#define HA_PT_CALL_AT_ONCE_INFO_PUSH (1 << 5)
#define HA_PT_CALL_AT_ONCE_TOP_TABLE (1 << 6)
/*
bits in alter_table_flags:
*/
......@@ -3904,6 +3913,7 @@ class handler :public Sql_alloc
}
virtual void set_part_info(partition_info *part_info) {return;}
virtual void return_record_by_parent() { return; }
virtual ulong table_flags_for_partition() { return 0; };
virtual ulong index_flags(uint idx, uint part, bool all_parts) const =0;
......
This diff is collapsed.
......@@ -51,9 +51,7 @@ struct st_spider_ft_info
class ha_spider: public handler
{
public:
THR_LOCK_DATA lock;
SPIDER_SHARE *share;
SPIDER_TRX *trx;
ulonglong spider_thread_id;
ulonglong trx_conn_adjustment;
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
......@@ -89,18 +87,16 @@ class ha_spider: public handler
int search_link_idx;
int result_link_idx;
SPIDER_RESULT_LIST result_list;
SPIDER_CONDITION *condition;
spider_string *blob_buff;
uchar *searched_bitmap;
uchar *ft_discard_bitmap;
bool position_bitmap_init;
uchar *position_bitmap;
SPIDER_POSITION *pushed_pos;
SPIDER_POSITION pushed_pos_buf;
#ifdef WITH_PARTITION_STORAGE_ENGINE
bool pt_handler_share_owner = FALSE;
SPIDER_PARTITION_HANDLER_SHARE *partition_handler_share;
ha_spider *pt_handler_share_creator;
#endif
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;
......@@ -115,10 +111,8 @@ class ha_spider: public handler
bool init_ha_mem_root;
MEM_ROOT ha_mem_root;
*/
ulonglong external_lock_cnt;
#endif
bool is_clone;
bool clone_bitmap_init;
ha_spider *pt_clone_source_handler;
ha_spider *pt_clone_last_searcher;
bool use_index_merge;
......@@ -160,22 +154,11 @@ class ha_spider: public handler
ha_spider *next;
bool dml_inited;
bool rnd_scan_and_first;
bool quick_mode;
bool keyread;
bool ignore_dup_key;
bool write_can_replace;
bool insert_with_update;
bool low_priority;
bool high_priority;
bool insert_delayed;
bool use_pre_call;
bool use_pre_records;
bool pre_bitmap_checked;
enum thr_lock_type lock_type;
int lock_mode;
uint sql_command;
int selupd_lock_mode;
bool bulk_insert;
#ifdef HANDLER_HAS_NEED_INFO_FOR_AUTO_INC
bool info_auto_called;
......@@ -188,12 +171,9 @@ class ha_spider: public handler
int store_error_num;
uint dup_key_idx;
int select_column_mode;
bool update_request;
bool pk_update;
bool force_auto_increment;
int bka_mode;
bool cond_check;
int cond_check_error;
int error_mode;
ulonglong store_last_insert_id;
......@@ -215,14 +195,7 @@ class ha_spider: public handler
uint32 **hs_w_ret_fields;
size_t *hs_r_ret_fields_num;
size_t *hs_w_ret_fields_num;
uint32 *hs_pushed_ret_fields;
size_t hs_pushed_ret_fields_num;
size_t hs_pushed_ret_fields_size;
size_t hs_pushed_lcl_fields_num;
uchar *tmp_column_bitmap;
bool hs_increment;
bool hs_decrement;
uint32 hs_pushed_strref_num;
#endif
#endif
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
......@@ -231,11 +204,6 @@ class ha_spider: public handler
bool maybe_do_hs_direct_update;
#endif
uint direct_update_kinds;
List<Item> *direct_update_fields;
List<Item> *direct_update_values;
#endif
#ifdef INFO_KIND_FORCE_LIMIT_BEGIN
longlong info_limit;
#endif
spider_index_rnd_init prev_index_rnd_init;
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
......@@ -277,10 +245,13 @@ class ha_spider: public handler
uint test_if_locked
);
int close();
int check_access_kind(
int check_access_kind_for_connection(
THD *thd,
bool write_request
);
void check_access_kind(
THD *thd
);
#ifdef HA_CAN_BULK_ACCESS
int additional_lock(
THD *thd,
......@@ -296,6 +267,10 @@ class ha_spider: public handler
THD *thd,
int lock_type
);
int start_stmt(
THD *thd,
thr_lock_type lock_type
);
int reset();
int extra(
enum ha_extra_function operation
......@@ -514,6 +489,7 @@ class ha_spider: public handler
ha_rows records();
const char *table_type() const;
ulonglong table_flags() const;
ulong table_flags_for_partition();
const char *index_type(
uint key_number
);
......@@ -853,6 +829,12 @@ class ha_spider: public handler
int error_num,
uint flags
);
int set_top_table_and_fields(
TABLE *top_table,
Field **top_table_field,
uint top_table_fields
);
void clear_top_table_fields();
Field *get_top_table_field(
uint16 field_index
);
......@@ -1239,4 +1221,15 @@ class ha_spider: public handler
#endif
int init_union_table_name_pos_sql();
int set_union_table_name_pos_sql();
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
};
......@@ -308,6 +308,10 @@ void spider_free_conn_from_trx(
}
} else {
/* conn_recycle_mode == 0 */
if (conn->quick_target)
{
spider_db_free_result((ha_spider *) conn->quick_target, TRUE);
}
spider_free_conn(conn);
}
} else if (roop_count)
......@@ -1279,7 +1283,7 @@ int spider_check_and_get_casual_read_conn(
if (
!(spider->conns[link_idx] =
spider_get_conn(spider->share, link_idx,
spider->conn_keys[link_idx], spider->trx,
spider->conn_keys[link_idx], spider->wide_handler->trx,
spider, FALSE, TRUE, SPIDER_CONN_KIND_MYSQL,
&error_num))
) {
......@@ -1728,7 +1732,8 @@ int spider_set_conn_bg_param(
int error_num, roop_count, bgs_mode;
SPIDER_SHARE *share = spider->share;
SPIDER_RESULT_LIST *result_list = &spider->result_list;
THD *thd = spider->trx->thd;
SPIDER_WIDE_HANDLER *wide_handler = spider->wide_handler;
THD *thd = wide_handler->trx->thd;
DBUG_ENTER("spider_set_conn_bg_param");
DBUG_PRINT("info",("spider spider=%p", spider));
bgs_mode =
......@@ -1737,10 +1742,11 @@ int spider_set_conn_bg_param(
result_list->bgs_phase = 0;
else if (
bgs_mode <= 2 &&
(result_list->lock_type == F_WRLCK || spider->lock_mode == 2)
(wide_handler->external_lock_type == F_WRLCK ||
wide_handler->lock_mode == 2)
)
result_list->bgs_phase = 0;
else if (bgs_mode <= 1 && spider->lock_mode == 1)
else if (bgs_mode <= 1 && wide_handler->lock_mode == 1)
result_list->bgs_phase = 0;
else {
result_list->bgs_phase = 1;
......@@ -1787,12 +1793,12 @@ int spider_set_conn_bg_param(
for (
roop_count = spider_conn_link_idx_next(share->link_statuses,
spider->conn_link_idx, -1, share->link_count,
spider->lock_mode ?
spider->wide_handler->lock_mode ?
SPIDER_LINK_STATUS_RECOVERY : SPIDER_LINK_STATUS_OK);
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->lock_mode ?
spider->wide_handler->lock_mode ?
SPIDER_LINK_STATUS_RECOVERY : SPIDER_LINK_STATUS_OK)
) {
if ((error_num = spider_create_conn_thread(spider->conns[roop_count])))
......@@ -2671,7 +2677,7 @@ void *spider_bg_conn_action(
conn->link_idx);
result_list->tmp_tables_created = TRUE;
spider_conn_set_timeout_from_share(conn, conn->link_idx,
spider->trx->thd, share);
spider->wide_handler->trx->thd, share);
if (dbton_handler->execute_sql(
SPIDER_SQL_TYPE_TMP_SQL,
conn,
......@@ -2689,7 +2695,7 @@ void *spider_bg_conn_action(
if (!result_list->bgs_error)
{
spider_conn_set_timeout_from_share(conn, conn->link_idx,
spider->trx->thd, share);
spider->wide_handler->trx->thd, share);
if (dbton_handler->execute_sql(
sql_type,
conn,
......@@ -2935,6 +2941,7 @@ void *spider_bg_sts_action(
SPIDER_TRX *trx;
int error_num = 0, roop_count;
ha_spider spider;
SPIDER_WIDE_HANDLER wide_handler;
int *need_mons;
SPIDER_CONN **conns;
uint *conn_link_idx;
......@@ -3028,7 +3035,8 @@ void *spider_bg_sts_action(
DBUG_RETURN(NULL);
}
share->bg_sts_thd = thd;
spider.trx = trx;
spider.wide_handler = &wide_handler;
wide_handler.trx = trx;
spider.share = share;
spider.conns = conns;
spider.conn_link_idx = conn_link_idx;
......@@ -3300,6 +3308,7 @@ void *spider_bg_crd_action(
SPIDER_TRX *trx;
int error_num = 0, roop_count;
ha_spider spider;
SPIDER_WIDE_HANDLER wide_handler;
TABLE table;
int *need_mons;
SPIDER_CONN **conns;
......@@ -3397,7 +3406,8 @@ void *spider_bg_crd_action(
table.s = share->table_share;
table.field = share->table_share->field;
table.key_info = share->table_share->key_info;
spider.trx = trx;
spider.wide_handler = &wide_handler;
wide_handler.trx = trx;
spider.change_table_ptr(&table, share->table_share);
spider.share = share;
spider.conns = conns;
......@@ -4080,11 +4090,12 @@ int spider_conn_get_link_status(
int spider_conn_lock_mode(
ha_spider *spider
) {
SPIDER_RESULT_LIST *result_list = &spider->result_list;
SPIDER_WIDE_HANDLER *wide_handler = spider->wide_handler;
DBUG_ENTER("spider_conn_lock_mode");
if (result_list->lock_type == F_WRLCK || spider->lock_mode == 2)
if (wide_handler->external_lock_type == F_WRLCK ||
wide_handler->lock_mode == 2)
DBUG_RETURN(SPIDER_LOCK_MODE_EXCLUSIVE);
else if (spider->lock_mode == 1)
else if (wide_handler->lock_mode == 1)
DBUG_RETURN(SPIDER_LOCK_MODE_SHARED);
DBUG_RETURN(SPIDER_LOCK_MODE_NO_LOCK);
}
......@@ -4107,7 +4118,7 @@ bool spider_conn_use_handler(
int lock_mode,
int link_idx
) {
THD *thd = spider->trx->thd;
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");
......@@ -4180,7 +4191,7 @@ bool spider_conn_use_handler(
DBUG_RETURN(FALSE);
}
if (
spider->sql_command == SQLCOM_HA_READ &&
spider->wide_handler->sql_command == SQLCOM_HA_READ &&
(
!(use_handler & 2) ||
(
......@@ -4195,7 +4206,7 @@ bool spider_conn_use_handler(
DBUG_RETURN(TRUE);
}
if (
spider->sql_command != SQLCOM_HA_READ &&
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 &&
......
/* Copyright (C) 2009-2018 Kentoku Shiba
/* Copyright (C) 2009-2019 Kentoku Shiba
Copyright (C) 2019 MariaDB corp
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -836,6 +837,7 @@ long long spider_copy_tables_body(
spider_string *tmp_sql = NULL;
SPIDER_COPY_TABLE_CONN *table_conn, *src_tbl_conn, *dst_tbl_conn;
SPIDER_CONN *tmp_conn;
SPIDER_WIDE_HANDLER *wide_handler;
spider_db_copy_table *select_ct, *insert_ct;
MEM_ROOT mem_root;
longlong bulk_insert_rows;
......@@ -1125,13 +1127,15 @@ long long spider_copy_tables_body(
__func__, __FILE__, __LINE__, MYF(MY_WME | MY_ZEROFILL),
&tmp_spider->dbton_handler,
sizeof(spider_db_handler *) * SPIDER_DBTON_SIZE,
&wide_handler, sizeof(SPIDER_WIDE_HANDLER),
NullS))
) {
my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM);
goto error;
}
tmp_spider->share = table_conn->share;
tmp_spider->trx = copy_tables->trx;
tmp_spider->wide_handler = wide_handler;
wide_handler->trx = copy_tables->trx;
/*
if (spider_db_append_set_names(table_conn->share))
{
......@@ -1144,7 +1148,7 @@ long long spider_copy_tables_body(
tmp_sql[roop_count].set_charset(copy_tables->access_charset);
tmp_spider->result_list.sqls = &tmp_sql[roop_count];
tmp_spider->need_mons = &table_conn->need_mon;
tmp_spider->lock_type = TL_READ;
tmp_spider->wide_handler->lock_type = TL_READ;
tmp_spider->conn_link_idx = &tmp_conn_link_idx;
uint dbton_id = tmp_spider->share->use_dbton_ids[0];
if (!(tmp_spider->dbton_handler[dbton_id] =
......@@ -1169,13 +1173,15 @@ long long spider_copy_tables_body(
__func__, __FILE__, __LINE__, MYF(MY_WME | MY_ZEROFILL),
&tmp_spider->dbton_handler,
sizeof(spider_db_handler *) * SPIDER_DBTON_SIZE,
&wide_handler, sizeof(SPIDER_WIDE_HANDLER),
NullS))
) {
my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM);
goto error;
}
tmp_spider->share = table_conn->share;
tmp_spider->trx = copy_tables->trx;
tmp_spider->wide_handler = wide_handler;
wide_handler->trx = copy_tables->trx;
/*
if (spider_db_append_set_names(table_conn->share))
{
......@@ -1188,7 +1194,7 @@ long long spider_copy_tables_body(
tmp_sql[roop_count].set_charset(copy_tables->access_charset);
tmp_spider->result_list.sqls = &tmp_sql[roop_count];
tmp_spider->need_mons = &table_conn->need_mon;
tmp_spider->lock_type = TL_WRITE;
tmp_spider->wide_handler->lock_type = TL_WRITE;
tmp_spider->conn_link_idx = &tmp_conn_link_idx;
uint dbton_id = tmp_spider->share->use_dbton_ids[0];
if (!(tmp_spider->dbton_handler[dbton_id] =
......
This diff is collapsed.
......@@ -2006,7 +2006,6 @@ typedef struct st_spider_result_list
#endif
int quick_phase;
bool keyread;
int lock_type;
TABLE *table;
#ifndef WITHOUT_SPIDER_BG_SEARCH
volatile int bgs_error;
......
This diff is collapsed.
This diff is collapsed.
......@@ -794,7 +794,7 @@ void spider_fields::choose_a_conn(
SPIDER_CONN_HOLDER *conn_holder;
longlong balance_total = 0, balance_val;
double rand_val;
THD *thd = table_holder[0].spider->trx->thd;
THD *thd = table_holder[0].spider->wide_handler->trx->thd;
DBUG_ENTER("spider_fields::choose_a_conn");
DBUG_PRINT("info",("spider this=%p", this));
for (current_conn_holder = first_conn_holder; current_conn_holder;
......@@ -1146,8 +1146,8 @@ int spider_fields::ping_table_mon_from_table(
if (tmp_share->monitoring_kind[tmp_link_idx])
{
error_num_buf = spider_ping_table_mon_from_table(
tmp_spider->trx,
tmp_spider->trx->thd,
tmp_spider->wide_handler->trx,
tmp_spider->wide_handler->trx->thd,
tmp_share,
tmp_link_idx,
(uint32) tmp_share->monitoring_sid[tmp_link_idx],
......@@ -1180,7 +1180,7 @@ spider_group_by_handler::spider_group_by_handler(
fields->set_pos_to_first_table_holder();
SPIDER_TABLE_HOLDER *table_holder = fields->get_next_table_holder();
spider = table_holder->spider;
trx = spider->trx;
trx = spider->wide_handler->trx;
DBUG_VOID_RETURN;
}
......@@ -1917,6 +1917,12 @@ group_by_handler *spider_create_group_by_handler(
delete fields;
DBUG_RETURN(NULL);
}
if (spider->dml_init())
{
DBUG_PRINT("info",("spider can not init for dml"));
delete fields;
DBUG_RETURN(NULL);
}
for (
roop_count = spider_conn_link_idx_next(share->link_statuses,
spider->conn_link_idx, -1, share->link_count,
......@@ -1998,6 +2004,12 @@ group_by_handler *spider_create_group_by_handler(
}
DBUG_PRINT("info",("spider s->db=%s", from->table->s->db.str));
DBUG_PRINT("info",("spider s->table_name=%s", from->table->s->table_name.str));
if (spider->dml_init())
{
DBUG_PRINT("info",("spider can not init for dml"));
delete fields;
DBUG_RETURN(NULL);
}
for (
roop_count = spider_conn_link_idx_next(share->link_statuses,
spider->conn_link_idx, -1, share->link_count,
......
......@@ -615,26 +615,19 @@ typedef struct st_spider_lgtm_tblhnd_share
#ifdef WITH_PARTITION_STORAGE_ENGINE
typedef struct st_spider_patition_handler_share
{
uint use_count;
TABLE *table;
bool clone_bitmap_init;
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type table_hash_value;
#endif
void *creator;
void **handlers;
uchar *searched_bitmap;
uchar *ft_discard_bitmap;
uchar *idx_read_bitmap;
uchar *idx_write_bitmap;
uchar *rnd_read_bitmap;
uchar *rnd_write_bitmap;
bool between_flg;
bool idx_bitmap_is_set;
bool rnd_bitmap_is_set;
query_id_t parallel_search_query_id;
uint no_parts;
TABLE *table;
ha_spider *owner;
ha_spider **handlers;
} SPIDER_PARTITION_HANDLER_SHARE;
#endif
typedef struct st_spider_patition_share
typedef struct st_spider_wide_share
{
char *table_name;
uint table_name_length;
......@@ -642,6 +635,7 @@ typedef struct st_spider_patition_share
my_hash_value_type table_path_hash_value;
#endif
uint use_count;
THR_LOCK lock;
pthread_mutex_t sts_mutex;
pthread_mutex_t crd_mutex;
pthread_mutex_t pt_handler_mutex;
......@@ -666,11 +660,88 @@ typedef struct st_spider_patition_share
time_t update_time;
longlong *cardinality;
/*
volatile SPIDER_PARTITION_HANDLER_SHARE *partition_handler_share;
*/
} SPIDER_PARTITION_SHARE;
} SPIDER_WIDE_SHARE;
typedef struct st_spider_wide_handler
{
THR_LOCK_DATA lock;
SPIDER_TRX *trx;
uchar *searched_bitmap;
uchar *ft_discard_bitmap;
uchar *position_bitmap;
uchar *idx_read_bitmap;
uchar *idx_write_bitmap;
uchar *rnd_read_bitmap;
uchar *rnd_write_bitmap;
SPIDER_CONDITION *condition;
void *owner;
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
uint32 *hs_pushed_ret_fields;
#endif
#endif
#ifdef WITH_PARTITION_STORAGE_ENGINE
SPIDER_PARTITION_HANDLER_SHARE *partition_handler_share;
#endif
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
List<Item> *direct_update_fields;
List<Item> *direct_update_values;
#endif
TABLE *top_table;
Field **top_table_field;
enum thr_lock_type lock_type;
uchar lock_table_type;
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
uint32 hs_pushed_strref_num;
#endif
#endif
int lock_mode;
int external_lock_type;
int cond_check_error;
uint sql_command;
uint top_table_fields;
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
#ifdef INFO_KIND_FORCE_LIMIT_BEGIN
longlong info_limit;
#endif
#endif
#ifdef HA_CAN_BULK_ACCESS
ulonglong external_lock_cnt;
#endif
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
size_t hs_pushed_ret_fields_num;
size_t hs_pushed_ret_fields_size;
size_t hs_pushed_lcl_fields_num;
#endif
#endif
bool between_flg;
bool idx_bitmap_is_set;
bool rnd_bitmap_is_set;
bool position_bitmap_init;
bool semi_trx_isolation_chk;
bool semi_trx_chk;
bool low_priority;
bool high_priority;
bool insert_delayed;
bool consistent_snapshot;
bool quick_mode;
bool keyread;
bool update_request;
bool ignore_dup_key;
bool write_can_replace;
bool insert_with_update;
bool cond_check;
bool set_top_table_fields;
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
bool hs_increment;
bool hs_decrement;
#endif
#endif
bool semi_table_lock;
} SPIDER_WIDE_HANDLER;
typedef struct st_spider_transaction
{
......@@ -807,7 +878,6 @@ typedef struct st_spider_share
/*
pthread_mutex_t auto_increment_mutex;
*/
THR_LOCK lock;
TABLE_SHARE *table_share;
SPIDER_LGTM_TBLHND_SHARE *lgtm_tblhnd_share;
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
......@@ -1189,9 +1259,7 @@ typedef struct st_spider_share
#endif
SPIDER_ALTER_TABLE alter_table;
#ifdef WITH_PARTITION_STORAGE_ENGINE
SPIDER_PARTITION_SHARE *partition_share;
#endif
SPIDER_WIDE_SHARE *wide_share;
} SPIDER_SHARE;
typedef struct st_spider_link_pack
......
This diff is collapsed.
......@@ -224,13 +224,13 @@ uchar *spider_tbl_get_key(
my_bool not_used __attribute__ ((unused))
);
#ifdef WITH_PARTITION_STORAGE_ENGINE
uchar *spider_pt_share_get_key(
SPIDER_PARTITION_SHARE *share,
uchar *spider_wide_share_get_key(
SPIDER_WIDE_SHARE *share,
size_t *length,
my_bool not_used __attribute__ ((unused))
);
#ifdef WITH_PARTITION_STORAGE_ENGINE
uchar *spider_pt_handler_share_get_key(
SPIDER_PARTITION_HANDLER_SHARE *share,
size_t *length,
......@@ -420,39 +420,37 @@ void spider_update_link_status_for_share(
long link_status
);
#ifdef WITH_PARTITION_STORAGE_ENGINE
SPIDER_PARTITION_SHARE *spider_get_pt_share(
SPIDER_WIDE_SHARE *spider_get_wide_share(
SPIDER_SHARE *share,
TABLE_SHARE *table_share,
int *error_num
);
int spider_free_pt_share(
SPIDER_PARTITION_SHARE *partition_share
int spider_free_wide_share(
SPIDER_WIDE_SHARE *wide_share
);
void spider_copy_sts_to_pt_share(
SPIDER_PARTITION_SHARE *partition_share,
void spider_copy_sts_to_wide_share(
SPIDER_WIDE_SHARE *wide_share,
SPIDER_SHARE *share
);
void spider_copy_sts_to_share(
SPIDER_SHARE *share,
SPIDER_PARTITION_SHARE *partition_share
SPIDER_WIDE_SHARE *wide_share
);
void spider_copy_crd_to_pt_share(
SPIDER_PARTITION_SHARE *partition_share,
void spider_copy_crd_to_wide_share(
SPIDER_WIDE_SHARE *wide_share,
SPIDER_SHARE *share,
int fields
);
void spider_copy_crd_to_share(
SPIDER_SHARE *share,
SPIDER_PARTITION_SHARE *partition_share,
SPIDER_WIDE_SHARE *wide_share,
int fields
);
#endif
int spider_open_all_tables(
SPIDER_TRX *trx,
......
......@@ -247,6 +247,7 @@ int spider_trx_another_lock_tables(
SPIDER_CONN *conn;
ha_spider tmp_spider;
SPIDER_SHARE tmp_share;
SPIDER_WIDE_HANDLER tmp_wide_handler;
char sql_buf[MAX_FIELD_WIDTH];
spider_string sql_str(sql_buf, sizeof(sql_buf), system_charset_info);
DBUG_ENTER("spider_trx_another_lock_tables");
......@@ -255,13 +256,11 @@ int spider_trx_another_lock_tables(
sql_str.length(0);
memset((void*)&tmp_spider, 0, sizeof(ha_spider));
memset((void*)&tmp_share, 0, sizeof(SPIDER_SHARE));
memset((void*)&tmp_wide_handler, 0, sizeof(SPIDER_WIDE_HANDLER));
tmp_spider.share = &tmp_share;
tmp_spider.trx = trx;
tmp_spider.wide_handler = &tmp_wide_handler;
tmp_wide_handler.trx = trx;
tmp_share.access_charset = system_charset_info;
/*
if ((error_num = spider_db_append_set_names(&tmp_share)))
DBUG_RETURN(error_num);
*/
tmp_spider.conns = &conn;
tmp_spider.result_list.sqls = &sql_str;
tmp_spider.need_mons = &need_mon;
......@@ -273,17 +272,11 @@ int spider_trx_another_lock_tables(
SPIDER_CONN_RESTORE_DASTATUS_AND_RESET_ERROR_NUM;
if (error_num)
{
/*
spider_db_free_set_names(&tmp_share);
*/
DBUG_RETURN(error_num);
}
}
roop_count++;
}
/*
spider_db_free_set_names(&tmp_share);
*/
DBUG_RETURN(0);
}
......@@ -387,10 +380,13 @@ int spider_trx_all_start_trx(
THD *thd = trx->thd;
SPIDER_CONN *conn;
ha_spider tmp_spider;
SPIDER_WIDE_HANDLER tmp_wide_handler;
DBUG_ENTER("spider_trx_all_start_trx");
SPIDER_BACKUP_DASTATUS;
memset((void*)&tmp_spider, 0, sizeof(ha_spider));
tmp_spider.trx = trx;
memset(&tmp_wide_handler, 0, sizeof(SPIDER_WIDE_HANDLER));
tmp_spider.wide_handler = &tmp_wide_handler;
tmp_wide_handler.trx = trx;
tmp_spider.need_mons = &need_mon;
while ((conn = (SPIDER_CONN*) my_hash_element(&trx->trx_conn_hash,
roop_count)))
......@@ -398,7 +394,8 @@ int spider_trx_all_start_trx(
if (
(spider_param_sync_trx_isolation(trx->thd) &&
(error_num = spider_check_and_set_trx_isolation(conn, &need_mon))) ||
(error_num = spider_internal_start_trx(&tmp_spider, conn, 0))
(error_num = spider_internal_start_trx_for_connection(&tmp_spider,
conn, 0))
) {
SPIDER_CONN_RESTORE_DASTATUS_AND_RESET_ERROR_NUM;
if (error_num)
......@@ -418,6 +415,7 @@ int spider_trx_all_flush_logs(
SPIDER_CONN *conn;
ha_spider tmp_spider;
SPIDER_SHARE tmp_share;
SPIDER_WIDE_HANDLER tmp_wide_handler;
long tmp_link_statuses = SPIDER_LINK_STATUS_OK;
uint conn_link_idx = 0;
long net_read_timeout = 600;
......@@ -425,6 +423,7 @@ int spider_trx_all_flush_logs(
DBUG_ENTER("spider_trx_all_flush_logs");
SPIDER_BACKUP_DASTATUS;
memset((void*)&tmp_spider, 0, sizeof(ha_spider));
memset(&tmp_wide_handler, 0, sizeof(SPIDER_WIDE_HANDLER));
tmp_share.link_count = 1;
tmp_share.all_link_count = 1;
tmp_share.link_statuses = &tmp_link_statuses;
......@@ -437,7 +436,8 @@ int spider_trx_all_flush_logs(
tmp_spider.conns = &conn;
tmp_spider.need_mons = &need_mon;
tmp_spider.conn_link_idx = &conn_link_idx;
tmp_spider.trx = trx;
tmp_spider.wide_handler = &tmp_wide_handler;
tmp_wide_handler.trx = trx;
while ((conn = (SPIDER_CONN*) my_hash_element(&trx->trx_conn_hash,
roop_count)))
{
......@@ -1191,6 +1191,7 @@ SPIDER_TRX *spider_get_trx(
int roop_count = 0, roop_count2;
SPIDER_TRX *trx;
SPIDER_SHARE *tmp_share;
SPIDER_WIDE_HANDLER *tmp_wide_handler;
pthread_mutex_t *udf_table_mutexes;
DBUG_ENTER("spider_get_trx");
......@@ -1203,6 +1204,7 @@ SPIDER_TRX *spider_get_trx(
spider_bulk_malloc(NULL, 56, MYF(MY_WME | MY_ZEROFILL),
&trx, sizeof(*trx),
&tmp_share, sizeof(SPIDER_SHARE),
&tmp_wide_handler, sizeof(SPIDER_WIDE_HANDLER),
&udf_table_mutexes, sizeof(pthread_mutex_t) *
spider_param_udf_table_lock_mutex_count(),
NullS))
......@@ -1374,7 +1376,8 @@ SPIDER_TRX *spider_get_trx(
}
trx->tmp_spider->need_mons = &trx->tmp_need_mon;
trx->tmp_spider->share = trx->tmp_share;
trx->tmp_spider->trx = trx;
trx->tmp_spider->wide_handler = tmp_wide_handler;
tmp_wide_handler->trx = trx;
trx->tmp_spider->dbton_handler = trx->tmp_dbton_handler;
if (!(trx->tmp_spider->result_list.sqls =
new spider_string[trx->tmp_share->link_count]))
......@@ -1850,27 +1853,14 @@ int spider_start_internal_consistent_snapshot(
}
int spider_internal_start_trx(
ha_spider *spider,
SPIDER_CONN *conn,
int link_idx
ha_spider *spider
) {
int error_num;
SPIDER_TRX *trx = spider->trx;
SPIDER_TRX *trx = spider->wide_handler->trx;
THD *thd = trx->thd;
bool sync_autocommit = spider_param_sync_autocommit(thd);
double ping_interval_at_trx_start =
spider_param_ping_interval_at_trx_start(thd);
bool xa_lock = FALSE;
time_t tmp_time = (time_t) time((time_t*) 0);
DBUG_ENTER("spider_internal_start_trx");
if (
conn->server_lost ||
difftime(tmp_time, conn->ping_time) >= ping_interval_at_trx_start
) {
spider_conn_queue_ping(spider, conn, link_idx);
}
conn->disable_reconnect = TRUE;
if (!trx->trx_start)
{
if (!trx->trx_consistent_snapshot)
......@@ -1881,16 +1871,7 @@ int spider_internal_start_trx(
trx->internal_xa_snapshot = spider_param_internal_xa_snapshot(thd);
}
}
if (
(error_num = spider_check_and_set_sql_log_off(thd, conn,
&spider->need_mons[link_idx])) ||
(error_num = spider_check_and_set_wait_timeout(thd, conn,
&spider->need_mons[link_idx])) ||
(sync_autocommit &&
(error_num = spider_check_and_set_autocommit(thd, conn,
&spider->need_mons[link_idx])))
)
goto error;
spider->wide_handler->consistent_snapshot = FALSE;
if (trx->trx_consistent_snapshot)
{
if (trx->internal_xa && trx->internal_xa_snapshot < 2)
......@@ -1901,9 +1882,7 @@ int spider_internal_start_trx(
goto error;
} else if (!trx->internal_xa || trx->internal_xa_snapshot == 2)
{
if ((error_num = spider_start_internal_consistent_snapshot(trx, conn,
&spider->need_mons[link_idx])))
goto error;
spider->wide_handler->consistent_snapshot = TRUE;
}
}
DBUG_PRINT("info",("spider trx->trx_start= %s",
......@@ -1922,7 +1901,7 @@ int spider_internal_start_trx(
!trx->trx_xa &&
trx->internal_xa &&
(!trx->trx_consistent_snapshot || trx->internal_xa_snapshot == 3) &&
spider->sql_command != SQLCOM_LOCK_TABLES
spider->wide_handler->sql_command != SQLCOM_LOCK_TABLES
) {
trx->trx_xa = TRUE;
trx->xid.formatID = 1;
......@@ -1975,6 +1954,51 @@ int spider_internal_start_trx(
trx->updated_in_this_trx = FALSE;
DBUG_PRINT("info",("spider trx->updated_in_this_trx=FALSE"));
}
DBUG_RETURN(0);
error:
if (xa_lock)
spider_xa_unlock(&trx->internal_xid_state);
DBUG_RETURN(error_num);
}
int spider_internal_start_trx_for_connection(
ha_spider *spider,
SPIDER_CONN *conn,
int link_idx
) {
int error_num;
SPIDER_TRX *trx = spider->wide_handler->trx;
THD *thd = trx->thd;
bool sync_autocommit = spider_param_sync_autocommit(thd);
double ping_interval_at_trx_start =
spider_param_ping_interval_at_trx_start(thd);
time_t tmp_time = (time_t) time((time_t*) 0);
DBUG_ENTER("spider_internal_start_trx_for_connection");
if (
conn->server_lost ||
difftime(tmp_time, conn->ping_time) >= ping_interval_at_trx_start
) {
spider_conn_queue_ping(spider, conn, link_idx);
}
conn->disable_reconnect = TRUE;
if (
(error_num = spider_check_and_set_sql_log_off(thd, conn,
&spider->need_mons[link_idx])) ||
(error_num = spider_check_and_set_wait_timeout(thd, conn,
&spider->need_mons[link_idx])) ||
(sync_autocommit &&
(error_num = spider_check_and_set_autocommit(thd, conn,
&spider->need_mons[link_idx])))
)
goto error;
if (spider->wide_handler->consistent_snapshot)
{
if ((error_num = spider_start_internal_consistent_snapshot(trx, conn,
&spider->need_mons[link_idx])))
goto error;
}
DBUG_PRINT("info",("spider sync_autocommit = %d", sync_autocommit));
DBUG_PRINT("info",("spider conn->semi_trx_chk = %d", conn->semi_trx_chk));
......@@ -2040,8 +2064,6 @@ int spider_internal_start_trx(
DBUG_RETURN(0);
error:
if (xa_lock)
spider_xa_unlock(&trx->internal_xid_state);
DBUG_RETURN(error_num);
}
......@@ -3722,11 +3744,11 @@ int spider_check_trx_and_get_conn(
DBUG_PRINT("info",("spider get trx error"));
DBUG_RETURN(error_num);
}
spider->trx = trx;
spider->wide_handler->trx = trx;
spider->set_error_mode();
if (
spider->sql_command != SQLCOM_DROP_TABLE &&
spider->sql_command != SQLCOM_ALTER_TABLE
spider->wide_handler->sql_command != SQLCOM_DROP_TABLE &&
spider->wide_handler->sql_command != SQLCOM_ALTER_TABLE
) {
SPIDER_TRX_HA *trx_ha = spider_check_trx_ha(trx, spider);
if (!trx_ha || trx_ha->wait_for_reusing)
......@@ -3782,9 +3804,9 @@ int spider_check_trx_and_get_conn(
SPIDER_LINK_STATUS_NG
) {
DBUG_PRINT("info",(first_byte != *spider->conn_keys[0] ?
"spider change conn type" : trx != spider->trx ? "spider change thd" :
"spider next trx"));
spider->trx = trx;
"spider change conn type" : trx != spider->wide_handler->trx ?
"spider change thd" : "spider next trx"));
spider->wide_handler->trx = trx;
spider->trx_conn_adjustment = trx->trx_conn_adjustment;
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
if (use_conn_kind)
......
......@@ -119,6 +119,10 @@ int spider_start_internal_consistent_snapshot(
);
int spider_internal_start_trx(
ha_spider *spider
);
int spider_internal_start_trx_for_connection(
ha_spider *spider,
SPIDER_CONN *conn,
int link_idx
......
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