mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
MDEV-6088 - Merge spider 3.2
This commit is contained in:
commit
15b443b095
34 changed files with 37224 additions and 35441 deletions
File diff suppressed because it is too large
Load diff
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2008-2013 Kentoku Shiba
|
||||
/* Copyright (C) 2008-2014 Kentoku Shiba
|
||||
|
||||
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
|
||||
|
@ -125,6 +125,7 @@ public:
|
|||
bool clone_bitmap_init;
|
||||
ha_spider *pt_clone_source_handler;
|
||||
ha_spider *pt_clone_last_searcher;
|
||||
bool has_clone_for_merge;
|
||||
|
||||
bool init_index_handler;
|
||||
bool init_rnd_handler;
|
||||
|
@ -165,6 +166,7 @@ public:
|
|||
bool high_priority;
|
||||
bool insert_delayed;
|
||||
bool use_pre_call;
|
||||
bool use_pre_records;
|
||||
enum thr_lock_type lock_type;
|
||||
int lock_mode;
|
||||
uint sql_command;
|
||||
|
@ -172,6 +174,9 @@ public:
|
|||
bool bulk_insert;
|
||||
#ifdef HANDLER_HAS_NEED_INFO_FOR_AUTO_INC
|
||||
bool info_auto_called;
|
||||
#endif
|
||||
#ifdef HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT
|
||||
bool auto_inc_temporary;
|
||||
#endif
|
||||
int bulk_size;
|
||||
int direct_dup_insert;
|
||||
|
@ -232,6 +237,7 @@ public:
|
|||
SPIDER_ITEM_HLD *direct_aggregate_item_first;
|
||||
SPIDER_ITEM_HLD *direct_aggregate_item_current;
|
||||
#endif
|
||||
ha_rows table_rows;
|
||||
|
||||
/* for fulltext search */
|
||||
bool ft_init_and_first;
|
||||
|
@ -463,6 +469,9 @@ public:
|
|||
bool use_parallel
|
||||
);
|
||||
#ifdef HA_MRR_USE_DEFAULT_IMPL
|
||||
int pre_multi_range_read_next(
|
||||
bool use_parallel
|
||||
);
|
||||
#else
|
||||
int pre_read_multi_range_first(
|
||||
KEY_MULTI_RANGE **found_range_p,
|
||||
|
@ -491,6 +500,7 @@ public:
|
|||
key_range *end_key
|
||||
);
|
||||
int check_crd();
|
||||
int pre_records();
|
||||
ha_rows records();
|
||||
const char *table_type() const;
|
||||
ulonglong table_flags() const;
|
||||
|
@ -510,6 +520,9 @@ public:
|
|||
uint8 table_cache_type();
|
||||
#ifdef HANDLER_HAS_NEED_INFO_FOR_AUTO_INC
|
||||
bool need_info_for_auto_inc();
|
||||
#endif
|
||||
#ifdef HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT
|
||||
bool can_use_for_auto_inc_init();
|
||||
#endif
|
||||
int update_auto_increment();
|
||||
void get_auto_increment(
|
||||
|
@ -541,6 +554,12 @@ public:
|
|||
int pre_write_row(
|
||||
uchar *buf
|
||||
);
|
||||
#endif
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
void direct_update_init(
|
||||
THD *thd,
|
||||
bool hs_request
|
||||
);
|
||||
#endif
|
||||
bool start_bulk_update();
|
||||
int exec_bulk_update(
|
||||
|
@ -721,6 +740,7 @@ public:
|
|||
);
|
||||
uint check_partitioned();
|
||||
void check_direct_order_limit();
|
||||
int check_ha_range_eof();
|
||||
int drop_tmp_tables();
|
||||
bool handler_opened(
|
||||
int link_idx,
|
||||
|
@ -845,7 +865,7 @@ public:
|
|||
int append_direct_update_set_hs_part();
|
||||
#endif
|
||||
#endif
|
||||
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
int append_dup_update_pushdown_sql_part(
|
||||
const char *alias,
|
||||
uint alias_length
|
||||
|
@ -944,6 +964,13 @@ public:
|
|||
void set_order_to_pos_sql(
|
||||
ulong sql_type
|
||||
);
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
int append_group_by_sql_part(
|
||||
const char *alias,
|
||||
uint alias_length,
|
||||
ulong sql_type
|
||||
);
|
||||
#endif
|
||||
int append_key_order_for_merge_with_alias_sql_part(
|
||||
const char *alias,
|
||||
uint alias_length,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2008-2013 Kentoku Shiba
|
||||
/* Copyright (C) 2008-2014 Kentoku Shiba
|
||||
|
||||
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
|
||||
|
@ -233,6 +233,7 @@ void spider_free_conn_from_trx(
|
|||
) {
|
||||
/* conn_recycle_mode == 1 */
|
||||
*conn->conn_key = '0';
|
||||
conn->casual_read_base_conn = NULL;
|
||||
if (
|
||||
conn->quick_target &&
|
||||
spider_db_free_result((ha_spider *) conn->quick_target, FALSE)
|
||||
|
@ -1100,6 +1101,91 @@ int spider_free_conn(
|
|||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
int spider_check_and_get_casual_read_conn(
|
||||
THD *thd,
|
||||
ha_spider *spider,
|
||||
int link_idx
|
||||
) {
|
||||
int error_num;
|
||||
DBUG_ENTER("spider_check_and_get_casual_read_conn");
|
||||
if (spider->result_list.casual_read[link_idx])
|
||||
{
|
||||
SPIDER_CONN *conn = spider->conns[link_idx];
|
||||
if (conn->casual_read_query_id != thd->query_id)
|
||||
{
|
||||
conn->casual_read_query_id = thd->query_id;
|
||||
conn->casual_read_current_id = 2;
|
||||
}
|
||||
if (spider->result_list.casual_read[link_idx] == 1)
|
||||
{
|
||||
spider->result_list.casual_read[link_idx] = conn->casual_read_current_id;
|
||||
++conn->casual_read_current_id;
|
||||
if (conn->casual_read_current_id > 63)
|
||||
{
|
||||
conn->casual_read_current_id = 2;
|
||||
}
|
||||
}
|
||||
char first_byte_bak = *spider->conn_keys[link_idx];
|
||||
*spider->conn_keys[link_idx] =
|
||||
'0' + spider->result_list.casual_read[link_idx];
|
||||
if (
|
||||
!(spider->conns[link_idx] =
|
||||
spider_get_conn(spider->share, link_idx,
|
||||
spider->conn_keys[link_idx], spider->trx,
|
||||
spider, FALSE, TRUE, SPIDER_CONN_KIND_MYSQL,
|
||||
&error_num))
|
||||
) {
|
||||
*spider->conn_keys[link_idx] = first_byte_bak;
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
*spider->conn_keys[link_idx] = first_byte_bak;
|
||||
spider->conns[link_idx]->casual_read_base_conn = conn;
|
||||
conn = spider->conns[link_idx];
|
||||
spider_check_and_set_autocommit(thd, conn, NULL);
|
||||
}
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
int spider_check_and_init_casual_read(
|
||||
THD *thd,
|
||||
ha_spider *spider,
|
||||
int link_idx
|
||||
) {
|
||||
int error_num;
|
||||
SPIDER_RESULT_LIST *result_list = &spider->result_list;
|
||||
SPIDER_SHARE *share = spider->share;
|
||||
DBUG_ENTER("spider_check_and_init_casual_read");
|
||||
if (
|
||||
spider_param_sync_autocommit(thd) &&
|
||||
(!thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) &&
|
||||
(
|
||||
result_list->direct_order_limit
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
|| result_list->direct_aggregate
|
||||
#endif
|
||||
)
|
||||
) {
|
||||
if (!result_list->casual_read[link_idx])
|
||||
{
|
||||
result_list->casual_read[link_idx] =
|
||||
spider_param_casual_read(thd, share->casual_read);
|
||||
}
|
||||
if ((error_num = spider_check_and_get_casual_read_conn(thd, spider,
|
||||
link_idx)))
|
||||
{
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
SPIDER_CONN *conn = spider->conns[link_idx];
|
||||
if (
|
||||
conn->casual_read_base_conn &&
|
||||
(error_num = spider_create_conn_thread(conn))
|
||||
) {
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
}
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
void spider_conn_queue_connect(
|
||||
SPIDER_SHARE *share,
|
||||
SPIDER_CONN *conn,
|
||||
|
@ -2096,18 +2182,38 @@ int spider_bg_conn_search(
|
|||
|
||||
void spider_bg_conn_simple_action(
|
||||
SPIDER_CONN *conn,
|
||||
uint simple_action
|
||||
uint simple_action,
|
||||
bool caller_wait,
|
||||
void *target,
|
||||
uint link_idx,
|
||||
int *error_num
|
||||
) {
|
||||
DBUG_ENTER("spider_bg_conn_simple_action");
|
||||
pthread_mutex_lock(&conn->bg_conn_mutex);
|
||||
conn->bg_caller_wait = TRUE;
|
||||
conn->bg_target = target;
|
||||
conn->link_idx = link_idx;
|
||||
conn->bg_simple_action = simple_action;
|
||||
pthread_mutex_lock(&conn->bg_conn_sync_mutex);
|
||||
conn->bg_error_num = error_num;
|
||||
if (caller_wait)
|
||||
{
|
||||
conn->bg_caller_wait = TRUE;
|
||||
pthread_mutex_lock(&conn->bg_conn_sync_mutex);
|
||||
} else {
|
||||
conn->bg_caller_sync_wait = TRUE;
|
||||
pthread_mutex_lock(&conn->bg_conn_sync_mutex);
|
||||
}
|
||||
pthread_cond_signal(&conn->bg_conn_cond);
|
||||
pthread_mutex_unlock(&conn->bg_conn_mutex);
|
||||
pthread_cond_wait(&conn->bg_conn_sync_cond, &conn->bg_conn_sync_mutex);
|
||||
pthread_mutex_unlock(&conn->bg_conn_sync_mutex);
|
||||
conn->bg_caller_wait = FALSE;
|
||||
if (caller_wait)
|
||||
{
|
||||
pthread_cond_wait(&conn->bg_conn_sync_cond, &conn->bg_conn_sync_mutex);
|
||||
pthread_mutex_unlock(&conn->bg_conn_sync_mutex);
|
||||
conn->bg_caller_wait = FALSE;
|
||||
} else {
|
||||
pthread_cond_wait(&conn->bg_conn_sync_cond, &conn->bg_conn_sync_mutex);
|
||||
pthread_mutex_unlock(&conn->bg_conn_sync_mutex);
|
||||
conn->bg_caller_sync_wait = FALSE;
|
||||
}
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
@ -2450,6 +2556,13 @@ void *spider_bg_conn_action(
|
|||
case SPIDER_BG_SIMPLE_DISCONNECT:
|
||||
conn->db_conn->bg_disconnect();
|
||||
break;
|
||||
case SPIDER_BG_SIMPLE_RECORDS:
|
||||
DBUG_PRINT("info",("spider bg simple records"));
|
||||
spider = (ha_spider*) conn->bg_target;
|
||||
*conn->bg_error_num =
|
||||
spider->dbton_handler[conn->dbton_id]->
|
||||
show_records(conn->link_idx);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -2761,10 +2874,15 @@ void *spider_bg_sts_action(
|
|||
if (spider.search_link_idx == -1)
|
||||
{
|
||||
spider_trx_set_link_idx_for_all(&spider);
|
||||
/*
|
||||
spider.search_link_idx = spider_conn_next_link_idx(
|
||||
thd, share->link_statuses, share->access_balances,
|
||||
spider.conn_link_idx, spider.search_link_idx, share->link_count,
|
||||
SPIDER_LINK_STATUS_OK);
|
||||
*/
|
||||
spider.search_link_idx = spider_conn_first_link_idx(thd,
|
||||
share->link_statuses, share->access_balances, spider.conn_link_idx,
|
||||
share->link_count, SPIDER_LINK_STATUS_OK);
|
||||
}
|
||||
if (spider.search_link_idx >= 0)
|
||||
{
|
||||
|
@ -2780,6 +2898,7 @@ void *spider_bg_sts_action(
|
|||
&error_num);
|
||||
conns[spider.search_link_idx]->error_mode = 0;
|
||||
pthread_mutex_unlock(&spider_global_trx_mutex);
|
||||
/*
|
||||
if (
|
||||
error_num &&
|
||||
share->monitoring_kind[spider.search_link_idx] &&
|
||||
|
@ -2802,8 +2921,10 @@ void *spider_bg_sts_action(
|
|||
);
|
||||
lex_end(thd->lex);
|
||||
}
|
||||
*/
|
||||
spider.search_link_idx = -1;
|
||||
}
|
||||
if (conns[spider.search_link_idx])
|
||||
if (spider.search_link_idx != -1 && conns[spider.search_link_idx])
|
||||
{
|
||||
#ifdef WITH_PARTITION_STORAGE_ENGINE
|
||||
if (spider_get_sts(share, spider.search_link_idx,
|
||||
|
@ -2818,6 +2939,7 @@ void *spider_bg_sts_action(
|
|||
2, HA_STATUS_CONST | HA_STATUS_VARIABLE))
|
||||
#endif
|
||||
{
|
||||
/*
|
||||
if (
|
||||
share->monitoring_kind[spider.search_link_idx] &&
|
||||
need_mons[spider.search_link_idx]
|
||||
|
@ -2839,6 +2961,7 @@ void *spider_bg_sts_action(
|
|||
);
|
||||
lex_end(thd->lex);
|
||||
}
|
||||
*/
|
||||
spider.search_link_idx = -1;
|
||||
}
|
||||
}
|
||||
|
@ -3143,10 +3266,15 @@ void *spider_bg_crd_action(
|
|||
if (spider.search_link_idx == -1)
|
||||
{
|
||||
spider_trx_set_link_idx_for_all(&spider);
|
||||
/*
|
||||
spider.search_link_idx = spider_conn_next_link_idx(
|
||||
thd, share->link_statuses, share->access_balances,
|
||||
spider.conn_link_idx, spider.search_link_idx, share->link_count,
|
||||
SPIDER_LINK_STATUS_OK);
|
||||
*/
|
||||
spider.search_link_idx = spider_conn_first_link_idx(thd,
|
||||
share->link_statuses, share->access_balances, spider.conn_link_idx,
|
||||
share->link_count, SPIDER_LINK_STATUS_OK);
|
||||
}
|
||||
if (spider.search_link_idx >= 0)
|
||||
{
|
||||
|
@ -3162,6 +3290,7 @@ void *spider_bg_crd_action(
|
|||
&error_num);
|
||||
conns[spider.search_link_idx]->error_mode = 0;
|
||||
pthread_mutex_unlock(&spider_global_trx_mutex);
|
||||
/*
|
||||
if (
|
||||
error_num &&
|
||||
share->monitoring_kind[spider.search_link_idx] &&
|
||||
|
@ -3184,8 +3313,10 @@ void *spider_bg_crd_action(
|
|||
);
|
||||
lex_end(thd->lex);
|
||||
}
|
||||
*/
|
||||
spider.search_link_idx = -1;
|
||||
}
|
||||
if (conns[spider.search_link_idx])
|
||||
if (spider.search_link_idx != -1 && conns[spider.search_link_idx])
|
||||
{
|
||||
#ifdef WITH_PARTITION_STORAGE_ENGINE
|
||||
if (spider_get_crd(share, spider.search_link_idx,
|
||||
|
@ -3200,6 +3331,7 @@ void *spider_bg_crd_action(
|
|||
2))
|
||||
#endif
|
||||
{
|
||||
/*
|
||||
if (
|
||||
share->monitoring_kind[spider.search_link_idx] &&
|
||||
need_mons[spider.search_link_idx]
|
||||
|
@ -3221,6 +3353,7 @@ void *spider_bg_crd_action(
|
|||
);
|
||||
lex_end(thd->lex);
|
||||
}
|
||||
*/
|
||||
spider.search_link_idx = -1;
|
||||
}
|
||||
}
|
||||
|
@ -3718,28 +3851,35 @@ bool spider_conn_use_handler(
|
|||
#endif
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
#endif
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
if (spider->do_direct_update)
|
||||
{
|
||||
spider->sql_kinds |= SPIDER_SQL_KIND_SQL;
|
||||
spider->sql_kind[link_idx] = SPIDER_SQL_KIND_SQL;
|
||||
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
|
||||
if (spider_bit_is_set(spider->do_hs_direct_update, link_idx))
|
||||
{
|
||||
spider->direct_update_kinds |= SPIDER_SQL_KIND_HS;
|
||||
DBUG_PRINT("info",("spider TRUE by using HS direct_update"));
|
||||
DBUG_RETURN(TRUE);
|
||||
} else
|
||||
} else {
|
||||
#endif
|
||||
spider->direct_update_kinds |= SPIDER_SQL_KIND_SQL;
|
||||
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
|
||||
}
|
||||
if (spider->conn_kind[link_idx] == SPIDER_CONN_KIND_MYSQL)
|
||||
{
|
||||
#endif
|
||||
DBUG_PRINT("info",("spider FALSE by using direct_update"));
|
||||
DBUG_RETURN(FALSE);
|
||||
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
|
||||
} else {
|
||||
DBUG_PRINT("info",("spider TRUE by using BOTH"));
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
if (spider->use_spatial_index)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2008-2013 Kentoku Shiba
|
||||
/* Copyright (C) 2008-2014 Kentoku Shiba
|
||||
|
||||
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
|
||||
|
@ -20,6 +20,7 @@
|
|||
#define SPIDER_BG_SIMPLE_NO_ACTION 0
|
||||
#define SPIDER_BG_SIMPLE_CONNECT 1
|
||||
#define SPIDER_BG_SIMPLE_DISCONNECT 2
|
||||
#define SPIDER_BG_SIMPLE_RECORDS 3
|
||||
|
||||
uchar *spider_conn_get_key(
|
||||
SPIDER_CONN *conn,
|
||||
|
@ -69,6 +70,18 @@ int spider_free_conn(
|
|||
SPIDER_CONN *conn
|
||||
);
|
||||
|
||||
int spider_check_and_get_casual_read_conn(
|
||||
THD *thd,
|
||||
ha_spider *spider,
|
||||
int link_idx
|
||||
);
|
||||
|
||||
int spider_check_and_init_casual_read(
|
||||
THD *thd,
|
||||
ha_spider *spider,
|
||||
int link_idx
|
||||
);
|
||||
|
||||
void spider_conn_queue_connect(
|
||||
SPIDER_SHARE *share,
|
||||
SPIDER_CONN *conn,
|
||||
|
@ -220,7 +233,11 @@ int spider_bg_conn_search(
|
|||
|
||||
void spider_bg_conn_simple_action(
|
||||
SPIDER_CONN *conn,
|
||||
uint simple_action
|
||||
uint simple_action,
|
||||
bool caller_wait,
|
||||
void *target,
|
||||
uint link_idx,
|
||||
int *error_num
|
||||
);
|
||||
|
||||
void *spider_bg_conn_action(
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2009-2013 Kentoku Shiba
|
||||
/* Copyright (C) 2009-2014 Kentoku Shiba
|
||||
|
||||
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
|
||||
|
@ -719,7 +719,7 @@ int spider_udf_copy_tables_create_table_list(
|
|||
©_tables->link_idxs[1],
|
||||
sizeof(int) * copy_tables->link_idx_count[1],
|
||||
&tmp_name_ptr, sizeof(char) * (
|
||||
spider_table_name_length * 2 + copy_tables->database_length + 2
|
||||
spider_table_name_length * 2 + copy_tables->database_length + 3
|
||||
),
|
||||
NullS))
|
||||
) {
|
||||
|
@ -849,6 +849,7 @@ long long spider_copy_tables_body(
|
|||
MEM_ROOT mem_root;
|
||||
longlong bulk_insert_rows;
|
||||
Reprepare_observer *reprepare_observer_backup;
|
||||
uint tmp_conn_link_idx = 0;
|
||||
DBUG_ENTER("spider_copy_tables_body");
|
||||
if (
|
||||
thd->open_tables != 0 ||
|
||||
|
@ -989,6 +990,7 @@ long long spider_copy_tables_body(
|
|||
table_list->table_name_length));
|
||||
reprepare_observer_backup = thd->m_reprepare_observer;
|
||||
thd->m_reprepare_observer = NULL;
|
||||
copy_tables->trx->trx_start = TRUE;
|
||||
#if MYSQL_VERSION_ID < 50500
|
||||
if (open_and_lock_tables(thd, table_list))
|
||||
#else
|
||||
|
@ -1003,12 +1005,14 @@ long long spider_copy_tables_body(
|
|||
#endif
|
||||
{
|
||||
thd->m_reprepare_observer = reprepare_observer_backup;
|
||||
copy_tables->trx->trx_start = FALSE;
|
||||
my_printf_error(ER_SPIDER_UDF_CANT_OPEN_TABLE_NUM,
|
||||
ER_SPIDER_UDF_CANT_OPEN_TABLE_STR, MYF(0), table_list->db,
|
||||
table_list->table_name);
|
||||
goto error;
|
||||
}
|
||||
thd->m_reprepare_observer = reprepare_observer_backup;
|
||||
copy_tables->trx->trx_start = FALSE;
|
||||
|
||||
table = table_list->table;
|
||||
table_share = table->s;
|
||||
|
@ -1093,6 +1097,7 @@ long long spider_copy_tables_body(
|
|||
for (roop_count = 0; roop_count < all_link_cnt; roop_count++)
|
||||
{
|
||||
spider[roop_count].conns = NULL;
|
||||
spider[roop_count].change_table_ptr(table, table_share);
|
||||
}
|
||||
for (roop_count = 0, table_conn = copy_tables->table_conn[0];
|
||||
table_conn; roop_count++, table_conn = table_conn->next)
|
||||
|
@ -1123,6 +1128,7 @@ long long spider_copy_tables_body(
|
|||
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->conn_link_idx = &tmp_conn_link_idx;
|
||||
uint dbton_id = tmp_spider->share->use_dbton_ids[0];
|
||||
if (!(tmp_spider->dbton_handler[dbton_id] =
|
||||
spider_dbton[dbton_id].create_db_handler(tmp_spider,
|
||||
|
@ -1166,6 +1172,7 @@ long long spider_copy_tables_body(
|
|||
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->conn_link_idx = &tmp_conn_link_idx;
|
||||
uint dbton_id = tmp_spider->share->use_dbton_ids[0];
|
||||
if (!(tmp_spider->dbton_handler[dbton_id] =
|
||||
spider_dbton[dbton_id].create_db_handler(tmp_spider,
|
||||
|
@ -1293,7 +1300,9 @@ error:
|
|||
delete [] tmp_sql;
|
||||
}
|
||||
if (copy_tables)
|
||||
{
|
||||
spider_udf_free_copy_tables_alloc(copy_tables);
|
||||
}
|
||||
*error = 1;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
@ -1338,6 +1347,6 @@ void spider_copy_tables_deinit_body(
|
|||
!thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN) &&
|
||||
(trx = spider_get_trx(thd, TRUE, &error_num))
|
||||
)
|
||||
spider_free_trx_conn(trx, FALSE);
|
||||
spider_copy_table_free_trx_conn(trx);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2010-2013 Kentoku Shiba
|
||||
/* Copyright (C) 2010-2014 Kentoku Shiba
|
||||
|
||||
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
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2008-2013 Kentoku Shiba
|
||||
/* Copyright (C) 2008-2014 Kentoku Shiba
|
||||
|
||||
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
|
||||
|
@ -1205,7 +1205,7 @@ void spider_db_append_xid_str(
|
|||
DBUG_ENTER("spider_db_append_xid_str");
|
||||
|
||||
format_id_length =
|
||||
my_sprintf(format_id, (format_id, "0x%lx", xid->formatID));
|
||||
my_sprintf(format_id, (format_id, "%lu", xid->formatID));
|
||||
spider_db_append_hex_string(tmp_str, (uchar *) xid->data, xid->gtrid_length);
|
||||
/*
|
||||
tmp_str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN);
|
||||
|
@ -1595,9 +1595,10 @@ int spider_db_append_key_where_internal(
|
|||
start_key_part_map = 0;
|
||||
use_both = FALSE;
|
||||
}
|
||||
if (end_key)
|
||||
if (end_key) {
|
||||
end_key_part_map = end_key->keypart_map & full_key_part_map;
|
||||
else {
|
||||
result_list->end_key = end_key;
|
||||
} else {
|
||||
end_key_part_map = 0;
|
||||
use_both = FALSE;
|
||||
}
|
||||
|
@ -1657,6 +1658,8 @@ int spider_db_append_key_where_internal(
|
|||
tgt_key_part_map = end_key_part_map;
|
||||
}
|
||||
DBUG_PRINT("info", ("spider tgt_key_part_map=%lu", tgt_key_part_map));
|
||||
if (start_key_part_map == end_key_part_map)
|
||||
result_list->use_both_key = TRUE;
|
||||
|
||||
if (sql_kind == SPIDER_SQL_KIND_SQL)
|
||||
{
|
||||
|
@ -1707,6 +1710,7 @@ int spider_db_append_key_where_internal(
|
|||
#endif
|
||||
}
|
||||
} else {
|
||||
DBUG_PRINT("info", ("spider tgt_key_part_map=%lu", tgt_key_part_map));
|
||||
if (tgt_key_part_map > 1)
|
||||
key_eq = TRUE;
|
||||
else
|
||||
|
@ -1716,10 +1720,11 @@ int spider_db_append_key_where_internal(
|
|||
(key_eq && use_key == start_key) ||
|
||||
(!key_eq && start_key_part_map)
|
||||
) {
|
||||
bool tgt_final = (use_key == start_key && tgt_key_part_map == 1);
|
||||
ptr = start_key->key + length;
|
||||
if (
|
||||
(error_num = dbton_hdl->append_is_null_part(sql_type, key_part,
|
||||
start_key, &ptr, key_eq))
|
||||
start_key, &ptr, key_eq, tgt_final))
|
||||
) {
|
||||
if (error_num > 0)
|
||||
DBUG_RETURN(error_num);
|
||||
|
@ -1759,10 +1764,13 @@ int spider_db_append_key_where_internal(
|
|||
share->access_charset))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
|
||||
if (spider_dbton[dbton_id].db_util->
|
||||
append_column_value(spider, str_part, field, ptr,
|
||||
share->access_charset))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
if (use_key == start_key)
|
||||
{
|
||||
if (spider_dbton[dbton_id].db_util->
|
||||
append_column_value(spider, str_part, field, ptr,
|
||||
share->access_charset))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
}
|
||||
}
|
||||
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
|
||||
else {
|
||||
|
@ -1807,13 +1815,19 @@ int spider_db_append_key_where_internal(
|
|||
share->access_charset))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
|
||||
if (str->reserve(SPIDER_SQL_EQUAL_LEN))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
str->q_append(SPIDER_SQL_EQUAL_STR, SPIDER_SQL_EQUAL_LEN);
|
||||
if (spider_dbton[dbton_id].db_util->
|
||||
append_column_value(spider, str_part, field, ptr,
|
||||
share->access_charset))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
if (use_key == start_key)
|
||||
{
|
||||
if (tgt_key_part_map == 1)
|
||||
{
|
||||
if (str->reserve(SPIDER_SQL_EQUAL_LEN))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
str->q_append(SPIDER_SQL_EQUAL_STR, SPIDER_SQL_EQUAL_LEN);
|
||||
}
|
||||
if (spider_dbton[dbton_id].db_util->
|
||||
append_column_value(spider, str_part, field, ptr,
|
||||
share->access_charset))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
}
|
||||
}
|
||||
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
|
||||
else {
|
||||
|
@ -1860,13 +1874,19 @@ int spider_db_append_key_where_internal(
|
|||
share->access_charset))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
|
||||
if (str->reserve(SPIDER_SQL_GT_LEN))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
str->q_append(SPIDER_SQL_GT_STR, SPIDER_SQL_GT_LEN);
|
||||
if (spider_dbton[dbton_id].db_util->
|
||||
append_column_value(spider, str_part, field, ptr,
|
||||
share->access_charset))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
if (use_key == start_key)
|
||||
{
|
||||
if (tgt_key_part_map == 1)
|
||||
{
|
||||
if (str->reserve(SPIDER_SQL_GT_LEN))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
str->q_append(SPIDER_SQL_GT_STR, SPIDER_SQL_GT_LEN);
|
||||
}
|
||||
if (spider_dbton[dbton_id].db_util->
|
||||
append_column_value(spider, str_part, field, ptr,
|
||||
share->access_charset))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
}
|
||||
}
|
||||
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
|
||||
else {
|
||||
|
@ -1914,13 +1934,19 @@ int spider_db_append_key_where_internal(
|
|||
share->access_charset))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
|
||||
if (str->reserve(SPIDER_SQL_LT_LEN))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
str->q_append(SPIDER_SQL_LT_STR, SPIDER_SQL_LT_LEN);
|
||||
if (spider_dbton[dbton_id].db_util->
|
||||
append_column_value(spider, str_part, field, ptr,
|
||||
share->access_charset))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
if (use_key == start_key)
|
||||
{
|
||||
if (tgt_key_part_map == 1)
|
||||
{
|
||||
if (str->reserve(SPIDER_SQL_LT_LEN))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
str->q_append(SPIDER_SQL_LT_STR, SPIDER_SQL_LT_LEN);
|
||||
}
|
||||
if (spider_dbton[dbton_id].db_util->
|
||||
append_column_value(spider, str_part, field, ptr,
|
||||
share->access_charset))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
}
|
||||
}
|
||||
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
|
||||
else {
|
||||
|
@ -1974,13 +2000,20 @@ int spider_db_append_key_where_internal(
|
|||
share->access_charset))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
|
||||
if (str->reserve(SPIDER_SQL_LTEQUAL_LEN))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
str->q_append(SPIDER_SQL_LTEQUAL_STR, SPIDER_SQL_LTEQUAL_LEN);
|
||||
if (spider_dbton[dbton_id].db_util->
|
||||
append_column_value(spider, str_part, field, ptr,
|
||||
share->access_charset))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
if (use_key == start_key)
|
||||
{
|
||||
if (tgt_key_part_map == 1)
|
||||
{
|
||||
if (str->reserve(SPIDER_SQL_LTEQUAL_LEN))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
str->q_append(SPIDER_SQL_LTEQUAL_STR,
|
||||
SPIDER_SQL_LTEQUAL_LEN);
|
||||
}
|
||||
if (spider_dbton[dbton_id].db_util->
|
||||
append_column_value(spider, str_part, field, ptr,
|
||||
share->access_charset))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
}
|
||||
}
|
||||
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
|
||||
else {
|
||||
|
@ -2116,13 +2149,20 @@ int spider_db_append_key_where_internal(
|
|||
share->access_charset))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
|
||||
if (str->reserve(SPIDER_SQL_GTEQUAL_LEN))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
str->q_append(SPIDER_SQL_GTEQUAL_STR, SPIDER_SQL_GTEQUAL_LEN);
|
||||
if (spider_dbton[dbton_id].db_util->
|
||||
append_column_value(spider, str_part, field, ptr,
|
||||
share->access_charset))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
if (use_key == start_key)
|
||||
{
|
||||
if (tgt_key_part_map == 1)
|
||||
{
|
||||
if (str->reserve(SPIDER_SQL_GTEQUAL_LEN))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
str->q_append(SPIDER_SQL_GTEQUAL_STR,
|
||||
SPIDER_SQL_GTEQUAL_LEN);
|
||||
}
|
||||
if (spider_dbton[dbton_id].db_util->
|
||||
append_column_value(spider, str_part, field, ptr,
|
||||
share->access_charset))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
}
|
||||
}
|
||||
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
|
||||
else {
|
||||
|
@ -2152,9 +2192,12 @@ int spider_db_append_key_where_internal(
|
|||
str_part2->q_append(SPIDER_SQL_AND_STR,
|
||||
SPIDER_SQL_AND_LEN);
|
||||
|
||||
if (str_part->reserve(SPIDER_SQL_COMMA_LEN))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
str_part->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
|
||||
if (use_key == start_key)
|
||||
{
|
||||
if (str_part->reserve(SPIDER_SQL_COMMA_LEN))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
str_part->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2166,9 +2209,10 @@ int spider_db_append_key_where_internal(
|
|||
(key_eq && use_key == end_key) ||
|
||||
(!key_eq && end_key_part_map)
|
||||
) {
|
||||
bool tgt_final = (use_key == end_key && tgt_key_part_map == 1);
|
||||
ptr = end_key->key + length;
|
||||
if ((error_num = dbton_hdl->append_is_null_part(sql_type, key_part,
|
||||
end_key, &ptr, key_eq)))
|
||||
end_key, &ptr, key_eq, tgt_final)))
|
||||
{
|
||||
if (error_num > 0)
|
||||
DBUG_RETURN(error_num);
|
||||
|
@ -2207,13 +2251,21 @@ int spider_db_append_key_where_internal(
|
|||
share->access_charset))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
|
||||
if (str->reserve(SPIDER_SQL_EQUAL_LEN))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
str->q_append(SPIDER_SQL_EQUAL_STR, SPIDER_SQL_EQUAL_LEN);
|
||||
if (spider_dbton[dbton_id].db_util->
|
||||
append_column_value(spider, str_part, field, ptr,
|
||||
share->access_charset))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
if (use_key == end_key)
|
||||
{
|
||||
/*
|
||||
if (tgt_key_part_map == 1)
|
||||
{
|
||||
if (str->reserve(SPIDER_SQL_EQUAL_LEN))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
str->q_append(SPIDER_SQL_EQUAL_STR, SPIDER_SQL_EQUAL_LEN);
|
||||
}
|
||||
*/
|
||||
if (spider_dbton[dbton_id].db_util->
|
||||
append_column_value(spider, str_part, field, ptr,
|
||||
share->access_charset))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
DBUG_PRINT("info", ("spider end_key->flag=%d", end_key->flag));
|
||||
|
@ -2251,13 +2303,19 @@ int spider_db_append_key_where_internal(
|
|||
share->access_charset))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
|
||||
if (str->reserve(SPIDER_SQL_LT_LEN))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
str->q_append(SPIDER_SQL_LT_STR, SPIDER_SQL_LT_LEN);
|
||||
if (spider_dbton[dbton_id].db_util->
|
||||
append_column_value(spider, str_part, field, ptr,
|
||||
share->access_charset))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
if (use_key == end_key)
|
||||
{
|
||||
if (tgt_key_part_map == 1)
|
||||
{
|
||||
if (str->reserve(SPIDER_SQL_LT_LEN))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
str->q_append(SPIDER_SQL_LT_STR, SPIDER_SQL_LT_LEN);
|
||||
}
|
||||
if (spider_dbton[dbton_id].db_util->
|
||||
append_column_value(spider, str_part, field, ptr,
|
||||
share->access_charset))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -2291,13 +2349,20 @@ int spider_db_append_key_where_internal(
|
|||
share->access_charset))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
|
||||
if (str->reserve(SPIDER_SQL_LTEQUAL_LEN))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
str->q_append(SPIDER_SQL_LTEQUAL_STR, SPIDER_SQL_LTEQUAL_LEN);
|
||||
if (spider_dbton[dbton_id].db_util->
|
||||
append_column_value(spider, str_part, field, ptr,
|
||||
share->access_charset))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
if (use_key == end_key)
|
||||
{
|
||||
if (tgt_key_part_map == 1)
|
||||
{
|
||||
if (str->reserve(SPIDER_SQL_LTEQUAL_LEN))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
str->q_append(SPIDER_SQL_LTEQUAL_STR,
|
||||
SPIDER_SQL_LTEQUAL_LEN);
|
||||
}
|
||||
if (spider_dbton[dbton_id].db_util->
|
||||
append_column_value(spider, str_part, field, ptr,
|
||||
share->access_charset))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -2314,9 +2379,12 @@ int spider_db_append_key_where_internal(
|
|||
str_part2->q_append(SPIDER_SQL_AND_STR,
|
||||
SPIDER_SQL_AND_LEN);
|
||||
|
||||
if (str_part->reserve(SPIDER_SQL_COMMA_LEN))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
str_part->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
|
||||
if (use_key == end_key)
|
||||
{
|
||||
if (str_part->reserve(SPIDER_SQL_COMMA_LEN))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
str_part->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (use_both && (!start_key_part_map || !end_key_part_map))
|
||||
|
@ -2745,6 +2813,13 @@ int spider_db_fetch_table(
|
|||
{
|
||||
if (!row->is_null())
|
||||
spider->multi_range_hit_point = row->val_int();
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
else if (result_list->direct_aggregate)
|
||||
{
|
||||
table->status = STATUS_NOT_FOUND;
|
||||
DBUG_RETURN(HA_ERR_END_OF_FILE);
|
||||
}
|
||||
#endif
|
||||
else
|
||||
DBUG_RETURN(ER_SPIDER_UNKNOWN_NUM);
|
||||
row->next();
|
||||
|
@ -2926,6 +3001,13 @@ int spider_db_fetch_key(
|
|||
DBUG_PRINT("info", ("spider mrr_with_cnt"));
|
||||
if (!row->is_null())
|
||||
spider->multi_range_hit_point = row->val_int();
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
else if (result_list->direct_aggregate)
|
||||
{
|
||||
table->status = STATUS_NOT_FOUND;
|
||||
DBUG_RETURN(HA_ERR_END_OF_FILE);
|
||||
}
|
||||
#endif
|
||||
else
|
||||
DBUG_RETURN(ER_SPIDER_UNKNOWN_NUM);
|
||||
row->next();
|
||||
|
@ -3026,6 +3108,13 @@ int spider_db_fetch_minimum_columns(
|
|||
DBUG_PRINT("info", ("spider mrr_with_cnt"));
|
||||
if (!row->is_null())
|
||||
spider->multi_range_hit_point = row->val_int();
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
else if (result_list->direct_aggregate)
|
||||
{
|
||||
table->status = STATUS_NOT_FOUND;
|
||||
DBUG_RETURN(HA_ERR_END_OF_FILE);
|
||||
}
|
||||
#endif
|
||||
else
|
||||
DBUG_RETURN(ER_SPIDER_UNKNOWN_NUM);
|
||||
row->next();
|
||||
|
@ -3555,33 +3644,33 @@ int spider_db_store_result(
|
|||
}
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
if (
|
||||
error_num != HA_ERR_END_OF_FILE &&
|
||||
(error_num = spider_db_errorno(conn))
|
||||
)
|
||||
DBUG_RETURN(error_num);
|
||||
else {
|
||||
DBUG_PRINT("info",("spider set finish_flg point 1"));
|
||||
DBUG_PRINT("info",("spider current->finish_flg = TRUE"));
|
||||
DBUG_PRINT("info",("spider result_list->finish_flg = TRUE"));
|
||||
current->finish_flg = TRUE;
|
||||
result_list->finish_flg = TRUE;
|
||||
#ifndef WITHOUT_SPIDER_BG_SEARCH
|
||||
if (result_list->bgs_phase <= 1)
|
||||
{
|
||||
#endif
|
||||
result_list->current_row_num = 0;
|
||||
table->status = STATUS_NOT_FOUND;
|
||||
#ifndef WITHOUT_SPIDER_BG_SEARCH
|
||||
}
|
||||
#endif
|
||||
if (!conn->mta_conn_mutex_unlock_later)
|
||||
{
|
||||
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
pthread_mutex_unlock(&conn->mta_conn_mutex);
|
||||
}
|
||||
DBUG_RETURN(HA_ERR_END_OF_FILE);
|
||||
bool call_db_errorno = FALSE;
|
||||
if (error_num != HA_ERR_END_OF_FILE)
|
||||
{
|
||||
call_db_errorno = TRUE;
|
||||
if ((error_num = spider_db_errorno(conn)))
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
DBUG_PRINT("info",("spider set finish_flg point 1"));
|
||||
DBUG_PRINT("info",("spider current->finish_flg = TRUE"));
|
||||
DBUG_PRINT("info",("spider result_list->finish_flg = TRUE"));
|
||||
current->finish_flg = TRUE;
|
||||
result_list->finish_flg = TRUE;
|
||||
#ifndef WITHOUT_SPIDER_BG_SEARCH
|
||||
if (result_list->bgs_phase <= 1)
|
||||
{
|
||||
#endif
|
||||
result_list->current_row_num = 0;
|
||||
table->status = STATUS_NOT_FOUND;
|
||||
#ifndef WITHOUT_SPIDER_BG_SEARCH
|
||||
}
|
||||
#endif
|
||||
if (!conn->mta_conn_mutex_unlock_later && !call_db_errorno)
|
||||
{
|
||||
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
pthread_mutex_unlock(&conn->mta_conn_mutex);
|
||||
}
|
||||
DBUG_RETURN(HA_ERR_END_OF_FILE);
|
||||
} else {
|
||||
if (!conn->mta_conn_mutex_unlock_later)
|
||||
{
|
||||
|
@ -3594,14 +3683,14 @@ int spider_db_store_result(
|
|||
current->record_num));
|
||||
DBUG_PRINT("info",("spider result_list->record_num=%lld",
|
||||
result_list->record_num));
|
||||
DBUG_PRINT("info",("spider result_list->internal_limit=%lld",
|
||||
result_list->internal_limit));
|
||||
DBUG_PRINT("info",("spider result_list->split_read=%lld",
|
||||
result_list->split_read));
|
||||
if (
|
||||
result_list->internal_limit <= result_list->record_num ||
|
||||
result_list->split_read > current->record_num
|
||||
) {
|
||||
DBUG_PRINT("info",("spider result_list->internal_limit=%lld",
|
||||
result_list->internal_limit));
|
||||
DBUG_PRINT("info",("spider result_list->split_read=%lld",
|
||||
result_list->split_read));
|
||||
DBUG_PRINT("info",("spider set finish_flg point 2"));
|
||||
DBUG_PRINT("info",("spider current->finish_flg = TRUE"));
|
||||
DBUG_PRINT("info",("spider result_list->finish_flg = TRUE"));
|
||||
|
@ -4785,7 +4874,7 @@ int spider_db_seek_tmp(
|
|||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
pos->row->first();
|
||||
}
|
||||
if (spider->sql_kind[spider->result_link_idx] == SPIDER_SQL_KIND_SQL)
|
||||
if (pos->sql_kind == SPIDER_SQL_KIND_SQL)
|
||||
{
|
||||
if (!spider->select_column_mode)
|
||||
{
|
||||
|
@ -5087,14 +5176,55 @@ int spider_db_show_table_status(
|
|||
|
||||
int spider_db_show_records(
|
||||
ha_spider *spider,
|
||||
int link_idx
|
||||
int link_idx,
|
||||
bool pre_call
|
||||
) {
|
||||
int error_num;
|
||||
SPIDER_CONN *conn = spider->conns[link_idx];
|
||||
THD *thd = spider->trx->thd;
|
||||
SPIDER_CONN *conn;
|
||||
DBUG_ENTER("spider_db_show_records");
|
||||
error_num = spider->dbton_handler[conn->dbton_id]->show_records(
|
||||
link_idx
|
||||
);
|
||||
if (pre_call)
|
||||
{
|
||||
if (spider_param_bgs_mode(thd, spider->share->bgs_mode))
|
||||
{
|
||||
if ((error_num = spider_check_and_get_casual_read_conn(thd, spider,
|
||||
link_idx)))
|
||||
{
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
conn = spider->conns[link_idx];
|
||||
if (!(error_num = spider_create_conn_thread(conn)))
|
||||
{
|
||||
spider_bg_conn_simple_action(conn, SPIDER_BG_SIMPLE_RECORDS, FALSE,
|
||||
spider, link_idx, (int *) &spider->result_list.bgs_error);
|
||||
}
|
||||
} else {
|
||||
conn = spider->conns[link_idx];
|
||||
error_num = spider->dbton_handler[conn->dbton_id]->show_records(
|
||||
link_idx
|
||||
);
|
||||
}
|
||||
} else {
|
||||
conn = spider->conns[link_idx];
|
||||
if (spider->use_pre_records)
|
||||
{
|
||||
if (spider_param_bgs_mode(thd, spider->share->bgs_mode))
|
||||
{
|
||||
spider_bg_conn_wait(conn);
|
||||
error_num = spider->result_list.bgs_error;
|
||||
if (conn->casual_read_base_conn)
|
||||
{
|
||||
spider->conns[link_idx] = conn->casual_read_base_conn;
|
||||
}
|
||||
} else {
|
||||
error_num = 0;
|
||||
}
|
||||
} else {
|
||||
error_num = spider->dbton_handler[conn->dbton_id]->show_records(
|
||||
link_idx
|
||||
);
|
||||
}
|
||||
}
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
|
||||
|
@ -5584,7 +5714,6 @@ int spider_db_bulk_bulk_insert(
|
|||
) {
|
||||
int error_num = 0, first_insert_link_idx = -1, tmp_error_num;
|
||||
int roop_count2;
|
||||
SPIDER_RESULT_LIST *result_list = &spider->result_list;
|
||||
SPIDER_SHARE *share = spider->share;
|
||||
SPIDER_CONN *conn, *first_insert_conn = NULL;
|
||||
TABLE *table = spider->get_table();
|
||||
|
@ -5624,6 +5753,7 @@ int spider_db_bulk_bulk_insert(
|
|||
if (conn->conn_kind != SPIDER_CONN_KIND_MYSQL)
|
||||
{
|
||||
uint roop_count;
|
||||
SPIDER_RESULT_LIST *result_list = &spider->result_list;
|
||||
DBUG_PRINT("info",("spider conn=%p", conn));
|
||||
DBUG_PRINT("info",("spider result_list->hs_upd_rows=%llu",
|
||||
result_list->hs_upd_rows));
|
||||
|
@ -6283,12 +6413,14 @@ int spider_db_direct_update(
|
|||
) {
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
|
||||
if (
|
||||
(spider->direct_update_kinds & SPIDER_SQL_KIND_HS) &&
|
||||
(error_num = spider->append_direct_update_set_hs_part())
|
||||
) {
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
|
||||
|
@ -6323,6 +6455,7 @@ int spider_db_direct_update(
|
|||
DBUG_RETURN(error_num);
|
||||
}
|
||||
}
|
||||
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
|
||||
if (spider->direct_update_kinds & SPIDER_SQL_KIND_HS)
|
||||
{
|
||||
if (
|
||||
|
@ -6337,6 +6470,7 @@ int spider_db_direct_update(
|
|||
DBUG_RETURN(error_num);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
for (
|
||||
roop_count = spider_conn_link_idx_next(share->link_statuses,
|
||||
|
@ -6455,9 +6589,9 @@ int spider_db_direct_update(
|
|||
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
|
||||
if (!spider_bit_is_set(spider->do_hs_direct_update, roop_count))
|
||||
{
|
||||
#endif
|
||||
if (!counted)
|
||||
{
|
||||
#endif
|
||||
*update_rows = spider->conns[roop_count]->db_conn->affected_rows();
|
||||
DBUG_PRINT("info", ("spider update_rows = %u", *update_rows));
|
||||
counted = TRUE;
|
||||
|
@ -6559,9 +6693,9 @@ int spider_db_bulk_direct_update(
|
|||
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
|
||||
if (!spider_bit_is_set(spider->do_hs_direct_update, roop_count))
|
||||
{
|
||||
#endif
|
||||
if (!counted)
|
||||
{
|
||||
#endif
|
||||
*update_rows = spider->conns[roop_count]->db_conn->affected_rows();
|
||||
DBUG_PRINT("info", ("spider update_rows = %u", *update_rows));
|
||||
counted = TRUE;
|
||||
|
@ -6747,6 +6881,7 @@ int spider_db_direct_delete(
|
|||
DBUG_RETURN(error_num);
|
||||
}
|
||||
}
|
||||
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
|
||||
if (spider->direct_update_kinds & SPIDER_SQL_KIND_HS)
|
||||
{
|
||||
if (
|
||||
|
@ -6761,6 +6896,7 @@ int spider_db_direct_delete(
|
|||
DBUG_RETURN(error_num);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
for (
|
||||
roop_count = spider_conn_link_idx_next(share->link_statuses,
|
||||
|
@ -6926,6 +7062,7 @@ int spider_db_direct_delete(
|
|||
if ((error_num = spider->reset_sql_sql(SPIDER_SQL_TYPE_DELETE_SQL)))
|
||||
error_num2 = error_num;
|
||||
}
|
||||
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
|
||||
if (spider->direct_update_kinds & SPIDER_SQL_KIND_HS)
|
||||
{
|
||||
if ((error_num = spider->reset_hs_sql(SPIDER_SQL_TYPE_DELETE_HS)))
|
||||
|
@ -6933,6 +7070,7 @@ int spider_db_direct_delete(
|
|||
if ((error_num = spider->reset_hs_keys(SPIDER_SQL_TYPE_DELETE_HS)))
|
||||
error_num2 = error_num;
|
||||
}
|
||||
#endif
|
||||
DBUG_RETURN(error_num2);
|
||||
}
|
||||
#endif
|
||||
|
@ -7932,10 +8070,27 @@ int spider_db_open_item_int(
|
|||
{
|
||||
char tmp_buf[MAX_FIELD_WIDTH];
|
||||
spider_string tmp_str(tmp_buf, MAX_FIELD_WIDTH, str->charset());
|
||||
String *tmp_str2;
|
||||
tmp_str.init_calc_mem(127);
|
||||
if (str->append(*item->val_str(tmp_str.get_str())))
|
||||
if (!(tmp_str2 = item->val_str(tmp_str.get_str())))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
tmp_str.mem_calc();
|
||||
#ifdef SPIDER_ITEM_HAS_CMP_TYPE
|
||||
DBUG_PRINT("info",("spider cmp_type=%u", item->cmp_type()));
|
||||
if (item->cmp_type() == TIME_RESULT)
|
||||
{
|
||||
if (str->reserve(SPIDER_SQL_VALUE_QUOTE_LEN * 2 + tmp_str2->length()))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN);
|
||||
str->append(*tmp_str2);
|
||||
str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN);
|
||||
} else {
|
||||
#endif
|
||||
if (str->append(*tmp_str2))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
#ifdef SPIDER_ITEM_HAS_CMP_TYPE
|
||||
}
|
||||
#endif
|
||||
}
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
@ -7951,6 +8106,7 @@ int spider_db_open_item_cache(
|
|||
DBUG_ENTER("spider_db_open_item_cache");
|
||||
if (!item_cache->const_item())
|
||||
DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM);
|
||||
DBUG_PRINT("info",("spider result_type=%u", item_cache->result_type()));
|
||||
switch (item_cache->result_type())
|
||||
{
|
||||
case STRING_RESULT:
|
||||
|
@ -8534,8 +8690,10 @@ int spider_db_udf_direct_sql(
|
|||
}
|
||||
#if MYSQL_VERSION_ID < 50500
|
||||
#else
|
||||
if (table->pos_in_table_list)
|
||||
{
|
||||
if (
|
||||
table->s->tmp_table == NO_TMP_TABLE &&
|
||||
table->pos_in_table_list
|
||||
) {
|
||||
TABLE_LIST *next_tables =
|
||||
table->pos_in_table_list->next_global;
|
||||
while (next_tables && next_tables->parent_l)
|
||||
|
@ -8622,8 +8780,10 @@ int spider_db_udf_direct_sql(
|
|||
table->file->ha_external_lock(table->in_use, F_UNLCK);
|
||||
#if MYSQL_VERSION_ID < 50500
|
||||
#else
|
||||
if (table->pos_in_table_list)
|
||||
{
|
||||
if (
|
||||
table->s->tmp_table == NO_TMP_TABLE &&
|
||||
table->pos_in_table_list
|
||||
) {
|
||||
TABLE_LIST *next_tables =
|
||||
table->pos_in_table_list->next_global;
|
||||
while (next_tables && next_tables->parent_l)
|
||||
|
@ -8865,16 +9025,19 @@ int spider_db_udf_ping_table(
|
|||
bool use_where,
|
||||
longlong limit
|
||||
) {
|
||||
int error_num, need_mon = 0;
|
||||
uint tmp_conn_link_idx = 0;
|
||||
ha_spider spider;
|
||||
int error_num;
|
||||
DBUG_ENTER("spider_db_udf_ping_table");
|
||||
if (!pthread_mutex_trylock(&table_mon_list->monitor_mutex))
|
||||
{
|
||||
int need_mon = 0;
|
||||
uint tmp_conn_link_idx = 0;
|
||||
ha_spider spider;
|
||||
uchar db_request_phase = 0;
|
||||
spider.share = share;
|
||||
spider.trx = trx;
|
||||
spider.need_mons = &need_mon;
|
||||
spider.conn_link_idx = &tmp_conn_link_idx;
|
||||
spider.db_request_phase = &db_request_phase;
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
conn->need_mon = &need_mon;
|
||||
|
@ -9279,6 +9442,8 @@ int spider_db_udf_copy_tables(
|
|||
{
|
||||
tmp_spider = &spider[roop_count];
|
||||
tmp_conn = tmp_spider->conns[0];
|
||||
/* disable transaction */
|
||||
spider_conn_clear_queue_at_commit(tmp_conn);
|
||||
if (!tmp_conn->trx_start)
|
||||
{
|
||||
if (spider_db_ping(tmp_spider, tmp_conn, 0))
|
||||
|
@ -9301,6 +9466,8 @@ int spider_db_udf_copy_tables(
|
|||
{
|
||||
tmp_spider = &spider[roop_count];
|
||||
tmp_conn = tmp_spider->conns[0];
|
||||
/* disable transaction */
|
||||
spider_conn_clear_queue_at_commit(tmp_conn);
|
||||
spider_db_handler *tmp_dbton_hdl =
|
||||
tmp_spider->dbton_handler[tmp_conn->dbton_id];
|
||||
if ((error_num = tmp_dbton_hdl->insert_lock_tables_list(tmp_conn, 0)))
|
||||
|
@ -9916,7 +10083,9 @@ int spider_db_bulk_open_handler(
|
|||
int link_idx
|
||||
) {
|
||||
int error_num = 0;
|
||||
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
|
||||
bool opening_index = FALSE;
|
||||
#endif
|
||||
DBUG_ENTER("spider_db_bulk_open_handler");
|
||||
DBUG_PRINT("info",("spider spider=%p", spider));
|
||||
DBUG_PRINT("info",("spider conn=%p", conn));
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2008-2013 Kentoku Shiba
|
||||
/* Copyright (C) 2008-2014 Kentoku Shiba
|
||||
|
||||
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
|
||||
|
@ -639,7 +639,8 @@ int spider_db_show_table_status(
|
|||
|
||||
int spider_db_show_records(
|
||||
ha_spider *spider,
|
||||
int link_idx
|
||||
int link_idx,
|
||||
bool pre_call
|
||||
);
|
||||
|
||||
void spider_db_set_cardinarity(
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2008-2013 Kentoku Shiba
|
||||
/* Copyright (C) 2008-2014 Kentoku Shiba
|
||||
|
||||
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
|
||||
|
@ -26,11 +26,20 @@
|
|||
#define SPIDER_HAS_SHOW_SIMPLE_FUNC
|
||||
#endif
|
||||
|
||||
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100007
|
||||
#define SPIDER_HAS_DISCOVER_TABLE_STRUCTURE_COMMENT
|
||||
#define SPIDER_ITEM_HAS_CMP_TYPE
|
||||
#endif
|
||||
|
||||
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100004
|
||||
#define SPIDER_HAS_TIME_STATUS
|
||||
#define SPIDER_HAS_DECIMAL_OPERATION_RESULTS_VALUE_TYPE
|
||||
#endif
|
||||
|
||||
#if defined(MARIADB_BASE_VERSION)
|
||||
#define SPIDER_ITEM_GEOFUNC_NAME_HAS_MBR
|
||||
#endif
|
||||
|
||||
class spider_db_conn;
|
||||
typedef spider_db_conn SPIDER_DB_CONN;
|
||||
class spider_db_result;
|
||||
|
@ -1120,7 +1129,8 @@ public:
|
|||
KEY_PART_INFO *key_part,
|
||||
const key_range *key,
|
||||
const uchar **ptr,
|
||||
bool key_eq
|
||||
bool key_eq,
|
||||
bool tgt_final
|
||||
) = 0;
|
||||
virtual int append_where_terminator_part(
|
||||
ulong sql_type,
|
||||
|
@ -1154,6 +1164,13 @@ public:
|
|||
virtual void set_order_to_pos(
|
||||
ulong sql_type
|
||||
) = 0;
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
virtual int append_group_by_part(
|
||||
const char *alias,
|
||||
uint alias_length,
|
||||
ulong sql_type
|
||||
) = 0;
|
||||
#endif
|
||||
virtual int append_key_order_for_merge_with_alias_part(
|
||||
const char *alias,
|
||||
uint alias_length,
|
||||
|
@ -1578,6 +1595,8 @@ typedef struct st_spider_result_list
|
|||
uint *sql_kind_backup;
|
||||
uint sql_kinds_backup;
|
||||
bool use_union;
|
||||
bool use_both_key;
|
||||
const key_range *end_key;
|
||||
spider_string *insert_sqls;
|
||||
spider_string *update_sqls;
|
||||
TABLE **upd_tmp_tbls;
|
||||
|
@ -1624,6 +1643,7 @@ typedef struct st_spider_result_list
|
|||
longlong first_read;
|
||||
longlong second_read;
|
||||
int set_split_read_count;
|
||||
int *casual_read;
|
||||
#ifndef WITHOUT_SPIDER_BG_SEARCH
|
||||
/* 0:nomal 1:store 2:store end */
|
||||
volatile
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2009-2013 Kentoku Shiba
|
||||
/* Copyright (C) 2009-2014 Kentoku Shiba
|
||||
|
||||
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
|
||||
|
@ -40,6 +40,10 @@
|
|||
#include "spd_udf.h"
|
||||
#include "spd_malloc.h"
|
||||
|
||||
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100004
|
||||
#define SPIDER_NEED_INIT_ONE_TABLE_FOR_FIND_TEMPORARY_TABLE
|
||||
#endif
|
||||
|
||||
extern const char **spd_defaults_extra_file;
|
||||
extern const char **spd_defaults_file;
|
||||
|
||||
|
@ -1604,8 +1608,16 @@ long long spider_direct_sql_body(
|
|||
#endif
|
||||
for (roop_count = 0; roop_count < direct_sql->table_count; roop_count++)
|
||||
{
|
||||
#ifdef SPIDER_NEED_INIT_ONE_TABLE_FOR_FIND_TEMPORARY_TABLE
|
||||
table_list.init_one_table(direct_sql->db_names[roop_count],
|
||||
strlen(direct_sql->db_names[roop_count]),
|
||||
direct_sql->table_names[roop_count],
|
||||
strlen(direct_sql->table_names[roop_count]),
|
||||
direct_sql->table_names[roop_count], TL_WRITE);
|
||||
#else
|
||||
table_list.db = direct_sql->db_names[roop_count];
|
||||
table_list.table_name = direct_sql->table_names[roop_count];
|
||||
#endif
|
||||
if (!(direct_sql->tables[roop_count] =
|
||||
find_temporary_table(thd, &table_list)))
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2009-2013 Kentoku Shiba
|
||||
/* Copyright (C) 2009-2014 Kentoku Shiba
|
||||
|
||||
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
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2008-2013 Kentoku Shiba
|
||||
/* Copyright (C) 2008-2014 Kentoku Shiba
|
||||
|
||||
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
|
||||
|
@ -61,6 +61,8 @@
|
|||
#define ER_SPIDER_NOSQL_WRAPPER_IS_INVALID_STR "Can't use wrapper '%s' for NOSQL connection"
|
||||
#define ER_SPIDER_REQUEST_KEY_NUM 12523
|
||||
#define ER_SPIDER_REQUEST_KEY_STR "Request key not found"
|
||||
#define ER_SPIDER_CANT_OPEN_SYS_TABLE_NUM 12524
|
||||
#define ER_SPIDER_CANT_OPEN_SYS_TABLE_STR "Can't open system table %s.%s"
|
||||
|
||||
#define ER_SPIDER_CANT_USE_BOTH_INNER_XA_AND_SNAPSHOT_NUM 12601
|
||||
#define ER_SPIDER_CANT_USE_BOTH_INNER_XA_AND_SNAPSHOT_STR "Can't use both spider_use_consistent_snapshot = 1 and spider_internal_xa = 1"
|
||||
|
|
|
@ -1,146 +1,167 @@
|
|||
/* Copyright (C) 2012-2013 Kentoku Shiba
|
||||
|
||||
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
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
#define MYSQL_SERVER 1
|
||||
#include "mysql_version.h"
|
||||
#if MYSQL_VERSION_ID < 50500
|
||||
#include "mysql_priv.h"
|
||||
#include <mysql/plugin.h>
|
||||
#else
|
||||
#include "sql_priv.h"
|
||||
#include "probes_mysql.h"
|
||||
#include "sql_class.h"
|
||||
#include "sql_partition.h"
|
||||
#include "sql_show.h"
|
||||
#endif
|
||||
#include "spd_db_include.h"
|
||||
#include "spd_include.h"
|
||||
#include "spd_table.h"
|
||||
|
||||
extern pthread_mutex_t spider_mem_calc_mutex;
|
||||
|
||||
extern const char *spider_alloc_func_name[SPIDER_MEM_CALC_LIST_NUM];
|
||||
extern const char *spider_alloc_file_name[SPIDER_MEM_CALC_LIST_NUM];
|
||||
extern ulong spider_alloc_line_no[SPIDER_MEM_CALC_LIST_NUM];
|
||||
extern ulonglong spider_total_alloc_mem[SPIDER_MEM_CALC_LIST_NUM];
|
||||
extern longlong spider_current_alloc_mem[SPIDER_MEM_CALC_LIST_NUM];
|
||||
extern ulonglong spider_alloc_mem_count[SPIDER_MEM_CALC_LIST_NUM];
|
||||
extern ulonglong spider_free_mem_count[SPIDER_MEM_CALC_LIST_NUM];
|
||||
|
||||
static struct st_mysql_storage_engine spider_i_s_info =
|
||||
{ MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION };
|
||||
|
||||
static ST_FIELD_INFO spider_i_s_alloc_mem_fields_info[] =
|
||||
{
|
||||
{"ID", 10, MYSQL_TYPE_LONG, 0, MY_I_S_UNSIGNED, "id", SKIP_OPEN_TABLE},
|
||||
{"FUNC_NAME", 64, MYSQL_TYPE_STRING, 0,
|
||||
MY_I_S_MAYBE_NULL, "func_name", SKIP_OPEN_TABLE},
|
||||
{"FILE_NAME", 64, MYSQL_TYPE_STRING, 0,
|
||||
MY_I_S_MAYBE_NULL, "file_name", SKIP_OPEN_TABLE},
|
||||
{"LINE_NO", 10, MYSQL_TYPE_LONG, 0,
|
||||
MY_I_S_UNSIGNED | MY_I_S_MAYBE_NULL, "line_no", SKIP_OPEN_TABLE},
|
||||
{"TOTAL_ALLOC_MEM", 20, MYSQL_TYPE_LONGLONG, 0,
|
||||
MY_I_S_UNSIGNED | MY_I_S_MAYBE_NULL, "total_alloc_mem", SKIP_OPEN_TABLE},
|
||||
{"CURRENT_ALLOC_MEM", 20, MYSQL_TYPE_LONGLONG, 0,
|
||||
MY_I_S_MAYBE_NULL, "current_alloc_mem", SKIP_OPEN_TABLE},
|
||||
{"ALLOC_MEM_COUNT", 20, MYSQL_TYPE_LONGLONG, 0,
|
||||
MY_I_S_UNSIGNED | MY_I_S_MAYBE_NULL, "alloc_mem_count", SKIP_OPEN_TABLE},
|
||||
{"FREE_MEM_COUNT", 20, MYSQL_TYPE_LONGLONG, 0,
|
||||
MY_I_S_UNSIGNED | MY_I_S_MAYBE_NULL, "free_mem_count", SKIP_OPEN_TABLE},
|
||||
{NULL, 0, MYSQL_TYPE_STRING, 0, 0, NULL, 0}
|
||||
};
|
||||
|
||||
static int spider_i_s_alloc_mem_fill_table(
|
||||
THD *thd,
|
||||
TABLE_LIST *tables,
|
||||
COND *cond
|
||||
) {
|
||||
uint roop_count;
|
||||
TABLE *table = tables->table;
|
||||
DBUG_ENTER("spider_i_s_alloc_mem_fill_table");
|
||||
for (roop_count = 0; roop_count < SPIDER_MEM_CALC_LIST_NUM; roop_count++)
|
||||
{
|
||||
table->field[0]->store(roop_count, TRUE);
|
||||
if (spider_alloc_func_name[roop_count])
|
||||
{
|
||||
table->field[1]->set_notnull();
|
||||
table->field[2]->set_notnull();
|
||||
table->field[3]->set_notnull();
|
||||
table->field[4]->set_notnull();
|
||||
table->field[5]->set_notnull();
|
||||
table->field[6]->set_notnull();
|
||||
table->field[7]->set_notnull();
|
||||
table->field[1]->store(spider_alloc_func_name[roop_count],
|
||||
strlen(spider_alloc_func_name[roop_count]), system_charset_info);
|
||||
table->field[2]->store(spider_alloc_file_name[roop_count],
|
||||
strlen(spider_alloc_file_name[roop_count]), system_charset_info);
|
||||
table->field[3]->store(spider_alloc_line_no[roop_count], TRUE);
|
||||
pthread_mutex_lock(&spider_mem_calc_mutex);
|
||||
table->field[4]->store(spider_total_alloc_mem[roop_count], TRUE);
|
||||
table->field[5]->store(spider_current_alloc_mem[roop_count], FALSE);
|
||||
table->field[6]->store(spider_alloc_mem_count[roop_count], TRUE);
|
||||
table->field[7]->store(spider_free_mem_count[roop_count], TRUE);
|
||||
pthread_mutex_unlock(&spider_mem_calc_mutex);
|
||||
} else {
|
||||
table->field[1]->set_null();
|
||||
table->field[2]->set_null();
|
||||
table->field[3]->set_null();
|
||||
table->field[4]->set_null();
|
||||
table->field[5]->set_null();
|
||||
table->field[6]->set_null();
|
||||
table->field[7]->set_null();
|
||||
}
|
||||
if (schema_table_store_record(thd, table))
|
||||
{
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
}
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
static int spider_i_s_alloc_mem_init(
|
||||
void *p
|
||||
) {
|
||||
ST_SCHEMA_TABLE *schema = (ST_SCHEMA_TABLE *) p;
|
||||
DBUG_ENTER("spider_i_s_alloc_mem_init");
|
||||
schema->fields_info = spider_i_s_alloc_mem_fields_info;
|
||||
schema->fill_table = spider_i_s_alloc_mem_fill_table;
|
||||
schema->idx_field1 = 0;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
static int spider_i_s_alloc_mem_deinit(
|
||||
void *p
|
||||
) {
|
||||
DBUG_ENTER("spider_i_s_alloc_mem_deinit");
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
struct st_maria_plugin spider_i_s_alloc_mem =
|
||||
{
|
||||
MYSQL_INFORMATION_SCHEMA_PLUGIN,
|
||||
&spider_i_s_info,
|
||||
"SPIDER_ALLOC_MEM",
|
||||
"Kentoku Shiba",
|
||||
"Spider memory allocating viewer",
|
||||
PLUGIN_LICENSE_GPL,
|
||||
spider_i_s_alloc_mem_init,
|
||||
spider_i_s_alloc_mem_deinit,
|
||||
0x0001,
|
||||
NULL,
|
||||
NULL,
|
||||
"0.1",
|
||||
MariaDB_PLUGIN_MATURITY_BETA
|
||||
};
|
||||
/* Copyright (C) 2012-2014 Kentoku Shiba
|
||||
|
||||
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
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
#define MYSQL_SERVER 1
|
||||
#include "mysql_version.h"
|
||||
#if MYSQL_VERSION_ID < 50500
|
||||
#include "mysql_priv.h"
|
||||
#include <mysql/plugin.h>
|
||||
#else
|
||||
#include "sql_priv.h"
|
||||
#include "probes_mysql.h"
|
||||
#include "sql_class.h"
|
||||
#include "sql_partition.h"
|
||||
#include "sql_show.h"
|
||||
#endif
|
||||
#include "spd_db_include.h"
|
||||
#include "spd_include.h"
|
||||
#include "spd_table.h"
|
||||
|
||||
extern pthread_mutex_t spider_mem_calc_mutex;
|
||||
|
||||
extern const char *spider_alloc_func_name[SPIDER_MEM_CALC_LIST_NUM];
|
||||
extern const char *spider_alloc_file_name[SPIDER_MEM_CALC_LIST_NUM];
|
||||
extern ulong spider_alloc_line_no[SPIDER_MEM_CALC_LIST_NUM];
|
||||
extern ulonglong spider_total_alloc_mem[SPIDER_MEM_CALC_LIST_NUM];
|
||||
extern longlong spider_current_alloc_mem[SPIDER_MEM_CALC_LIST_NUM];
|
||||
extern ulonglong spider_alloc_mem_count[SPIDER_MEM_CALC_LIST_NUM];
|
||||
extern ulonglong spider_free_mem_count[SPIDER_MEM_CALC_LIST_NUM];
|
||||
|
||||
static struct st_mysql_storage_engine spider_i_s_info =
|
||||
{ MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION };
|
||||
|
||||
static ST_FIELD_INFO spider_i_s_alloc_mem_fields_info[] =
|
||||
{
|
||||
{"ID", 10, MYSQL_TYPE_LONG, 0, MY_I_S_UNSIGNED, "id", SKIP_OPEN_TABLE},
|
||||
{"FUNC_NAME", 64, MYSQL_TYPE_STRING, 0,
|
||||
MY_I_S_MAYBE_NULL, "func_name", SKIP_OPEN_TABLE},
|
||||
{"FILE_NAME", 64, MYSQL_TYPE_STRING, 0,
|
||||
MY_I_S_MAYBE_NULL, "file_name", SKIP_OPEN_TABLE},
|
||||
{"LINE_NO", 10, MYSQL_TYPE_LONG, 0,
|
||||
MY_I_S_UNSIGNED | MY_I_S_MAYBE_NULL, "line_no", SKIP_OPEN_TABLE},
|
||||
{"TOTAL_ALLOC_MEM", 20, MYSQL_TYPE_LONGLONG, 0,
|
||||
MY_I_S_UNSIGNED | MY_I_S_MAYBE_NULL, "total_alloc_mem", SKIP_OPEN_TABLE},
|
||||
{"CURRENT_ALLOC_MEM", 20, MYSQL_TYPE_LONGLONG, 0,
|
||||
MY_I_S_MAYBE_NULL, "current_alloc_mem", SKIP_OPEN_TABLE},
|
||||
{"ALLOC_MEM_COUNT", 20, MYSQL_TYPE_LONGLONG, 0,
|
||||
MY_I_S_UNSIGNED | MY_I_S_MAYBE_NULL, "alloc_mem_count", SKIP_OPEN_TABLE},
|
||||
{"FREE_MEM_COUNT", 20, MYSQL_TYPE_LONGLONG, 0,
|
||||
MY_I_S_UNSIGNED | MY_I_S_MAYBE_NULL, "free_mem_count", SKIP_OPEN_TABLE},
|
||||
{NULL, 0, MYSQL_TYPE_STRING, 0, 0, NULL, 0}
|
||||
};
|
||||
|
||||
static int spider_i_s_alloc_mem_fill_table(
|
||||
THD *thd,
|
||||
TABLE_LIST *tables,
|
||||
COND *cond
|
||||
) {
|
||||
uint roop_count;
|
||||
TABLE *table = tables->table;
|
||||
DBUG_ENTER("spider_i_s_alloc_mem_fill_table");
|
||||
for (roop_count = 0; roop_count < SPIDER_MEM_CALC_LIST_NUM; roop_count++)
|
||||
{
|
||||
table->field[0]->store(roop_count, TRUE);
|
||||
if (spider_alloc_func_name[roop_count])
|
||||
{
|
||||
table->field[1]->set_notnull();
|
||||
table->field[2]->set_notnull();
|
||||
table->field[3]->set_notnull();
|
||||
table->field[4]->set_notnull();
|
||||
table->field[5]->set_notnull();
|
||||
table->field[6]->set_notnull();
|
||||
table->field[7]->set_notnull();
|
||||
table->field[1]->store(spider_alloc_func_name[roop_count],
|
||||
strlen(spider_alloc_func_name[roop_count]), system_charset_info);
|
||||
table->field[2]->store(spider_alloc_file_name[roop_count],
|
||||
strlen(spider_alloc_file_name[roop_count]), system_charset_info);
|
||||
table->field[3]->store(spider_alloc_line_no[roop_count], TRUE);
|
||||
pthread_mutex_lock(&spider_mem_calc_mutex);
|
||||
table->field[4]->store(spider_total_alloc_mem[roop_count], TRUE);
|
||||
table->field[5]->store(spider_current_alloc_mem[roop_count], FALSE);
|
||||
table->field[6]->store(spider_alloc_mem_count[roop_count], TRUE);
|
||||
table->field[7]->store(spider_free_mem_count[roop_count], TRUE);
|
||||
pthread_mutex_unlock(&spider_mem_calc_mutex);
|
||||
} else {
|
||||
table->field[1]->set_null();
|
||||
table->field[2]->set_null();
|
||||
table->field[3]->set_null();
|
||||
table->field[4]->set_null();
|
||||
table->field[5]->set_null();
|
||||
table->field[6]->set_null();
|
||||
table->field[7]->set_null();
|
||||
}
|
||||
if (schema_table_store_record(thd, table))
|
||||
{
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
}
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
static int spider_i_s_alloc_mem_init(
|
||||
void *p
|
||||
) {
|
||||
ST_SCHEMA_TABLE *schema = (ST_SCHEMA_TABLE *) p;
|
||||
DBUG_ENTER("spider_i_s_alloc_mem_init");
|
||||
schema->fields_info = spider_i_s_alloc_mem_fields_info;
|
||||
schema->fill_table = spider_i_s_alloc_mem_fill_table;
|
||||
schema->idx_field1 = 0;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
static int spider_i_s_alloc_mem_deinit(
|
||||
void *p
|
||||
) {
|
||||
DBUG_ENTER("spider_i_s_alloc_mem_deinit");
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
struct st_mysql_plugin spider_i_s_alloc_mem =
|
||||
{
|
||||
MYSQL_INFORMATION_SCHEMA_PLUGIN,
|
||||
&spider_i_s_info,
|
||||
"SPIDER_ALLOC_MEM",
|
||||
"Kentoku Shiba",
|
||||
"Spider memory allocating viewer",
|
||||
PLUGIN_LICENSE_GPL,
|
||||
spider_i_s_alloc_mem_init,
|
||||
spider_i_s_alloc_mem_deinit,
|
||||
0x0001,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
#if MYSQL_VERSION_ID >= 50600
|
||||
0,
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef MARIADB_BASE_VERSION
|
||||
struct st_maria_plugin spider_i_s_alloc_mem_maria =
|
||||
{
|
||||
MYSQL_INFORMATION_SCHEMA_PLUGIN,
|
||||
&spider_i_s_info,
|
||||
"SPIDER_ALLOC_MEM",
|
||||
"Kentoku Shiba",
|
||||
"Spider memory allocating viewer",
|
||||
PLUGIN_LICENSE_GPL,
|
||||
spider_i_s_alloc_mem_init,
|
||||
spider_i_s_alloc_mem_deinit,
|
||||
0x0100,
|
||||
NULL,
|
||||
NULL,
|
||||
"1.0",
|
||||
MariaDB_PLUGIN_MATURITY_GAMMA,
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2008-2013 Kentoku Shiba
|
||||
/* Copyright (C) 2008-2014 Kentoku Shiba
|
||||
|
||||
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
|
||||
|
@ -13,6 +13,9 @@
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
#define SPIDER_DETAIL_VERSION "3.2.0"
|
||||
#define SPIDER_HEX_VERSION 0x0302
|
||||
|
||||
#if MYSQL_VERSION_ID < 50500
|
||||
#else
|
||||
#define my_free(A,B) my_free(A)
|
||||
|
@ -77,8 +80,13 @@
|
|||
#define spider_stmt_da_message(A) (A)->main_da.message()
|
||||
#define spider_stmt_da_sql_errno(A) (A)->main_da.sql_errno()
|
||||
#else
|
||||
#if MYSQL_VERSION_ID < 50600
|
||||
#define spider_stmt_da_message(A) (A)->stmt_da->message()
|
||||
#define spider_stmt_da_sql_errno(A) (A)->stmt_da->sql_errno()
|
||||
#else
|
||||
#define spider_stmt_da_message(A) (A)->get_stmt_da()->message()
|
||||
#define spider_stmt_da_sql_errno(A) (A)->get_stmt_da()->sql_errno()
|
||||
#endif
|
||||
#endif
|
||||
#define spider_user_defined_key_parts(A) (A)->key_parts
|
||||
#define SPIDER_ALTER_ADD_PARTITION ALTER_ADD_PARTITION
|
||||
|
@ -91,6 +99,12 @@
|
|||
#define SPIDER_WARN_LEVEL_NOTE MYSQL_ERROR::WARN_LEVEL_NOTE
|
||||
#endif
|
||||
|
||||
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100009
|
||||
#define SPIDER_TEST(A) MY_TEST(A)
|
||||
#else
|
||||
#define SPIDER_TEST(A) test(A)
|
||||
#endif
|
||||
|
||||
#if MYSQL_VERSION_ID >= 50500
|
||||
#define SPIDER_HAS_HASH_VALUE_TYPE
|
||||
#endif
|
||||
|
@ -118,7 +132,7 @@
|
|||
#define SPIDER_TMP_SHARE_LONG_COUNT 15
|
||||
#define SPIDER_TMP_SHARE_LONGLONG_COUNT 3
|
||||
|
||||
#define SPIDER_MEM_CALC_LIST_NUM 243
|
||||
#define SPIDER_MEM_CALC_LIST_NUM 244
|
||||
|
||||
#define SPIDER_BACKUP_DASTATUS \
|
||||
bool da_status; if (thd) da_status = thd->is_error(); else da_status = FALSE;
|
||||
|
@ -134,7 +148,7 @@
|
|||
#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) \
|
||||
{(A)->thd = NULL; (A)->func_name = NULL; (A)->file_name = NULL; (A)->line_no = 0;}
|
||||
{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;
|
||||
|
@ -261,6 +275,9 @@ typedef struct st_spider_conn
|
|||
uint opened_handlers;
|
||||
ulonglong conn_id;
|
||||
ulonglong connection_id;
|
||||
query_id_t casual_read_query_id;
|
||||
uint casual_read_current_id;
|
||||
st_spider_conn *casual_read_base_conn;
|
||||
pthread_mutex_t mta_conn_mutex;
|
||||
volatile bool mta_conn_mutex_lock_already;
|
||||
volatile bool mta_conn_mutex_unlock_later;
|
||||
|
@ -473,6 +490,7 @@ typedef struct st_spider_transaction
|
|||
bool trx_start;
|
||||
bool trx_xa;
|
||||
bool trx_consistent_snapshot;
|
||||
bool trx_xa_prepared;
|
||||
|
||||
bool use_consistent_snapshot;
|
||||
bool internal_xa;
|
||||
|
@ -571,6 +589,18 @@ typedef struct st_spider_transaction
|
|||
longlong current_alloc_mem_buffer[SPIDER_MEM_CALC_LIST_NUM];
|
||||
ulonglong alloc_mem_count_buffer[SPIDER_MEM_CALC_LIST_NUM];
|
||||
ulonglong free_mem_count_buffer[SPIDER_MEM_CALC_LIST_NUM];
|
||||
|
||||
MEM_ROOT mem_root;
|
||||
|
||||
/* for transaction level query */
|
||||
SPIDER_SHARE *tmp_share;
|
||||
char *tmp_connect_info[SPIDER_TMP_SHARE_CHAR_PTR_COUNT];
|
||||
uint tmp_connect_info_length[SPIDER_TMP_SHARE_UINT_COUNT];
|
||||
long tmp_long[SPIDER_TMP_SHARE_LONG_COUNT];
|
||||
longlong tmp_longlong[SPIDER_TMP_SHARE_LONGLONG_COUNT];
|
||||
ha_spider *tmp_spider;
|
||||
int tmp_need_mon;
|
||||
spider_db_handler *tmp_dbton_handler[SPIDER_DBTON_SIZE];
|
||||
} SPIDER_TRX;
|
||||
|
||||
typedef struct st_spider_share
|
||||
|
@ -734,6 +764,8 @@ typedef struct st_spider_share
|
|||
#ifdef HA_CAN_FORCE_BULK_DELETE
|
||||
int force_bulk_delete;
|
||||
#endif
|
||||
int casual_read;
|
||||
int delete_all_rows_type;
|
||||
|
||||
int bka_mode;
|
||||
char *bka_engine;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2012-2013 Kentoku Shiba
|
||||
/* Copyright (C) 2012-2014 Kentoku Shiba
|
||||
|
||||
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
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2012-2013 Kentoku Shiba
|
||||
/* Copyright (C) 2012-2014 Kentoku Shiba
|
||||
|
||||
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
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2008-2013 Kentoku Shiba
|
||||
/* Copyright (C) 2008-2014 Kentoku Shiba
|
||||
|
||||
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
|
||||
|
@ -32,7 +32,10 @@
|
|||
#include "spd_table.h"
|
||||
#include "spd_trx.h"
|
||||
|
||||
extern struct st_maria_plugin spider_i_s_alloc_mem;
|
||||
extern struct st_mysql_plugin spider_i_s_alloc_mem;
|
||||
#ifdef MARIADB_BASE_VERSION
|
||||
extern struct st_maria_plugin spider_i_s_alloc_mem_maria;
|
||||
#endif
|
||||
|
||||
extern volatile ulonglong spider_mon_table_cache_version;
|
||||
extern volatile ulonglong spider_mon_table_cache_version_req;
|
||||
|
@ -2827,6 +2830,136 @@ uint spider_param_log_result_errors()
|
|||
DBUG_RETURN(spider_log_result_errors);
|
||||
}
|
||||
|
||||
static uint spider_log_result_error_with_sql;
|
||||
/*
|
||||
0: no log
|
||||
1: log spider sql at logging result errors
|
||||
2: log user sql at logging result errors
|
||||
3: log both sql at logging result errors
|
||||
*/
|
||||
static MYSQL_SYSVAR_UINT(
|
||||
log_result_error_with_sql,
|
||||
spider_log_result_error_with_sql,
|
||||
PLUGIN_VAR_RQCMDARG,
|
||||
"Log sql at logging result errors",
|
||||
NULL,
|
||||
NULL,
|
||||
0,
|
||||
0,
|
||||
3,
|
||||
0
|
||||
);
|
||||
|
||||
uint spider_param_log_result_error_with_sql()
|
||||
{
|
||||
DBUG_ENTER("spider_param_log_result_error_with_sql");
|
||||
DBUG_RETURN(spider_log_result_error_with_sql);
|
||||
}
|
||||
|
||||
static char *spider_version = (char *) SPIDER_DETAIL_VERSION;
|
||||
static MYSQL_SYSVAR_STR(
|
||||
version,
|
||||
spider_version,
|
||||
PLUGIN_VAR_NOCMDOPT | PLUGIN_VAR_READONLY,
|
||||
"The version of Spider",
|
||||
NULL,
|
||||
NULL,
|
||||
SPIDER_DETAIL_VERSION
|
||||
);
|
||||
|
||||
/*
|
||||
0: server_id + thread_id
|
||||
1: server_id + thread_id + query_id
|
||||
*/
|
||||
static MYSQL_THDVAR_UINT(
|
||||
internal_xa_id_type, /* name */
|
||||
PLUGIN_VAR_RQCMDARG, /* opt */
|
||||
"The type of internal_xa id", /* comment */
|
||||
NULL, /* check */
|
||||
NULL, /* update */
|
||||
0, /* def */
|
||||
0, /* min */
|
||||
1, /* max */
|
||||
0 /* blk */
|
||||
);
|
||||
|
||||
uint spider_param_internal_xa_id_type(
|
||||
THD *thd
|
||||
) {
|
||||
DBUG_ENTER("spider_param_internal_xa_id_type");
|
||||
DBUG_RETURN(THDVAR(thd, internal_xa_id_type));
|
||||
}
|
||||
|
||||
/*
|
||||
-1 :use table parameter
|
||||
0 :OFF
|
||||
1 :automatic channel
|
||||
2-63 :use custom channel
|
||||
*/
|
||||
static MYSQL_THDVAR_INT(
|
||||
casual_read, /* name */
|
||||
PLUGIN_VAR_RQCMDARG, /* opt */
|
||||
"Read casually if it is possible", /* comment */
|
||||
NULL, /* check */
|
||||
NULL, /* update */
|
||||
-1, /* def */
|
||||
-1, /* min */
|
||||
63, /* max */
|
||||
0 /* blk */
|
||||
);
|
||||
|
||||
int spider_param_casual_read(
|
||||
THD *thd,
|
||||
int casual_read
|
||||
) {
|
||||
DBUG_ENTER("spider_param_casual_read");
|
||||
DBUG_RETURN(THDVAR(thd, casual_read) == -1 ?
|
||||
casual_read : THDVAR(thd, casual_read));
|
||||
}
|
||||
|
||||
static my_bool spider_dry_access;
|
||||
static MYSQL_SYSVAR_BOOL(
|
||||
dry_access,
|
||||
spider_dry_access,
|
||||
PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,
|
||||
"dry access",
|
||||
NULL,
|
||||
NULL,
|
||||
FALSE
|
||||
);
|
||||
|
||||
my_bool spider_param_dry_access()
|
||||
{
|
||||
DBUG_ENTER("spider_param_dry_access");
|
||||
DBUG_RETURN(spider_dry_access);
|
||||
}
|
||||
|
||||
/*
|
||||
-1 :use table parameter
|
||||
0 :fast
|
||||
1 :correct delete row number
|
||||
*/
|
||||
static MYSQL_THDVAR_INT(
|
||||
delete_all_rows_type, /* name */
|
||||
PLUGIN_VAR_RQCMDARG, /* opt */
|
||||
"The type of delete_all_rows", /* comment */
|
||||
NULL, /* check */
|
||||
NULL, /* update */
|
||||
-1, /* def */
|
||||
-1, /* min */
|
||||
1, /* max */
|
||||
0 /* blk */
|
||||
);
|
||||
|
||||
int spider_param_delete_all_rows_type(
|
||||
THD *thd,
|
||||
int delete_all_rows_type
|
||||
) {
|
||||
DBUG_ENTER("spider_param_delete_all_rows_type");
|
||||
DBUG_RETURN(THDVAR(thd, delete_all_rows_type) == -1 ?
|
||||
delete_all_rows_type : THDVAR(thd, delete_all_rows_type));
|
||||
}
|
||||
|
||||
static struct st_mysql_storage_engine spider_storage_engine =
|
||||
{ MYSQL_HANDLERTON_INTERFACE_VERSION };
|
||||
|
||||
|
@ -2954,9 +3087,37 @@ static struct st_mysql_sys_var* spider_system_variables[] = {
|
|||
#endif
|
||||
MYSQL_SYSVAR(general_log),
|
||||
MYSQL_SYSVAR(log_result_errors),
|
||||
MYSQL_SYSVAR(log_result_error_with_sql),
|
||||
MYSQL_SYSVAR(version),
|
||||
MYSQL_SYSVAR(internal_xa_id_type),
|
||||
MYSQL_SYSVAR(casual_read),
|
||||
MYSQL_SYSVAR(dry_access),
|
||||
MYSQL_SYSVAR(delete_all_rows_type),
|
||||
NULL
|
||||
};
|
||||
|
||||
mysql_declare_plugin(spider)
|
||||
{
|
||||
MYSQL_STORAGE_ENGINE_PLUGIN,
|
||||
&spider_storage_engine,
|
||||
"SPIDER",
|
||||
"Kentoku Shiba",
|
||||
"Spider storage engine",
|
||||
PLUGIN_LICENSE_GPL,
|
||||
spider_db_init,
|
||||
spider_db_done,
|
||||
SPIDER_HEX_VERSION,
|
||||
spider_status_variables,
|
||||
spider_system_variables,
|
||||
NULL,
|
||||
#if MYSQL_VERSION_ID >= 50600
|
||||
0,
|
||||
#endif
|
||||
},
|
||||
spider_i_s_alloc_mem
|
||||
mysql_declare_plugin_end;
|
||||
|
||||
#ifdef MARIADB_BASE_VERSION
|
||||
maria_declare_plugin(spider)
|
||||
{
|
||||
MYSQL_STORAGE_ENGINE_PLUGIN,
|
||||
|
@ -2967,11 +3128,12 @@ maria_declare_plugin(spider)
|
|||
PLUGIN_LICENSE_GPL,
|
||||
spider_db_init,
|
||||
spider_db_done,
|
||||
0x0300,
|
||||
SPIDER_HEX_VERSION,
|
||||
spider_status_variables,
|
||||
spider_system_variables,
|
||||
"3.0",
|
||||
MariaDB_PLUGIN_MATURITY_BETA
|
||||
SPIDER_DETAIL_VERSION,
|
||||
MariaDB_PLUGIN_MATURITY_GAMMA
|
||||
},
|
||||
spider_i_s_alloc_mem
|
||||
spider_i_s_alloc_mem_maria
|
||||
maria_declare_plugin_end;
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2008-2013 Kentoku Shiba
|
||||
/* Copyright (C) 2008-2014 Kentoku Shiba
|
||||
|
||||
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
|
||||
|
@ -370,3 +370,16 @@ int spider_param_udf_ds_use_real_table(
|
|||
#endif
|
||||
my_bool spider_param_general_log();
|
||||
uint spider_param_log_result_errors();
|
||||
uint spider_param_log_result_error_with_sql();
|
||||
uint spider_param_internal_xa_id_type(
|
||||
THD *thd
|
||||
);
|
||||
int spider_param_casual_read(
|
||||
THD *thd,
|
||||
int casual_read
|
||||
);
|
||||
my_bool spider_param_dry_access();
|
||||
int spider_param_delete_all_rows_type(
|
||||
THD *thd,
|
||||
int delete_all_rows_type
|
||||
);
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,102 +1,102 @@
|
|||
/* Copyright (C) 2009-2013 Kentoku Shiba
|
||||
|
||||
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
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
SPIDER_TABLE_MON_LIST *spider_get_ping_table_mon_list(
|
||||
SPIDER_TRX *trx,
|
||||
THD *thd,
|
||||
spider_string *str,
|
||||
uint conv_name_length,
|
||||
int link_idx,
|
||||
uint32 server_id,
|
||||
bool need_lock,
|
||||
int *error_num
|
||||
);
|
||||
|
||||
void spider_free_ping_table_mon_list(
|
||||
SPIDER_TABLE_MON_LIST *table_mon_list
|
||||
);
|
||||
|
||||
void spider_release_ping_table_mon_list_loop(
|
||||
uint mutex_hash,
|
||||
SPIDER_TABLE_MON_LIST *table_mon_list
|
||||
);
|
||||
|
||||
void spider_release_ping_table_mon_list(
|
||||
const char *conv_name,
|
||||
uint conv_name_length,
|
||||
int link_idx
|
||||
);
|
||||
|
||||
int spider_get_ping_table_mon(
|
||||
THD *thd,
|
||||
SPIDER_TABLE_MON_LIST *table_mon_list,
|
||||
char *name,
|
||||
uint name_length,
|
||||
int link_idx,
|
||||
uint32 server_id,
|
||||
MEM_ROOT *mem_root,
|
||||
bool need_lock
|
||||
);
|
||||
|
||||
SPIDER_TABLE_MON_LIST *spider_get_ping_table_tgt(
|
||||
THD *thd,
|
||||
char *name,
|
||||
uint name_length,
|
||||
int link_idx,
|
||||
uint32 server_id,
|
||||
spider_string *str,
|
||||
bool need_lock,
|
||||
int *error_num
|
||||
);
|
||||
|
||||
SPIDER_CONN *spider_get_ping_table_tgt_conn(
|
||||
SPIDER_TRX *trx,
|
||||
SPIDER_SHARE *share,
|
||||
int *error_num
|
||||
);
|
||||
|
||||
int spider_init_ping_table_mon_cache(
|
||||
THD *thd,
|
||||
MEM_ROOT *mem_root,
|
||||
bool need_lock
|
||||
);
|
||||
|
||||
int spider_ping_table_cache_compare(
|
||||
TABLE *table,
|
||||
MEM_ROOT *mem_root
|
||||
);
|
||||
|
||||
void spider_ping_table_free_mon_list(
|
||||
SPIDER_TABLE_MON_LIST *table_mon_list
|
||||
);
|
||||
|
||||
void spider_ping_table_free_mon(
|
||||
SPIDER_TABLE_MON *table_mon
|
||||
);
|
||||
|
||||
int spider_ping_table_mon_from_table(
|
||||
SPIDER_TRX *trx,
|
||||
THD *thd,
|
||||
SPIDER_SHARE *share,
|
||||
uint32 server_id,
|
||||
char *conv_name,
|
||||
uint conv_name_length,
|
||||
int link_idx,
|
||||
char *where_clause,
|
||||
uint where_clause_length,
|
||||
long monitoring_kind,
|
||||
longlong monitoring_limit,
|
||||
bool need_lock
|
||||
);
|
||||
/* Copyright (C) 2009-2014 Kentoku Shiba
|
||||
|
||||
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
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
SPIDER_TABLE_MON_LIST *spider_get_ping_table_mon_list(
|
||||
SPIDER_TRX *trx,
|
||||
THD *thd,
|
||||
spider_string *str,
|
||||
uint conv_name_length,
|
||||
int link_idx,
|
||||
uint32 server_id,
|
||||
bool need_lock,
|
||||
int *error_num
|
||||
);
|
||||
|
||||
void spider_free_ping_table_mon_list(
|
||||
SPIDER_TABLE_MON_LIST *table_mon_list
|
||||
);
|
||||
|
||||
void spider_release_ping_table_mon_list_loop(
|
||||
uint mutex_hash,
|
||||
SPIDER_TABLE_MON_LIST *table_mon_list
|
||||
);
|
||||
|
||||
void spider_release_ping_table_mon_list(
|
||||
const char *conv_name,
|
||||
uint conv_name_length,
|
||||
int link_idx
|
||||
);
|
||||
|
||||
int spider_get_ping_table_mon(
|
||||
THD *thd,
|
||||
SPIDER_TABLE_MON_LIST *table_mon_list,
|
||||
char *name,
|
||||
uint name_length,
|
||||
int link_idx,
|
||||
uint32 server_id,
|
||||
MEM_ROOT *mem_root,
|
||||
bool need_lock
|
||||
);
|
||||
|
||||
SPIDER_TABLE_MON_LIST *spider_get_ping_table_tgt(
|
||||
THD *thd,
|
||||
char *name,
|
||||
uint name_length,
|
||||
int link_idx,
|
||||
uint32 server_id,
|
||||
spider_string *str,
|
||||
bool need_lock,
|
||||
int *error_num
|
||||
);
|
||||
|
||||
SPIDER_CONN *spider_get_ping_table_tgt_conn(
|
||||
SPIDER_TRX *trx,
|
||||
SPIDER_SHARE *share,
|
||||
int *error_num
|
||||
);
|
||||
|
||||
int spider_init_ping_table_mon_cache(
|
||||
THD *thd,
|
||||
MEM_ROOT *mem_root,
|
||||
bool need_lock
|
||||
);
|
||||
|
||||
int spider_ping_table_cache_compare(
|
||||
TABLE *table,
|
||||
MEM_ROOT *mem_root
|
||||
);
|
||||
|
||||
void spider_ping_table_free_mon_list(
|
||||
SPIDER_TABLE_MON_LIST *table_mon_list
|
||||
);
|
||||
|
||||
void spider_ping_table_free_mon(
|
||||
SPIDER_TABLE_MON *table_mon
|
||||
);
|
||||
|
||||
int spider_ping_table_mon_from_table(
|
||||
SPIDER_TRX *trx,
|
||||
THD *thd,
|
||||
SPIDER_SHARE *share,
|
||||
uint32 server_id,
|
||||
char *conv_name,
|
||||
uint conv_name_length,
|
||||
int link_idx,
|
||||
char *where_clause,
|
||||
uint where_clause_length,
|
||||
long monitoring_kind,
|
||||
longlong monitoring_limit,
|
||||
bool need_lock
|
||||
);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2008-2013 Kentoku Shiba
|
||||
/* Copyright (C) 2008-2014 Kentoku Shiba
|
||||
|
||||
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
|
||||
|
@ -90,7 +90,10 @@ TABLE *spider_open_sys_table(
|
|||
if (!(table = spider_sys_open_table(thd, &tables, open_tables_backup)))
|
||||
#endif
|
||||
{
|
||||
*error_num = my_errno;
|
||||
my_printf_error(ER_SPIDER_CANT_OPEN_SYS_TABLE_NUM,
|
||||
ER_SPIDER_CANT_OPEN_SYS_TABLE_STR, MYF(0),
|
||||
"mysql", table_name);
|
||||
*error_num = ER_SPIDER_CANT_OPEN_SYS_TABLE_NUM;
|
||||
DBUG_RETURN(NULL);
|
||||
}
|
||||
#if MYSQL_VERSION_ID < 50500
|
||||
|
@ -117,7 +120,10 @@ TABLE *spider_open_sys_table(
|
|||
table, FALSE)
|
||||
) {
|
||||
release_table_share(table_share, RELEASE_NORMAL);
|
||||
*error_num = my_errno;
|
||||
my_printf_error(ER_SPIDER_CANT_OPEN_SYS_TABLE_NUM,
|
||||
ER_SPIDER_CANT_OPEN_SYS_TABLE_STR, MYF(0),
|
||||
"mysql", table_name);
|
||||
*error_num = ER_SPIDER_CANT_OPEN_SYS_TABLE_NUM;
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
@ -1913,7 +1919,6 @@ int spider_sys_update_tables_link_status(
|
|||
SPIDER_SYS_TABLES_TABLE_NAME_LEN, TRUE, &open_tables_backup, need_lock,
|
||||
&error_num))
|
||||
) {
|
||||
my_error(error_num, MYF(0));
|
||||
goto error;
|
||||
}
|
||||
if ((error_num = spider_update_tables_link_status(table_tables,
|
||||
|
@ -1952,7 +1957,6 @@ int spider_sys_log_tables_link_failed(
|
|||
SPIDER_SYS_LINK_FAILED_TABLE_NAME_LEN, TRUE, &open_tables_backup,
|
||||
need_lock, &error_num))
|
||||
) {
|
||||
my_error(error_num, MYF(0));
|
||||
goto error;
|
||||
}
|
||||
empty_record(table_tables);
|
||||
|
@ -1992,7 +1996,6 @@ int spider_sys_log_xa_failed(
|
|||
SPIDER_SYS_XA_FAILED_TABLE_NAME_LEN, TRUE, &open_tables_backup,
|
||||
need_lock, &error_num))
|
||||
) {
|
||||
my_error(error_num, MYF(0));
|
||||
goto error;
|
||||
}
|
||||
empty_record(table_tables);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2008-2013 Kentoku Shiba
|
||||
/* Copyright (C) 2008-2014 Kentoku Shiba
|
||||
|
||||
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
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2008-2013 Kentoku Shiba
|
||||
/* Copyright (C) 2008-2014 Kentoku Shiba
|
||||
|
||||
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
|
||||
|
@ -43,6 +43,9 @@
|
|||
#include "spd_malloc.h"
|
||||
|
||||
ulong *spd_db_att_thread_id;
|
||||
#ifdef XID_CACHE_IS_SPLITTED
|
||||
uint *spd_db_att_xid_cache_split_num;
|
||||
#endif
|
||||
pthread_mutex_t *spd_db_att_LOCK_xid_cache;
|
||||
HASH *spd_db_att_xid_cache;
|
||||
struct charset_info_st *spd_charset_utf8_bin;
|
||||
|
@ -1789,6 +1792,8 @@ int spider_parse_connect_info(
|
|||
#ifdef HA_CAN_FORCE_BULK_DELETE
|
||||
share->force_bulk_delete = -1;
|
||||
#endif
|
||||
share->casual_read = -1;
|
||||
share->delete_all_rows_type = -1;
|
||||
|
||||
#ifdef WITH_PARTITION_STORAGE_ENGINE
|
||||
for (roop_count = 4; roop_count > 0; roop_count--)
|
||||
|
@ -1918,6 +1923,7 @@ int spider_parse_connect_info(
|
|||
#endif
|
||||
SPIDER_PARAM_DOUBLE("civ", crd_interval, 0);
|
||||
SPIDER_PARAM_INT_WITH_MAX("cmd", crd_mode, 0, 3);
|
||||
SPIDER_PARAM_INT_WITH_MAX("csr", casual_read, 0, 63);
|
||||
#ifdef WITH_PARTITION_STORAGE_ENGINE
|
||||
SPIDER_PARAM_INT_WITH_MAX("csy", crd_sync, 0, 2);
|
||||
#endif
|
||||
|
@ -1925,6 +1931,7 @@ int spider_parse_connect_info(
|
|||
2147483647);
|
||||
SPIDER_PARAM_INT_WITH_MAX("ctp", crd_type, 0, 2);
|
||||
SPIDER_PARAM_DOUBLE("cwg", crd_weight, 1);
|
||||
SPIDER_PARAM_INT_WITH_MAX("dat", delete_all_rows_type, 0, 1);
|
||||
SPIDER_PARAM_INT_WITH_MAX("ddi", direct_dup_insert, 0, 1);
|
||||
SPIDER_PARAM_STR_LIST("dff", tgt_default_files);
|
||||
SPIDER_PARAM_STR_LIST("dfg", tgt_default_groups);
|
||||
|
@ -2108,6 +2115,7 @@ int spider_parse_connect_info(
|
|||
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
|
||||
SPIDER_PARAM_LONG_LIST_WITH_MAX("use_hs_read", use_hs_reads, 0, 1);
|
||||
#endif
|
||||
SPIDER_PARAM_INT_WITH_MAX("casual_read", casual_read, 0, 63);
|
||||
error_num = ER_SPIDER_INVALID_CONNECT_INFO_NUM;
|
||||
my_printf_error(error_num, ER_SPIDER_INVALID_CONNECT_INFO_STR,
|
||||
MYF(0), tmp_ptr);
|
||||
|
@ -2256,6 +2264,8 @@ int spider_parse_connect_info(
|
|||
case 20:
|
||||
SPIDER_PARAM_LONGLONG_LIST_WITH_MAX(
|
||||
"monitoring_server_id", monitoring_sid, 0, 4294967295LL);
|
||||
SPIDER_PARAM_INT_WITH_MAX(
|
||||
"delete_all_rows_type", delete_all_rows_type, 0, 1);
|
||||
error_num = ER_SPIDER_INVALID_CONNECT_INFO_NUM;
|
||||
my_printf_error(error_num, ER_SPIDER_INVALID_CONNECT_INFO_STR,
|
||||
MYF(0), tmp_ptr);
|
||||
|
@ -3433,6 +3443,16 @@ int spider_set_connect_info_default(
|
|||
if (share->force_bulk_delete == -1)
|
||||
share->force_bulk_delete = 0;
|
||||
#endif
|
||||
if (share->casual_read == -1)
|
||||
share->casual_read = 0;
|
||||
if (share->delete_all_rows_type == -1)
|
||||
{
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
share->delete_all_rows_type = 1;
|
||||
#else
|
||||
share->delete_all_rows_type = 0;
|
||||
#endif
|
||||
}
|
||||
if (share->bka_mode == -1)
|
||||
share->bka_mode = 1;
|
||||
if (!share->bka_engine)
|
||||
|
@ -4320,12 +4340,15 @@ SPIDER_SHARE *spider_get_share(
|
|||
&result_list->tmp_table_created,
|
||||
sizeof(uchar) * share->link_bitmap_size,
|
||||
#ifdef HA_CAN_BULK_ACCESS
|
||||
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
|
||||
&result_list->hs_r_bulk_open_index,
|
||||
sizeof(uchar) * share->link_bitmap_size,
|
||||
&result_list->hs_w_bulk_open_index,
|
||||
sizeof(uchar) * share->link_bitmap_size,
|
||||
#endif
|
||||
#endif
|
||||
&result_list->sql_kind_backup, sizeof(uint) * share->link_count,
|
||||
&result_list->casual_read, sizeof(int) * share->link_count,
|
||||
&spider->dbton_handler,
|
||||
sizeof(spider_db_handler *) * SPIDER_DBTON_SIZE,
|
||||
NullS))
|
||||
|
@ -4759,12 +4782,15 @@ SPIDER_SHARE *spider_get_share(
|
|||
&result_list->tmp_table_created,
|
||||
sizeof(uchar) * share->link_bitmap_size,
|
||||
#ifdef HA_CAN_BULK_ACCESS
|
||||
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
|
||||
&result_list->hs_r_bulk_open_index,
|
||||
sizeof(uchar) * share->link_bitmap_size,
|
||||
&result_list->hs_w_bulk_open_index,
|
||||
sizeof(uchar) * share->link_bitmap_size,
|
||||
#endif
|
||||
#endif
|
||||
&result_list->sql_kind_backup, sizeof(uint) * share->link_count,
|
||||
&result_list->casual_read, sizeof(int) * share->link_count,
|
||||
&spider->dbton_handler,
|
||||
sizeof(spider_db_handler *) * SPIDER_DBTON_SIZE,
|
||||
NullS))
|
||||
|
@ -5669,21 +5695,14 @@ int spider_close_connection(
|
|||
handlerton* hton,
|
||||
THD* thd
|
||||
) {
|
||||
int roop_count = 0, need_mon = 0;
|
||||
int roop_count = 0;
|
||||
SPIDER_CONN *conn;
|
||||
SPIDER_TRX *trx;
|
||||
ha_spider tmp_spider;
|
||||
char buf[MAX_FIELD_WIDTH];
|
||||
spider_string tmp_str(buf, MAX_FIELD_WIDTH, &my_charset_bin);
|
||||
DBUG_ENTER("spider_close_connection");
|
||||
tmp_str.init_calc_mem(121);
|
||||
if (!(trx = (SPIDER_TRX*) *thd_ha_data(thd, spider_hton_ptr)))
|
||||
DBUG_RETURN(0); /* transaction is not started */
|
||||
|
||||
tmp_spider.conns = &conn;
|
||||
tmp_spider.need_mons = &need_mon;
|
||||
tmp_spider.trx = trx;
|
||||
tmp_spider.result_list.sqls = &tmp_str;
|
||||
trx->tmp_spider->conns = &conn;
|
||||
while ((conn = (SPIDER_CONN*) my_hash_element(&trx->trx_conn_hash,
|
||||
roop_count)))
|
||||
{
|
||||
|
@ -5695,7 +5714,7 @@ int spider_close_connection(
|
|||
conn->disable_reconnect = FALSE;
|
||||
if (conn->table_lock != 2)
|
||||
{
|
||||
spider_db_unlock_tables(&tmp_spider, 0);
|
||||
spider_db_unlock_tables(trx->tmp_spider, 0);
|
||||
}
|
||||
conn->table_lock = 0;
|
||||
}
|
||||
|
@ -6000,6 +6019,16 @@ int spider_db_init(
|
|||
HMODULE current_module = GetModuleHandle(NULL);
|
||||
spd_db_att_thread_id = (ulong *)
|
||||
GetProcAddress(current_module, "?thread_id@@3KA");
|
||||
#ifdef XID_CACHE_IS_SPLITTED
|
||||
spd_db_att_xid_cache_split_num = (uint *)
|
||||
GetProcAddress(current_module,
|
||||
"?opt_xid_cache_split_num@@3IA");
|
||||
spd_db_att_LOCK_xid_cache = *((pthread_mutex_t **)
|
||||
GetProcAddress(current_module,
|
||||
"?LOCK_xid_cache@@3PAUst_mysql_mutex@@A"));
|
||||
spd_db_att_xid_cache = *((HASH **)
|
||||
GetProcAddress(current_module, "?xid_cache@@3PAUst_hash@@A"));
|
||||
#else
|
||||
spd_db_att_LOCK_xid_cache = (pthread_mutex_t *)
|
||||
#if MYSQL_VERSION_ID < 50500
|
||||
GetProcAddress(current_module,
|
||||
|
@ -6010,6 +6039,7 @@ int spider_db_init(
|
|||
#endif
|
||||
spd_db_att_xid_cache = (HASH *)
|
||||
GetProcAddress(current_module, "?xid_cache@@3Ust_hash@@A");
|
||||
#endif
|
||||
spd_charset_utf8_bin = (struct charset_info_st *)
|
||||
GetProcAddress(current_module, "my_charset_utf8_bin");
|
||||
spd_defaults_extra_file = (const char **)
|
||||
|
@ -6018,8 +6048,14 @@ int spider_db_init(
|
|||
GetProcAddress(current_module, "my_defaults_file");
|
||||
#else
|
||||
spd_db_att_thread_id = &thread_id;
|
||||
#ifdef XID_CACHE_IS_SPLITTED
|
||||
spd_db_att_xid_cache_split_num = &opt_xid_cache_split_num;
|
||||
spd_db_att_LOCK_xid_cache = LOCK_xid_cache;
|
||||
spd_db_att_xid_cache = xid_cache;
|
||||
#else
|
||||
spd_db_att_LOCK_xid_cache = &LOCK_xid_cache;
|
||||
spd_db_att_xid_cache = &xid_cache;
|
||||
#endif
|
||||
spd_charset_utf8_bin = &my_charset_utf8_bin;
|
||||
spd_defaults_extra_file = &my_defaults_extra_file;
|
||||
spd_defaults_file = &my_defaults_file;
|
||||
|
@ -7489,7 +7525,7 @@ longlong spider_split_read_param(
|
|||
/* This case must select by one shot */
|
||||
DBUG_PRINT("info",("spider cancel split read"));
|
||||
result_list->split_read_base = 9223372036854775807LL;
|
||||
result_list->semi_split_read = 9223372036854775807LL;
|
||||
result_list->semi_split_read = 0;
|
||||
result_list->semi_split_read_limit = 9223372036854775807LL;
|
||||
result_list->first_read = 9223372036854775807LL;
|
||||
result_list->second_read = 9223372036854775807LL;
|
||||
|
@ -7596,8 +7632,25 @@ bool spider_check_direct_order_limit(
|
|||
longlong select_limit;
|
||||
longlong offset_limit;
|
||||
DBUG_ENTER("spider_check_direct_order_limit");
|
||||
if (spider->sql_command != SQLCOM_HA_READ)
|
||||
{
|
||||
DBUG_PRINT("info",("spider SQLCOM_HA_READ=%s",
|
||||
(spider->sql_command == SQLCOM_HA_READ) ? "TRUE" : "FALSE"));
|
||||
DBUG_PRINT("info",("spider has_clone_for_merge=%s",
|
||||
spider->has_clone_for_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->sql_command != SQLCOM_HA_READ &&
|
||||
!spider->has_clone_for_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;
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
|
@ -7660,8 +7713,25 @@ bool spider_check_direct_order_limit(
|
|||
|
||||
longlong direct_order_limit = spider_param_direct_order_limit(thd,
|
||||
share->direct_order_limit);
|
||||
DBUG_PRINT("info",("spider direct_order_limit=%lld", direct_order_limit));
|
||||
if (direct_order_limit)
|
||||
{
|
||||
DBUG_PRINT("info",("spider first_check=%s",
|
||||
first_check ? "TRUE" : "FALSE"));
|
||||
DBUG_PRINT("info",("spider (select_lex->options & OPTION_FOUND_ROWS)=%s",
|
||||
(select_lex->options & OPTION_FOUND_ROWS) ? "TRUE" : "FALSE"));
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
DBUG_PRINT("info",("spider direct_aggregate=%s",
|
||||
spider->result_list.direct_aggregate ? "TRUE" : "FALSE"));
|
||||
#endif
|
||||
DBUG_PRINT("info",("spider select_lex->group_list.elements=%u",
|
||||
select_lex->group_list.elements));
|
||||
DBUG_PRINT("info",("spider select_lex->with_sum_func=%s",
|
||||
select_lex->with_sum_func ? "TRUE" : "FALSE"));
|
||||
DBUG_PRINT("info",("spider select_lex->having=%s",
|
||||
select_lex->having ? "TRUE" : "FALSE"));
|
||||
DBUG_PRINT("info",("spider select_lex->order_list.elements=%u",
|
||||
select_lex->order_list.elements));
|
||||
if (
|
||||
!first_check ||
|
||||
!select_lex->explicit_limit ||
|
||||
|
@ -7989,8 +8059,13 @@ int spider_discover_table_structure(
|
|||
{
|
||||
DBUG_RETURN(ER_SPIDER_UNKNOWN_NUM);
|
||||
}
|
||||
#ifdef SPIDER_HAS_DISCOVER_TABLE_STRUCTURE_COMMENT
|
||||
if (!(part_syntax = generate_partition_syntax(part_info, &part_syntax_len,
|
||||
FALSE, TRUE, info, NULL, NULL)))
|
||||
#else
|
||||
if (!(part_syntax = generate_partition_syntax(part_info, &part_syntax_len,
|
||||
FALSE, TRUE, info, NULL)))
|
||||
#endif
|
||||
{
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2008-2013 Kentoku Shiba
|
||||
/* Copyright (C) 2008-2014 Kentoku Shiba
|
||||
|
||||
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
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2008-2013 Kentoku Shiba
|
||||
/* Copyright (C) 2008-2014 Kentoku Shiba
|
||||
|
||||
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
|
||||
|
@ -38,11 +38,15 @@
|
|||
#include "spd_ping_table.h"
|
||||
#include "spd_malloc.h"
|
||||
|
||||
#ifdef XID_CACHE_IS_SPLITTED
|
||||
extern uint *spd_db_att_xid_cache_split_num;
|
||||
#endif
|
||||
extern pthread_mutex_t *spd_db_att_LOCK_xid_cache;
|
||||
extern HASH *spd_db_att_xid_cache;
|
||||
extern struct charset_info_st *spd_charset_utf8_bin;
|
||||
|
||||
extern handlerton *spider_hton_ptr;
|
||||
extern SPIDER_DBTON spider_dbton[SPIDER_DBTON_SIZE];
|
||||
pthread_mutex_t spider_thread_id_mutex;
|
||||
ulonglong spider_thread_id = 1;
|
||||
|
||||
|
@ -213,18 +217,15 @@ int spider_free_trx_another_conn(
|
|||
bool lock
|
||||
) {
|
||||
int error_num, tmp_error_num;
|
||||
int roop_count = 0, need_mon = 0;
|
||||
int roop_count = 0;
|
||||
SPIDER_CONN *conn;
|
||||
ha_spider tmp_spider;
|
||||
DBUG_ENTER("spider_free_trx_another_conn");
|
||||
tmp_spider.conns = &conn;
|
||||
tmp_spider.need_mons = &need_mon;
|
||||
trx->tmp_spider->conns = &conn;
|
||||
error_num = 0;
|
||||
while ((conn = (SPIDER_CONN*) my_hash_element(&trx->trx_another_conn_hash,
|
||||
roop_count)))
|
||||
{
|
||||
tmp_spider.trx = trx;
|
||||
if (lock && (tmp_error_num = spider_db_unlock_tables(&tmp_spider, 0)))
|
||||
if (lock && (tmp_error_num = spider_db_unlock_tables(trx->tmp_spider, 0)))
|
||||
error_num = tmp_error_num;
|
||||
spider_free_conn_from_trx(trx, conn, TRUE, TRUE, &roop_count);
|
||||
}
|
||||
|
@ -352,20 +353,16 @@ int spider_trx_all_unlock_tables(
|
|||
SPIDER_TRX *trx
|
||||
) {
|
||||
int error_num;
|
||||
int roop_count = 0, need_mon = 0;
|
||||
int roop_count = 0;
|
||||
THD *thd = trx->thd;
|
||||
SPIDER_CONN *conn;
|
||||
ha_spider tmp_spider;
|
||||
DBUG_ENTER("spider_trx_all_unlock_tables");
|
||||
SPIDER_BACKUP_DASTATUS;
|
||||
memset((void*)&tmp_spider, 0, sizeof(ha_spider));
|
||||
tmp_spider.conns = &conn;
|
||||
tmp_spider.need_mons = &need_mon;
|
||||
trx->tmp_spider->conns = &conn;
|
||||
while ((conn = (SPIDER_CONN*) my_hash_element(&trx->trx_conn_hash,
|
||||
roop_count)))
|
||||
{
|
||||
tmp_spider.trx = trx;
|
||||
if ((error_num = spider_db_unlock_tables(&tmp_spider, 0)))
|
||||
if ((error_num = spider_db_unlock_tables(trx->tmp_spider, 0)))
|
||||
{
|
||||
SPIDER_CONN_RESTORE_DASTATUS_AND_RESET_ERROR_NUM;
|
||||
if (error_num)
|
||||
|
@ -1049,6 +1046,36 @@ int spider_free_trx_alloc(
|
|||
) {
|
||||
int roop_count;
|
||||
DBUG_ENTER("spider_free_trx_alloc");
|
||||
if (trx->tmp_spider)
|
||||
{
|
||||
for (roop_count = 0; roop_count < SPIDER_DBTON_SIZE; ++roop_count)
|
||||
{
|
||||
if (trx->tmp_spider->dbton_handler[roop_count])
|
||||
{
|
||||
delete trx->tmp_spider->dbton_handler[roop_count];
|
||||
trx->tmp_spider->dbton_handler[roop_count] = NULL;
|
||||
}
|
||||
}
|
||||
if (trx->tmp_spider->result_list.sqls)
|
||||
{
|
||||
delete [] trx->tmp_spider->result_list.sqls;
|
||||
trx->tmp_spider->result_list.sqls = NULL;
|
||||
}
|
||||
delete trx->tmp_spider;
|
||||
trx->tmp_spider = NULL;
|
||||
}
|
||||
if (trx->tmp_share)
|
||||
{
|
||||
for (roop_count = 0; roop_count < SPIDER_DBTON_SIZE; ++roop_count)
|
||||
{
|
||||
if (trx->tmp_share->dbton_share[roop_count])
|
||||
{
|
||||
delete trx->tmp_share->dbton_share[roop_count];
|
||||
trx->tmp_share->dbton_share[roop_count] = NULL;
|
||||
}
|
||||
}
|
||||
spider_free_tmp_share_alloc(trx->tmp_share);
|
||||
}
|
||||
spider_db_udf_free_set_names(trx);
|
||||
for (roop_count = spider_param_udf_table_lock_mutex_count() - 1;
|
||||
roop_count >= 0; roop_count--)
|
||||
|
@ -1100,6 +1127,7 @@ int spider_free_trx_alloc(
|
|||
trx->trx_alter_table_hash.array.max_element *
|
||||
trx->trx_alter_table_hash.array.size_of_element);
|
||||
my_hash_free(&trx->trx_alter_table_hash);
|
||||
free_root(&trx->mem_root, MYF(0));
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
@ -1108,8 +1136,9 @@ SPIDER_TRX *spider_get_trx(
|
|||
bool regist_allocated_thds,
|
||||
int *error_num
|
||||
) {
|
||||
int roop_count = 0;
|
||||
int roop_count = 0, roop_count2;
|
||||
SPIDER_TRX *trx;
|
||||
SPIDER_SHARE *tmp_share;
|
||||
pthread_mutex_t *udf_table_mutexes;
|
||||
DBUG_ENTER("spider_get_trx");
|
||||
|
||||
|
@ -1121,12 +1150,15 @@ SPIDER_TRX *spider_get_trx(
|
|||
if (!(trx = (SPIDER_TRX *)
|
||||
spider_bulk_malloc(NULL, 56, MYF(MY_WME | MY_ZEROFILL),
|
||||
&trx, sizeof(*trx),
|
||||
&tmp_share, sizeof(SPIDER_SHARE),
|
||||
&udf_table_mutexes, sizeof(pthread_mutex_t) *
|
||||
spider_param_udf_table_lock_mutex_count(),
|
||||
NullS))
|
||||
)
|
||||
goto error_alloc_trx;
|
||||
|
||||
SPD_INIT_ALLOC_ROOT(&trx->mem_root, 4096, 0, MYF(MY_WME));
|
||||
trx->tmp_share = tmp_share;
|
||||
trx->udf_table_mutexes = udf_table_mutexes;
|
||||
|
||||
for (roop_count = 0;
|
||||
|
@ -1263,6 +1295,79 @@ SPIDER_TRX *spider_get_trx(
|
|||
|
||||
if (thd)
|
||||
{
|
||||
spider_set_tmp_share_pointer(trx->tmp_share, trx->tmp_connect_info,
|
||||
trx->tmp_connect_info_length, trx->tmp_long, trx->tmp_longlong);
|
||||
if (
|
||||
spider_set_connect_info_default(
|
||||
trx->tmp_share,
|
||||
#ifdef WITH_PARTITION_STORAGE_ENGINE
|
||||
NULL,
|
||||
NULL,
|
||||
#endif
|
||||
NULL
|
||||
) ||
|
||||
spider_set_connect_info_default_db_table(
|
||||
trx->tmp_share,
|
||||
"", 0,
|
||||
"", 0
|
||||
) ||
|
||||
spider_create_conn_keys(trx->tmp_share)
|
||||
) {
|
||||
goto error_set_connect_info_default;
|
||||
}
|
||||
|
||||
if (!(trx->tmp_spider = new (&trx->mem_root) ha_spider()))
|
||||
{
|
||||
goto error_alloc_spider;
|
||||
}
|
||||
trx->tmp_spider->need_mons = &trx->tmp_need_mon;
|
||||
trx->tmp_spider->share = trx->tmp_share;
|
||||
trx->tmp_spider->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]))
|
||||
{
|
||||
goto error_init_result_list_sql;
|
||||
}
|
||||
for (roop_count2 = 0; roop_count2 < (int) trx->tmp_share->link_count;
|
||||
++roop_count2)
|
||||
{
|
||||
trx->tmp_spider->result_list.sqls[roop_count2].init_calc_mem(121);
|
||||
trx->tmp_spider->result_list.sqls[roop_count2].set_charset(
|
||||
trx->tmp_share->access_charset);
|
||||
}
|
||||
|
||||
for (roop_count2 = 0; roop_count2 < SPIDER_DBTON_SIZE; ++roop_count2)
|
||||
{
|
||||
if (!spider_dbton[roop_count2].init)
|
||||
continue;
|
||||
|
||||
if (!(trx->tmp_share->dbton_share[roop_count2] =
|
||||
spider_dbton[roop_count2].create_db_share(trx->tmp_share)))
|
||||
{
|
||||
goto error_create_db_share;
|
||||
}
|
||||
if (trx->tmp_share->dbton_share[roop_count2]->init())
|
||||
{
|
||||
delete trx->tmp_share->dbton_share[roop_count2];
|
||||
trx->tmp_share->dbton_share[roop_count2] = NULL;
|
||||
goto error_create_db_share;
|
||||
}
|
||||
|
||||
if (!(trx->tmp_spider->dbton_handler[roop_count2] =
|
||||
spider_dbton[roop_count2].create_db_handler(trx->tmp_spider,
|
||||
trx->tmp_share->dbton_share[roop_count2])))
|
||||
{
|
||||
goto error_create_db_share;
|
||||
}
|
||||
if (trx->tmp_spider->dbton_handler[roop_count2]->init())
|
||||
{
|
||||
delete trx->tmp_spider->dbton_handler[roop_count2];
|
||||
trx->tmp_spider->dbton_handler[roop_count2] = NULL;
|
||||
goto error_create_db_share;
|
||||
}
|
||||
}
|
||||
|
||||
if (regist_allocated_thds)
|
||||
{
|
||||
pthread_mutex_lock(&spider_allocated_thds_mutex);
|
||||
|
@ -1295,6 +1400,37 @@ SPIDER_TRX *spider_get_trx(
|
|||
DBUG_RETURN(trx);
|
||||
|
||||
error_allocated_thds_insert:
|
||||
error_alloc_spider:
|
||||
error_create_db_share:
|
||||
if (thd)
|
||||
{
|
||||
delete [] trx->tmp_spider->result_list.sqls;
|
||||
trx->tmp_spider->result_list.sqls = NULL;
|
||||
}
|
||||
error_init_result_list_sql:
|
||||
if (thd)
|
||||
{
|
||||
delete trx->tmp_spider;
|
||||
trx->tmp_spider = NULL;
|
||||
for (roop_count2 = 0; roop_count2 < SPIDER_DBTON_SIZE; ++roop_count2)
|
||||
{
|
||||
if (trx->tmp_spider->dbton_handler[roop_count2])
|
||||
{
|
||||
delete trx->tmp_spider->dbton_handler[roop_count2];
|
||||
trx->tmp_spider->dbton_handler[roop_count2] = NULL;
|
||||
}
|
||||
if (trx->tmp_share->dbton_share[roop_count2])
|
||||
{
|
||||
delete trx->tmp_share->dbton_share[roop_count2];
|
||||
trx->tmp_share->dbton_share[roop_count2] = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
error_set_connect_info_default:
|
||||
if (thd)
|
||||
{
|
||||
spider_free_tmp_share_alloc(trx->tmp_share);
|
||||
}
|
||||
spider_free_mem_calc(trx,
|
||||
trx->trx_ha_hash_id,
|
||||
trx->trx_ha_hash.array.max_element *
|
||||
|
@ -1360,6 +1496,7 @@ error_init_hash:
|
|||
pthread_mutex_destroy(&trx->udf_table_mutexes[roop_count]);
|
||||
}
|
||||
error_init_udf_table_mutex:
|
||||
free_root(&trx->mem_root, MYF(0));
|
||||
spider_free(NULL, trx, MYF(0));
|
||||
error_alloc_trx:
|
||||
*error_num = HA_ERR_OUT_OF_MEM;
|
||||
|
@ -1500,16 +1637,31 @@ int spider_check_and_set_time_zone(
|
|||
int spider_xa_lock(
|
||||
XID_STATE *xid_state
|
||||
) {
|
||||
THD *thd = current_thd;
|
||||
int error_num;
|
||||
const char *old_proc_info;
|
||||
DBUG_ENTER("spider_xa_lock");
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
my_hash_value_type hash_value = my_calc_hash(spd_db_att_xid_cache,
|
||||
(uchar*) xid_state->xid.key(), xid_state->xid.key_length());
|
||||
#ifdef XID_CACHE_IS_SPLITTED
|
||||
uint idx = hash_value % *spd_db_att_xid_cache_split_num;
|
||||
#endif
|
||||
#endif
|
||||
old_proc_info = thd_proc_info(thd, "Locking xid by Spider");
|
||||
#ifdef XID_CACHE_IS_SPLITTED
|
||||
pthread_mutex_lock(&spd_db_att_LOCK_xid_cache[idx]);
|
||||
#else
|
||||
pthread_mutex_lock(spd_db_att_LOCK_xid_cache);
|
||||
#endif
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
#ifdef XID_CACHE_IS_SPLITTED
|
||||
if (my_hash_search_using_hash_value(&spd_db_att_xid_cache[idx], hash_value,
|
||||
xid_state->xid.key(), xid_state->xid.key_length()))
|
||||
#else
|
||||
if (my_hash_search_using_hash_value(spd_db_att_xid_cache, hash_value,
|
||||
xid_state->xid.key(), xid_state->xid.key_length()))
|
||||
#endif
|
||||
#else
|
||||
if (my_hash_search(spd_db_att_xid_cache,
|
||||
xid_state->xid.key(), xid_state->xid.key_length()))
|
||||
|
@ -1519,8 +1671,13 @@ int spider_xa_lock(
|
|||
goto error;
|
||||
}
|
||||
#ifdef HASH_UPDATE_WITH_HASH_VALUE
|
||||
#ifdef XID_CACHE_IS_SPLITTED
|
||||
if (my_hash_insert_with_hash_value(&spd_db_att_xid_cache[idx], hash_value,
|
||||
(uchar*)xid_state))
|
||||
#else
|
||||
if (my_hash_insert_with_hash_value(spd_db_att_xid_cache, hash_value,
|
||||
(uchar*)xid_state))
|
||||
#endif
|
||||
#else
|
||||
if (my_hash_insert(spd_db_att_xid_cache, (uchar*)xid_state))
|
||||
#endif
|
||||
|
@ -1528,29 +1685,60 @@ int spider_xa_lock(
|
|||
error_num = HA_ERR_OUT_OF_MEM;
|
||||
goto error;
|
||||
}
|
||||
#ifdef XID_CACHE_IS_SPLITTED
|
||||
pthread_mutex_unlock(&spd_db_att_LOCK_xid_cache[idx]);
|
||||
#else
|
||||
pthread_mutex_unlock(spd_db_att_LOCK_xid_cache);
|
||||
#endif
|
||||
thd_proc_info(thd, old_proc_info);
|
||||
DBUG_RETURN(0);
|
||||
|
||||
error:
|
||||
#ifdef XID_CACHE_IS_SPLITTED
|
||||
pthread_mutex_unlock(&spd_db_att_LOCK_xid_cache[idx]);
|
||||
#else
|
||||
pthread_mutex_unlock(spd_db_att_LOCK_xid_cache);
|
||||
#endif
|
||||
thd_proc_info(thd, old_proc_info);
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
|
||||
int spider_xa_unlock(
|
||||
XID_STATE *xid_state
|
||||
) {
|
||||
THD *thd = current_thd;
|
||||
const char *old_proc_info;
|
||||
DBUG_ENTER("spider_xa_unlock");
|
||||
#if defined(SPIDER_HAS_HASH_VALUE_TYPE) && defined(HASH_UPDATE_WITH_HASH_VALUE)
|
||||
my_hash_value_type hash_value = my_calc_hash(spd_db_att_xid_cache,
|
||||
(uchar*) xid_state->xid.key(), xid_state->xid.key_length());
|
||||
#ifdef XID_CACHE_IS_SPLITTED
|
||||
uint idx = hash_value % *spd_db_att_xid_cache_split_num;
|
||||
#endif
|
||||
#endif
|
||||
old_proc_info = thd_proc_info(thd, "Unlocking xid by Spider");
|
||||
#ifdef XID_CACHE_IS_SPLITTED
|
||||
pthread_mutex_lock(&spd_db_att_LOCK_xid_cache[idx]);
|
||||
#else
|
||||
pthread_mutex_lock(spd_db_att_LOCK_xid_cache);
|
||||
#endif
|
||||
#if defined(SPIDER_HAS_HASH_VALUE_TYPE) && defined(HASH_UPDATE_WITH_HASH_VALUE)
|
||||
my_hash_delete_with_hash_value(spd_db_att_xid_cache, hash_value, (uchar *)xid_state);
|
||||
#ifdef XID_CACHE_IS_SPLITTED
|
||||
my_hash_delete_with_hash_value(&spd_db_att_xid_cache[idx],
|
||||
hash_value, (uchar *)xid_state);
|
||||
#else
|
||||
my_hash_delete_with_hash_value(spd_db_att_xid_cache,
|
||||
hash_value, (uchar *)xid_state);
|
||||
#endif
|
||||
#else
|
||||
my_hash_delete(spd_db_att_xid_cache, (uchar *)xid_state);
|
||||
#endif
|
||||
#ifdef XID_CACHE_IS_SPLITTED
|
||||
pthread_mutex_unlock(&spd_db_att_LOCK_xid_cache[idx]);
|
||||
#else
|
||||
pthread_mutex_unlock(spd_db_att_LOCK_xid_cache);
|
||||
#endif
|
||||
thd_proc_info(thd, old_proc_info);
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
@ -1572,10 +1760,11 @@ int spider_internal_start_trx(
|
|||
) {
|
||||
int error_num;
|
||||
SPIDER_TRX *trx = spider->trx;
|
||||
bool sync_autocommit = spider_param_sync_autocommit(trx->thd);
|
||||
bool sync_time_zone = spider_param_sync_time_zone(trx->thd);
|
||||
THD *thd = trx->thd;
|
||||
bool sync_autocommit = spider_param_sync_autocommit(thd);
|
||||
bool sync_time_zone = spider_param_sync_time_zone(thd);
|
||||
double ping_interval_at_trx_start =
|
||||
spider_param_ping_interval_at_trx_start(trx->thd);
|
||||
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");
|
||||
|
@ -1592,19 +1781,19 @@ int spider_internal_start_trx(
|
|||
if (!trx->trx_consistent_snapshot)
|
||||
{
|
||||
trx->use_consistent_snapshot =
|
||||
spider_param_use_consistent_snapshot(trx->thd);
|
||||
trx->internal_xa = spider_param_internal_xa(trx->thd);
|
||||
trx->internal_xa_snapshot = spider_param_internal_xa_snapshot(trx->thd);
|
||||
spider_param_use_consistent_snapshot(thd);
|
||||
trx->internal_xa = spider_param_internal_xa(thd);
|
||||
trx->internal_xa_snapshot = spider_param_internal_xa_snapshot(thd);
|
||||
}
|
||||
}
|
||||
if (
|
||||
(error_num = spider_check_and_set_sql_log_off(trx->thd, conn,
|
||||
(error_num = spider_check_and_set_sql_log_off(thd, conn,
|
||||
&spider->need_mons[link_idx])) ||
|
||||
(sync_time_zone &&
|
||||
(error_num = spider_check_and_set_time_zone(trx->thd, conn,
|
||||
(error_num = spider_check_and_set_time_zone(thd, conn,
|
||||
&spider->need_mons[link_idx]))) ||
|
||||
(sync_autocommit &&
|
||||
(error_num = spider_check_and_set_autocommit(trx->thd, conn,
|
||||
(error_num = spider_check_and_set_autocommit(thd, conn,
|
||||
&spider->need_mons[link_idx])))
|
||||
)
|
||||
goto error;
|
||||
|
@ -1628,70 +1817,74 @@ int spider_internal_start_trx(
|
|||
if (!trx->trx_start)
|
||||
{
|
||||
if (
|
||||
trx->thd->transaction.xid_state.xa_state == XA_ACTIVE &&
|
||||
thd->transaction.xid_state.xa_state == XA_ACTIVE &&
|
||||
spider_param_support_xa()
|
||||
) {
|
||||
trx->trx_xa = TRUE;
|
||||
thd_get_xid(trx->thd, (MYSQL_XID*) &trx->xid);
|
||||
thd_get_xid(thd, (MYSQL_XID*) &trx->xid);
|
||||
}
|
||||
|
||||
if (!trx->trx_xa && trx->internal_xa)
|
||||
{
|
||||
if (!trx->trx_consistent_snapshot || trx->internal_xa_snapshot == 3)
|
||||
if (
|
||||
!trx->trx_xa &&
|
||||
trx->internal_xa &&
|
||||
(!trx->trx_consistent_snapshot || trx->internal_xa_snapshot == 3) &&
|
||||
spider->sql_command != SQLCOM_LOCK_TABLES
|
||||
) {
|
||||
trx->trx_xa = TRUE;
|
||||
trx->xid.formatID = 1;
|
||||
if (spider_param_internal_xa_id_type(thd) == 0)
|
||||
{
|
||||
trx->trx_xa = TRUE;
|
||||
trx->xid.formatID = 1;
|
||||
trx->xid.gtrid_length
|
||||
= my_sprintf(trx->xid.data,
|
||||
(trx->xid.data, "%lx", thd_get_thread_id(trx->thd)));
|
||||
(trx->xid.data, "%lx", thd_get_thread_id(thd)));
|
||||
} else {
|
||||
trx->xid.gtrid_length
|
||||
= my_sprintf(trx->xid.data,
|
||||
(trx->xid.data, "%lx%016llx", thd_get_thread_id(thd),
|
||||
thd->query_id));
|
||||
}
|
||||
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100002
|
||||
trx->xid.bqual_length
|
||||
= my_sprintf(trx->xid.data + trx->xid.gtrid_length,
|
||||
(trx->xid.data + trx->xid.gtrid_length, "%lx",
|
||||
trx->thd->variables.server_id));
|
||||
trx->xid.bqual_length
|
||||
= my_sprintf(trx->xid.data + trx->xid.gtrid_length,
|
||||
(trx->xid.data + trx->xid.gtrid_length, "%lx",
|
||||
thd->variables.server_id));
|
||||
#else
|
||||
trx->xid.bqual_length
|
||||
= my_sprintf(trx->xid.data + trx->xid.gtrid_length,
|
||||
(trx->xid.data + trx->xid.gtrid_length, "%x",
|
||||
trx->thd->server_id));
|
||||
trx->xid.bqual_length
|
||||
= my_sprintf(trx->xid.data + trx->xid.gtrid_length,
|
||||
(trx->xid.data + trx->xid.gtrid_length, "%x",
|
||||
thd->server_id));
|
||||
#endif
|
||||
|
||||
trx->internal_xid_state.xa_state = XA_ACTIVE;
|
||||
trx->internal_xid_state.xid.set(&trx->xid);
|
||||
trx->internal_xid_state.in_thd = 1;
|
||||
while ((error_num = spider_xa_lock(&trx->internal_xid_state)))
|
||||
{
|
||||
if (error_num != ER_SPIDER_XA_LOCKED_NUM)
|
||||
goto error;
|
||||
else if (trx->xid.formatID == 0)
|
||||
{
|
||||
my_message(error_num, ER_SPIDER_XA_LOCKED_STR, MYF(0));
|
||||
goto error;
|
||||
}
|
||||
/* retry */
|
||||
trx->xid.formatID++;
|
||||
trx->internal_xid_state.xid.set(&trx->xid);
|
||||
}
|
||||
xa_lock = TRUE;
|
||||
trx->internal_xid_state.xa_state = XA_ACTIVE;
|
||||
trx->internal_xid_state.xid.set(&trx->xid);
|
||||
trx->internal_xid_state.in_thd = 1;
|
||||
if ((error_num = spider_xa_lock(&trx->internal_xid_state)))
|
||||
{
|
||||
if (error_num == ER_SPIDER_XA_LOCKED_NUM)
|
||||
my_message(error_num, ER_SPIDER_XA_LOCKED_STR, MYF(0));
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
xa_lock = TRUE;
|
||||
} else
|
||||
trx->internal_xa = FALSE;
|
||||
|
||||
DBUG_PRINT("info",("spider trx->trx_consistent_snapshot= %s",
|
||||
trx->trx_consistent_snapshot ? "TRUE" : "FALSE"));
|
||||
if (!trx->trx_consistent_snapshot)
|
||||
{
|
||||
trans_register_ha(trx->thd, FALSE, spider_hton_ptr);
|
||||
if (thd_test_options(trx->thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))
|
||||
trans_register_ha(trx->thd, TRUE, spider_hton_ptr);
|
||||
trans_register_ha(thd, FALSE, spider_hton_ptr);
|
||||
if (thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))
|
||||
trans_register_ha(thd, TRUE, spider_hton_ptr);
|
||||
}
|
||||
trx->trx_start = TRUE;
|
||||
trx->trx_xa_prepared = FALSE;
|
||||
}
|
||||
|
||||
DBUG_PRINT("info",("spider sync_autocommit = %d", sync_autocommit));
|
||||
DBUG_PRINT("info",("spider conn->semi_trx_chk = %d", conn->semi_trx_chk));
|
||||
DBUG_PRINT("info",("spider conn->table_lock = %d", conn->table_lock));
|
||||
DBUG_PRINT("info",("spider conn->autocommit = %d", conn->autocommit));
|
||||
DBUG_PRINT("info",("spider semi_trx = %d", spider_param_semi_trx(trx->thd)));
|
||||
DBUG_PRINT("info",("spider semi_trx = %d", spider_param_semi_trx(thd)));
|
||||
conn->semi_trx = FALSE;
|
||||
if (conn->table_lock == 3)
|
||||
{
|
||||
|
@ -1708,7 +1901,7 @@ int spider_internal_start_trx(
|
|||
(!conn->queued_autocommit && conn->autocommit == 1) ||
|
||||
(conn->queued_autocommit && conn->queued_autocommit_val == TRUE)
|
||||
) &&
|
||||
spider_param_semi_trx(trx->thd)
|
||||
spider_param_semi_trx(thd)
|
||||
) {
|
||||
DBUG_PRINT("info",("spider semi_trx is set"));
|
||||
conn->semi_trx = TRUE;
|
||||
|
@ -1717,7 +1910,7 @@ int spider_internal_start_trx(
|
|||
conn->disable_xa = FALSE;
|
||||
} else if (
|
||||
!trx->trx_consistent_snapshot &&
|
||||
!thd_test_options(trx->thd, OPTION_BEGIN) &&
|
||||
!thd_test_options(thd, OPTION_BEGIN) &&
|
||||
sync_autocommit &&
|
||||
conn->semi_trx_chk &&
|
||||
!conn->table_lock &&
|
||||
|
@ -1725,14 +1918,14 @@ int spider_internal_start_trx(
|
|||
(!conn->queued_autocommit && conn->autocommit == 1) ||
|
||||
(conn->queued_autocommit && conn->queued_autocommit_val == TRUE)
|
||||
) &&
|
||||
spider_param_semi_trx(trx->thd)
|
||||
spider_param_semi_trx(thd)
|
||||
) {
|
||||
DBUG_PRINT("info",("spider semi_trx is set"));
|
||||
spider_conn_queue_start_transaction(conn);
|
||||
conn->semi_trx = TRUE;
|
||||
} else if (
|
||||
!trx->trx_consistent_snapshot &&
|
||||
thd_test_options(trx->thd, OPTION_BEGIN)
|
||||
thd_test_options(thd, OPTION_BEGIN)
|
||||
) {
|
||||
DBUG_PRINT("info",("spider start transaction"));
|
||||
spider_conn_queue_start_transaction(conn);
|
||||
|
@ -1848,6 +2041,8 @@ int spider_internal_xa_commit(
|
|||
if ((conn = spider_tree_first(trx->join_trx_top)))
|
||||
{
|
||||
do {
|
||||
if (conn->bg_search)
|
||||
spider_bg_conn_break(conn, NULL);
|
||||
DBUG_PRINT("info",("spider conn=%p", conn));
|
||||
DBUG_PRINT("info",("spider conn->join_trx=%u", conn->join_trx));
|
||||
if (conn->join_trx)
|
||||
|
@ -1950,12 +2145,11 @@ int spider_internal_xa_rollback(
|
|||
Open_tables_backup open_tables_backup;
|
||||
#endif
|
||||
bool server_lost = FALSE;
|
||||
bool prepared = (thd->transaction.xid_state.xa_state == XA_PREPARED);
|
||||
bool table_xa_opened = FALSE;
|
||||
bool table_xa_member_opened = FALSE;
|
||||
DBUG_ENTER("spider_internal_xa_rollback");
|
||||
|
||||
if (prepared)
|
||||
if (trx->trx_xa_prepared)
|
||||
{
|
||||
/*
|
||||
select
|
||||
|
@ -2029,11 +2223,13 @@ int spider_internal_xa_rollback(
|
|||
if ((conn = spider_tree_first(trx->join_trx_top)))
|
||||
{
|
||||
do {
|
||||
if (conn->bg_search)
|
||||
spider_bg_conn_break(conn, NULL);
|
||||
if (conn->join_trx)
|
||||
{
|
||||
if (conn->disable_xa)
|
||||
{
|
||||
if (conn->table_lock != 3 && !prepared)
|
||||
if (conn->table_lock != 3 && !trx->trx_xa_prepared)
|
||||
{
|
||||
if (
|
||||
!conn->server_lost &&
|
||||
|
@ -2048,7 +2244,7 @@ int spider_internal_xa_rollback(
|
|||
if (!conn->server_lost)
|
||||
{
|
||||
if (
|
||||
!prepared &&
|
||||
!trx->trx_xa_prepared &&
|
||||
(tmp_error_num = spider_db_xa_end(conn, &trx->xid))
|
||||
) {
|
||||
if (
|
||||
|
@ -2102,7 +2298,7 @@ int spider_internal_xa_rollback(
|
|||
goto error_in_rollback;
|
||||
|
||||
if (
|
||||
prepared &&
|
||||
trx->trx_xa_prepared &&
|
||||
!server_lost
|
||||
) {
|
||||
/*
|
||||
|
@ -2213,6 +2409,8 @@ int spider_internal_xa_prepare(
|
|||
if ((conn = spider_tree_first(trx->join_trx_top)))
|
||||
{
|
||||
do {
|
||||
if (conn->bg_search)
|
||||
spider_bg_conn_break(conn, NULL);
|
||||
if (conn->disable_xa)
|
||||
{
|
||||
if (conn->table_lock != 3)
|
||||
|
@ -3089,21 +3287,24 @@ int spider_commit(
|
|||
{
|
||||
if (trx->trx_xa)
|
||||
{
|
||||
if (
|
||||
trx->internal_xa &&
|
||||
(error_num = spider_internal_xa_prepare(
|
||||
thd, trx, table_xa, table_xa_member, TRUE))
|
||||
) {
|
||||
if (trx->internal_xa && !trx->trx_xa_prepared)
|
||||
{
|
||||
if (
|
||||
(error_num = spider_internal_xa_prepare(
|
||||
thd, trx, table_xa, table_xa_member, TRUE))
|
||||
) {
|
||||
/*
|
||||
if (!thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))
|
||||
{
|
||||
if (!thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))
|
||||
{
|
||||
*/
|
||||
/* rollback for semi_trx */
|
||||
spider_rollback(hton, thd, all);
|
||||
/* rollback for semi_trx */
|
||||
spider_rollback(hton, thd, all);
|
||||
/*
|
||||
}
|
||||
*/
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
*/
|
||||
DBUG_RETURN(error_num);
|
||||
trx->trx_xa_prepared = TRUE;
|
||||
}
|
||||
int tmp_error_num;
|
||||
if (
|
||||
|
@ -3114,6 +3315,7 @@ int spider_commit(
|
|||
error_num = tmp_error_num;
|
||||
}
|
||||
trx->trx_xa = FALSE;
|
||||
trx->join_trx_top = NULL;
|
||||
} else {
|
||||
if ((conn = spider_tree_first(trx->join_trx_top)))
|
||||
{
|
||||
|
@ -3183,6 +3385,7 @@ int spider_rollback(
|
|||
error_num = tmp_error_num;
|
||||
}
|
||||
trx->trx_xa = FALSE;
|
||||
trx->join_trx_top = NULL;
|
||||
} else {
|
||||
if ((conn = spider_tree_first(trx->join_trx_top)))
|
||||
{
|
||||
|
@ -3246,6 +3449,7 @@ int spider_xa_prepare(
|
|||
if ((error_num = spider_internal_xa_prepare(
|
||||
thd, trx, table_xa, table_xa_member, FALSE)))
|
||||
goto error;
|
||||
trx->trx_xa_prepared = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3315,22 +3519,40 @@ error_get_trx:
|
|||
DBUG_RETURN(error_num);
|
||||
}
|
||||
|
||||
void spider_copy_table_free_trx_conn(
|
||||
SPIDER_TRX *trx
|
||||
) {
|
||||
SPIDER_CONN *conn;
|
||||
DBUG_ENTER("spider_copy_table_free_trx_conn");
|
||||
if ((conn = spider_tree_first(trx->join_trx_top)))
|
||||
{
|
||||
do {
|
||||
spider_end_trx(trx, conn);
|
||||
conn->join_trx = 0;
|
||||
} while ((conn = spider_tree_next(conn)));
|
||||
trx->join_trx_top = NULL;
|
||||
}
|
||||
spider_reuse_trx_ha(trx);
|
||||
spider_free_trx_conn(trx, FALSE);
|
||||
trx->trx_consistent_snapshot = FALSE;
|
||||
spider_merge_mem_calc(trx, FALSE);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
int spider_end_trx(
|
||||
SPIDER_TRX *trx,
|
||||
SPIDER_CONN *conn
|
||||
) {
|
||||
int error_num = 0, need_mon = 0;
|
||||
ha_spider tmp_spider;
|
||||
DBUG_ENTER("spider_end_trx");
|
||||
tmp_spider.conns = &conn;
|
||||
if (conn->table_lock == 3)
|
||||
{
|
||||
trx->tmp_spider->conns = &conn;
|
||||
conn->table_lock = 0;
|
||||
conn->disable_reconnect = FALSE;
|
||||
tmp_spider.trx = trx;
|
||||
if (
|
||||
!conn->server_lost &&
|
||||
(error_num = spider_db_unlock_tables(&tmp_spider, 0))
|
||||
(error_num = spider_db_unlock_tables(trx->tmp_spider, 0))
|
||||
) {
|
||||
if (error_num == ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM)
|
||||
error_num = 0;
|
||||
|
@ -3422,8 +3644,6 @@ int spider_check_trx_and_get_conn(
|
|||
DBUG_PRINT("info",("spider semi_table_lock = %d",
|
||||
spider_param_semi_table_lock(thd, share->semi_table_lock)));
|
||||
DBUG_PRINT("info",("spider first_byte = %d", first_byte));
|
||||
DBUG_PRINT("info",("spider link_status = %ld",
|
||||
share->link_statuses[spider->conn_link_idx[spider->search_link_idx]]));
|
||||
if (
|
||||
!trx_ha ||
|
||||
trx_ha->wait_for_reusing ||
|
||||
|
@ -3615,6 +3835,8 @@ int spider_check_trx_and_get_conn(
|
|||
#endif
|
||||
}
|
||||
} else {
|
||||
DBUG_PRINT("info",("spider link_status = %ld",
|
||||
share->link_statuses[spider->conn_link_idx[spider->search_link_idx]]));
|
||||
for (
|
||||
roop_count = spider_conn_link_idx_next(share->link_statuses,
|
||||
spider->conn_link_idx, -1, share->link_count,
|
||||
|
@ -3757,12 +3979,12 @@ void spider_free_tmp_thd(
|
|||
THD *thd
|
||||
) {
|
||||
DBUG_ENTER("spider_free_tmp_thd");
|
||||
thd->cleanup();
|
||||
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
|
||||
thd->reset_globals();
|
||||
#else
|
||||
thd->restore_globals();
|
||||
#endif
|
||||
thd->cleanup();
|
||||
delete thd;
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2008-2013 Kentoku Shiba
|
||||
/* Copyright (C) 2008-2014 Kentoku Shiba
|
||||
|
||||
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
|
||||
|
@ -208,6 +208,10 @@ int spider_xa_rollback_by_xid(
|
|||
XID* xid
|
||||
);
|
||||
|
||||
void spider_copy_table_free_trx_conn(
|
||||
SPIDER_TRX *trx
|
||||
);
|
||||
|
||||
int spider_end_trx(
|
||||
SPIDER_TRX *trx,
|
||||
SPIDER_CONN *conn
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2009-2013 Kentoku Shiba
|
||||
/* Copyright (C) 2009-2014 Kentoku Shiba
|
||||
|
||||
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
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2009-2013 Kentoku Shiba
|
||||
/* Copyright (C) 2009-2014 Kentoku Shiba
|
||||
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue