Commit 15b443b0 authored by Sergey Vojtovich's avatar Sergey Vojtovich

MDEV-6088 - Merge spider 3.2

parents 244d4b53 e105d8bc
This diff is collapsed.
/* 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,
......
/* 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)
{
......
/* 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(
......
/* 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(
&copy_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;
}
/* 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
......
This diff is collapsed.
/* 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(
......
This diff is collapsed.
This diff is collapsed.
/* 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
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/* 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)))
{
......
/* 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
......
/* 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"
......
This diff is collapsed.
/* 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;
......
/* 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
......
/* 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
......
This diff is collapsed.
/* 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
);
This diff is collapsed.
This diff is collapsed.
/* 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);
......
/* 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
......
This diff is collapsed.
/* 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
......
This diff is collapsed.
/* 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
......
/* 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
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment