Commit 09b1269e authored by Yuchen Pei's avatar Yuchen Pei

Merge branch '10.5' into 10.6

parents fafcd24e cc0faa1e
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -88,21 +88,6 @@ class ha_spider final : public handler
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;
bool synced_from_clone_source;
bool bulk_access_started;
bool bulk_access_executing;
bool bulk_access_pre_called;
SPIDER_BULK_ACCESS_LINK *bulk_access_link_first;
SPIDER_BULK_ACCESS_LINK *bulk_access_link_current;
SPIDER_BULK_ACCESS_LINK *bulk_access_link_exec_tgt;
/*
bool init_ha_mem_root;
MEM_ROOT ha_mem_root;
*/
#endif
bool is_clone;
ha_spider *pt_clone_source_handler;
ha_spider *pt_clone_last_searcher;
......@@ -221,12 +206,6 @@ class ha_spider final : public handler
void check_access_kind(
THD *thd
);
#ifdef HA_CAN_BULK_ACCESS
int additional_lock(
THD *thd,
enum thr_lock_type lock_type
);
#endif
THR_LOCK_DATA **store_lock(
THD *thd,
THR_LOCK_DATA **to,
......@@ -248,16 +227,7 @@ class ha_spider final : public handler
uint idx,
bool sorted
) override;
#ifdef HA_CAN_BULK_ACCESS
int pre_index_init(
uint idx,
bool sorted
);
#endif
int index_end() override;
#ifdef HA_CAN_BULK_ACCESS
int pre_index_end();
#endif
int index_read_map(
uchar *buf,
const uchar *key,
......@@ -345,15 +315,7 @@ class ha_spider final : public handler
int rnd_init(
bool scan
) override;
#ifdef HA_CAN_BULK_ACCESS
int pre_rnd_init(
bool scan
);
#endif
int rnd_end() override;
#ifdef HA_CAN_BULK_ACCESS
int pre_rnd_end();
#endif
int rnd_next(
uchar *buf
) override;
......@@ -467,11 +429,6 @@ class ha_spider final : public handler
int write_row(
const uchar *buf
) override;
#ifdef HA_CAN_BULK_ACCESS
int pre_write_row(
uchar *buf
);
#endif
void direct_update_init(
THD *thd,
bool hs_request
......@@ -514,27 +471,6 @@ class ha_spider final : public handler
List<Item> *update_fields
) override;
#endif
#ifdef HA_CAN_BULK_ACCESS
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
inline int pre_direct_update_rows_init(
List<Item> *update_fields
) {
return pre_direct_update_rows_init(update_fields, 2, NULL, 0, FALSE, NULL);
}
int pre_direct_update_rows_init(
List<Item> *update_fields,
uint mode,
KEY_MULTI_RANGE *ranges,
uint range_count,
bool sorted,
uchar *new_data
);
#else
int pre_direct_update_rows_init(
List<Item> *update_fields
);
#endif
#endif
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
inline int direct_update_rows(ha_rows *update_rows, ha_rows *found_rows)
{
......@@ -553,28 +489,6 @@ class ha_spider final : public handler
ha_rows *update_rows,
ha_rows *found_row
) override;
#endif
#ifdef HA_CAN_BULK_ACCESS
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
inline int pre_direct_update_rows()
{
ha_rows update_rows;
ha_rows found_rows;
return pre_direct_update_rows(NULL, 0, FALSE, NULL, &update_rows,
&found_rows);
}
int pre_direct_update_rows(
KEY_MULTI_RANGE *ranges,
uint range_count,
bool sorted,
uchar *new_data,
ha_rows *update_rows,
ha_rows *found_row
);
#else
int pre_direct_update_rows();
#endif
#endif
bool start_bulk_delete() override;
int end_bulk_delete() override;
......@@ -600,22 +514,6 @@ class ha_spider final : public handler
#else
int direct_delete_rows_init() override;
#endif
#ifdef HA_CAN_BULK_ACCESS
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
inline int pre_direct_delete_rows_init()
{
return pre_direct_delete_rows_init(2, NULL, 0, FALSE);
}
int pre_direct_delete_rows_init(
uint mode,
KEY_MULTI_RANGE *ranges,
uint range_count,
bool sorted
);
#else
int pre_direct_delete_rows_init();
#endif
#endif
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
inline int direct_delete_rows(ha_rows *delete_rows)
{
......@@ -631,24 +529,6 @@ class ha_spider final : public handler
int direct_delete_rows(
ha_rows *delete_rows
) override;
#endif
#ifdef HA_CAN_BULK_ACCESS
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
inline int pre_direct_delete_rows()
{
ha_rows delete_rows;
return pre_direct_delete_rows(NULL, 0, FALSE, &delete_rows);
}
int pre_direct_delete_rows(
KEY_MULTI_RANGE *ranges,
uint range_count,
bool sorted,
ha_rows *delete_rows
);
#else
int pre_direct_delete_rows();
#endif
#endif
int delete_all_rows() override;
int truncate() override;
......@@ -658,9 +538,6 @@ class ha_spider final : public handler
uint ranges,
ha_rows rows
) override;
#ifdef HA_CAN_BULK_ACCESS
void bulk_req_exec();
#endif
const key_map *keys_to_use_for_scanning() override;
ha_rows estimate_rows_upper_bound() override;
void print_error(
......@@ -818,15 +695,6 @@ class ha_spider final : public handler
bool use_parallel
);
void check_insert_dup_update_pushdown();
#ifdef HA_CAN_BULK_ACCESS
SPIDER_BULK_ACCESS_LINK *create_bulk_access_link();
void delete_bulk_access_link(
SPIDER_BULK_ACCESS_LINK *bulk_access_link
);
int sync_from_clone_source(
ha_spider *spider
);
#endif
void sync_from_clone_source_base(
ha_spider *spider
);
......@@ -1044,15 +912,6 @@ class ha_spider final : public handler
int append_lock_tables_list();
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
};
......
......@@ -277,7 +277,6 @@ int spider_free_conn_alloc(
conn->db_conn = NULL;
}
spider_conn_done(conn);
DBUG_ASSERT(!conn->mta_conn_mutex_file_pos.file_name);
pthread_mutex_destroy(&conn->mta_conn_mutex);
conn->default_database.free();
DBUG_RETURN(0);
......@@ -1469,10 +1468,6 @@ void spider_conn_clear_queue(
) {
DBUG_ENTER("spider_conn_clear_queue");
DBUG_PRINT("info", ("spider conn=%p", conn));
/*
conn->queued_connect = FALSE;
conn->queued_ping = FALSE;
*/
conn->queued_trx_isolation = FALSE;
conn->queued_semi_trx_isolation = FALSE;
conn->queued_autocommit = FALSE;
......@@ -2584,7 +2579,6 @@ void *spider_bg_conn_action(
} else {
sql_type = SPIDER_SQL_TYPE_HANDLER;
}
pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
if (spider->use_fields)
{
if ((error_num = dbton_handler->set_sql_for_exec(sql_type,
......@@ -2603,28 +2597,12 @@ void *spider_bg_conn_action(
strmov(result_list->bgs_error_msg, spider_stmt_da_message(thd));
}
}
pthread_mutex_lock(&conn->mta_conn_mutex);
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
/* todo: is it ok if the following statement is not locked? */
sql_type &= ~SPIDER_SQL_TYPE_TMP_SQL;
DBUG_PRINT("info",("spider sql_type=%lu", sql_type));
#ifdef HA_CAN_BULK_ACCESS
if (spider->is_bulk_access_clone)
{
spider->connection_ids[conn->link_idx] = conn->connection_id;
spider_trx_add_bulk_access_conn(spider->trx, conn);
}
#endif
if (!result_list->bgs_error)
{
conn->need_mon = &spider->need_mons[conn->link_idx];
DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
#ifdef HA_CAN_BULK_ACCESS
if (!spider->is_bulk_access_clone)
{
#endif
spider_lock_before_query(conn, &spider->need_mons[conn->link_idx]);
if (!(result_list->bgs_error =
spider_db_set_names(spider, conn, conn->link_idx)))
{
......@@ -2693,18 +2671,7 @@ void *spider_bg_conn_action(
strmov(result_list->bgs_error_msg,
spider_stmt_da_message(thd));
}
#ifdef HA_CAN_BULK_ACCESS
}
#endif
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
} else {
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
spider_unlock_after_query(conn, 0);
}
} else {
spider->connection_ids[conn->link_idx] = conn->connection_id;
......@@ -2779,26 +2746,14 @@ void *spider_bg_conn_action(
{
DBUG_PRINT("info",("spider bg exec sql start"));
spider = (ha_spider*) conn->bg_target;
pthread_mutex_assert_not_owner(&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[conn->link_idx];
DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
spider_lock_before_query(conn, &spider->need_mons[conn->link_idx]);
*conn->bg_error_num = spider_db_query_with_set_names(
conn->bg_sql_type,
spider,
conn,
conn->link_idx
);
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
spider_unlock_after_query(conn, 0);
conn->bg_exec_sql = FALSE;
continue;
}
......@@ -4169,3 +4124,42 @@ void spider_free_ipport_conn(void *info)
}
DBUG_VOID_RETURN;
}
void spider_lock_before_query(SPIDER_CONN *conn, int *need_mon)
{
pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
pthread_mutex_lock(&conn->mta_conn_mutex);
conn->need_mon = need_mon;
DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
}
int spider_unlock_after_query(SPIDER_CONN *conn, int ret)
{
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
pthread_mutex_unlock(&conn->mta_conn_mutex);
return ret;
}
int spider_unlock_after_query_1(SPIDER_CONN *conn)
{
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
return spider_db_errorno(conn);
}
int spider_unlock_after_query_2(SPIDER_CONN *conn, ha_spider *spider, int link_idx, TABLE *table)
{
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
return spider_db_store_result(spider, link_idx, table);
}
......@@ -24,6 +24,8 @@
#define SPIDER_SIMPLE_RECORDS 3
#define SPIDER_SIMPLE_CHECKSUM_TABLE 4
struct TABLE;
/*
The SPIDER_CONN_LOOP_CHECK has been added to the loop_check queue to
check for self-reference.
......@@ -454,3 +456,11 @@ SPIDER_CONN* spider_get_conn_from_idle_connection
int *error_num
);
void spider_free_ipport_conn(void *info);
void spider_lock_before_query(SPIDER_CONN *conn, int *need_mon);
int spider_unlock_after_query(SPIDER_CONN *conn, int ret);
int spider_unlock_after_query_1(SPIDER_CONN *conn);
int spider_unlock_after_query_2(SPIDER_CONN *conn, ha_spider *spider, int link_idx, TABLE *table);
This diff is collapsed.
......@@ -634,14 +634,6 @@ void spider_db_discard_multiple_result(
SPIDER_CONN *conn
);
#ifdef HA_CAN_BULK_ACCESS
int spider_db_bulk_store_result(
ha_spider *spider,
SPIDER_CONN *conn,
int link_idx,
bool discard_result
);
#endif
int spider_db_fetch(
uchar *buf,
......@@ -764,11 +756,6 @@ int spider_db_bulk_insert(
bool bulk_end
);
#ifdef HA_CAN_BULK_ACCESS
int spider_db_bulk_bulk_insert(
ha_spider *spider
);
#endif
int spider_db_update_auto_increment(
ha_spider *spider,
......@@ -815,12 +802,6 @@ int spider_db_direct_update(
);
#endif
#ifdef HA_CAN_BULK_ACCESS
int spider_db_bulk_direct_update(
ha_spider *spider,
ha_rows *update_rows
);
#endif
int spider_db_bulk_delete(
ha_spider *spider,
......@@ -1190,13 +1171,6 @@ int spider_db_open_handler(
int link_idx
);
#ifdef HA_CAN_BULK_ACCESS
int spider_db_bulk_open_handler(
ha_spider *spider,
SPIDER_CONN *conn,
int link_idx
);
#endif
int spider_db_close_handler(
ha_spider *spider,
......
......@@ -1764,8 +1764,6 @@ typedef struct st_spider_result_list
SPIDER_RESULT *current;
KEY *key_info;
int key_order;
#ifdef HA_CAN_BULK_ACCESS
#endif
spider_string *sqls;
int ha_read_kind;
bool have_sql_kind_backup;
......
This diff is collapsed.
This diff is collapsed.
......@@ -491,7 +491,6 @@ SPIDER_CONN *spider_udf_direct_sql_create_conn(
DBUG_RETURN(conn);
error:
DBUG_ASSERT(!conn->mta_conn_mutex_file_pos.file_name);
error_too_many_ipport_count:
spider_conn_done(conn);
error_conn_init:
......
......@@ -1191,27 +1191,15 @@ static int spider_send_query(
}
} else {
#endif
pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
if ((error_num = dbton_hdl->set_sql_for_exec(
SPIDER_SQL_TYPE_SELECT_SQL, link_idx, link_idx_chain)))
DBUG_RETURN(error_num);
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);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
spider_lock_before_query(conn, &spider->need_mons[link_idx]);
if ((error_num = spider_db_set_names(spider, conn,
link_idx)))
if ((error_num = spider_db_set_names(spider, conn, link_idx)))
{
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
spider_unlock_after_query(conn, 0);
if (spider->need_mons[link_idx])
error_num = fields->ping_table_mon_from_table(link_idx_chain);
if ((error_num = spider->check_error_mode_eof(error_num)) ==
......@@ -1229,11 +1217,7 @@ static int spider_send_query(
spider->result_list.quick_mode,
&spider->need_mons[link_idx]))
{
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
error_num = spider_db_errorno(conn);
error_num= spider_unlock_after_query_1(conn);
if (spider->need_mons[link_idx])
error_num = fields->ping_table_mon_from_table(link_idx_chain);
if ((error_num = spider->check_error_mode_eof(error_num)) ==
......@@ -1245,13 +1229,9 @@ static int spider_send_query(
DBUG_RETURN(error_num);
}
spider->connection_ids[link_idx] = conn->connection_id;
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
if (fields->is_first_link_ok_chain(link_idx_chain))
{
if ((error_num = spider_db_store_result(spider, link_idx, table)))
if ((error_num = spider_unlock_after_query_2(conn, spider, link_idx, table)))
{
if (error_num != HA_ERR_END_OF_FILE && spider->need_mons[link_idx])
error_num = fields->ping_table_mon_from_table(link_idx_chain);
......@@ -1268,8 +1248,7 @@ static int spider_send_query(
} else
{
spider_db_discard_result(spider, link_idx, conn);
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
spider_unlock_after_query(conn, 0);
}
#ifndef WITHOUT_SPIDER_BG_SEARCH
}
......
......@@ -109,7 +109,6 @@
#define SPIDER_read_record_read_record(A) read_record()
#define SPIDER_has_Item_with_subquery
#define SPIDER_use_LEX_CSTRING_for_KEY_Field_name
#define SPIDER_use_LEX_CSTRING_for_Field_blob_constructor
#define SPIDER_use_LEX_CSTRING_for_database_tablename_alias
#define SPIDER_THD_db_str(A) (A)->db.str
......@@ -453,11 +452,6 @@ enum spider_malloc_id {
#define SPIDER_CONN_RESTORE_DASTATUS_AND_RESET_TMP_ERROR_NUM \
if (thd && conn->error_mode) {SPIDER_RESTORE_DASTATUS; tmp_error_num = 0;}
#define SPIDER_SET_FILE_POS(A) \
{(A)->thd = current_thd; (A)->func_name = __func__; (A)->file_name = __FILE__; (A)->line_no = __LINE__;}
#define SPIDER_CLEAR_FILE_POS(A) \
{DBUG_PRINT("info", ("spider thd=%p func_name=%s file_name=%s line_no=%lu", (A)->thd, (A)->func_name ? (A)->func_name : "NULL", (A)->file_name ? (A)->file_name : "NULL", (A)->line_no)); (A)->thd = NULL; (A)->func_name = NULL; (A)->file_name = NULL; (A)->line_no = 0;}
class ha_spider;
typedef struct st_spider_share SPIDER_SHARE;
typedef struct st_spider_table_mon_list SPIDER_TABLE_MON_LIST;
......@@ -481,14 +475,6 @@ typedef struct st_spider_thread
} SPIDER_THREAD;
#endif
typedef struct st_spider_file_pos
{
THD *thd;
const char *func_name;
const char *file_name;
ulong line_no;
} SPIDER_FILE_POS;
typedef struct st_spider_link_for_hash
{
ha_spider *spider;
......@@ -618,7 +604,6 @@ typedef struct st_spider_conn
pthread_mutex_t mta_conn_mutex;
volatile bool mta_conn_mutex_lock_already;
volatile bool mta_conn_mutex_unlock_later;
SPIDER_FILE_POS mta_conn_mutex_file_pos;
uint join_trx;
int trx_isolation;
bool semi_trx_isolation_chk;
......@@ -771,12 +756,6 @@ typedef struct st_spider_conn
Time_zone *queued_time_zone_val;
XID *queued_xa_start_xid;
#ifdef HA_CAN_BULK_ACCESS
uint bulk_access_requests;
uint bulk_access_sended;
int bulk_access_error_num;
st_spider_conn *bulk_access_next;
#endif
bool disable_connect_retry; /* TRUE if it is unnecessary to
retry to connect after a
......@@ -904,9 +883,6 @@ typedef struct st_spider_wide_handler
uint top_table_fields;
#ifdef INFO_KIND_FORCE_LIMIT_BEGIN
longlong info_limit;
#endif
#ifdef HA_CAN_BULK_ACCESS
ulonglong external_lock_cnt;
#endif
bool between_flg;
bool idx_bitmap_is_set;
......@@ -980,10 +956,6 @@ typedef struct st_spider_transaction
ulonglong direct_aggregate_count;
ulonglong parallel_search_count;
#ifdef HA_CAN_BULK_ACCESS
SPIDER_CONN *bulk_access_conn_first;
SPIDER_CONN *bulk_access_conn_last;
#endif
pthread_mutex_t *udf_table_mutexes;
CHARSET_INFO *udf_access_charset;
......@@ -1201,9 +1173,6 @@ typedef struct st_spider_share
int error_read_mode;
int error_write_mode;
int active_link_count;
#ifdef HA_CAN_BULK_ACCESS
int bulk_access_free;
#endif
#ifdef HA_CAN_FORCE_BULK_UPDATE
int force_bulk_update;
#endif
......@@ -1621,17 +1590,6 @@ typedef struct st_spider_trx_ha
bool wait_for_reusing;
} SPIDER_TRX_HA;
#ifdef HA_CAN_BULK_ACCESS
typedef struct st_spider_bulk_access_link
{
ha_spider *spider;
uint sequence_num;
bool used;
bool called;
MEM_ROOT mem_root;
st_spider_bulk_access_link *next;
} SPIDER_BULK_ACCESS_LINK;
#endif
#define SPIDER_INT_HLD_TGT_SIZE 100
typedef struct st_spider_int_hld
......
......@@ -2029,28 +2029,6 @@ static MYSQL_THDVAR_INT(
SPIDER_THDVAR_OVERRIDE_VALUE_FUNC(int, read_only_mode)
#ifdef HA_CAN_BULK_ACCESS
static int spider_bulk_access_free;
/*
-1 :fallback to default
0 :in reset
1 :in close
*/
static MYSQL_SYSVAR_INT(
bulk_access_free,
spider_bulk_access_free,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"Free mode of bulk access resources",
NULL,
NULL,
0,
-1,
1,
0
);
SPIDER_SYSVAR_OVERRIDE_VALUE_FUN(int, bulk_access_free)
#endif
/*
-1 :fallback to default
......@@ -2653,9 +2631,6 @@ static struct st_mysql_sys_var* spider_system_variables[] = {
MYSQL_SYSVAR(skip_parallel_search),
MYSQL_SYSVAR(direct_order_limit),
MYSQL_SYSVAR(read_only_mode),
#ifdef HA_CAN_BULK_ACCESS
MYSQL_SYSVAR(bulk_access_free),
#endif
MYSQL_SYSVAR(udf_ds_use_real_table),
MYSQL_SYSVAR(general_log),
MYSQL_SYSVAR(index_hint_pushdown),
......
......@@ -337,11 +337,6 @@ int spider_param_read_only_mode(
THD *thd,
int read_only_mode
);
#ifdef HA_CAN_BULK_ACCESS
int spider_param_bulk_access_free(
int bulk_access_free
);
#endif
int spider_param_udf_ds_use_real_table(
THD *thd,
int udf_ds_use_real_table
......
......@@ -1866,9 +1866,6 @@ static void spider_minus_1(SPIDER_SHARE *share, TABLE_SHARE *table_share)
share->error_read_mode = -1;
share->error_write_mode = -1;
share->active_link_count = -1;
#ifdef HA_CAN_BULK_ACCESS
share->bulk_access_free = -1;
#endif
#ifdef HA_CAN_FORCE_BULK_UPDATE
share->force_bulk_update = -1;
#endif
......@@ -2192,9 +2189,6 @@ int spider_parse_connect_info(
2147483647);
SPIDER_PARAM_INT_WITH_MAX("aim", auto_increment_mode, 0, 3);
SPIDER_PARAM_INT("alc", active_link_count, 1);
#ifdef HA_CAN_BULK_ACCESS
SPIDER_PARAM_INT_WITH_MAX("baf", bulk_access_free, 0, 1);
#endif
SPIDER_PARAM_INT("bfz", buffer_size, 0);
#ifndef WITHOUT_SPIDER_BG_SEARCH
SPIDER_PARAM_LONGLONG("bfr", bgs_first_read, 0);
......@@ -2455,10 +2449,6 @@ int spider_parse_connect_info(
net_read_timeouts, 0, 2147483647);
SPIDER_PARAM_INT_WITH_MAX(
"error_write_mode", error_write_mode, 0, 1);
#ifdef HA_CAN_BULK_ACCESS
SPIDER_PARAM_INT_WITH_MAX(
"bulk_access_free", bulk_access_free, 0, 1);
#endif
SPIDER_PARAM_INT_WITH_MAX(
"query_cache_sync", query_cache_sync, 0, 3);
error_num = parse.fail(true);
......@@ -4703,8 +4693,6 @@ SPIDER_SHARE *spider_get_share(
sizeof(uchar) * share->link_bitmap_size,
&result_list->tmp_table_created,
sizeof(uchar) * share->link_bitmap_size,
#ifdef HA_CAN_BULK_ACCESS
#endif
&result_list->sql_kind_backup, sizeof(uint) * share->link_count,
&result_list->casual_read, sizeof(int) * share->link_count,
&spider->dbton_handler,
......@@ -5181,8 +5169,6 @@ SPIDER_SHARE *spider_get_share(
sizeof(uchar) * share->link_bitmap_size,
&result_list->tmp_table_created,
sizeof(uchar) * share->link_bitmap_size,
#ifdef HA_CAN_BULK_ACCESS
#endif
&result_list->sql_kind_backup, sizeof(uint) * share->link_count,
&result_list->casual_read, sizeof(int) * share->link_count,
&spider->dbton_handler,
......@@ -5893,22 +5879,10 @@ int spider_open_all_tables(
}
conn->error_mode &= spider_param_error_read_mode(thd, 0);
conn->error_mode &= spider_param_error_write_mode(thd, 0);
pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
pthread_mutex_lock(&conn->mta_conn_mutex);
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
conn->need_mon = &mon_val;
DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
spider_lock_before_query(conn, &mon_val);
if ((error_num = spider_db_before_query(conn, &mon_val)))
{
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
spider_unlock_after_query(conn, 0);
spider_sys_index_end(table_tables);
spider_close_sys_table(thd, table_tables,
&open_tables_backup, TRUE);
......@@ -5917,12 +5891,7 @@ int spider_open_all_tables(
free_root(&mem_root, MYF(0));
DBUG_RETURN(error_num);
}
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
spider_unlock_after_query(conn, 0);
if (lock && spider_param_use_snapshot_with_flush_tables(thd) == 2)
{
......@@ -7904,18 +7873,10 @@ bool spider_check_direct_order_limit(
spider->use_index_merge ? "TRUE" : "FALSE"));
DBUG_PRINT("info",("spider is_clone=%s",
spider->is_clone ? "TRUE" : "FALSE"));
#ifdef HA_CAN_BULK_ACCESS
DBUG_PRINT("info",("spider is_bulk_access_clone=%s",
spider->is_bulk_access_clone ? "TRUE" : "FALSE"));
#endif
if (
spider->wide_handler->sql_command != SQLCOM_HA_READ &&
!spider->use_index_merge &&
#ifdef HA_CAN_BULK_ACCESS
(!spider->is_clone || spider->is_bulk_access_clone)
#else
!spider->is_clone
#endif
) {
spider_get_select_limit(spider, &select_lex, &select_limit, &offset_limit);
bool first_check = TRUE;
......@@ -8117,12 +8078,6 @@ Field *spider_field_exchange(
Field *field
) {
DBUG_ENTER("spider_field_exchange");
#ifdef HA_CAN_BULK_ACCESS
if (handler->is_bulk_access_clone)
{
handler = handler->pt_clone_source_handler;
}
#endif
DBUG_PRINT("info",("spider in field=%p", field));
DBUG_PRINT("info",("spider in field->table=%p", field->table));
DBUG_PRINT("info",("spider table=%p", handler->get_table()));
......
......@@ -3149,11 +3149,6 @@ int spider_commit(
if (!(trx = (SPIDER_TRX*) thd_get_ha_data(thd, spider_hton_ptr)))
DBUG_RETURN(0); /* transaction is not started */
#ifdef HA_CAN_BULK_ACCESS
DBUG_PRINT("info",("spider trx->bulk_access_conn_first=%p",
trx->bulk_access_conn_first));
trx->bulk_access_conn_first = NULL;
#endif
/*
We do (almost) nothing if the following two conditions are both met:
......@@ -3247,11 +3242,6 @@ int spider_rollback(
if (!(trx = (SPIDER_TRX*) thd_get_ha_data(thd, spider_hton_ptr)))
DBUG_RETURN(0); /* transaction is not started */
#ifdef HA_CAN_BULK_ACCESS
DBUG_PRINT("info",("spider trx->bulk_access_conn_first=%p",
trx->bulk_access_conn_first));
trx->bulk_access_conn_first = NULL;
#endif
/* In case the rollback happens due to failure of LOCK TABLE, we
need to clear the list of tables to lock. */
......@@ -3988,34 +3978,3 @@ int spider_trx_check_link_idx_failed(
DBUG_RETURN(0);
}
#ifdef HA_CAN_BULK_ACCESS
void spider_trx_add_bulk_access_conn(
SPIDER_TRX *trx,
SPIDER_CONN *conn
) {
DBUG_ENTER("spider_trx_add_bulk_access_conn");
DBUG_PRINT("info",("spider trx=%p", trx));
DBUG_PRINT("info",("spider conn=%p", conn));
DBUG_PRINT("info",("spider conn->bulk_access_requests=%u",
conn->bulk_access_requests));
DBUG_PRINT("info",("spider conn->bulk_access_sended=%u",
conn->bulk_access_sended));
DBUG_PRINT("info",("spider trx->bulk_access_conn_first=%p",
trx->bulk_access_conn_first));
if (!conn->bulk_access_requests && !conn->bulk_access_sended)
{
if (!trx->bulk_access_conn_first)
{
trx->bulk_access_conn_first = conn;
} else {
trx->bulk_access_conn_last->bulk_access_next = conn;
}
trx->bulk_access_conn_last = conn;
conn->bulk_access_next = NULL;
}
conn->bulk_access_requests++;
DBUG_PRINT("info",("spider conn->bulk_access_requests=%u",
conn->bulk_access_requests));
DBUG_VOID_RETURN;
}
#endif
......@@ -266,9 +266,3 @@ int spider_trx_check_link_idx_failed(
ha_spider *spider
);
#ifdef HA_CAN_BULK_ACCESS
void spider_trx_add_bulk_access_conn(
SPIDER_TRX *trx,
SPIDER_CONN *conn
);
#endif
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