mirror of
https://github.com/MariaDB/server.git
synced 2025-03-27 01:18:42 +01:00
Merge branch '10.5' into 10.6
This commit is contained in:
commit
4a09e74387
26 changed files with 0 additions and 1444 deletions
storage/spider
ha_spider.ccha_spider.hspd_conn.ccspd_conn.hspd_copy_tables.ccspd_db_conn.ccspd_db_conn.hspd_db_include.ccspd_db_include.hspd_db_mysql.ccspd_db_mysql.hspd_db_oracle.ccspd_db_oracle.hspd_direct_sql.ccspd_environ.hspd_group_by_handler.ccspd_i_s.ccspd_include.hspd_malloc.ccspd_param.ccspd_ping_table.ccspd_sys_table.ccspd_table.ccspd_table.hspd_trx.ccspd_udf.cc
|
@ -21,14 +21,11 @@
|
|||
#define MYSQL_SERVER 1
|
||||
#include <my_global.h>
|
||||
#include "mysql_version.h"
|
||||
#include "spd_environ.h"
|
||||
#include "sql_priv.h"
|
||||
#include "probes_mysql.h"
|
||||
#include "sql_class.h"
|
||||
#include "key.h"
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
#include "sql_select.h"
|
||||
#endif
|
||||
#include "ha_partition.h"
|
||||
#include "spd_param.h"
|
||||
#include "spd_err.h"
|
||||
|
@ -49,9 +46,7 @@
|
|||
|
||||
extern handlerton *spider_hton_ptr;
|
||||
extern SPIDER_DBTON spider_dbton[SPIDER_DBTON_SIZE];
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
extern HASH spider_open_tables;
|
||||
#endif
|
||||
extern pthread_mutex_t spider_lgtm_tblhnd_share_mutex;
|
||||
|
||||
/* UTC time zone for timestamp columns */
|
||||
|
@ -98,9 +93,7 @@ ha_spider::ha_spider(
|
|||
dml_inited = FALSE;
|
||||
use_pre_call = FALSE;
|
||||
use_pre_action = FALSE;
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
do_direct_update = FALSE;
|
||||
#endif
|
||||
#ifdef HA_CAN_BULK_ACCESS
|
||||
is_bulk_access_clone = FALSE;
|
||||
synced_from_clone_source = FALSE;
|
||||
|
@ -113,9 +106,7 @@ ha_spider::ha_spider(
|
|||
*/
|
||||
#endif
|
||||
prev_index_rnd_init = SPD_NONE;
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
direct_aggregate_item_first = NULL;
|
||||
#endif
|
||||
result_link_idx = 0;
|
||||
result_list.have_sql_kind_backup = FALSE;
|
||||
result_list.sqls = NULL;
|
||||
|
@ -129,10 +120,8 @@ ha_spider::ha_spider(
|
|||
result_list.set_split_read = FALSE;
|
||||
result_list.insert_dup_update_pushdown = FALSE;
|
||||
result_list.tmp_pos_row_first = NULL;
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
result_list.direct_aggregate = FALSE;
|
||||
result_list.snap_direct_aggregate = FALSE;
|
||||
#endif
|
||||
result_list.direct_distinct = FALSE;
|
||||
result_list.casual_read = NULL;
|
||||
result_list.use_both_key = FALSE;
|
||||
|
@ -183,9 +172,7 @@ ha_spider::ha_spider(
|
|||
dml_inited = FALSE;
|
||||
use_pre_call = FALSE;
|
||||
use_pre_action = FALSE;
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
do_direct_update = FALSE;
|
||||
#endif
|
||||
#ifdef HA_CAN_BULK_ACCESS
|
||||
is_bulk_access_clone = FALSE;
|
||||
synced_from_clone_source = FALSE;
|
||||
|
@ -198,9 +185,7 @@ ha_spider::ha_spider(
|
|||
*/
|
||||
#endif
|
||||
prev_index_rnd_init = SPD_NONE;
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
direct_aggregate_item_first = NULL;
|
||||
#endif
|
||||
result_link_idx = 0;
|
||||
result_list.have_sql_kind_backup = FALSE;
|
||||
result_list.sqls = NULL;
|
||||
|
@ -214,10 +199,8 @@ ha_spider::ha_spider(
|
|||
result_list.set_split_read = FALSE;
|
||||
result_list.insert_dup_update_pushdown = FALSE;
|
||||
result_list.tmp_pos_row_first = NULL;
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
result_list.direct_aggregate = FALSE;
|
||||
result_list.snap_direct_aggregate = FALSE;
|
||||
#endif
|
||||
result_list.direct_distinct = FALSE;
|
||||
result_list.casual_read = NULL;
|
||||
result_list.use_both_key = FALSE;
|
||||
|
@ -640,7 +623,6 @@ int ha_spider::close()
|
|||
} while (bulk_access_link_first);
|
||||
}
|
||||
#endif
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
while (direct_aggregate_item_first)
|
||||
{
|
||||
direct_aggregate_item_current = direct_aggregate_item_first->next;
|
||||
|
@ -651,7 +633,6 @@ int ha_spider::close()
|
|||
spider_free(spider_current_trx, direct_aggregate_item_first, MYF(0));
|
||||
direct_aggregate_item_first = direct_aggregate_item_current;
|
||||
}
|
||||
#endif
|
||||
if (is_clone)
|
||||
{
|
||||
for (roop_count = 0; roop_count < (int) share->link_count; roop_count++)
|
||||
|
@ -795,22 +776,7 @@ void ha_spider::check_access_kind(
|
|||
wide_handler->sql_command = thd_sql_command(thd);
|
||||
DBUG_PRINT("info",("spider sql_command=%u", wide_handler->sql_command));
|
||||
DBUG_PRINT("info",("spider thd->query_id=%lld", thd->query_id));
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
wide_handler->update_request = FALSE;
|
||||
#else
|
||||
if (
|
||||
wide_handler->sql_command == SQLCOM_UPDATE ||
|
||||
wide_handler->sql_command == SQLCOM_UPDATE_MULTI ||
|
||||
/* for triggers */
|
||||
wide_handler->sql_command == SQLCOM_INSERT ||
|
||||
wide_handler->sql_command == SQLCOM_INSERT_SELECT ||
|
||||
wide_handler->sql_command == SQLCOM_DELETE ||
|
||||
wide_handler->sql_command == SQLCOM_DELETE_MULTI
|
||||
)
|
||||
wide_handler->update_request = TRUE;
|
||||
else
|
||||
wide_handler->update_request = FALSE;
|
||||
#endif
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
@ -1212,7 +1178,6 @@ int ha_spider::reset()
|
|||
} while (bulk_access_link_first);
|
||||
}
|
||||
#endif
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
direct_aggregate_item_current = direct_aggregate_item_first;
|
||||
while (direct_aggregate_item_current)
|
||||
{
|
||||
|
@ -1232,7 +1197,6 @@ int ha_spider::reset()
|
|||
}
|
||||
result_list.direct_aggregate = FALSE;
|
||||
result_list.snap_direct_aggregate = FALSE;
|
||||
#endif
|
||||
result_list.direct_distinct = FALSE;
|
||||
store_error_num = 0;
|
||||
if (wide_handler)
|
||||
|
@ -1265,9 +1229,7 @@ int ha_spider::reset()
|
|||
wide_handler->condition = tmp_cond;
|
||||
}
|
||||
wide_handler->cond_check = FALSE;
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
wide_handler->direct_update_fields = NULL;
|
||||
#endif
|
||||
#ifdef INFO_KIND_FORCE_LIMIT_BEGIN
|
||||
wide_handler->info_limit = 9223372036854775807LL;
|
||||
#endif
|
||||
|
@ -1345,9 +1307,7 @@ int ha_spider::reset()
|
|||
ft_count = 0;
|
||||
ft_init_without_index_init = FALSE;
|
||||
sql_kinds = 0;
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
do_direct_update = FALSE;
|
||||
#endif
|
||||
prev_index_rnd_init = SPD_NONE;
|
||||
result_list.have_sql_kind_backup = FALSE;
|
||||
result_list.direct_order_limit = FALSE;
|
||||
|
@ -1423,11 +1383,9 @@ int ha_spider::extra(
|
|||
case HA_EXTRA_WRITE_CANNOT_REPLACE:
|
||||
wide_handler->write_can_replace = FALSE;
|
||||
break;
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
case HA_EXTRA_INSERT_WITH_UPDATE:
|
||||
wide_handler->insert_with_update = TRUE;
|
||||
break;
|
||||
#endif
|
||||
case HA_EXTRA_ATTACH_CHILDREN:
|
||||
DBUG_PRINT("info",("spider HA_EXTRA_ATTACH_CHILDREN"));
|
||||
if (!(wide_handler->trx = spider_get_trx(ha_thd(), TRUE, &error_num)))
|
||||
|
@ -1438,13 +1396,7 @@ int ha_spider::extra(
|
|||
if (!(wide_handler->trx = spider_get_trx(ha_thd(), TRUE, &error_num)))
|
||||
DBUG_RETURN(error_num);
|
||||
break;
|
||||
#if defined(HA_EXTRA_HAS_STARTING_ORDERED_INDEX_SCAN) || defined(HA_EXTRA_HAS_HA_EXTRA_USE_CMP_REF)
|
||||
#ifdef HA_EXTRA_HAS_STARTING_ORDERED_INDEX_SCAN
|
||||
case HA_EXTRA_STARTING_ORDERED_INDEX_SCAN:
|
||||
#endif
|
||||
#ifdef HA_EXTRA_HAS_HA_EXTRA_USE_CMP_REF
|
||||
case HA_EXTRA_USE_CMP_REF:
|
||||
#endif
|
||||
DBUG_PRINT("info",("spider HA_EXTRA_STARTING_ORDERED_INDEX_SCAN"));
|
||||
if (table_share->primary_key != MAX_KEY)
|
||||
{
|
||||
|
@ -1472,7 +1424,6 @@ int ha_spider::extra(
|
|||
}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -1625,9 +1576,7 @@ int ha_spider::index_read_map_internal(
|
|||
my_error(ER_QUERY_INTERRUPTED, MYF(0));
|
||||
DBUG_RETURN(ER_QUERY_INTERRUPTED);
|
||||
}
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
do_direct_update = FALSE;
|
||||
#endif
|
||||
if (
|
||||
find_flag >= HA_READ_MBR_CONTAIN &&
|
||||
find_flag <= HA_READ_MBR_EQUAL
|
||||
|
@ -2097,9 +2046,7 @@ int ha_spider::index_read_last_map_internal(
|
|||
my_error(ER_QUERY_INTERRUPTED, MYF(0));
|
||||
DBUG_RETURN(ER_QUERY_INTERRUPTED);
|
||||
}
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
do_direct_update = FALSE;
|
||||
#endif
|
||||
if ((error_num = index_handler_init()))
|
||||
DBUG_RETURN(check_error_mode_eof(error_num));
|
||||
if (is_clone)
|
||||
|
@ -2555,9 +2502,7 @@ int ha_spider::index_first_internal(
|
|||
my_error(ER_QUERY_INTERRUPTED, MYF(0));
|
||||
DBUG_RETURN(ER_QUERY_INTERRUPTED);
|
||||
}
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
do_direct_update = FALSE;
|
||||
#endif
|
||||
if ((error_num = index_handler_init()))
|
||||
DBUG_RETURN(check_error_mode_eof(error_num));
|
||||
if (is_clone)
|
||||
|
@ -2929,9 +2874,7 @@ int ha_spider::index_last_internal(
|
|||
my_error(ER_QUERY_INTERRUPTED, MYF(0));
|
||||
DBUG_RETURN(ER_QUERY_INTERRUPTED);
|
||||
}
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
do_direct_update = FALSE;
|
||||
#endif
|
||||
if ((error_num = index_handler_init()))
|
||||
DBUG_RETURN(check_error_mode_eof(error_num));
|
||||
if (is_clone)
|
||||
|
@ -3356,9 +3299,7 @@ int ha_spider::read_range_first_internal(
|
|||
my_error(ER_QUERY_INTERRUPTED, MYF(0));
|
||||
DBUG_RETURN(ER_QUERY_INTERRUPTED);
|
||||
}
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
do_direct_update = FALSE;
|
||||
#endif
|
||||
if (
|
||||
start_key &&
|
||||
start_key->flag >= HA_READ_MBR_CONTAIN &&
|
||||
|
@ -3944,9 +3885,7 @@ int ha_spider::read_multi_range_first_internal(
|
|||
my_error(ER_QUERY_INTERRUPTED, MYF(0));
|
||||
DBUG_RETURN(ER_QUERY_INTERRUPTED);
|
||||
}
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
do_direct_update = FALSE;
|
||||
#endif
|
||||
if ((error_num = index_handler_init()))
|
||||
DBUG_RETURN(check_error_mode_eof(error_num));
|
||||
if (is_clone)
|
||||
|
@ -4830,10 +4769,8 @@ int ha_spider::read_multi_range_first_internal(
|
|||
DBUG_RETURN(error_num);
|
||||
result_list.use_union = TRUE;
|
||||
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
bool direct_aggregate_backup = result_list.direct_aggregate;
|
||||
result_list.direct_aggregate = FALSE;
|
||||
#endif
|
||||
if (result_list.direct_order_limit)
|
||||
{
|
||||
if ((error_num =
|
||||
|
@ -4845,9 +4782,7 @@ int ha_spider::read_multi_range_first_internal(
|
|||
NULL, 0, SPIDER_SQL_TYPE_SELECT_SQL)))
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
result_list.direct_aggregate = direct_aggregate_backup;
|
||||
#endif
|
||||
if ((error_num = append_limit_sql_part(
|
||||
result_list.internal_offset,
|
||||
result_list.limit_num,
|
||||
|
@ -6245,10 +6180,8 @@ int ha_spider::read_multi_range_next(
|
|||
DBUG_RETURN(error_num);
|
||||
result_list.use_union = TRUE;
|
||||
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
bool direct_aggregate_backup = result_list.direct_aggregate;
|
||||
result_list.direct_aggregate = FALSE;
|
||||
#endif
|
||||
if (result_list.direct_order_limit)
|
||||
{
|
||||
if ((error_num =
|
||||
|
@ -6260,9 +6193,7 @@ int ha_spider::read_multi_range_next(
|
|||
NULL, 0, SPIDER_SQL_TYPE_SELECT_SQL)))
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
result_list.direct_aggregate = direct_aggregate_backup;
|
||||
#endif
|
||||
if ((error_num = append_limit_sql_part(
|
||||
result_list.internal_offset,
|
||||
result_list.limit_num,
|
||||
|
@ -6818,9 +6749,7 @@ int ha_spider::rnd_next_internal(
|
|||
/* do not copy table data at alter table */
|
||||
if (wide_handler->sql_command == SQLCOM_ALTER_TABLE)
|
||||
DBUG_RETURN(HA_ERR_END_OF_FILE);
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
do_direct_update = FALSE;
|
||||
#endif
|
||||
|
||||
if (rnd_scan_and_first)
|
||||
{
|
||||
|
@ -6892,14 +6821,12 @@ int ha_spider::rnd_next_internal(
|
|||
NULL, 0, SPIDER_SQL_TYPE_SELECT_SQL)))
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
else if (result_list.direct_aggregate)
|
||||
{
|
||||
if ((error_num =
|
||||
append_group_by_sql_part(NULL, 0, SPIDER_SQL_TYPE_SELECT_SQL)))
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
#endif
|
||||
result_list.desc_flg = FALSE;
|
||||
result_list.sorted = FALSE;
|
||||
result_list.key_info = NULL;
|
||||
|
@ -7524,14 +7451,12 @@ int ha_spider::ft_read_internal(
|
|||
SPIDER_SQL_TYPE_SELECT_SQL)))
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
else if (result_list.direct_aggregate)
|
||||
{
|
||||
if ((error_num =
|
||||
append_group_by_sql_part(NULL, 0, SPIDER_SQL_TYPE_SELECT_SQL)))
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
#endif
|
||||
if (sql_kinds & SPIDER_SQL_KIND_SQL)
|
||||
{
|
||||
if ((error_num = append_limit_sql_part(
|
||||
|
@ -7812,9 +7737,7 @@ int ha_spider::info(
|
|||
DBUG_ENTER("ha_spider::info");
|
||||
DBUG_PRINT("info",("spider this=%p", this));
|
||||
DBUG_PRINT("info",("spider flag=%x", flag));
|
||||
#ifdef HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT
|
||||
auto_inc_temporary = FALSE;
|
||||
#endif
|
||||
wide_handler->sql_command = thd_sql_command(thd);
|
||||
/*
|
||||
if (
|
||||
|
@ -7830,9 +7753,7 @@ int ha_spider::info(
|
|||
share->lgtm_tblhnd_share->auto_increment_value;
|
||||
else {
|
||||
stats.auto_increment_value = 1;
|
||||
#ifdef HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT
|
||||
auto_inc_temporary = TRUE;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
if (
|
||||
|
@ -7857,9 +7778,7 @@ int ha_spider::info(
|
|||
{
|
||||
tmp_auto_increment_mode = spider_param_auto_increment_mode(thd,
|
||||
share->auto_increment_mode);
|
||||
#ifdef HANDLER_HAS_NEED_INFO_FOR_AUTO_INC
|
||||
info_auto_called = TRUE;
|
||||
#endif
|
||||
}
|
||||
if (!share->sts_init)
|
||||
{
|
||||
|
@ -8107,9 +8026,7 @@ int ha_spider::info(
|
|||
}
|
||||
if (flag & HA_STATUS_AUTO)
|
||||
{
|
||||
#ifdef HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT
|
||||
auto_inc_temporary = FALSE;
|
||||
#endif
|
||||
if (share->wide_share && table->next_number_field)
|
||||
{
|
||||
ulonglong first_value, nb_reserved_values;
|
||||
|
@ -8714,7 +8631,6 @@ ha_rows ha_spider::records()
|
|||
DBUG_RETURN(table_rows);
|
||||
}
|
||||
|
||||
#ifdef HA_HAS_CHECKSUM_EXTENDED
|
||||
int ha_spider::pre_calculate_checksum()
|
||||
{
|
||||
int error_num;
|
||||
|
@ -8792,7 +8708,6 @@ int ha_spider::calculate_checksum()
|
|||
}
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
const char *ha_spider::table_type() const
|
||||
{
|
||||
|
@ -8953,7 +8868,6 @@ uint8 ha_spider::table_cache_type()
|
|||
DBUG_RETURN(HA_CACHE_TBL_NOCACHE);
|
||||
}
|
||||
|
||||
#ifdef HANDLER_HAS_NEED_INFO_FOR_AUTO_INC
|
||||
bool ha_spider::need_info_for_auto_inc()
|
||||
{
|
||||
THD *thd = ha_thd();
|
||||
|
@ -8974,9 +8888,7 @@ bool ha_spider::need_info_for_auto_inc()
|
|||
)
|
||||
));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT
|
||||
bool ha_spider::can_use_for_auto_inc_init()
|
||||
{
|
||||
DBUG_ENTER("ha_spider::can_use_for_auto_inc_init");
|
||||
|
@ -8988,7 +8900,6 @@ bool ha_spider::can_use_for_auto_inc_init()
|
|||
!auto_inc_temporary
|
||||
));
|
||||
}
|
||||
#endif
|
||||
|
||||
int ha_spider::update_auto_increment()
|
||||
{
|
||||
|
@ -9131,16 +9042,10 @@ void ha_spider::release_auto_increment()
|
|||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
#ifdef SPIDER_HANDLER_START_BULK_INSERT_HAS_FLAGS
|
||||
void ha_spider::start_bulk_insert(
|
||||
ha_rows rows,
|
||||
uint flags
|
||||
)
|
||||
#else
|
||||
void ha_spider::start_bulk_insert(
|
||||
ha_rows rows
|
||||
)
|
||||
#endif
|
||||
{
|
||||
DBUG_ENTER("ha_spider::start_bulk_insert");
|
||||
DBUG_PRINT("info",("spider this=%p", this));
|
||||
|
@ -9283,12 +9188,8 @@ int ha_spider::write_row(
|
|||
DBUG_RETURN(check_error_mode(error_num));
|
||||
if (bulk_insert)
|
||||
bulk_size =
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
(wide_handler->insert_with_update &&
|
||||
!result_list.insert_dup_update_pushdown) ||
|
||||
#else
|
||||
wide_handler->insert_with_update ||
|
||||
#endif
|
||||
(!direct_dup_insert && wide_handler->ignore_dup_key) ?
|
||||
0 : spider_param_bulk_size(wide_handler->trx->thd, share->bulk_size);
|
||||
else
|
||||
|
@ -9327,7 +9228,6 @@ int ha_spider::pre_write_row(
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
void ha_spider::direct_update_init(
|
||||
THD *thd,
|
||||
bool hs_request
|
||||
|
@ -9337,7 +9237,6 @@ void ha_spider::direct_update_init(
|
|||
do_direct_update = TRUE;
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool ha_spider::start_bulk_update(
|
||||
) {
|
||||
|
@ -9373,19 +9272,11 @@ int ha_spider::end_bulk_update(
|
|||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
#ifdef SPIDER_UPDATE_ROW_HAS_CONST_NEW_DATA
|
||||
int ha_spider::bulk_update_row(
|
||||
const uchar *old_data,
|
||||
const uchar *new_data,
|
||||
ha_rows *dup_key_found
|
||||
)
|
||||
#else
|
||||
int ha_spider::bulk_update_row(
|
||||
const uchar *old_data,
|
||||
uchar *new_data,
|
||||
ha_rows *dup_key_found
|
||||
)
|
||||
#endif
|
||||
{
|
||||
DBUG_ENTER("ha_spider::bulk_update_row");
|
||||
DBUG_PRINT("info",("spider this=%p", this));
|
||||
|
@ -9393,17 +9284,10 @@ int ha_spider::bulk_update_row(
|
|||
DBUG_RETURN(update_row(old_data, new_data));
|
||||
}
|
||||
|
||||
#ifdef SPIDER_UPDATE_ROW_HAS_CONST_NEW_DATA
|
||||
int ha_spider::update_row(
|
||||
const uchar *old_data,
|
||||
const uchar *new_data
|
||||
)
|
||||
#else
|
||||
int ha_spider::update_row(
|
||||
const uchar *old_data,
|
||||
uchar *new_data
|
||||
)
|
||||
#endif
|
||||
{
|
||||
int error_num;
|
||||
THD *thd = ha_thd();
|
||||
|
@ -9433,9 +9317,7 @@ int ha_spider::update_row(
|
|||
#ifndef SPIDER_WITHOUT_HA_STATISTIC_INCREMENT
|
||||
ha_statistic_increment(&SSV::ha_update_count);
|
||||
#endif
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
do_direct_update = FALSE;
|
||||
#endif
|
||||
if ((error_num = spider_db_update(this, table, old_data)))
|
||||
DBUG_RETURN(check_error_mode(error_num));
|
||||
if (table->found_next_number_field &&
|
||||
|
@ -9479,7 +9361,6 @@ int ha_spider::update_row(
|
|||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
bool ha_spider::check_direct_update_sql_part(
|
||||
st_select_lex *select_lex,
|
||||
longlong select_limit,
|
||||
|
@ -9503,7 +9384,6 @@ bool ha_spider::check_direct_update_sql_part(
|
|||
}
|
||||
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
|
||||
#ifdef SPIDER_MDEV_16246
|
||||
int ha_spider::direct_update_rows_init(
|
||||
List<Item> *update_fields,
|
||||
uint mode,
|
||||
|
@ -9512,15 +9392,6 @@ int ha_spider::direct_update_rows_init(
|
|||
bool sorted,
|
||||
uchar *new_data
|
||||
)
|
||||
#else
|
||||
int ha_spider::direct_update_rows_init(
|
||||
uint mode,
|
||||
KEY_MULTI_RANGE *ranges,
|
||||
uint range_count,
|
||||
bool sorted,
|
||||
uchar *new_data
|
||||
)
|
||||
#endif
|
||||
{
|
||||
st_select_lex *select_lex;
|
||||
longlong select_limit;
|
||||
|
@ -9545,13 +9416,8 @@ int ha_spider::direct_update_rows_init(
|
|||
pre_direct_init_result));
|
||||
DBUG_RETURN(pre_direct_init_result);
|
||||
}
|
||||
#ifdef SPIDER_MDEV_16246
|
||||
DBUG_RETURN(bulk_access_link_exec_tgt->spider->direct_update_rows_init(
|
||||
update_fields, mode, ranges, range_count, sorted, new_data));
|
||||
#else
|
||||
DBUG_RETURN(bulk_access_link_exec_tgt->spider->direct_update_rows_init(
|
||||
mode, ranges, range_count, sorted, new_data));
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
if (!dml_inited)
|
||||
|
@ -9628,7 +9494,6 @@ int ha_spider::direct_update_rows_init(
|
|||
DBUG_RETURN(HA_ERR_WRONG_COMMAND);
|
||||
}
|
||||
#else
|
||||
#ifdef SPIDER_MDEV_16246
|
||||
/**
|
||||
Perform initialization for a direct update request.
|
||||
|
||||
|
@ -9641,9 +9506,6 @@ int ha_spider::direct_update_rows_init(
|
|||
int ha_spider::direct_update_rows_init(
|
||||
List<Item> *update_fields
|
||||
)
|
||||
#else
|
||||
int ha_spider::direct_update_rows_init()
|
||||
#endif
|
||||
{
|
||||
st_select_lex *select_lex;
|
||||
longlong select_limit;
|
||||
|
@ -9692,12 +9554,8 @@ int ha_spider::direct_update_rows_init()
|
|||
pre_direct_init_result));
|
||||
DBUG_RETURN(pre_direct_init_result);
|
||||
}
|
||||
#ifdef SPIDER_MDEV_16246
|
||||
DBUG_RETURN(bulk_access_link_exec_tgt->spider->
|
||||
direct_update_rows_init(update_fields));
|
||||
#else
|
||||
DBUG_RETURN(bulk_access_link_exec_tgt->spider->direct_update_rows_init());
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
if (!dml_inited)
|
||||
|
@ -9772,7 +9630,6 @@ int ha_spider::direct_update_rows_init()
|
|||
|
||||
#ifdef HA_CAN_BULK_ACCESS
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
|
||||
#ifdef SPIDER_MDEV_16246
|
||||
int ha_spider::pre_direct_update_rows_init(
|
||||
List<Item> *update_fields,
|
||||
uint mode,
|
||||
|
@ -9781,30 +9638,15 @@ int ha_spider::pre_direct_update_rows_init(
|
|||
bool sorted,
|
||||
uchar *new_data
|
||||
)
|
||||
#else
|
||||
int ha_spider::pre_direct_update_rows_init(
|
||||
uint mode,
|
||||
KEY_MULTI_RANGE *ranges,
|
||||
uint range_count,
|
||||
bool sorted,
|
||||
uchar *new_data
|
||||
)
|
||||
#endif
|
||||
{
|
||||
int error_num;
|
||||
DBUG_ENTER("ha_spider::pre_direct_update_rows_init");
|
||||
DBUG_PRINT("info",("spider this=%p", this));
|
||||
if (bulk_access_started)
|
||||
{
|
||||
#ifdef SPIDER_MDEV_16246
|
||||
error_num = bulk_access_link_current->spider->
|
||||
pre_direct_update_rows_init(
|
||||
update_fields, mode, ranges, range_count, sorted, new_data);
|
||||
#else
|
||||
error_num = bulk_access_link_current->spider->
|
||||
pre_direct_update_rows_init(
|
||||
mode, ranges, range_count, sorted, new_data);
|
||||
#endif
|
||||
bulk_access_link_current->spider->bulk_access_pre_called = TRUE;
|
||||
bulk_access_link_current->called = TRUE;
|
||||
DBUG_RETURN(error_num);
|
||||
|
@ -9816,17 +9658,11 @@ int ha_spider::pre_direct_update_rows_init(
|
|||
DBUG_RETURN(error_num);
|
||||
}
|
||||
}
|
||||
#ifdef SPIDER_MDEV_16246
|
||||
pre_direct_init_result = direct_update_rows_init(
|
||||
update_fields, mode, ranges, range_count, sorted, new_data);
|
||||
#else
|
||||
pre_direct_init_result = direct_update_rows_init(
|
||||
mode, ranges, range_count, sorted, new_data);
|
||||
#endif
|
||||
DBUG_RETURN(pre_direct_init_result);
|
||||
}
|
||||
#else
|
||||
#ifdef SPIDER_MDEV_16246
|
||||
/**
|
||||
Do initialization for performing parallel direct update
|
||||
for a handlersocket update request.
|
||||
|
@ -9840,22 +9676,14 @@ int ha_spider::pre_direct_update_rows_init(
|
|||
int ha_spider::pre_direct_update_rows_init(
|
||||
List<Item> *update_fields
|
||||
)
|
||||
#else
|
||||
int ha_spider::pre_direct_update_rows_init()
|
||||
#endif
|
||||
{
|
||||
int error_num;
|
||||
DBUG_ENTER("ha_spider::pre_direct_update_rows_init");
|
||||
DBUG_PRINT("info",("spider this=%p", this));
|
||||
if (bulk_access_started)
|
||||
{
|
||||
#ifdef SPIDER_MDEV_16246
|
||||
error_num = bulk_access_link_current->spider->
|
||||
pre_direct_update_rows_init(update_fields);
|
||||
#else
|
||||
error_num = bulk_access_link_current->spider->
|
||||
pre_direct_update_rows_init();
|
||||
#endif
|
||||
bulk_access_link_current->spider->bulk_access_pre_called = TRUE;
|
||||
bulk_access_link_current->called = TRUE;
|
||||
DBUG_RETURN(error_num);
|
||||
|
@ -9867,11 +9695,7 @@ int ha_spider::pre_direct_update_rows_init()
|
|||
DBUG_RETURN(error_num);
|
||||
}
|
||||
}
|
||||
#ifdef SPIDER_MDEV_16246
|
||||
pre_direct_init_result = direct_update_rows_init(update_fields);
|
||||
#else
|
||||
pre_direct_init_result = direct_update_rows_init();
|
||||
#endif
|
||||
DBUG_RETURN(pre_direct_init_result);
|
||||
}
|
||||
#endif
|
||||
|
@ -10015,7 +9839,6 @@ int ha_spider::pre_direct_update_rows()
|
|||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
bool ha_spider::start_bulk_delete(
|
||||
) {
|
||||
|
@ -10065,15 +9888,12 @@ int ha_spider::delete_row(
|
|||
#ifndef SPIDER_WITHOUT_HA_STATISTIC_INCREMENT
|
||||
ha_statistic_increment(&SSV::ha_delete_count);
|
||||
#endif
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
do_direct_update = FALSE;
|
||||
#endif
|
||||
if ((error_num = spider_db_delete(this, table, buf)))
|
||||
DBUG_RETURN(check_error_mode(error_num));
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
bool ha_spider::check_direct_delete_sql_part(
|
||||
st_select_lex *select_lex,
|
||||
longlong select_limit,
|
||||
|
@ -10460,7 +10280,6 @@ int ha_spider::pre_direct_delete_rows()
|
|||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
int ha_spider::delete_all_rows()
|
||||
{
|
||||
|
@ -10489,9 +10308,7 @@ int ha_spider::truncate()
|
|||
{
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
do_direct_update = FALSE;
|
||||
#endif
|
||||
sql_kinds = SPIDER_SQL_KIND_SQL;
|
||||
for (roop_count = 0; roop_count < (int) share->link_count; roop_count++)
|
||||
sql_kind[roop_count] = SPIDER_SQL_KIND_SQL;
|
||||
|
@ -10706,16 +10523,11 @@ int ha_spider::create(
|
|||
memset((void*)&tmp_share, 0, sizeof(SPIDER_SHARE));
|
||||
tmp_share.table_name = (char*) name;
|
||||
tmp_share.table_name_length = strlen(name);
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
tmp_share.table_name_hash_value = my_calc_hash(&trx->trx_alter_table_hash,
|
||||
(uchar*) tmp_share.table_name, tmp_share.table_name_length);
|
||||
tmp_share.lgtm_tblhnd_share = spider_get_lgtm_tblhnd_share(
|
||||
name, tmp_share.table_name_length, tmp_share.table_name_hash_value,
|
||||
FALSE, TRUE, &error_num);
|
||||
#else
|
||||
tmp_share.lgtm_tblhnd_share = spider_get_lgtm_tblhnd_share(
|
||||
name, tmp_share.table_name_length, FALSE, TRUE, &error_num);
|
||||
#endif
|
||||
if (!tmp_share.lgtm_tblhnd_share)
|
||||
{
|
||||
goto error;
|
||||
|
@ -10759,7 +10571,6 @@ int ha_spider::create(
|
|||
) {
|
||||
goto error;
|
||||
}
|
||||
#ifdef SPIDER_SUPPORT_CREATE_OR_REPLACE_TABLE
|
||||
if (
|
||||
thd->lex->create_info.or_replace() &&
|
||||
(error_num = spider_delete_tables(
|
||||
|
@ -10770,7 +10581,6 @@ int ha_spider::create(
|
|||
) {
|
||||
goto error;
|
||||
}
|
||||
#endif
|
||||
if (
|
||||
(error_num = spider_insert_tables(table_tables, &tmp_share))
|
||||
) {
|
||||
|
@ -10788,16 +10598,10 @@ int ha_spider::create(
|
|||
spider_free_trx_alter_table(trx);
|
||||
trx->query_id = thd->query_id;
|
||||
}
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
if (!(alter_table =
|
||||
(SPIDER_ALTER_TABLE*) my_hash_search_using_hash_value(
|
||||
&trx->trx_alter_table_hash, tmp_share.table_name_hash_value,
|
||||
(uchar*) tmp_share.table_name, tmp_share.table_name_length)))
|
||||
#else
|
||||
if (!(alter_table =
|
||||
(SPIDER_ALTER_TABLE*) my_hash_search(&trx->trx_alter_table_hash,
|
||||
(uchar*) tmp_share.table_name, tmp_share.table_name_length)))
|
||||
#endif
|
||||
{
|
||||
if ((error_num = spider_create_trx_alter_table(trx, &tmp_share, TRUE)))
|
||||
goto error;
|
||||
|
@ -10922,12 +10726,10 @@ int ha_spider::rename_table(
|
|||
) {
|
||||
int error_num, roop_count, old_link_count, from_len = strlen(from),
|
||||
to_len = strlen(to), tmp_error_num;
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
my_hash_value_type from_hash_value = my_calc_hash(&spider_open_tables,
|
||||
(uchar*) from, from_len);
|
||||
my_hash_value_type to_hash_value = my_calc_hash(&spider_open_tables,
|
||||
(uchar*) to, to_len);
|
||||
#endif
|
||||
THD *thd = ha_thd();
|
||||
uint sql_command = thd_sql_command(thd);
|
||||
SPIDER_TRX *trx;
|
||||
|
@ -11095,22 +10897,12 @@ int ha_spider::rename_table(
|
|||
}
|
||||
|
||||
pthread_mutex_lock(&spider_lgtm_tblhnd_share_mutex);
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
from_lgtm_tblhnd_share = spider_get_lgtm_tblhnd_share(
|
||||
from, from_len, from_hash_value, TRUE, FALSE, &error_num);
|
||||
#else
|
||||
from_lgtm_tblhnd_share = spider_get_lgtm_tblhnd_share(
|
||||
from, from_len, TRUE, FALSE, &error_num);
|
||||
#endif
|
||||
if (from_lgtm_tblhnd_share)
|
||||
{
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
to_lgtm_tblhnd_share = spider_get_lgtm_tblhnd_share(
|
||||
to, to_len, to_hash_value, TRUE, TRUE, &error_num);
|
||||
#else
|
||||
to_lgtm_tblhnd_share = spider_get_lgtm_tblhnd_share(
|
||||
to, to_len, TRUE, TRUE, &error_num);
|
||||
#endif
|
||||
if (!to_lgtm_tblhnd_share)
|
||||
{
|
||||
pthread_mutex_unlock(&spider_lgtm_tblhnd_share_mutex);
|
||||
|
@ -11136,13 +10928,8 @@ error:
|
|||
spider_close_sys_table(current_thd, table_tables,
|
||||
&open_tables_backup, need_lock);
|
||||
pthread_mutex_lock(&spider_lgtm_tblhnd_share_mutex);
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
to_lgtm_tblhnd_share = spider_get_lgtm_tblhnd_share(
|
||||
to, to_len, to_hash_value, TRUE, FALSE, &tmp_error_num);
|
||||
#else
|
||||
to_lgtm_tblhnd_share = spider_get_lgtm_tblhnd_share(
|
||||
to, to_len, TRUE, FALSE, &tmp_error_num);
|
||||
#endif
|
||||
if (to_lgtm_tblhnd_share)
|
||||
spider_free_lgtm_tblhnd_share_alloc(to_lgtm_tblhnd_share, TRUE);
|
||||
pthread_mutex_unlock(&spider_lgtm_tblhnd_share_mutex);
|
||||
|
@ -11190,22 +10977,14 @@ int ha_spider::delete_table(
|
|||
{
|
||||
SPIDER_LGTM_TBLHND_SHARE *lgtm_tblhnd_share;
|
||||
int roop_count, old_link_count = 0, name_len = strlen(name);
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
my_hash_value_type hash_value = my_calc_hash(&spider_open_tables,
|
||||
(uchar*) name, name_len);
|
||||
#endif
|
||||
if (
|
||||
sql_command == SQLCOM_ALTER_TABLE &&
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
(alter_table =
|
||||
(SPIDER_ALTER_TABLE*) my_hash_search_using_hash_value(
|
||||
&trx->trx_alter_table_hash,
|
||||
hash_value, (uchar*) name, name_len)) &&
|
||||
#else
|
||||
(alter_table =
|
||||
(SPIDER_ALTER_TABLE*) my_hash_search(&trx->trx_alter_table_hash,
|
||||
(uchar*) name, name_len)) &&
|
||||
#endif
|
||||
alter_table->now_create
|
||||
)
|
||||
DBUG_RETURN(0);
|
||||
|
@ -11256,13 +11035,8 @@ int ha_spider::delete_table(
|
|||
}
|
||||
|
||||
pthread_mutex_lock(&spider_lgtm_tblhnd_share_mutex);
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
lgtm_tblhnd_share = spider_get_lgtm_tblhnd_share(
|
||||
name, name_len, hash_value, TRUE, FALSE, &error_num);
|
||||
#else
|
||||
lgtm_tblhnd_share = spider_get_lgtm_tblhnd_share(
|
||||
name, name_len, TRUE, FALSE, &error_num);
|
||||
#endif
|
||||
if (lgtm_tblhnd_share)
|
||||
spider_free_lgtm_tblhnd_share_alloc(lgtm_tblhnd_share, TRUE);
|
||||
pthread_mutex_unlock(&spider_lgtm_tblhnd_share_mutex);
|
||||
|
@ -11504,8 +11278,6 @@ int ha_spider::info_push(
|
|||
#endif
|
||||
#ifdef HA_CAN_BULK_ACCESS
|
||||
if (
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
#endif
|
||||
info_type != INFO_KIND_BULK_ACCESS_BEGIN &&
|
||||
info_type != INFO_KIND_BULK_ACCESS_CURRENT &&
|
||||
info_type != INFO_KIND_BULK_ACCESS_END
|
||||
|
@ -11527,10 +11299,8 @@ int ha_spider::info_push(
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(HANDLER_HAS_DIRECT_UPDATE_ROWS) || defined(HA_CAN_BULK_ACCESS)
|
||||
switch (info_type)
|
||||
{
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
#ifdef INFO_KIND_UPDATE_FIELDS
|
||||
case INFO_KIND_UPDATE_FIELDS:
|
||||
DBUG_PRINT("info",("spider INFO_KIND_UPDATE_FIELDS"));
|
||||
|
@ -11558,7 +11328,6 @@ int ha_spider::info_push(
|
|||
wide_handler->info_limit = 9223372036854775807LL;
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
#ifdef HA_CAN_BULK_ACCESS
|
||||
case INFO_KIND_BULK_ACCESS_BEGIN:
|
||||
DBUG_PRINT("info",("spider INFO_KIND_BULK_ACCESS_BEGIN"));
|
||||
|
@ -11621,11 +11390,9 @@ int ha_spider::info_push(
|
|||
default:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
void ha_spider::return_record_by_parent()
|
||||
{
|
||||
DBUG_ENTER("ha_spider::return_record_by_parent");
|
||||
|
@ -11633,7 +11400,6 @@ void ha_spider::return_record_by_parent()
|
|||
spider_db_refetch_for_item_sum_funcs(this);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
#endif
|
||||
|
||||
TABLE *ha_spider::get_table()
|
||||
{
|
||||
|
@ -12430,9 +12196,7 @@ int ha_spider::index_handler_init()
|
|||
roop_end = search_link_idx + 1;
|
||||
}
|
||||
sql_kinds = 0;
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
direct_update_kinds = 0;
|
||||
#endif
|
||||
for (roop_count = roop_start; roop_count < roop_end;
|
||||
roop_count = spider_conn_link_idx_next(share->link_statuses,
|
||||
conn_link_idx, roop_count, share->link_count,
|
||||
|
@ -12518,9 +12282,7 @@ int ha_spider::rnd_handler_init()
|
|||
roop_end = search_link_idx + 1;
|
||||
}
|
||||
sql_kinds = 0;
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
direct_update_kinds = 0;
|
||||
#endif
|
||||
for (roop_count = roop_start; roop_count < roop_end;
|
||||
roop_count = spider_conn_link_idx_next(share->link_statuses,
|
||||
conn_link_idx, roop_count, share->link_count,
|
||||
|
@ -12712,11 +12474,7 @@ void ha_spider::check_pre_call(
|
|||
) ||
|
||||
(
|
||||
(skip_parallel_search & 2) &&
|
||||
#ifdef SPIDER_SQL_CACHE_IS_IN_LEX
|
||||
lex->sql_cache == LEX::SQL_NO_CACHE // for mysqldump
|
||||
#else
|
||||
select_lex && select_lex->sql_cache == SELECT_LEX::SQL_NO_CACHE // for mysqldump
|
||||
#endif
|
||||
)
|
||||
) {
|
||||
use_pre_call = FALSE;
|
||||
|
@ -12746,7 +12504,6 @@ void ha_spider::check_pre_call(
|
|||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
void ha_spider::check_insert_dup_update_pushdown()
|
||||
{
|
||||
THD *thd = wide_handler->trx->thd;
|
||||
|
@ -12765,7 +12522,6 @@ void ha_spider::check_insert_dup_update_pushdown()
|
|||
}
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HA_CAN_BULK_ACCESS
|
||||
SPIDER_BULK_ACCESS_LINK *ha_spider::create_bulk_access_link()
|
||||
|
@ -12899,8 +12655,6 @@ int ha_spider::sync_from_clone_source(
|
|||
external_lock_cnt = spider->external_lock_cnt;
|
||||
}
|
||||
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
#endif
|
||||
DBUG_PRINT("info",("spider bulk_access_link->spider->dbton_handler=%p",
|
||||
dbton_handler));
|
||||
DBUG_PRINT("info",("spider ptr bulk_access_link->spider->dbton_handler=%p",
|
||||
|
@ -13183,7 +12937,6 @@ int ha_spider::append_update_set_sql_part()
|
|||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
int ha_spider::append_direct_update_set_sql_part()
|
||||
{
|
||||
int error_num;
|
||||
|
@ -13204,9 +12957,7 @@ int ha_spider::append_direct_update_set_sql_part()
|
|||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
int ha_spider::append_dup_update_pushdown_sql_part(
|
||||
const char *alias,
|
||||
uint alias_length
|
||||
|
@ -13272,7 +13023,6 @@ int ha_spider::check_update_columns_sql_part()
|
|||
}
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
int ha_spider::append_delete_sql_part()
|
||||
{
|
||||
|
@ -13681,7 +13431,6 @@ int ha_spider::append_condition_sql_part(
|
|||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
int ha_spider::append_sum_select_sql_part(
|
||||
ulong sql_type,
|
||||
const char *alias,
|
||||
|
@ -13705,7 +13454,6 @@ int ha_spider::append_sum_select_sql_part(
|
|||
}
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
int ha_spider::append_match_select_sql_part(
|
||||
ulong sql_type,
|
||||
|
@ -13763,7 +13511,6 @@ void ha_spider::set_order_to_pos_sql(
|
|||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
int ha_spider::append_group_by_sql_part(
|
||||
const char *alias,
|
||||
uint alias_length,
|
||||
|
@ -13787,7 +13534,6 @@ int ha_spider::append_group_by_sql_part(
|
|||
}
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
int ha_spider::append_key_order_for_merge_with_alias_sql_part(
|
||||
const char *alias,
|
||||
|
@ -13798,7 +13544,6 @@ int ha_spider::append_key_order_for_merge_with_alias_sql_part(
|
|||
uint roop_count, dbton_id;
|
||||
spider_db_handler *dbton_hdl;
|
||||
DBUG_ENTER("ha_spider::append_key_order_for_merge_with_alias_sql_part");
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
if (result_list.direct_aggregate)
|
||||
{
|
||||
st_select_lex *select_lex = spider_get_select_lex(this);
|
||||
|
@ -13809,7 +13554,6 @@ int ha_spider::append_key_order_for_merge_with_alias_sql_part(
|
|||
DBUG_RETURN(0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
for (roop_count = 0; roop_count < share->use_sql_dbton_count; roop_count++)
|
||||
{
|
||||
dbton_id = share->use_sql_dbton_ids[roop_count];
|
||||
|
@ -13859,7 +13603,6 @@ int ha_spider::append_key_order_with_alias_sql_part(
|
|||
uint roop_count, dbton_id;
|
||||
spider_db_handler *dbton_hdl;
|
||||
DBUG_ENTER("ha_spider::append_key_order_with_alias_sql_part");
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
if (result_list.direct_aggregate)
|
||||
{
|
||||
st_select_lex *select_lex = spider_get_select_lex(this);
|
||||
|
@ -13870,7 +13613,6 @@ int ha_spider::append_key_order_with_alias_sql_part(
|
|||
DBUG_RETURN(0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
for (roop_count = 0; roop_count < share->use_sql_dbton_count; roop_count++)
|
||||
{
|
||||
dbton_id = share->use_sql_dbton_ids[roop_count];
|
||||
|
@ -15081,12 +14823,10 @@ int ha_spider::dml_init()
|
|||
conns[roop_count]->semi_trx_isolation = -1;
|
||||
}
|
||||
}
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
if (wide_handler->insert_with_update)
|
||||
{
|
||||
check_insert_dup_update_pushdown();
|
||||
}
|
||||
#endif
|
||||
dml_inited = TRUE;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
|
|
@ -147,12 +147,8 @@ public:
|
|||
bool use_pre_action;
|
||||
bool pre_bitmap_checked;
|
||||
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= 0;
|
||||
int direct_dup_insert;
|
||||
int store_error_num;
|
||||
|
@ -175,21 +171,15 @@ public:
|
|||
corresponding m_handler_cid is t00003
|
||||
*/
|
||||
char **m_handler_cid;
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
bool do_direct_update;
|
||||
uint direct_update_kinds;
|
||||
#endif
|
||||
spider_index_rnd_init prev_index_rnd_init;
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
SPIDER_ITEM_HLD *direct_aggregate_item_first;
|
||||
SPIDER_ITEM_HLD *direct_aggregate_item_current;
|
||||
#endif
|
||||
ha_rows table_rows;
|
||||
#ifdef HA_HAS_CHECKSUM_EXTENDED
|
||||
ha_checksum checksum_val;
|
||||
bool checksum_null;
|
||||
uint action_flags;
|
||||
#endif
|
||||
|
||||
/* for fulltext search */
|
||||
bool ft_init_and_first;
|
||||
|
@ -436,10 +426,8 @@ public:
|
|||
int check_crd();
|
||||
int pre_records() override;
|
||||
ha_rows records() override;
|
||||
#ifdef HA_HAS_CHECKSUM_EXTENDED
|
||||
int pre_calculate_checksum() override;
|
||||
int calculate_checksum() override;
|
||||
#endif
|
||||
const char *table_type() const override;
|
||||
ulonglong table_flags() const override;
|
||||
ulong table_flags_for_partition();
|
||||
|
@ -457,12 +445,8 @@ public:
|
|||
uint max_supported_key_length() const override;
|
||||
uint max_supported_key_part_length() const override;
|
||||
uint8 table_cache_type() override;
|
||||
#ifdef HANDLER_HAS_NEED_INFO_FOR_AUTO_INC
|
||||
bool need_info_for_auto_inc() override;
|
||||
#endif
|
||||
#ifdef HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT
|
||||
bool can_use_for_auto_inc_init() override;
|
||||
#endif
|
||||
int update_auto_increment();
|
||||
void get_auto_increment(
|
||||
ulonglong offset,
|
||||
|
@ -475,16 +459,10 @@ public:
|
|||
ulonglong value
|
||||
) override;
|
||||
void release_auto_increment() override;
|
||||
#ifdef SPIDER_HANDLER_START_BULK_INSERT_HAS_FLAGS
|
||||
void start_bulk_insert(
|
||||
ha_rows rows,
|
||||
uint flags
|
||||
) override;
|
||||
#else
|
||||
void start_bulk_insert(
|
||||
ha_rows rows
|
||||
);
|
||||
#endif
|
||||
int end_bulk_insert() override;
|
||||
int write_row(
|
||||
const uchar *buf
|
||||
|
@ -494,18 +472,15 @@ public:
|
|||
uchar *buf
|
||||
);
|
||||
#endif
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
void direct_update_init(
|
||||
THD *thd,
|
||||
bool hs_request
|
||||
);
|
||||
#endif
|
||||
bool start_bulk_update() override;
|
||||
int exec_bulk_update(
|
||||
ha_rows *dup_key_found
|
||||
) override;
|
||||
int end_bulk_update() override;
|
||||
#ifdef SPIDER_UPDATE_ROW_HAS_CONST_NEW_DATA
|
||||
int bulk_update_row(
|
||||
const uchar *old_data,
|
||||
const uchar *new_data,
|
||||
|
@ -515,25 +490,12 @@ public:
|
|||
const uchar *old_data,
|
||||
const uchar *new_data
|
||||
) override;
|
||||
#else
|
||||
int bulk_update_row(
|
||||
const uchar *old_data,
|
||||
uchar *new_data,
|
||||
ha_rows *dup_key_found
|
||||
);
|
||||
int update_row(
|
||||
const uchar *old_data,
|
||||
uchar *new_data
|
||||
);
|
||||
#endif
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
bool check_direct_update_sql_part(
|
||||
st_select_lex *select_lex,
|
||||
longlong select_limit,
|
||||
longlong offset_limit
|
||||
);
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
|
||||
#ifdef SPIDER_MDEV_16246
|
||||
inline int direct_update_rows_init(
|
||||
List<Item> *update_fields
|
||||
) {
|
||||
|
@ -548,30 +510,12 @@ public:
|
|||
uchar *new_data
|
||||
);
|
||||
#else
|
||||
inline int direct_update_rows_init()
|
||||
{
|
||||
return direct_update_rows_init(2, NULL, 0, FALSE, NULL);
|
||||
}
|
||||
int direct_update_rows_init(
|
||||
uint mode,
|
||||
KEY_MULTI_RANGE *ranges,
|
||||
uint range_count,
|
||||
bool sorted,
|
||||
uchar *new_data
|
||||
);
|
||||
#endif
|
||||
#else
|
||||
#ifdef SPIDER_MDEV_16246
|
||||
int direct_update_rows_init(
|
||||
List<Item> *update_fields
|
||||
) override;
|
||||
#else
|
||||
int direct_update_rows_init();
|
||||
#endif
|
||||
#endif
|
||||
#ifdef HA_CAN_BULK_ACCESS
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
|
||||
#ifdef SPIDER_MDEV_16246
|
||||
inline int pre_direct_update_rows_init(
|
||||
List<Item> *update_fields
|
||||
) {
|
||||
|
@ -586,26 +530,9 @@ public:
|
|||
uchar *new_data
|
||||
);
|
||||
#else
|
||||
inline int pre_direct_update_rows_init()
|
||||
{
|
||||
return pre_direct_update_rows_init(2, NULL, 0, FALSE, NULL);
|
||||
}
|
||||
int pre_direct_update_rows_init(
|
||||
uint mode,
|
||||
KEY_MULTI_RANGE *ranges,
|
||||
uint range_count,
|
||||
bool sorted,
|
||||
uchar *new_data
|
||||
);
|
||||
#endif
|
||||
#else
|
||||
#ifdef SPIDER_MDEV_16246
|
||||
int pre_direct_update_rows_init(
|
||||
List<Item> *update_fields
|
||||
);
|
||||
#else
|
||||
int pre_direct_update_rows_init();
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
|
||||
|
@ -648,14 +575,12 @@ public:
|
|||
#else
|
||||
int pre_direct_update_rows();
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
bool start_bulk_delete() override;
|
||||
int end_bulk_delete() override;
|
||||
int delete_row(
|
||||
const uchar *buf
|
||||
) override;
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
bool check_direct_delete_sql_part(
|
||||
st_select_lex *select_lex,
|
||||
longlong select_limit,
|
||||
|
@ -724,7 +649,6 @@ public:
|
|||
#else
|
||||
int pre_direct_delete_rows();
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
int delete_all_rows() override;
|
||||
int truncate() override;
|
||||
|
@ -808,9 +732,7 @@ public:
|
|||
uint info_type,
|
||||
void *info
|
||||
) override;
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
void return_record_by_parent() override;
|
||||
#endif
|
||||
TABLE *get_table();
|
||||
void set_ft_discard_bitmap();
|
||||
void set_searched_bitmap();
|
||||
|
@ -895,9 +817,7 @@ public:
|
|||
void check_pre_call(
|
||||
bool use_parallel
|
||||
);
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
void check_insert_dup_update_pushdown();
|
||||
#endif
|
||||
#ifdef HA_CAN_BULK_ACCESS
|
||||
SPIDER_BULK_ACCESS_LINK *create_bulk_access_link();
|
||||
void delete_bulk_access_link(
|
||||
|
@ -926,10 +846,7 @@ public:
|
|||
int append_insert_sql_part();
|
||||
int append_update_sql_part();
|
||||
int append_update_set_sql_part();
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
int append_direct_update_set_sql_part();
|
||||
#endif
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
int append_dup_update_pushdown_sql_part(
|
||||
const char *alias,
|
||||
uint alias_length
|
||||
|
@ -939,7 +856,6 @@ public:
|
|||
uint alias_length
|
||||
);
|
||||
int check_update_columns_sql_part();
|
||||
#endif
|
||||
int append_delete_sql_part();
|
||||
int append_select_sql_part(
|
||||
ulong sql_type
|
||||
|
@ -1003,13 +919,11 @@ public:
|
|||
ulong sql_type,
|
||||
bool test_flg
|
||||
);
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
int append_sum_select_sql_part(
|
||||
ulong sql_type,
|
||||
const char *alias,
|
||||
uint alias_length
|
||||
);
|
||||
#endif
|
||||
int append_match_select_sql_part(
|
||||
ulong sql_type,
|
||||
const char *alias,
|
||||
|
@ -1021,13 +935,11 @@ 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,
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#define MYSQL_SERVER 1
|
||||
#include <my_global.h>
|
||||
#include "mysql_version.h"
|
||||
#include "spd_environ.h"
|
||||
#include "sql_priv.h"
|
||||
#include "probes_mysql.h"
|
||||
#include "sql_class.h"
|
||||
|
@ -311,12 +310,7 @@ void spider_free_conn_from_trx(
|
|||
if (another)
|
||||
{
|
||||
ha_spider *next_spider;
|
||||
#ifdef HASH_UPDATE_WITH_HASH_VALUE
|
||||
my_hash_delete_with_hash_value(&trx->trx_another_conn_hash,
|
||||
conn->conn_key_hash_value, (uchar*) conn);
|
||||
#else
|
||||
my_hash_delete(&trx->trx_another_conn_hash, (uchar*) conn);
|
||||
#endif
|
||||
spider = (ha_spider*) conn->another_ha_first;
|
||||
while (spider)
|
||||
{
|
||||
|
@ -331,12 +325,7 @@ void spider_free_conn_from_trx(
|
|||
conn->another_ha_first = NULL;
|
||||
conn->another_ha_last = NULL;
|
||||
} else {
|
||||
#ifdef HASH_UPDATE_WITH_HASH_VALUE
|
||||
my_hash_delete_with_hash_value(&trx->trx_conn_hash,
|
||||
conn->conn_key_hash_value, (uchar*) conn);
|
||||
#else
|
||||
my_hash_delete(&trx->trx_conn_hash, (uchar*) conn);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (
|
||||
|
@ -356,12 +345,7 @@ void spider_free_conn_from_trx(
|
|||
} else {
|
||||
pthread_mutex_lock(&spider_conn_mutex);
|
||||
uint old_elements = spider_open_connections.array.max_element;
|
||||
#ifdef HASH_UPDATE_WITH_HASH_VALUE
|
||||
if (my_hash_insert_with_hash_value(&spider_open_connections,
|
||||
conn->conn_key_hash_value, (uchar*) conn))
|
||||
#else
|
||||
if (my_hash_insert(&spider_open_connections, (uchar*) conn))
|
||||
#endif
|
||||
{
|
||||
pthread_mutex_unlock(&spider_conn_mutex);
|
||||
spider_free_conn(conn);
|
||||
|
@ -489,9 +473,7 @@ SPIDER_CONN *spider_create_conn(
|
|||
conn->conn_key = tmp_name;
|
||||
memcpy(conn->conn_key, share->conn_keys[link_idx],
|
||||
share->conn_keys_lengths[link_idx]);
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
conn->conn_key_hash_value = share->conn_keys_hash_value[link_idx];
|
||||
#endif
|
||||
spider_memcpy_or_null(&conn->tgt_host, tmp_host,
|
||||
share->tgt_hosts[link_idx], &conn->tgt_host_length,
|
||||
share->tgt_hosts_lengths[link_idx]);
|
||||
|
@ -610,14 +592,9 @@ SPIDER_CONN *spider_create_conn(
|
|||
pthread_mutex_unlock(&spider_conn_id_mutex);
|
||||
|
||||
pthread_mutex_lock(&spider_ipport_conn_mutex);
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
if ((ip_port_conn = (SPIDER_IP_PORT_CONN*) my_hash_search_using_hash_value(
|
||||
&spider_ipport_conns, conn->conn_key_hash_value,
|
||||
(uchar*)conn->conn_key, conn->conn_key_length)))
|
||||
#else
|
||||
if ((ip_port_conn = (SPIDER_IP_PORT_CONN*) my_hash_search(
|
||||
&spider_ipport_conns, (uchar*)conn->conn_key, conn->conn_key_length)))
|
||||
#endif
|
||||
{ /* exists, +1 */
|
||||
pthread_mutex_unlock(&spider_ipport_conn_mutex);
|
||||
pthread_mutex_lock(&ip_port_conn->mutex);
|
||||
|
@ -690,7 +667,6 @@ SPIDER_CONN *spider_get_conn(
|
|||
#ifdef DBUG_TRACE
|
||||
spider_print_keys(conn_key, share->conn_keys_lengths[link_idx]);
|
||||
#endif
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
if (
|
||||
(another &&
|
||||
!(conn = (SPIDER_CONN*) my_hash_search_using_hash_value(
|
||||
|
@ -703,16 +679,6 @@ SPIDER_CONN *spider_get_conn(
|
|||
share->conn_keys_hash_value[link_idx],
|
||||
(uchar*) conn_key, share->conn_keys_lengths[link_idx])))
|
||||
)
|
||||
#else
|
||||
if (
|
||||
(another &&
|
||||
!(conn = (SPIDER_CONN*) my_hash_search(&trx->trx_another_conn_hash,
|
||||
(uchar*) conn_key, share->conn_keys_lengths[link_idx]))) ||
|
||||
(!another &&
|
||||
!(conn = (SPIDER_CONN*) my_hash_search(&trx->trx_conn_hash,
|
||||
(uchar*) conn_key, share->conn_keys_lengths[link_idx])))
|
||||
)
|
||||
#endif
|
||||
{
|
||||
if (
|
||||
!trx->thd ||
|
||||
|
@ -722,16 +688,10 @@ SPIDER_CONN *spider_get_conn(
|
|||
)
|
||||
) {
|
||||
pthread_mutex_lock(&spider_conn_mutex);
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
if (!(conn = (SPIDER_CONN*) my_hash_search_using_hash_value(
|
||||
&spider_open_connections, share->conn_keys_hash_value[link_idx],
|
||||
(uchar*) share->conn_keys[link_idx],
|
||||
share->conn_keys_lengths[link_idx])))
|
||||
#else
|
||||
if (!(conn = (SPIDER_CONN*) my_hash_search(&spider_open_connections,
|
||||
(uchar*) share->conn_keys[link_idx],
|
||||
share->conn_keys_lengths[link_idx])))
|
||||
#endif
|
||||
{
|
||||
pthread_mutex_unlock(&spider_conn_mutex);
|
||||
if (spider_param_max_connections())
|
||||
|
@ -757,12 +717,7 @@ SPIDER_CONN *spider_get_conn(
|
|||
}
|
||||
}
|
||||
} else {
|
||||
#ifdef HASH_UPDATE_WITH_HASH_VALUE
|
||||
my_hash_delete_with_hash_value(&spider_open_connections,
|
||||
conn->conn_key_hash_value, (uchar*) conn);
|
||||
#else
|
||||
my_hash_delete(&spider_open_connections, (uchar*) conn);
|
||||
#endif
|
||||
pthread_mutex_unlock(&spider_conn_mutex);
|
||||
DBUG_PRINT("info",("spider get global conn"));
|
||||
if (spider)
|
||||
|
@ -792,13 +747,7 @@ SPIDER_CONN *spider_get_conn(
|
|||
if (another)
|
||||
{
|
||||
uint old_elements = trx->trx_another_conn_hash.array.max_element;
|
||||
#ifdef HASH_UPDATE_WITH_HASH_VALUE
|
||||
if (my_hash_insert_with_hash_value(&trx->trx_another_conn_hash,
|
||||
share->conn_keys_hash_value[link_idx],
|
||||
(uchar*) conn))
|
||||
#else
|
||||
if (my_hash_insert(&trx->trx_another_conn_hash, (uchar*) conn))
|
||||
#endif
|
||||
{
|
||||
spider_free_conn(conn);
|
||||
*error_num = HA_ERR_OUT_OF_MEM;
|
||||
|
@ -813,13 +762,7 @@ SPIDER_CONN *spider_get_conn(
|
|||
}
|
||||
} else {
|
||||
uint old_elements = trx->trx_conn_hash.array.max_element;
|
||||
#ifdef HASH_UPDATE_WITH_HASH_VALUE
|
||||
if (my_hash_insert_with_hash_value(&trx->trx_conn_hash,
|
||||
share->conn_keys_hash_value[link_idx],
|
||||
(uchar*) conn))
|
||||
#else
|
||||
if (my_hash_insert(&trx->trx_conn_hash, (uchar*) conn))
|
||||
#endif
|
||||
{
|
||||
spider_free_conn(conn);
|
||||
*error_num = HA_ERR_OUT_OF_MEM;
|
||||
|
@ -963,9 +906,7 @@ int spider_check_and_init_casual_read(
|
|||
(!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])
|
||||
|
@ -1151,16 +1092,10 @@ int spider_conn_queue_and_merge_loop_check(
|
|||
SPIDER_CONN_LOOP_CHECK *lcqptr, *lcrptr;
|
||||
DBUG_ENTER("spider_conn_queue_and_merge_loop_check");
|
||||
DBUG_PRINT("info", ("spider conn=%p", conn));
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
if (!(lcqptr = (SPIDER_CONN_LOOP_CHECK *)
|
||||
my_hash_search_using_hash_value(&conn->loop_check_queue,
|
||||
lcptr->hash_value_to,
|
||||
(uchar *) lcptr->to_name.str, lcptr->to_name.length)))
|
||||
#else
|
||||
if (unlikely(!(lcqptr = (SPIDER_CONN_LOOP_CHECK *) my_hash_search(
|
||||
&conn->loop_check_queue,
|
||||
(uchar *) lcptr->to_name.str, lcptr->to_name.length))))
|
||||
#endif
|
||||
{
|
||||
/*
|
||||
Construct the right hand side:
|
||||
|
@ -1177,12 +1112,7 @@ int spider_conn_queue_and_merge_loop_check(
|
|||
*tmp_name = '-';
|
||||
++tmp_name;
|
||||
memcpy(tmp_name, lcptr->from_value.str, lcptr->from_value.length + 1);
|
||||
#ifdef HASH_UPDATE_WITH_HASH_VALUE
|
||||
if (unlikely(my_hash_insert_with_hash_value(&conn->loop_check_queue,
|
||||
lcptr->hash_value_to, (uchar *) lcptr)))
|
||||
#else
|
||||
if (unlikely(my_hash_insert(&conn->loop_check_queue, (uchar *) lcptr)))
|
||||
#endif
|
||||
{
|
||||
goto error_hash_insert_queue;
|
||||
}
|
||||
|
@ -1207,9 +1137,7 @@ int spider_conn_queue_and_merge_loop_check(
|
|||
TODO: the new lcrptr has the same cur_name, to_name, full_name
|
||||
and from_value as lcqptr, but they do not seem to be relevant.
|
||||
*/
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
lcrptr->hash_value_to = lcqptr->hash_value_to;
|
||||
#endif
|
||||
lcrptr->cur_name.str = cur_name;
|
||||
lcrptr->cur_name.length = lcqptr->cur_name.length;
|
||||
memcpy(cur_name, lcqptr->cur_name.str, lcqptr->cur_name.length + 1);
|
||||
|
@ -1242,33 +1170,16 @@ int spider_conn_queue_and_merge_loop_check(
|
|||
memcpy(merged_value, lcptr->from_value.str, lcptr->from_value.length + 1);
|
||||
|
||||
DBUG_PRINT("info", ("spider free lcqptr"));
|
||||
#ifdef HASH_UPDATE_WITH_HASH_VALUE
|
||||
my_hash_delete_with_hash_value(&conn->loop_checked,
|
||||
lcqptr->hash_value_full, (uchar *) lcqptr);
|
||||
my_hash_delete_with_hash_value(&conn->loop_check_queue,
|
||||
lcqptr->hash_value_to, (uchar *) lcqptr);
|
||||
#else
|
||||
my_hash_delete(&conn->loop_checked, (uchar*) lcqptr);
|
||||
my_hash_delete(&conn->loop_check_queue, (uchar*) lcqptr);
|
||||
#endif
|
||||
spider_free(spider_current_trx, lcqptr, MYF(0));
|
||||
|
||||
lcptr = lcrptr;
|
||||
#ifdef HASH_UPDATE_WITH_HASH_VALUE
|
||||
if (unlikely(my_hash_insert_with_hash_value(&conn->loop_checked,
|
||||
lcptr->hash_value_full, (uchar *) lcptr)))
|
||||
#else
|
||||
if (unlikely(my_hash_insert(&conn->loop_checked, (uchar *) lcptr)))
|
||||
#endif
|
||||
{
|
||||
goto error_hash_insert;
|
||||
}
|
||||
#ifdef HASH_UPDATE_WITH_HASH_VALUE
|
||||
if (unlikely(my_hash_insert_with_hash_value(&conn->loop_check_queue,
|
||||
lcptr->hash_value_to, (uchar *) lcptr)))
|
||||
#else
|
||||
if (unlikely(my_hash_insert(&conn->loop_check_queue, (uchar *) lcptr)))
|
||||
#endif
|
||||
{
|
||||
goto error_hash_insert_queue;
|
||||
}
|
||||
|
@ -1278,12 +1189,7 @@ int spider_conn_queue_and_merge_loop_check(
|
|||
|
||||
error_alloc_loop_check_replace:
|
||||
error_hash_insert_queue:
|
||||
#ifdef HASH_UPDATE_WITH_HASH_VALUE
|
||||
my_hash_delete_with_hash_value(&conn->loop_checked,
|
||||
lcptr->hash_value_full, (uchar *) lcptr);
|
||||
#else
|
||||
my_hash_delete(&conn->loop_checked, (uchar*) lcptr);
|
||||
#endif
|
||||
error_hash_insert:
|
||||
spider_free(spider_current_trx, lcptr, MYF(0));
|
||||
pthread_mutex_unlock(&conn->loop_check_mutex);
|
||||
|
@ -1303,12 +1209,7 @@ int spider_conn_reset_queue_loop_check(
|
|||
if (!lcptr->flag)
|
||||
{
|
||||
DBUG_PRINT("info", ("spider free lcptr"));
|
||||
#ifdef HASH_UPDATE_WITH_HASH_VALUE
|
||||
my_hash_delete_with_hash_value(&conn->loop_checked,
|
||||
lcptr->hash_value_full, (uchar *) lcptr);
|
||||
#else
|
||||
my_hash_delete(&conn->loop_checked, (uchar*) lcptr);
|
||||
#endif
|
||||
spider_free(spider_current_trx, lcptr, MYF(0));
|
||||
}
|
||||
++l;
|
||||
|
@ -1450,19 +1351,12 @@ int spider_conn_queue_loop_check(
|
|||
memcpy(tmp_name, to_str.str, to_str.length);
|
||||
tmp_name += to_str.length;
|
||||
*tmp_name = '\0';
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
my_hash_value_type hash_value = my_calc_hash(&conn->loop_checked,
|
||||
(uchar *) loop_check_buf, buf_sz - 1);
|
||||
#endif
|
||||
pthread_mutex_lock(&conn->loop_check_mutex);
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
lcptr = (SPIDER_CONN_LOOP_CHECK *)
|
||||
my_hash_search_using_hash_value(&conn->loop_checked, hash_value,
|
||||
(uchar *) loop_check_buf, buf_sz - 1);
|
||||
#else
|
||||
lcptr = (SPIDER_CONN_LOOP_CHECK *) my_hash_search(
|
||||
&conn->loop_checked, (uchar *) loop_check_buf, buf_sz - 1);
|
||||
#endif
|
||||
if (
|
||||
!lcptr ||
|
||||
(
|
||||
|
@ -1477,12 +1371,7 @@ int spider_conn_queue_loop_check(
|
|||
if (unlikely(lcptr))
|
||||
{
|
||||
DBUG_PRINT("info", ("spider free lcptr"));
|
||||
#ifdef HASH_UPDATE_WITH_HASH_VALUE
|
||||
my_hash_delete_with_hash_value(&conn->loop_checked,
|
||||
lcptr->hash_value_full, (uchar *) lcptr);
|
||||
#else
|
||||
my_hash_delete(&conn->loop_checked, (uchar*) lcptr);
|
||||
#endif
|
||||
spider_free(spider_current_trx, lcptr, MYF(0));
|
||||
}
|
||||
DBUG_PRINT("info", ("spider alloc_lcptr"));
|
||||
|
@ -1517,20 +1406,9 @@ int spider_conn_queue_loop_check(
|
|||
spider_conn_queue_and_merge_loop_check()
|
||||
*/
|
||||
lcptr->merged_value.str = merged_value;
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
lcptr->hash_value_to = my_calc_hash(&conn->loop_check_queue,
|
||||
(uchar *) to_str.str, to_str.length);
|
||||
#endif
|
||||
/*
|
||||
Mark as checked. It will be added to loop_check_queue in
|
||||
spider_conn_queue_and_merge_loop_check() below for checking
|
||||
*/
|
||||
#ifdef HASH_UPDATE_WITH_HASH_VALUE
|
||||
if (unlikely(my_hash_insert_with_hash_value(&conn->loop_checked,
|
||||
lcptr->hash_value_full, (uchar *) lcptr)))
|
||||
#else
|
||||
if (unlikely(my_hash_insert(&conn->loop_checked, (uchar *) lcptr)))
|
||||
#endif
|
||||
{
|
||||
my_afree(loop_check_buf);
|
||||
goto error_hash_insert;
|
||||
|
@ -3209,32 +3087,6 @@ void *spider_bg_sts_action(
|
|||
trx, &spider, FALSE, FALSE, SPIDER_CONN_KIND_MYSQL,
|
||||
&error_num);
|
||||
conns[spider.search_link_idx]->error_mode = 0;
|
||||
/*
|
||||
if (
|
||||
error_num &&
|
||||
share->monitoring_kind[spider.search_link_idx] &&
|
||||
need_mons[spider.search_link_idx]
|
||||
) {
|
||||
lex_start(thd);
|
||||
error_num = spider_ping_table_mon_from_table(
|
||||
trx,
|
||||
thd,
|
||||
share,
|
||||
spider.search_link_idx,
|
||||
(uint32) share->monitoring_sid[spider.search_link_idx],
|
||||
share->table_name,
|
||||
share->table_name_length,
|
||||
spider.conn_link_idx[spider.search_link_idx],
|
||||
NULL,
|
||||
0,
|
||||
share->monitoring_kind[spider.search_link_idx],
|
||||
share->monitoring_limit[spider.search_link_idx],
|
||||
share->monitoring_flag[spider.search_link_idx],
|
||||
TRUE
|
||||
);
|
||||
lex_end(thd->lex);
|
||||
}
|
||||
*/
|
||||
spider.search_link_idx = -1;
|
||||
}
|
||||
if (spider.search_link_idx != -1 && conns[spider.search_link_idx])
|
||||
|
@ -3252,31 +3104,6 @@ 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]
|
||||
) {
|
||||
lex_start(thd);
|
||||
error_num = spider_ping_table_mon_from_table(
|
||||
trx,
|
||||
thd,
|
||||
share,
|
||||
spider.search_link_idx,
|
||||
(uint32) share->monitoring_sid[spider.search_link_idx],
|
||||
share->table_name,
|
||||
share->table_name_length,
|
||||
spider.conn_link_idx[spider.search_link_idx],
|
||||
NULL,
|
||||
0,
|
||||
share->monitoring_kind[spider.search_link_idx],
|
||||
share->monitoring_limit[spider.search_link_idx],
|
||||
share->monitoring_flag[spider.search_link_idx],
|
||||
TRUE
|
||||
);
|
||||
lex_end(thd->lex);
|
||||
}
|
||||
*/
|
||||
spider.search_link_idx = -1;
|
||||
}
|
||||
}
|
||||
|
@ -3519,12 +3346,6 @@ void *spider_bg_crd_action(
|
|||
if (spider.search_link_idx < 0)
|
||||
{
|
||||
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);
|
||||
|
@ -3541,32 +3362,6 @@ void *spider_bg_crd_action(
|
|||
trx, &spider, FALSE, FALSE, SPIDER_CONN_KIND_MYSQL,
|
||||
&error_num);
|
||||
conns[spider.search_link_idx]->error_mode = 0;
|
||||
/*
|
||||
if (
|
||||
error_num &&
|
||||
share->monitoring_kind[spider.search_link_idx] &&
|
||||
need_mons[spider.search_link_idx]
|
||||
) {
|
||||
lex_start(thd);
|
||||
error_num = spider_ping_table_mon_from_table(
|
||||
trx,
|
||||
thd,
|
||||
share,
|
||||
spider.search_link_idx,
|
||||
(uint32) share->monitoring_sid[spider.search_link_idx],
|
||||
share->table_name,
|
||||
share->table_name_length,
|
||||
spider.conn_link_idx[spider.search_link_idx],
|
||||
NULL,
|
||||
0,
|
||||
share->monitoring_kind[spider.search_link_idx],
|
||||
share->monitoring_limit[spider.search_link_idx],
|
||||
share->monitoring_flag[spider.search_link_idx],
|
||||
TRUE
|
||||
);
|
||||
lex_end(thd->lex);
|
||||
}
|
||||
*/
|
||||
spider.search_link_idx = -1;
|
||||
}
|
||||
if (spider.search_link_idx != -1 && conns[spider.search_link_idx])
|
||||
|
@ -3584,31 +3379,6 @@ void *spider_bg_crd_action(
|
|||
2))
|
||||
#endif
|
||||
{
|
||||
/*
|
||||
if (
|
||||
share->monitoring_kind[spider.search_link_idx] &&
|
||||
need_mons[spider.search_link_idx]
|
||||
) {
|
||||
lex_start(thd);
|
||||
error_num = spider_ping_table_mon_from_table(
|
||||
trx,
|
||||
thd,
|
||||
share,
|
||||
spider.search_link_idx,
|
||||
(uint32) share->monitoring_sid[spider.search_link_idx],
|
||||
share->table_name,
|
||||
share->table_name_length,
|
||||
spider.conn_link_idx[spider.search_link_idx],
|
||||
NULL,
|
||||
0,
|
||||
share->monitoring_kind[spider.search_link_idx],
|
||||
share->monitoring_limit[spider.search_link_idx],
|
||||
share->monitoring_flag[spider.search_link_idx],
|
||||
TRUE
|
||||
);
|
||||
lex_end(thd->lex);
|
||||
}
|
||||
*/
|
||||
spider.search_link_idx = -1;
|
||||
}
|
||||
}
|
||||
|
@ -3913,17 +3683,11 @@ void *spider_bg_mon_action(
|
|||
share->monitoring_bg_interval[link_idx] * 1000);
|
||||
pthread_cond_timedwait(&share->bg_mon_sleep_conds[link_idx],
|
||||
&share->bg_mon_mutexes[link_idx], &abstime);
|
||||
/*
|
||||
my_sleep((ulong) share->monitoring_bg_interval[link_idx]);
|
||||
*/
|
||||
}
|
||||
DBUG_PRINT("info",("spider bg mon roop start"));
|
||||
if (share->bg_mon_kill)
|
||||
{
|
||||
DBUG_PRINT("info",("spider bg mon kill start"));
|
||||
/*
|
||||
pthread_mutex_lock(&share->bg_mon_mutexes[link_idx]);
|
||||
*/
|
||||
pthread_cond_signal(&share->bg_mon_conds[link_idx]);
|
||||
pthread_mutex_unlock(&share->bg_mon_mutexes[link_idx]);
|
||||
spider_free_trx(trx, TRUE);
|
||||
|
@ -4152,7 +3916,6 @@ bool spider_conn_use_handler(
|
|||
DBUG_PRINT("info",("spider use_handler=%d", use_handler));
|
||||
DBUG_PRINT("info",("spider spider->conn_kind[link_idx]=%u",
|
||||
spider->conn_kind[link_idx]));
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
if (spider->do_direct_update)
|
||||
{
|
||||
spider->sql_kinds |= SPIDER_SQL_KIND_SQL;
|
||||
|
@ -4161,7 +3924,6 @@ bool spider_conn_use_handler(
|
|||
DBUG_PRINT("info",("spider FALSE by using direct_update"));
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
#endif
|
||||
if (spider->use_spatial_index)
|
||||
{
|
||||
DBUG_PRINT("info",("spider FALSE by use_spatial_index"));
|
||||
|
@ -4251,15 +4013,9 @@ SPIDER_CONN* spider_get_conn_from_idle_connection(
|
|||
set_timespec(abstime, 0);
|
||||
|
||||
pthread_mutex_lock(&spider_ipport_conn_mutex);
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
if ((ip_port_conn = (SPIDER_IP_PORT_CONN*) my_hash_search_using_hash_value(
|
||||
&spider_ipport_conns, share->conn_keys_hash_value[link_idx],
|
||||
(uchar*) share->conn_keys[link_idx], share->conn_keys_lengths[link_idx])))
|
||||
#else
|
||||
if ((ip_port_conn = (SPIDER_IP_PORT_CONN*) my_hash_search(
|
||||
&spider_ipport_conns,
|
||||
(uchar*) share->conn_keys[link_idx], share->conn_keys_lengths[link_idx])))
|
||||
#endif
|
||||
{ /* exists */
|
||||
pthread_mutex_unlock(&spider_ipport_conn_mutex);
|
||||
pthread_mutex_lock(&ip_port_conn->mutex);
|
||||
|
@ -4298,24 +4054,13 @@ SPIDER_CONN* spider_get_conn_from_idle_connection(
|
|||
}
|
||||
|
||||
pthread_mutex_lock(&spider_conn_mutex);
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
if ((conn = (SPIDER_CONN*) my_hash_search_using_hash_value(
|
||||
&spider_open_connections, share->conn_keys_hash_value[link_idx],
|
||||
(uchar*) share->conn_keys[link_idx],
|
||||
share->conn_keys_lengths[link_idx])))
|
||||
#else
|
||||
if ((conn = (SPIDER_CONN*) my_hash_search(&spider_open_connections,
|
||||
(uchar*) share->conn_keys[link_idx],
|
||||
share->conn_keys_lengths[link_idx])))
|
||||
#endif
|
||||
{
|
||||
/* get conn from spider_open_connections, then delete conn in spider_open_connections */
|
||||
#ifdef HASH_UPDATE_WITH_HASH_VALUE
|
||||
my_hash_delete_with_hash_value(&spider_open_connections,
|
||||
conn->conn_key_hash_value, (uchar*) conn);
|
||||
#else
|
||||
my_hash_delete(&spider_open_connections, (uchar*) conn);
|
||||
#endif
|
||||
pthread_mutex_unlock(&spider_conn_mutex);
|
||||
DBUG_PRINT("info",("spider get global conn"));
|
||||
if (spider)
|
||||
|
@ -4400,9 +4145,7 @@ SPIDER_IP_PORT_CONN* spider_create_ipport_conn(SPIDER_CONN *conn)
|
|||
ret->conn_id = conn->conn_id;
|
||||
ret->ip_port_count = 1; // init
|
||||
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
ret->key_hash_value = conn->conn_key_hash_value;
|
||||
#endif
|
||||
DBUG_RETURN(ret);
|
||||
err_malloc_key:
|
||||
spider_my_free(ret, MYF(0));
|
||||
|
|
|
@ -22,9 +22,7 @@
|
|||
#define SPIDER_SIMPLE_CONNECT 1
|
||||
#define SPIDER_SIMPLE_DISCONNECT 2
|
||||
#define SPIDER_SIMPLE_RECORDS 3
|
||||
#ifdef HA_HAS_CHECKSUM_EXTENDED
|
||||
#define SPIDER_SIMPLE_CHECKSUM_TABLE 4
|
||||
#endif
|
||||
|
||||
/*
|
||||
The SPIDER_CONN_LOOP_CHECK has been added to the loop_check queue to
|
||||
|
@ -50,10 +48,8 @@ typedef struct st_spider_conn_loop_check
|
|||
SPIDER_LOP_CHK_IGNORED
|
||||
*/
|
||||
uint flag;
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
/* hash value of to_name, used for the hash conn->loop_checked */
|
||||
my_hash_value_type hash_value_to;
|
||||
#endif
|
||||
/*
|
||||
The fully qualified name of the current spider table, which will
|
||||
also be used to construct the user var name to set in the data
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#define MYSQL_SERVER 1
|
||||
#include <my_global.h>
|
||||
#include "mysql_version.h"
|
||||
#include "spd_environ.h"
|
||||
#include "sql_priv.h"
|
||||
#include "probes_mysql.h"
|
||||
#include "sql_class.h"
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#define MYSQL_SERVER 1
|
||||
#include <my_global.h>
|
||||
#include "mysql_version.h"
|
||||
#include "spd_environ.h"
|
||||
#include "sql_priv.h"
|
||||
#include "probes_mysql.h"
|
||||
#include "sql_class.h"
|
||||
|
@ -26,9 +25,7 @@
|
|||
#include "sql_base.h"
|
||||
#include "tztime.h"
|
||||
#include "errmsg.h"
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
#include "sql_select.h"
|
||||
#endif
|
||||
#include "sql_common.h"
|
||||
#include <errmsg.h>
|
||||
#include "spd_err.h"
|
||||
|
@ -60,9 +57,7 @@ extern SPIDER_DBTON spider_dbton[SPIDER_DBTON_SIZE];
|
|||
#define SPIDER_SQL_PING_TABLE_STR "spider_ping_table("
|
||||
#define SPIDER_SQL_PING_TABLE_LEN (sizeof(SPIDER_SQL_PING_TABLE_STR) - 1)
|
||||
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
extern HASH spider_open_connections;
|
||||
#endif
|
||||
pthread_mutex_t spider_open_conn_mutex;
|
||||
const char spider_dig_upper[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
|
||||
|
@ -1392,14 +1387,12 @@ int spider_db_append_select_columns(
|
|||
DBUG_ENTER("spider_db_append_select_columns");
|
||||
if (spider->sql_kinds & SPIDER_SQL_KIND_SQL)
|
||||
{
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
if (
|
||||
result_list->direct_aggregate &&
|
||||
(error_num = spider->append_sum_select_sql_part(
|
||||
SPIDER_SQL_TYPE_SELECT_SQL, NULL, 0))
|
||||
)
|
||||
DBUG_RETURN(error_num);
|
||||
#endif
|
||||
if ((error_num = spider->append_match_select_sql_part(
|
||||
SPIDER_SQL_TYPE_SELECT_SQL, NULL, 0)))
|
||||
DBUG_RETURN(error_num);
|
||||
|
@ -2538,7 +2531,6 @@ int spider_db_append_charset_name_before_string(
|
|||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
int spider_db_refetch_for_item_sum_funcs(
|
||||
ha_spider *spider
|
||||
) {
|
||||
|
@ -2754,7 +2746,6 @@ int spider_db_fetch_for_item_sum_func(
|
|||
spider->wide_handler->trx->direct_aggregate_count++;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
int spider_db_append_match_fetch(
|
||||
ha_spider *spider,
|
||||
|
@ -2953,13 +2944,11 @@ int spider_db_fetch_table(
|
|||
}
|
||||
|
||||
DBUG_PRINT("info", ("spider row=%p", row));
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
DBUG_PRINT("info", ("spider direct_aggregate=%s",
|
||||
result_list->direct_aggregate ? "TRUE" : "FALSE"));
|
||||
result_list->snap_mrr_with_cnt = spider->mrr_with_cnt;
|
||||
result_list->snap_direct_aggregate = result_list->direct_aggregate;
|
||||
result_list->snap_row = row;
|
||||
#endif
|
||||
|
||||
/* for mrr */
|
||||
if (spider->mrr_with_cnt)
|
||||
|
@ -2969,32 +2958,26 @@ 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();
|
||||
} else {
|
||||
spider->multi_range_hit_point = 0;
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
result_list->snap_mrr_with_cnt = FALSE;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
/* for direct_aggregate */
|
||||
if (result_list->direct_aggregate)
|
||||
{
|
||||
if ((error_num = spider_db_fetch_for_item_sum_funcs(row, spider)))
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SPIDER_HAS_GROUP_BY_HANDLER
|
||||
if (!spider->use_fields)
|
||||
|
@ -3083,13 +3066,11 @@ int spider_db_fetch_key(
|
|||
}
|
||||
|
||||
DBUG_PRINT("info", ("spider row=%p", row));
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
DBUG_PRINT("info", ("spider direct_aggregate=%s",
|
||||
result_list->direct_aggregate ? "TRUE" : "FALSE"));
|
||||
result_list->snap_mrr_with_cnt = spider->mrr_with_cnt;
|
||||
result_list->snap_direct_aggregate = result_list->direct_aggregate;
|
||||
result_list->snap_row = row;
|
||||
#endif
|
||||
|
||||
/* for mrr */
|
||||
if (spider->mrr_with_cnt)
|
||||
|
@ -3097,26 +3078,22 @@ 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();
|
||||
}
|
||||
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
/* for direct_aggregate */
|
||||
if (result_list->direct_aggregate)
|
||||
{
|
||||
if ((error_num = spider_db_fetch_for_item_sum_funcs(row, spider)))
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((error_num = spider_db_append_match_fetch(spider,
|
||||
spider->ft_first, spider->ft_current, row)))
|
||||
|
@ -3200,13 +3177,11 @@ int spider_db_fetch_minimum_columns(
|
|||
}
|
||||
|
||||
DBUG_PRINT("info", ("spider row=%p", row));
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
DBUG_PRINT("info", ("spider direct_aggregate=%s",
|
||||
result_list->direct_aggregate ? "TRUE" : "FALSE"));
|
||||
result_list->snap_mrr_with_cnt = spider->mrr_with_cnt;
|
||||
result_list->snap_direct_aggregate = result_list->direct_aggregate;
|
||||
result_list->snap_row = row;
|
||||
#endif
|
||||
|
||||
/* for mrr */
|
||||
if (spider->mrr_with_cnt)
|
||||
|
@ -3214,26 +3189,22 @@ 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();
|
||||
}
|
||||
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
/* for direct_aggregate */
|
||||
if (result_list->direct_aggregate)
|
||||
{
|
||||
if ((error_num = spider_db_fetch_for_item_sum_funcs(row, spider)))
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((error_num = spider_db_append_match_fetch(spider,
|
||||
spider->ft_first, spider->ft_current, row)))
|
||||
|
@ -5582,9 +5553,7 @@ void spider_db_create_position(
|
|||
current->use_position = TRUE;
|
||||
pos->use_position = TRUE;
|
||||
pos->mrr_with_cnt = spider->mrr_with_cnt;
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
pos->direct_aggregate = result_list->direct_aggregate;
|
||||
#endif
|
||||
pos->sql_kind = spider->sql_kind[spider->result_link_idx];
|
||||
pos->position_bitmap = spider->wide_handler->position_bitmap;
|
||||
pos->ft_first = spider->ft_first;
|
||||
|
@ -5650,7 +5619,6 @@ int spider_db_seek_tmp_table(
|
|||
}
|
||||
|
||||
DBUG_PRINT("info", ("spider row=%p", row));
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
if (!spider->result_list.in_cmp_ref)
|
||||
{
|
||||
DBUG_PRINT("info", ("spider direct_aggregate=%s",
|
||||
|
@ -5659,7 +5627,6 @@ int spider_db_seek_tmp_table(
|
|||
spider->result_list.snap_direct_aggregate = pos->direct_aggregate;
|
||||
spider->result_list.snap_row = row;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* for mrr */
|
||||
if (pos->mrr_with_cnt)
|
||||
|
@ -5669,20 +5636,16 @@ int spider_db_seek_tmp_table(
|
|||
{
|
||||
row->next();
|
||||
} else {
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
spider->result_list.snap_mrr_with_cnt = FALSE;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
/* for direct_aggregate */
|
||||
if (pos->direct_aggregate)
|
||||
{
|
||||
if ((error_num = spider_db_fetch_for_item_sum_funcs(row, spider)))
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((error_num = spider_db_append_match_fetch(spider,
|
||||
pos->ft_first, pos->ft_current, row)))
|
||||
|
@ -5742,7 +5705,6 @@ int spider_db_seek_tmp_key(
|
|||
}
|
||||
|
||||
DBUG_PRINT("info", ("spider row=%p", row));
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
if (!spider->result_list.in_cmp_ref)
|
||||
{
|
||||
DBUG_PRINT("info", ("spider direct_aggregate=%s",
|
||||
|
@ -5751,7 +5713,6 @@ int spider_db_seek_tmp_key(
|
|||
spider->result_list.snap_direct_aggregate = pos->direct_aggregate;
|
||||
spider->result_list.snap_row = row;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* for mrr */
|
||||
if (pos->mrr_with_cnt)
|
||||
|
@ -5760,14 +5721,12 @@ int spider_db_seek_tmp_key(
|
|||
row->next();
|
||||
}
|
||||
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
/* for direct_aggregate */
|
||||
if (pos->direct_aggregate)
|
||||
{
|
||||
if ((error_num = spider_db_fetch_for_item_sum_funcs(row, spider)))
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((error_num = spider_db_append_match_fetch(spider,
|
||||
pos->ft_first, pos->ft_current, row)))
|
||||
|
@ -5827,7 +5786,6 @@ int spider_db_seek_tmp_minimum_columns(
|
|||
}
|
||||
|
||||
DBUG_PRINT("info", ("spider row=%p", row));
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
if (!spider->result_list.in_cmp_ref)
|
||||
{
|
||||
DBUG_PRINT("info", ("spider direct_aggregate=%s",
|
||||
|
@ -5836,7 +5794,6 @@ int spider_db_seek_tmp_minimum_columns(
|
|||
spider->result_list.snap_direct_aggregate = pos->direct_aggregate;
|
||||
spider->result_list.snap_row = row;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* for mrr */
|
||||
if (pos->mrr_with_cnt)
|
||||
|
@ -5845,14 +5802,12 @@ int spider_db_seek_tmp_minimum_columns(
|
|||
row->next();
|
||||
}
|
||||
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
/* for direct_aggregate */
|
||||
if (pos->direct_aggregate)
|
||||
{
|
||||
if ((error_num = spider_db_fetch_for_item_sum_funcs(row, spider)))
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((error_num = spider_db_append_match_fetch(spider,
|
||||
pos->ft_first, pos->ft_current, row)))
|
||||
|
@ -5935,14 +5890,12 @@ int spider_db_simple_action(
|
|||
link_idx
|
||||
);
|
||||
break;
|
||||
#ifdef HA_HAS_CHECKSUM_EXTENDED
|
||||
case SPIDER_SIMPLE_CHECKSUM_TABLE:
|
||||
DBUG_PRINT("info",("spider simple checksum_table"));
|
||||
error_num = db_handler->checksum_table(
|
||||
link_idx
|
||||
);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
DBUG_ASSERT(0);
|
||||
error_num = HA_ERR_CRASHED;
|
||||
|
@ -6910,7 +6863,6 @@ int spider_db_update(
|
|||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
|
||||
int spider_db_direct_update(
|
||||
ha_spider *spider,
|
||||
|
@ -6958,17 +6910,14 @@ int spider_db_direct_update(
|
|||
(spider->direct_update_kinds & SPIDER_SQL_KIND_HS)
|
||||
*/
|
||||
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
if (!spider->do_direct_update)
|
||||
{
|
||||
#endif
|
||||
if (
|
||||
(spider->sql_kinds & SPIDER_SQL_KIND_SQL) &&
|
||||
(error_num = spider->append_update_set_sql_part())
|
||||
) {
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
} else {
|
||||
if (
|
||||
(spider->direct_update_kinds & SPIDER_SQL_KIND_SQL) &&
|
||||
|
@ -6977,7 +6926,6 @@ int spider_db_direct_update(
|
|||
DBUG_RETURN(error_num);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
result_list->desc_flg = FALSE;
|
||||
result_list->sorted = TRUE;
|
||||
|
@ -7173,17 +7121,14 @@ int spider_db_direct_update(
|
|||
spider->wide_handler->direct_update_fields
|
||||
*/
|
||||
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
if (!spider->do_direct_update)
|
||||
{
|
||||
#endif
|
||||
if (
|
||||
(spider->sql_kinds & SPIDER_SQL_KIND_SQL) &&
|
||||
(error_num = spider->append_update_set_sql_part())
|
||||
) {
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
} else {
|
||||
if (
|
||||
(spider->direct_update_kinds & SPIDER_SQL_KIND_SQL) &&
|
||||
|
@ -7192,7 +7137,6 @@ int spider_db_direct_update(
|
|||
DBUG_RETURN(error_num);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
result_list->desc_flg = FALSE;
|
||||
result_list->sorted = TRUE;
|
||||
|
@ -7353,7 +7297,6 @@ int spider_db_direct_update(
|
|||
DBUG_RETURN(0);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HA_CAN_BULK_ACCESS
|
||||
int spider_db_bulk_direct_update(
|
||||
|
@ -7493,7 +7436,6 @@ int spider_db_delete(
|
|||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
|
||||
int spider_db_direct_delete(
|
||||
ha_spider *spider,
|
||||
|
@ -7860,7 +7802,6 @@ int spider_db_direct_delete(
|
|||
DBUG_RETURN(error_num2);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
int spider_db_delete_all_rows(
|
||||
ha_spider *spider
|
||||
|
@ -8570,11 +8511,9 @@ int spider_db_print_item_type(
|
|||
case Item::FUNC_ITEM:
|
||||
DBUG_RETURN(spider_db_open_item_func((Item_func *) item, spider, str,
|
||||
alias, alias_length, dbton_id, use_fields, fields));
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
case Item::SUM_FUNC_ITEM:
|
||||
DBUG_RETURN(spider_db_open_item_sum_func((Item_sum *)item, spider, str,
|
||||
alias, alias_length, dbton_id, use_fields, fields));
|
||||
#endif
|
||||
case Item::COND_ITEM:
|
||||
DBUG_RETURN(spider_db_open_item_cond((Item_cond *) item, spider, str,
|
||||
alias, alias_length, dbton_id, use_fields, fields));
|
||||
|
@ -8587,7 +8526,6 @@ int spider_db_print_item_type(
|
|||
case Item::ROW_ITEM:
|
||||
DBUG_RETURN(spider_db_open_item_row((Item_row *) item, spider, str,
|
||||
alias, alias_length, dbton_id, use_fields, fields));
|
||||
#ifdef SPIDER_USE_CONST_ITEM_FOR_STRING_INT_REAL_DECIMAL_DATE_ITEM
|
||||
case Item::CONST_ITEM:
|
||||
{
|
||||
switch (item->cmp_type()) {
|
||||
|
@ -8605,16 +8543,6 @@ int spider_db_print_item_type(
|
|||
DBUG_RETURN(spider_db_print_item_type_default(item, spider, str));
|
||||
}
|
||||
}
|
||||
#else
|
||||
case Item::STRING_ITEM:
|
||||
DBUG_RETURN(spider_db_open_item_string(item, field, spider, str,
|
||||
alias, alias_length, dbton_id, use_fields, fields));
|
||||
case Item::INT_ITEM:
|
||||
case Item::REAL_ITEM:
|
||||
case Item::DECIMAL_ITEM:
|
||||
DBUG_RETURN(spider_db_open_item_int(item, field, spider, str,
|
||||
alias, alias_length, dbton_id, use_fields, fields));
|
||||
#endif
|
||||
case Item::CACHE_ITEM:
|
||||
DBUG_RETURN(spider_db_open_item_cache((Item_cache *) item, field, spider,
|
||||
str, alias, alias_length, dbton_id, use_fields, fields));
|
||||
|
@ -8756,7 +8684,6 @@ int spider_db_open_item_func(
|
|||
item_func, spider, str, alias, alias_length, use_fields, fields));
|
||||
}
|
||||
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
int spider_db_open_item_sum_func(
|
||||
Item_sum *item_sum,
|
||||
ha_spider *spider,
|
||||
|
@ -8771,7 +8698,6 @@ int spider_db_open_item_sum_func(
|
|||
DBUG_RETURN(spider_dbton[dbton_id].db_util->open_item_sum_func(
|
||||
item_sum, spider, str, alias, alias_length, use_fields, fields));
|
||||
}
|
||||
#endif
|
||||
|
||||
int spider_db_open_item_ident(
|
||||
Item_ident *item_ident,
|
||||
|
@ -9506,7 +9432,6 @@ int spider_db_append_condition(
|
|||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
int spider_db_append_update_columns(
|
||||
ha_spider *spider,
|
||||
spider_string *str,
|
||||
|
@ -9561,9 +9486,7 @@ int spider_db_append_update_columns(
|
|||
str->length(str->length() - SPIDER_SQL_COMMA_LEN);
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
bool spider_db_check_select_colum_in_group(
|
||||
st_select_lex *select_lex,
|
||||
Field *field
|
||||
|
@ -9586,7 +9509,6 @@ bool spider_db_check_select_colum_in_group(
|
|||
}
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
#endif
|
||||
|
||||
uint spider_db_check_ft_idx(
|
||||
Item_func *item_func,
|
||||
|
|
|
@ -496,7 +496,6 @@ int spider_db_append_charset_name_before_string(
|
|||
CHARSET_INFO *cs
|
||||
);
|
||||
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
int spider_db_refetch_for_item_sum_funcs(
|
||||
ha_spider *spider
|
||||
);
|
||||
|
@ -511,7 +510,6 @@ int spider_db_fetch_for_item_sum_func(
|
|||
Item_sum *item_sum,
|
||||
ha_spider *spider
|
||||
);
|
||||
#endif
|
||||
|
||||
int spider_db_append_match_fetch(
|
||||
ha_spider *spider,
|
||||
|
@ -799,7 +797,6 @@ int spider_db_update(
|
|||
const uchar *old_data
|
||||
);
|
||||
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
|
||||
int spider_db_direct_update(
|
||||
ha_spider *spider,
|
||||
|
@ -817,7 +814,6 @@ int spider_db_direct_update(
|
|||
ha_rows *found_rows
|
||||
);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HA_CAN_BULK_ACCESS
|
||||
int spider_db_bulk_direct_update(
|
||||
|
@ -838,7 +834,6 @@ int spider_db_delete(
|
|||
const uchar *buf
|
||||
);
|
||||
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
|
||||
int spider_db_direct_delete(
|
||||
ha_spider *spider,
|
||||
|
@ -854,7 +849,6 @@ int spider_db_direct_delete(
|
|||
ha_rows *delete_rows
|
||||
);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
int spider_db_delete_all_rows(
|
||||
ha_spider *spider
|
||||
|
@ -944,7 +938,6 @@ int spider_db_open_item_func(
|
|||
spider_fields *fields
|
||||
);
|
||||
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
int spider_db_open_item_sum_func(
|
||||
Item_sum *item_sum,
|
||||
ha_spider *spider,
|
||||
|
@ -955,7 +948,6 @@ int spider_db_open_item_sum_func(
|
|||
bool use_fields,
|
||||
spider_fields *fields
|
||||
);
|
||||
#endif
|
||||
|
||||
int spider_db_open_item_ident(
|
||||
Item_ident *item_ident,
|
||||
|
@ -1056,7 +1048,6 @@ int spider_db_append_condition(
|
|||
bool test_flg
|
||||
);
|
||||
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
int spider_db_append_update_columns(
|
||||
ha_spider *spider,
|
||||
spider_string *str,
|
||||
|
@ -1066,14 +1057,11 @@ int spider_db_append_update_columns(
|
|||
bool use_fields,
|
||||
spider_fields *fields
|
||||
);
|
||||
#endif
|
||||
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
bool spider_db_check_select_colum_in_group(
|
||||
st_select_lex *select_lex,
|
||||
Field *field
|
||||
);
|
||||
#endif
|
||||
|
||||
uint spider_db_check_ft_idx(
|
||||
Item_func *item_func,
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#define MYSQL_SERVER 1
|
||||
#include <my_global.h>
|
||||
#include "mysql_version.h"
|
||||
#include "spd_environ.h"
|
||||
#include "sql_priv.h"
|
||||
#include "probes_mysql.h"
|
||||
#include "sql_class.h"
|
||||
|
@ -40,7 +39,6 @@ spider_db_result::spider_db_result(
|
|||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
#ifdef HA_HAS_CHECKSUM_EXTENDED
|
||||
int spider_db_result::fetch_table_checksum(
|
||||
ha_spider *spider
|
||||
) {
|
||||
|
@ -48,7 +46,6 @@ int spider_db_result::fetch_table_checksum(
|
|||
DBUG_PRINT("info",("spider this=%p", this));
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
uint spider_db_result::limit_mode()
|
||||
{
|
||||
|
@ -158,7 +155,6 @@ uint spider_db_util::limit_mode()
|
|||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
#ifdef HA_HAS_CHECKSUM_EXTENDED
|
||||
bool spider_db_share::checksum_support()
|
||||
{
|
||||
DBUG_ENTER("spider_db_share::checksum_support");
|
||||
|
@ -173,9 +169,7 @@ int spider_db_handler::checksum_table(
|
|||
DBUG_PRINT("info",("spider this=%p", this));
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
bool spider_db_handler::check_direct_update(
|
||||
st_select_lex *select_lex,
|
||||
longlong select_limit,
|
||||
|
@ -209,4 +203,3 @@ bool spider_db_handler::check_direct_delete(
|
|||
}
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -26,9 +26,6 @@
|
|||
#define SPIDER_DB_WRAPPER_MARIADB "mariadb"
|
||||
|
||||
#define PLUGIN_VAR_CAN_MEMALLOC
|
||||
/*
|
||||
#define HASH_UPDATE_WITH_HASH_VALUE
|
||||
*/
|
||||
|
||||
#define SPIDER_HAS_DISCOVER_TABLE_STRUCTURE
|
||||
#define SPIDER_HAS_APPEND_FOR_SINGLE_QUOTE
|
||||
|
@ -760,7 +757,6 @@ public:
|
|||
bool use_fields,
|
||||
spider_fields *fields
|
||||
) = 0;
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
virtual int open_item_sum_func(
|
||||
Item_sum *item_sum,
|
||||
ha_spider *spider,
|
||||
|
@ -770,7 +766,6 @@ public:
|
|||
bool use_fields,
|
||||
spider_fields *fields
|
||||
) = 0;
|
||||
#endif
|
||||
virtual int append_escaped_util(
|
||||
spider_string *to,
|
||||
String *from
|
||||
|
@ -872,11 +867,9 @@ public:
|
|||
int mode,
|
||||
ha_rows &records
|
||||
) = 0;
|
||||
#ifdef HA_HAS_CHECKSUM_EXTENDED
|
||||
virtual int fetch_table_checksum(
|
||||
ha_spider *spider
|
||||
);
|
||||
#endif
|
||||
virtual int fetch_table_cardinality(
|
||||
int mode,
|
||||
TABLE *table,
|
||||
|
@ -1117,9 +1110,7 @@ public:
|
|||
spider_string *str
|
||||
) = 0;
|
||||
#endif
|
||||
#ifdef HA_HAS_CHECKSUM_EXTENDED
|
||||
virtual bool checksum_support();
|
||||
#endif
|
||||
};
|
||||
|
||||
class spider_db_handler
|
||||
|
@ -1186,7 +1177,6 @@ public:
|
|||
virtual int append_update_part() = 0;
|
||||
virtual int append_delete_part() = 0;
|
||||
virtual int append_update_set_part() = 0;
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
virtual int append_direct_update_set_part() = 0;
|
||||
virtual int append_dup_update_pushdown_part(
|
||||
const char *alias,
|
||||
|
@ -1197,7 +1187,6 @@ public:
|
|||
uint alias_length
|
||||
) = 0;
|
||||
virtual int check_update_columns_part() = 0;
|
||||
#endif
|
||||
virtual int append_select_part(
|
||||
ulong sql_type
|
||||
) = 0;
|
||||
|
@ -1279,26 +1268,22 @@ public:
|
|||
const char *alias,
|
||||
uint alias_length
|
||||
) = 0;
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
virtual int append_sum_select_part(
|
||||
ulong sql_type,
|
||||
const char *alias,
|
||||
uint alias_length
|
||||
) = 0;
|
||||
#endif
|
||||
virtual void set_order_pos(
|
||||
ulong sql_type
|
||||
) = 0;
|
||||
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,
|
||||
|
@ -1463,11 +1448,9 @@ public:
|
|||
virtual int show_records(
|
||||
int link_idx
|
||||
) = 0;
|
||||
#ifdef HA_HAS_CHECKSUM_EXTENDED
|
||||
virtual int checksum_table(
|
||||
int link_idx
|
||||
);
|
||||
#endif
|
||||
virtual int show_last_insert_id(
|
||||
int link_idx,
|
||||
ulonglong &last_insert_id
|
||||
|
@ -1589,7 +1572,6 @@ public:
|
|||
ulong sql_type
|
||||
) = 0;
|
||||
#endif
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
virtual bool check_direct_update(
|
||||
st_select_lex *select_lex,
|
||||
longlong select_limit,
|
||||
|
@ -1600,7 +1582,6 @@ public:
|
|||
longlong select_limit,
|
||||
longlong offset_limit
|
||||
);
|
||||
#endif
|
||||
};
|
||||
|
||||
class spider_db_copy_table
|
||||
|
@ -1725,9 +1706,7 @@ typedef struct st_spider_position
|
|||
uint pos_mode;
|
||||
bool use_position;
|
||||
bool mrr_with_cnt;
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
bool direct_aggregate;
|
||||
#endif
|
||||
uint sql_kind;
|
||||
uchar *position_bitmap;
|
||||
st_spider_ft_info *ft_first;
|
||||
|
@ -1830,12 +1809,10 @@ typedef struct st_spider_result_list
|
|||
/* the limit_offeset, without where condition */
|
||||
bool direct_limit_offset;
|
||||
bool direct_distinct;
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
bool direct_aggregate;
|
||||
bool snap_mrr_with_cnt;
|
||||
bool snap_direct_aggregate;
|
||||
SPIDER_DB_ROW *snap_row;
|
||||
#endif
|
||||
bool in_cmp_ref;
|
||||
bool set_split_read;
|
||||
bool insert_dup_update_pushdown;
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#define MYSQL_SERVER 1
|
||||
#include <my_global.h>
|
||||
#include "mysql_version.h"
|
||||
#include "spd_environ.h"
|
||||
#include "sql_priv.h"
|
||||
#include "probes_mysql.h"
|
||||
#include "sql_class.h"
|
||||
|
@ -25,9 +24,7 @@
|
|||
#include "sql_analyse.h"
|
||||
#include "sql_base.h"
|
||||
#include "tztime.h"
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
#include "sql_select.h"
|
||||
#endif
|
||||
#include "sql_common.h"
|
||||
#include <mysql.h>
|
||||
#include <errmsg.h>
|
||||
|
@ -161,11 +158,9 @@ static const char *name_quote_str = SPIDER_SQL_NAME_QUOTE_STR;
|
|||
#define SPIDER_SQL_SHOW_RECORDS_RECORDS_POS 0
|
||||
#define SPIDER_SQL_EXPLAIN_SELECT_RECORDS_POS 8
|
||||
|
||||
#ifdef HA_HAS_CHECKSUM_EXTENDED
|
||||
#define SPIDER_SQL_CHECKSUM_CHECKSUM_POS 1
|
||||
#define SPIDER_SQL_CHECKSUM_TABLE_STR "checksum table "
|
||||
#define SPIDER_SQL_CHECKSUM_TABLE_LEN (sizeof(SPIDER_SQL_CHECKSUM_TABLE_STR) - 1)
|
||||
#endif
|
||||
|
||||
#define SPIDER_SQL_LIKE_STR " like "
|
||||
#define SPIDER_SQL_LIKE_LEN (sizeof(SPIDER_SQL_LIKE_STR) - 1)
|
||||
|
@ -1119,7 +1114,6 @@ int spider_db_mbase_result::fetch_simple_action(
|
|||
DBUG_PRINT("info", ("spider records=%lld", *records));
|
||||
break;
|
||||
}
|
||||
#ifdef HA_HAS_CHECKSUM_EXTENDED
|
||||
case SPIDER_SIMPLE_CHECKSUM_TABLE:
|
||||
{
|
||||
ha_spider *spider = (ha_spider *) param;
|
||||
|
@ -1136,7 +1130,6 @@ int spider_db_mbase_result::fetch_simple_action(
|
|||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
default:
|
||||
DBUG_ASSERT(0);
|
||||
break;
|
||||
|
@ -1160,7 +1153,6 @@ int spider_db_mbase_result::fetch_table_records(
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef HA_HAS_CHECKSUM_EXTENDED
|
||||
int spider_db_mbase_result::fetch_table_checksum(
|
||||
ha_spider *spider
|
||||
) {
|
||||
|
@ -1169,7 +1161,6 @@ int spider_db_mbase_result::fetch_table_checksum(
|
|||
DBUG_RETURN(fetch_simple_action(SPIDER_SIMPLE_CHECKSUM_TABLE,
|
||||
SPIDER_SQL_CHECKSUM_CHECKSUM_POS, spider));
|
||||
}
|
||||
#endif
|
||||
|
||||
int spider_db_mbase_result::fetch_table_cardinality(
|
||||
int mode,
|
||||
|
@ -2035,9 +2026,7 @@ int spider_db_mbase::connect(
|
|||
connect_retry_count--;
|
||||
my_sleep((ulong) connect_retry_interval);
|
||||
} else {
|
||||
#ifdef SPIDER_NET_HAS_THD
|
||||
db_conn->net.thd = NULL;
|
||||
#endif
|
||||
if (connect_mutex)
|
||||
pthread_mutex_unlock(&spider_open_conn_mutex);
|
||||
break;
|
||||
|
@ -3645,12 +3634,7 @@ int spider_db_mbase::append_lock_tables(
|
|||
my_hash_reset(&lock_table_hash);
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
#ifdef HASH_UPDATE_WITH_HASH_VALUE
|
||||
my_hash_delete_with_hash_value(&lock_table_hash,
|
||||
tmp_link_for_hash->db_table_str_hash_value, (uchar*) tmp_link_for_hash);
|
||||
#else
|
||||
my_hash_delete(&lock_table_hash, (uchar*) tmp_link_for_hash);
|
||||
#endif
|
||||
}
|
||||
if ((error_num = spider_db_mbase_utility->append_lock_table_tail(str)))
|
||||
{
|
||||
|
@ -6726,7 +6710,6 @@ int spider_db_mbase_util::print_item_func(
|
|||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
int spider_db_mbase_util::open_item_sum_func(
|
||||
Item_sum *item_sum,
|
||||
ha_spider *spider,
|
||||
|
@ -6844,7 +6827,6 @@ int spider_db_mbase_util::open_item_sum_func(
|
|||
}
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
int spider_db_mbase_util::append_escaped_util(
|
||||
spider_string *to,
|
||||
|
@ -7213,9 +7195,7 @@ spider_mbase_share::spider_mbase_share(
|
|||
table_names_str(NULL),
|
||||
db_names_str(NULL),
|
||||
db_table_str(NULL),
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
db_table_str_hash_value(NULL),
|
||||
#endif
|
||||
table_nm_max_length(0),
|
||||
db_nm_max_length(0),
|
||||
column_name_str(NULL),
|
||||
|
@ -7302,10 +7282,8 @@ int spider_mbase_share::init()
|
|||
__func__, __FILE__, __LINE__, MYF(MY_WME | MY_ZEROFILL),
|
||||
&key_select_pos,
|
||||
sizeof(int) * keys,
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
&db_table_str_hash_value,
|
||||
sizeof(my_hash_value_type) * spider_share->all_link_count,
|
||||
#endif
|
||||
NullS))
|
||||
) {
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
|
@ -7585,10 +7563,8 @@ int spider_mbase_share::create_table_names_str()
|
|||
if ((error_num = append_table_name(str, roop_count)))
|
||||
goto error;
|
||||
}
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
db_table_str_hash_value[roop_count] = my_calc_hash(
|
||||
&spider_open_connections, (uchar*) str->ptr(), str->length());
|
||||
#endif
|
||||
}
|
||||
DBUG_RETURN(0);
|
||||
|
||||
|
@ -8273,14 +8249,12 @@ int spider_mbase_share::discover_table_structure(
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef HA_HAS_CHECKSUM_EXTENDED
|
||||
bool spider_mbase_share::checksum_support()
|
||||
{
|
||||
DBUG_ENTER("spider_mbase_share::checksum_support");
|
||||
DBUG_PRINT("info",("spider this=%p", this));
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
spider_mbase_handler::spider_mbase_handler(
|
||||
ha_spider *spider,
|
||||
|
@ -8432,10 +8406,8 @@ int spider_mbase_handler::init()
|
|||
link_for_hash[roop_count].link_idx = roop_count;
|
||||
link_for_hash[roop_count].db_table_str =
|
||||
&mysql_share->db_table_str[roop_count];
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
link_for_hash[roop_count].db_table_str_hash_value =
|
||||
mysql_share->db_table_str_hash_value[roop_count];
|
||||
#endif
|
||||
}
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
@ -8735,14 +8707,12 @@ int spider_mbase_handler::append_tmp_table_and_sql_for_bka(
|
|||
SPIDER_SQL_B_DOT_STR, SPIDER_SQL_B_DOT_LEN)))
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
else if (spider->result_list.direct_aggregate)
|
||||
{
|
||||
if ((error_num =
|
||||
append_group_by(&sql, SPIDER_SQL_B_DOT_STR, SPIDER_SQL_B_DOT_LEN)))
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
#endif
|
||||
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
@ -8981,14 +8951,12 @@ int spider_mbase_handler::append_union_table_and_sql_for_bka(
|
|||
)
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
else if (spider->result_list.direct_aggregate)
|
||||
{
|
||||
if ((error_num =
|
||||
append_group_by(&tmp_sql, SPIDER_SQL_B_DOT_STR, SPIDER_SQL_B_DOT_LEN)))
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
#endif
|
||||
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
@ -9251,11 +9219,7 @@ int spider_mbase_handler::append_insert(
|
|||
spider->wide_handler->ignore_dup_key &&
|
||||
spider->direct_dup_insert &&
|
||||
!spider->wide_handler->write_can_replace &&
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
(!spider->wide_handler->insert_with_update || !dup_update_sql.length()) &&
|
||||
#else
|
||||
!spider->wide_handler->insert_with_update &&
|
||||
#endif
|
||||
/* for direct_dup_insert without patch for partition */
|
||||
spider->wide_handler->sql_command != SQLCOM_REPLACE &&
|
||||
spider->wide_handler->sql_command != SQLCOM_REPLACE_SELECT
|
||||
|
@ -9413,7 +9377,6 @@ int spider_mbase_handler::append_update_set(
|
|||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
int spider_mbase_handler::append_direct_update_set_part()
|
||||
{
|
||||
int error_num;
|
||||
|
@ -9490,7 +9453,6 @@ int spider_mbase_handler::append_update_columns(
|
|||
alias, alias_length, dbton_id, FALSE, NULL);
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
#endif
|
||||
|
||||
int spider_mbase_handler::append_select_part(
|
||||
ulong sql_type
|
||||
|
@ -9540,29 +9502,16 @@ int spider_mbase_handler::append_select(
|
|||
wide_handler->lock_mode < 1)
|
||||
{
|
||||
/* no lock */
|
||||
#ifdef SPIDER_SQL_CACHE_IS_IN_LEX
|
||||
LEX *lex = wide_handler->trx->thd->lex;
|
||||
#else
|
||||
st_select_lex *select_lex =
|
||||
&wide_handler->trx->thd->lex->select_lex;
|
||||
#endif
|
||||
if (
|
||||
#ifdef SPIDER_SQL_CACHE_IS_IN_LEX
|
||||
lex->sql_cache == LEX::SQL_CACHE &&
|
||||
#else
|
||||
select_lex->sql_cache == SELECT_LEX::SQL_CACHE &&
|
||||
#endif
|
||||
(spider->share->query_cache_sync & 1)
|
||||
) {
|
||||
if (str->reserve(SPIDER_SQL_SQL_CACHE_LEN))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
str->q_append(SPIDER_SQL_SQL_CACHE_STR, SPIDER_SQL_SQL_CACHE_LEN);
|
||||
} else if (
|
||||
#ifdef SPIDER_SQL_CACHE_IS_IN_LEX
|
||||
lex->sql_cache == LEX::SQL_NO_CACHE &&
|
||||
#else
|
||||
select_lex->sql_cache == SELECT_LEX::SQL_NO_CACHE &&
|
||||
#endif
|
||||
(spider->share->query_cache_sync & 2)
|
||||
) {
|
||||
if (str->reserve(SPIDER_SQL_SQL_NO_CACHE_LEN))
|
||||
|
@ -9615,13 +9564,10 @@ int spider_mbase_handler::append_table_select_part(
|
|||
int spider_mbase_handler::append_table_select(
|
||||
spider_string *str
|
||||
) {
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
st_select_lex *select_lex = NULL;
|
||||
bool sgb = (spider->result_list.direct_aggregate &&
|
||||
spider_param_strict_group_by(current_thd, (strict_group_by ? 1 : 0)) == 1);
|
||||
#endif
|
||||
DBUG_ENTER("spider_mbase_handler::append_table_select");
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
if (sgb)
|
||||
{
|
||||
select_lex = spider_get_select_lex(spider);
|
||||
|
@ -9660,13 +9606,10 @@ int spider_mbase_handler::append_table_select(
|
|||
}
|
||||
str->length(str->length() - SPIDER_SQL_COMMA_LEN);
|
||||
} else {
|
||||
#endif
|
||||
table_name_pos = str->length() + mysql_share->table_select_pos;
|
||||
if (str->append(*(mysql_share->table_select)))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
}
|
||||
#endif
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
@ -9694,13 +9637,10 @@ int spider_mbase_handler::append_key_select(
|
|||
spider_string *str,
|
||||
uint idx
|
||||
) {
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
st_select_lex *select_lex = NULL;
|
||||
bool sgb = (spider->result_list.direct_aggregate &&
|
||||
spider_param_strict_group_by(current_thd, (strict_group_by ? 1 : 0)) == 1);
|
||||
#endif
|
||||
DBUG_ENTER("spider_mbase_handler::append_key_select");
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
if (sgb)
|
||||
{
|
||||
select_lex = spider_get_select_lex(spider);
|
||||
|
@ -9744,13 +9684,10 @@ int spider_mbase_handler::append_key_select(
|
|||
}
|
||||
str->length(str->length() - SPIDER_SQL_COMMA_LEN);
|
||||
} else {
|
||||
#endif
|
||||
table_name_pos = str->length() + mysql_share->key_select_pos[idx];
|
||||
if (str->append(mysql_share->key_select[idx]))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
}
|
||||
#endif
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
@ -9781,13 +9718,10 @@ int spider_mbase_handler::append_minimum_select(
|
|||
Field **field;
|
||||
int field_length;
|
||||
bool appended = FALSE;
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
st_select_lex *select_lex = NULL;
|
||||
bool sgb = (spider->result_list.direct_aggregate &&
|
||||
spider_param_strict_group_by(current_thd, (strict_group_by ? 1 : 0)) == 1);
|
||||
#endif
|
||||
DBUG_ENTER("spider_mbase_handler::append_minimum_select");
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
if (sgb)
|
||||
{
|
||||
select_lex = spider_get_select_lex(spider);
|
||||
|
@ -9797,7 +9731,6 @@ int spider_mbase_handler::append_minimum_select(
|
|||
select_lex = NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
minimum_select_bitmap_create();
|
||||
for (field = table->field; *field; field++)
|
||||
{
|
||||
|
@ -9808,7 +9741,6 @@ int spider_mbase_handler::append_minimum_select(
|
|||
*/
|
||||
field_length =
|
||||
mysql_share->column_name_str[(*field)->field_index].length();
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
if (select_lex &&
|
||||
!spider_db_check_select_colum_in_group(select_lex, *field))
|
||||
{
|
||||
|
@ -9821,14 +9753,11 @@ int spider_mbase_handler::append_minimum_select(
|
|||
mysql_share->append_column_name(str, (*field)->field_index);
|
||||
str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, SPIDER_SQL_CLOSE_PAREN_LEN);
|
||||
} else {
|
||||
#endif
|
||||
if (str->reserve(field_length +
|
||||
/* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_COMMA_LEN))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
mysql_share->append_column_name(str, (*field)->field_index);
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
}
|
||||
#endif
|
||||
str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
|
||||
appended = TRUE;
|
||||
}
|
||||
|
@ -9851,13 +9780,10 @@ int spider_mbase_handler::append_table_select_with_alias(
|
|||
TABLE *table = spider->get_table();
|
||||
Field **field;
|
||||
int field_length;
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
st_select_lex *select_lex = NULL;
|
||||
bool sgb = (spider->result_list.direct_aggregate &&
|
||||
spider_param_strict_group_by(current_thd, (strict_group_by ? 1 : 0)) == 1);
|
||||
#endif
|
||||
DBUG_ENTER("spider_mbase_handler::append_table_select_with_alias");
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
if (sgb)
|
||||
{
|
||||
select_lex = spider_get_select_lex(spider);
|
||||
|
@ -9867,12 +9793,10 @@ int spider_mbase_handler::append_table_select_with_alias(
|
|||
select_lex = NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
for (field = table->field; *field; field++)
|
||||
{
|
||||
field_length =
|
||||
mysql_share->column_name_str[(*field)->field_index].length();
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
if (select_lex &&
|
||||
!spider_db_check_select_colum_in_group(select_lex, *field))
|
||||
{
|
||||
|
@ -9886,15 +9810,12 @@ int spider_mbase_handler::append_table_select_with_alias(
|
|||
mysql_share->append_column_name(str, (*field)->field_index);
|
||||
str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, SPIDER_SQL_CLOSE_PAREN_LEN);
|
||||
} else {
|
||||
#endif
|
||||
if (str->reserve(alias_length + field_length +
|
||||
/* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_COMMA_LEN))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
str->q_append(alias, alias_length);
|
||||
mysql_share->append_column_name(str, (*field)->field_index);
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
}
|
||||
#endif
|
||||
str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
|
||||
}
|
||||
str->length(str->length() - SPIDER_SQL_COMMA_LEN);
|
||||
|
@ -9911,13 +9832,10 @@ int spider_mbase_handler::append_key_select_with_alias(
|
|||
Field *field;
|
||||
uint part_num;
|
||||
int field_length;
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
st_select_lex *select_lex = NULL;
|
||||
bool sgb = (spider->result_list.direct_aggregate &&
|
||||
spider_param_strict_group_by(current_thd, (strict_group_by ? 1 : 0)) == 1);
|
||||
#endif
|
||||
DBUG_ENTER("spider_mbase_handler::append_key_select_with_alias");
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
if (sgb)
|
||||
{
|
||||
select_lex = spider_get_select_lex(spider);
|
||||
|
@ -9927,13 +9845,11 @@ int spider_mbase_handler::append_key_select_with_alias(
|
|||
select_lex = NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
for (key_part = key_info->key_part, part_num = 0;
|
||||
part_num < spider_user_defined_key_parts(key_info); key_part++, part_num++)
|
||||
{
|
||||
field = key_part->field;
|
||||
field_length = mysql_share->column_name_str[field->field_index].length();
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
if (select_lex &&
|
||||
!spider_db_check_select_colum_in_group(select_lex, field))
|
||||
{
|
||||
|
@ -9947,15 +9863,12 @@ int spider_mbase_handler::append_key_select_with_alias(
|
|||
mysql_share->append_column_name(str, field->field_index);
|
||||
str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, SPIDER_SQL_CLOSE_PAREN_LEN);
|
||||
} else {
|
||||
#endif
|
||||
if (str->reserve(alias_length + field_length +
|
||||
/* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_COMMA_LEN))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
str->q_append(alias, alias_length);
|
||||
mysql_share->append_column_name(str, field->field_index);
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
}
|
||||
#endif
|
||||
str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
|
||||
}
|
||||
str->length(str->length() - SPIDER_SQL_COMMA_LEN);
|
||||
|
@ -9971,13 +9884,10 @@ int spider_mbase_handler::append_minimum_select_with_alias(
|
|||
Field **field;
|
||||
int field_length;
|
||||
bool appended = FALSE;
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
st_select_lex *select_lex = NULL;
|
||||
bool sgb = (spider->result_list.direct_aggregate &&
|
||||
spider_param_strict_group_by(current_thd, (strict_group_by ? 1 : 0)) == 1);
|
||||
#endif
|
||||
DBUG_ENTER("spider_mbase_handler::append_minimum_select_with_alias");
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
if (sgb)
|
||||
{
|
||||
select_lex = spider_get_select_lex(spider);
|
||||
|
@ -9987,7 +9897,6 @@ int spider_mbase_handler::append_minimum_select_with_alias(
|
|||
select_lex = NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
minimum_select_bitmap_create();
|
||||
for (field = table->field; *field; field++)
|
||||
{
|
||||
|
@ -9998,7 +9907,6 @@ int spider_mbase_handler::append_minimum_select_with_alias(
|
|||
*/
|
||||
field_length =
|
||||
mysql_share->column_name_str[(*field)->field_index].length();
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
if (select_lex &&
|
||||
!spider_db_check_select_colum_in_group(select_lex, *field))
|
||||
{
|
||||
|
@ -10012,15 +9920,12 @@ int spider_mbase_handler::append_minimum_select_with_alias(
|
|||
mysql_share->append_column_name(str, (*field)->field_index);
|
||||
str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, SPIDER_SQL_CLOSE_PAREN_LEN);
|
||||
} else {
|
||||
#endif
|
||||
if (str->reserve(alias_length + field_length +
|
||||
/* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_COMMA_LEN))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
str->q_append(alias, alias_length);
|
||||
mysql_share->append_column_name(str, (*field)->field_index);
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
}
|
||||
#endif
|
||||
str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
|
||||
appended = TRUE;
|
||||
}
|
||||
|
@ -10043,13 +9948,11 @@ int spider_mbase_handler::append_select_columns_with_alias(
|
|||
int error_num;
|
||||
SPIDER_RESULT_LIST *result_list = &spider->result_list;
|
||||
DBUG_ENTER("spider_mbase_handler::append_select_columns_with_alias");
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
if (
|
||||
result_list->direct_aggregate &&
|
||||
(error_num = append_sum_select(str, alias, alias_length))
|
||||
)
|
||||
DBUG_RETURN(error_num);
|
||||
#endif
|
||||
if ((error_num = append_match_select(str, alias, alias_length)))
|
||||
DBUG_RETURN(error_num);
|
||||
if (!spider->select_column_mode)
|
||||
|
@ -11209,7 +11112,6 @@ int spider_mbase_handler::append_match_select(
|
|||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
int spider_mbase_handler::append_sum_select_part(
|
||||
ulong sql_type,
|
||||
const char *alias,
|
||||
|
@ -11256,7 +11158,6 @@ int spider_mbase_handler::append_sum_select(
|
|||
}
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
void spider_mbase_handler::set_order_pos(
|
||||
ulong sql_type
|
||||
|
@ -11310,7 +11211,6 @@ void spider_mbase_handler::set_order_to_pos(
|
|||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
int spider_mbase_handler::append_group_by_part(
|
||||
const char *alias,
|
||||
uint alias_length,
|
||||
|
@ -11373,7 +11273,6 @@ int spider_mbase_handler::append_group_by(
|
|||
}
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
int spider_mbase_handler::append_key_order_for_merge_with_alias_part(
|
||||
const char *alias,
|
||||
|
@ -11419,14 +11318,12 @@ int spider_mbase_handler::append_key_order_for_merge_with_alias(
|
|||
uint key_name_length;
|
||||
DBUG_ENTER("spider_mbase_handler::append_key_order_for_merge_with_alias");
|
||||
DBUG_PRINT("info",("spider this=%p", this));
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
if (spider->result_list.direct_aggregate)
|
||||
{
|
||||
int error_num;
|
||||
if ((error_num = append_group_by(str, alias, alias_length)))
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
#endif
|
||||
if (table->s->primary_key < MAX_KEY)
|
||||
{
|
||||
/* sort by primary key */
|
||||
|
@ -11535,13 +11432,11 @@ int spider_mbase_handler::append_key_order_for_direct_order_limit_with_alias(
|
|||
longlong offset_limit;
|
||||
DBUG_ENTER("spider_mbase_handler::append_key_order_for_direct_order_limit_with_alias");
|
||||
DBUG_PRINT("info",("spider this=%p", this));
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
if (spider->result_list.direct_aggregate)
|
||||
{
|
||||
if ((error_num = append_group_by(str, alias, alias_length)))
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
#endif
|
||||
spider_get_select_limit(spider, &select_lex, &select_limit,
|
||||
&offset_limit);
|
||||
if (select_lex->order_list.first)
|
||||
|
@ -11637,14 +11532,12 @@ int spider_mbase_handler::append_key_order_with_alias(
|
|||
uint key_name_length;
|
||||
DBUG_ENTER("spider_mbase_handler::append_key_order_with_alias");
|
||||
DBUG_PRINT("info",("spider this=%p", this));
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
if (spider->result_list.direct_aggregate)
|
||||
{
|
||||
int error_num;
|
||||
if ((error_num = append_group_by(str, alias, alias_length)))
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
#endif
|
||||
if (result_list->sorted == TRUE)
|
||||
{
|
||||
if (result_list->desc_flg == TRUE)
|
||||
|
@ -13188,15 +13081,8 @@ int spider_mbase_handler::insert_lock_tables_list(
|
|||
DBUG_PRINT("info",("spider this=%p", this));
|
||||
uint old_elements =
|
||||
db_conn->lock_table_hash.array.max_element;
|
||||
#ifdef HASH_UPDATE_WITH_HASH_VALUE
|
||||
if (my_hash_insert_with_hash_value(
|
||||
&db_conn->lock_table_hash,
|
||||
tmp_link_for_hash2->db_table_str_hash_value,
|
||||
(uchar*) tmp_link_for_hash2))
|
||||
#else
|
||||
if (my_hash_insert(&db_conn->lock_table_hash,
|
||||
(uchar*) tmp_link_for_hash2))
|
||||
#endif
|
||||
{
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
}
|
||||
|
@ -13227,7 +13113,6 @@ int spider_mbase_handler::append_lock_tables_list(
|
|||
&mysql_share->db_table_str[conn_link_idx];
|
||||
DBUG_PRINT("info",("spider db_table_str=%s",
|
||||
tmp_link_for_hash2->db_table_str->c_ptr_safe()));
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
tmp_link_for_hash2->db_table_str_hash_value =
|
||||
mysql_share->db_table_str_hash_value[conn_link_idx];
|
||||
if (!(tmp_link_for_hash = (SPIDER_LINK_FOR_HASH *)
|
||||
|
@ -13236,12 +13121,6 @@ int spider_mbase_handler::append_lock_tables_list(
|
|||
tmp_link_for_hash2->db_table_str_hash_value,
|
||||
(uchar*) tmp_link_for_hash2->db_table_str->ptr(),
|
||||
tmp_link_for_hash2->db_table_str->length())))
|
||||
#else
|
||||
if (!(tmp_link_for_hash = (SPIDER_LINK_FOR_HASH *) my_hash_search(
|
||||
&db_conn->lock_table_hash,
|
||||
(uchar*) tmp_link_for_hash2->db_table_str->ptr(),
|
||||
tmp_link_for_hash2->db_table_str->length())))
|
||||
#endif
|
||||
{
|
||||
if ((error_num = insert_lock_tables_list(conn, link_idx)))
|
||||
DBUG_RETURN(error_num);
|
||||
|
@ -13250,26 +13129,12 @@ int spider_mbase_handler::append_lock_tables_list(
|
|||
if (tmp_link_for_hash->spider->wide_handler->lock_type <
|
||||
spider->wide_handler->lock_type)
|
||||
{
|
||||
#ifdef HASH_UPDATE_WITH_HASH_VALUE
|
||||
my_hash_delete_with_hash_value(
|
||||
&db_conn->lock_table_hash,
|
||||
tmp_link_for_hash->db_table_str_hash_value,
|
||||
(uchar*) tmp_link_for_hash);
|
||||
#else
|
||||
my_hash_delete(&db_conn->lock_table_hash,
|
||||
(uchar*) tmp_link_for_hash);
|
||||
#endif
|
||||
uint old_elements =
|
||||
db_conn->lock_table_hash.array.max_element;
|
||||
#ifdef HASH_UPDATE_WITH_HASH_VALUE
|
||||
if (my_hash_insert_with_hash_value(
|
||||
&db_conn->lock_table_hash,
|
||||
tmp_link_for_hash2->db_table_str_hash_value,
|
||||
(uchar*) tmp_link_for_hash2))
|
||||
#else
|
||||
if (my_hash_insert(&db_conn->lock_table_hash,
|
||||
(uchar*) tmp_link_for_hash2))
|
||||
#endif
|
||||
{
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
}
|
||||
|
@ -14349,7 +14214,6 @@ int spider_mbase_handler::simple_action(
|
|||
DBUG_PRINT("info",("spider simple records"));
|
||||
str = &mysql_share->show_records[pos];
|
||||
break;
|
||||
#ifdef HA_HAS_CHECKSUM_EXTENDED
|
||||
case SPIDER_SIMPLE_CHECKSUM_TABLE:
|
||||
DBUG_PRINT("info",("spider simple checksum_table"));
|
||||
str = &spider->result_list.sqls[link_idx];
|
||||
|
@ -14379,7 +14243,6 @@ int spider_mbase_handler::simple_action(
|
|||
SPIDER_SQL_SQL_EXTENDED_LEN);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
DBUG_ASSERT(0);
|
||||
DBUG_RETURN(0);
|
||||
|
@ -14503,12 +14366,10 @@ int spider_mbase_handler::simple_action(
|
|||
DBUG_PRINT("info",("spider simple records"));
|
||||
error_num = res->fetch_table_records(1, spider->table_rows);
|
||||
break;
|
||||
#ifdef HA_HAS_CHECKSUM_EXTENDED
|
||||
case SPIDER_SIMPLE_CHECKSUM_TABLE:
|
||||
DBUG_PRINT("info",("spider simple checksum_table"));
|
||||
error_num = res->fetch_table_checksum(spider);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
DBUG_ASSERT(0);
|
||||
break;
|
||||
|
@ -14537,7 +14398,6 @@ int spider_mbase_handler::show_records(
|
|||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
#ifdef HA_HAS_CHECKSUM_EXTENDED
|
||||
int spider_mbase_handler::checksum_table(
|
||||
int link_idx
|
||||
) {
|
||||
|
@ -14545,7 +14405,6 @@ int spider_mbase_handler::checksum_table(
|
|||
DBUG_RETURN(simple_action(SPIDER_SIMPLE_CHECKSUM_TABLE, link_idx));
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
int spider_mbase_handler::show_last_insert_id(
|
||||
int link_idx,
|
||||
|
@ -15812,7 +15671,6 @@ int spider_mbase_handler::append_order_by(
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
bool spider_mbase_handler::check_direct_update(
|
||||
st_select_lex *select_lex,
|
||||
longlong select_limit,
|
||||
|
@ -15832,7 +15690,6 @@ bool spider_mbase_handler::check_direct_delete(
|
|||
DBUG_PRINT("info",("spider this=%p", this));
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
#endif
|
||||
|
||||
spider_mbase_copy_table::spider_mbase_copy_table(
|
||||
spider_mbase_share *db_share
|
||||
|
|
|
@ -145,7 +145,6 @@ protected:
|
|||
spider_fields *fields
|
||||
);
|
||||
public:
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
int open_item_sum_func(
|
||||
Item_sum *item_sum,
|
||||
ha_spider *spider,
|
||||
|
@ -155,7 +154,6 @@ public:
|
|||
bool use_fields,
|
||||
spider_fields *fields
|
||||
) override;
|
||||
#endif
|
||||
int append_escaped_util(
|
||||
spider_string *to,
|
||||
String *from
|
||||
|
@ -324,11 +322,9 @@ public:
|
|||
int mode,
|
||||
ha_rows &records
|
||||
) override;
|
||||
#ifdef HA_HAS_CHECKSUM_EXTENDED
|
||||
int fetch_table_checksum(
|
||||
ha_spider *spider
|
||||
) override;
|
||||
#endif
|
||||
int fetch_table_cardinality(
|
||||
int mode,
|
||||
TABLE *table,
|
||||
|
@ -628,9 +624,7 @@ public:
|
|||
spider_string *db_names_str;
|
||||
/* fixme: this field looks useless */
|
||||
spider_string *db_table_str;
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
my_hash_value_type *db_table_str_hash_value;
|
||||
#endif
|
||||
uint table_nm_max_length;
|
||||
uint db_nm_max_length;
|
||||
spider_string *column_name_str;
|
||||
|
@ -677,9 +671,7 @@ public:
|
|||
spider_string *str
|
||||
) override;
|
||||
#endif
|
||||
#ifdef HA_HAS_CHECKSUM_EXTENDED
|
||||
bool checksum_support() override;
|
||||
#endif
|
||||
protected:
|
||||
int create_table_names_str();
|
||||
void free_table_names_str();
|
||||
|
@ -866,7 +858,6 @@ public:
|
|||
int append_update_set(
|
||||
spider_string *str
|
||||
);
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
int append_direct_update_set_part() override;
|
||||
int append_direct_update_set(
|
||||
spider_string *str
|
||||
|
@ -885,7 +876,6 @@ public:
|
|||
const char *alias,
|
||||
uint alias_length
|
||||
);
|
||||
#endif
|
||||
int append_select_part(
|
||||
ulong sql_type
|
||||
) override;
|
||||
|
@ -1082,7 +1072,6 @@ public:
|
|||
const char *alias,
|
||||
uint alias_length
|
||||
);
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
int append_sum_select_part(
|
||||
ulong sql_type,
|
||||
const char *alias,
|
||||
|
@ -1093,14 +1082,12 @@ public:
|
|||
const char *alias,
|
||||
uint alias_length
|
||||
);
|
||||
#endif
|
||||
void set_order_pos(
|
||||
ulong sql_type
|
||||
) override;
|
||||
void set_order_to_pos(
|
||||
ulong sql_type
|
||||
) override;
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
int append_group_by_part(
|
||||
const char *alias,
|
||||
uint alias_length,
|
||||
|
@ -1111,7 +1098,6 @@ public:
|
|||
const char *alias,
|
||||
uint alias_length
|
||||
);
|
||||
#endif
|
||||
int append_key_order_for_merge_with_alias_part(
|
||||
const char *alias,
|
||||
uint alias_length,
|
||||
|
@ -1412,11 +1398,9 @@ public:
|
|||
int show_records(
|
||||
int link_idx
|
||||
) override;
|
||||
#ifdef HA_HAS_CHECKSUM_EXTENDED
|
||||
int checksum_table(
|
||||
int link_idx
|
||||
) override;
|
||||
#endif
|
||||
int show_last_insert_id(
|
||||
int link_idx,
|
||||
ulonglong &last_insert_id
|
||||
|
@ -1563,7 +1547,6 @@ public:
|
|||
spider_fields *fields
|
||||
);
|
||||
#endif
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
bool check_direct_update(
|
||||
st_select_lex *select_lex,
|
||||
longlong select_limit,
|
||||
|
@ -1574,7 +1557,6 @@ public:
|
|||
longlong select_limit,
|
||||
longlong offset_limit
|
||||
) override;
|
||||
#endif
|
||||
};
|
||||
|
||||
class spider_mysql_handler: public spider_mbase_handler
|
||||
|
|
|
@ -17,14 +17,11 @@
|
|||
#define MYSQL_SERVER 1
|
||||
#include <my_global.h>
|
||||
#include "mysql_version.h"
|
||||
#include "spd_environ.h"
|
||||
#include "sql_priv.h"
|
||||
#include "probes_mysql.h"
|
||||
#include "sql_partition.h"
|
||||
#include "sql_analyse.h"
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
#include "sql_select.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ORACLE_OCI
|
||||
#if (defined(WIN32) || defined(_WIN32) || defined(WINDOWS) || defined(_WINDOWS))
|
||||
|
@ -2353,12 +2350,7 @@ int spider_db_oracle::append_lock_tables(
|
|||
my_hash_reset(&lock_table_hash);
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
#ifdef HASH_UPDATE_WITH_HASH_VALUE
|
||||
my_hash_delete_with_hash_value(&lock_table_hash,
|
||||
tmp_link_for_hash->db_table_str_hash_value, (uchar*) tmp_link_for_hash);
|
||||
#else
|
||||
my_hash_delete(&lock_table_hash, (uchar*) tmp_link_for_hash);
|
||||
#endif
|
||||
|
||||
if ((error_num = spider_db_oracle_utility.append_lock_table_tail(str)))
|
||||
{
|
||||
|
@ -3094,11 +3086,7 @@ int spider_db_oracle_util::open_item_func(
|
|||
{
|
||||
if (
|
||||
!strncasecmp("rand", func_name, func_name_length) &&
|
||||
#ifdef SPIDER_Item_args_arg_count_IS_PROTECTED
|
||||
!item_func->argument_count()
|
||||
#else
|
||||
!item_func->arg_count
|
||||
#endif
|
||||
) {
|
||||
if (str)
|
||||
str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN);
|
||||
|
@ -4122,7 +4110,6 @@ int spider_db_oracle_util::open_item_func(
|
|||
}
|
||||
break;
|
||||
case Item_func::LIKE_FUNC:
|
||||
#ifdef SPIDER_LIKE_FUNC_HAS_GET_NEGATED
|
||||
if (str)
|
||||
{
|
||||
if (((Item_func_like *)item_func)->get_negated())
|
||||
|
@ -4138,9 +4125,6 @@ int spider_db_oracle_util::open_item_func(
|
|||
}
|
||||
}
|
||||
break;
|
||||
#else
|
||||
DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM);
|
||||
#endif
|
||||
default:
|
||||
THD *thd = spider->wide_handler->trx->thd;
|
||||
SPIDER_SHARE *share = spider->share;
|
||||
|
@ -4255,7 +4239,6 @@ int spider_db_oracle_util::open_item_func(
|
|||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
int spider_db_oracle_util::open_item_sum_func(
|
||||
Item_sum *item_sum,
|
||||
ha_spider *spider,
|
||||
|
@ -4331,7 +4314,6 @@ int spider_db_oracle_util::open_item_sum_func(
|
|||
}
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
size_t spider_db_oracle_util::escape_string(
|
||||
char *to,
|
||||
|
@ -4503,9 +4485,7 @@ spider_oracle_share::spider_oracle_share(
|
|||
db_names_str(NULL),
|
||||
db_table_str(NULL),
|
||||
nextval_str(NULL),
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
db_table_str_hash_value(NULL),
|
||||
#endif
|
||||
table_nm_max_length(0),
|
||||
db_nm_max_length(0),
|
||||
nextval_max_length(0),
|
||||
|
@ -4558,10 +4538,8 @@ int spider_oracle_share::init()
|
|||
__func__, __FILE__, __LINE__, MYF(MY_WME | MY_ZEROFILL),
|
||||
&key_select_pos,
|
||||
sizeof(int) * keys,
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
&db_table_str_hash_value,
|
||||
sizeof(my_hash_value_type) * spider_share->all_link_count,
|
||||
#endif
|
||||
NullS))
|
||||
) {
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
|
@ -4839,10 +4817,8 @@ int spider_oracle_share::create_table_names_str()
|
|||
if ((error_num = append_table_name(str, roop_count)))
|
||||
goto error;
|
||||
}
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
db_table_str_hash_value[roop_count] = my_calc_hash(
|
||||
&spider_open_connections, (uchar*) str->ptr(), str->length());
|
||||
#endif
|
||||
}
|
||||
DBUG_RETURN(0);
|
||||
|
||||
|
@ -5526,10 +5502,8 @@ int spider_oracle_handler::init()
|
|||
link_for_hash[roop_count].link_idx = roop_count;
|
||||
link_for_hash[roop_count].db_table_str =
|
||||
&oracle_share->db_table_str[roop_count];
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
link_for_hash[roop_count].db_table_str_hash_value =
|
||||
oracle_share->db_table_str_hash_value[roop_count];
|
||||
#endif
|
||||
}
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
@ -5775,14 +5749,12 @@ int spider_oracle_handler::append_tmp_table_and_sql_for_bka(
|
|||
SPIDER_SQL_B_DOT_STR, SPIDER_SQL_B_DOT_LEN)))
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
else if (spider->result_list.direct_aggregate)
|
||||
{
|
||||
if ((error_num =
|
||||
append_group_by(&sql, SPIDER_SQL_B_DOT_STR, SPIDER_SQL_B_DOT_LEN)))
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
#endif
|
||||
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
@ -6015,14 +5987,12 @@ int spider_oracle_handler::append_union_table_and_sql_for_bka(
|
|||
&tmp_sql, SPIDER_SQL_B_DOT_STR, SPIDER_SQL_B_DOT_LEN)))
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
else if (spider->result_list.direct_aggregate)
|
||||
{
|
||||
if ((error_num =
|
||||
append_group_by(&tmp_sql, SPIDER_SQL_B_DOT_STR, SPIDER_SQL_B_DOT_LEN)))
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
#endif
|
||||
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
@ -6369,7 +6339,6 @@ int spider_oracle_handler::append_update_set(
|
|||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
int spider_oracle_handler::append_direct_update_set_part()
|
||||
{
|
||||
int error_num;
|
||||
|
@ -6486,7 +6455,6 @@ int spider_oracle_handler::append_update_columns(
|
|||
DBUG_RETURN(error_num);
|
||||
*/
|
||||
}
|
||||
#endif
|
||||
|
||||
int spider_oracle_handler::append_select_part(
|
||||
ulong sql_type
|
||||
|
@ -6748,13 +6716,11 @@ int spider_oracle_handler::append_select_columns_with_alias(
|
|||
int error_num;
|
||||
SPIDER_RESULT_LIST *result_list = &spider->result_list;
|
||||
DBUG_ENTER("spider_oracle_handler::append_select_columns_with_alias");
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
if (
|
||||
result_list->direct_aggregate &&
|
||||
(error_num = append_sum_select(str, alias, alias_length))
|
||||
)
|
||||
DBUG_RETURN(error_num);
|
||||
#endif
|
||||
if ((error_num = append_match_select(str, alias, alias_length)))
|
||||
DBUG_RETURN(error_num);
|
||||
if (!spider->select_column_mode)
|
||||
|
@ -7872,7 +7838,6 @@ int spider_oracle_handler::append_match_select(
|
|||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
int spider_oracle_handler::append_sum_select_part(
|
||||
ulong sql_type,
|
||||
const char *alias,
|
||||
|
@ -7919,7 +7884,6 @@ int spider_oracle_handler::append_sum_select(
|
|||
}
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
void spider_oracle_handler::set_order_pos(
|
||||
ulong sql_type
|
||||
|
@ -7973,7 +7937,6 @@ void spider_oracle_handler::set_order_to_pos(
|
|||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
int spider_oracle_handler::append_group_by_part(
|
||||
const char *alias,
|
||||
uint alias_length,
|
||||
|
@ -8036,7 +7999,6 @@ int spider_oracle_handler::append_group_by(
|
|||
}
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
int spider_oracle_handler::append_key_order_for_merge_with_alias_part(
|
||||
const char *alias,
|
||||
|
@ -8082,14 +8044,12 @@ int spider_oracle_handler::append_key_order_for_merge_with_alias(
|
|||
uint key_name_length;
|
||||
DBUG_ENTER("spider_oracle_handler::append_key_order_for_merge_with_alias");
|
||||
DBUG_PRINT("info",("spider this=%p", this));
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
if (spider->result_list.direct_aggregate)
|
||||
{
|
||||
int error_num;
|
||||
if ((error_num = append_group_by(str, alias, alias_length)))
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
#endif
|
||||
if (
|
||||
spider->result_list.direct_order_limit ||
|
||||
spider->result_list.internal_limit < 9223372036854775807LL ||
|
||||
|
@ -8312,13 +8272,11 @@ int spider_oracle_handler::append_key_order_for_direct_order_limit_with_alias(
|
|||
longlong offset_limit;
|
||||
DBUG_ENTER("spider_oracle_handler::append_key_order_for_direct_order_limit_with_alias");
|
||||
DBUG_PRINT("info",("spider this=%p", this));
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
if (spider->result_list.direct_aggregate)
|
||||
{
|
||||
if ((error_num = append_group_by(str, alias, alias_length)))
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
#endif
|
||||
spider_get_select_limit(spider, &select_lex, &select_limit,
|
||||
&offset_limit);
|
||||
if (
|
||||
|
@ -8537,14 +8495,12 @@ int spider_oracle_handler::append_key_order_with_alias(
|
|||
uint key_name_length;
|
||||
DBUG_ENTER("spider_oracle_handler::append_key_order_with_alias");
|
||||
DBUG_PRINT("info",("spider this=%p", this));
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
if (spider->result_list.direct_aggregate)
|
||||
{
|
||||
int error_num;
|
||||
if ((error_num = append_group_by(str, alias, alias_length)))
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
#endif
|
||||
if (
|
||||
spider->result_list.direct_order_limit ||
|
||||
spider->result_list.internal_limit < 9223372036854775807LL ||
|
||||
|
@ -10349,15 +10305,8 @@ int spider_oracle_handler::insert_lock_tables_list(
|
|||
DBUG_PRINT("info",("spider this=%p", this));
|
||||
uint old_elements =
|
||||
db_conn->lock_table_hash.array.max_element;
|
||||
#ifdef HASH_UPDATE_WITH_HASH_VALUE
|
||||
if (my_hash_insert_with_hash_value(
|
||||
&db_conn->lock_table_hash,
|
||||
tmp_link_for_hash2->db_table_str_hash_value,
|
||||
(uchar*) tmp_link_for_hash2))
|
||||
#else
|
||||
if (my_hash_insert(&db_conn->lock_table_hash,
|
||||
(uchar*) tmp_link_for_hash2))
|
||||
#endif
|
||||
{
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
}
|
||||
|
@ -10385,7 +10334,6 @@ int spider_oracle_handler::append_lock_tables_list(
|
|||
tmp_link_for_hash2 = &link_for_hash[link_idx];
|
||||
tmp_link_for_hash2->db_table_str =
|
||||
&oracle_share->db_table_str[conn_link_idx];
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
tmp_link_for_hash2->db_table_str_hash_value =
|
||||
oracle_share->db_table_str_hash_value[conn_link_idx];
|
||||
if (!(tmp_link_for_hash = (SPIDER_LINK_FOR_HASH *)
|
||||
|
@ -10394,12 +10342,6 @@ int spider_oracle_handler::append_lock_tables_list(
|
|||
tmp_link_for_hash2->db_table_str_hash_value,
|
||||
(uchar*) tmp_link_for_hash2->db_table_str->ptr(),
|
||||
tmp_link_for_hash2->db_table_str->length())))
|
||||
#else
|
||||
if (!(tmp_link_for_hash = (SPIDER_LINK_FOR_HASH *) my_hash_search(
|
||||
&db_conn->lock_table_hash,
|
||||
(uchar*) tmp_link_for_hash2->db_table_str->ptr(),
|
||||
tmp_link_for_hash2->db_table_str->length())))
|
||||
#endif
|
||||
{
|
||||
if ((error_num = insert_lock_tables_list(conn, link_idx)))
|
||||
DBUG_RETURN(error_num);
|
||||
|
@ -10408,26 +10350,12 @@ int spider_oracle_handler::append_lock_tables_list(
|
|||
if (tmp_link_for_hash->spider->wide_handler->lock_type <
|
||||
spider->wide_handler->lock_type)
|
||||
{
|
||||
#ifdef HASH_UPDATE_WITH_HASH_VALUE
|
||||
my_hash_delete_with_hash_value(
|
||||
&db_conn->lock_table_hash,
|
||||
tmp_link_for_hash->db_table_str_hash_value,
|
||||
(uchar*) tmp_link_for_hash);
|
||||
#else
|
||||
my_hash_delete(&db_conn->lock_table_hash,
|
||||
(uchar*) tmp_link_for_hash);
|
||||
#endif
|
||||
uint old_elements =
|
||||
db_conn->lock_table_hash.array.max_element;
|
||||
#ifdef HASH_UPDATE_WITH_HASH_VALUE
|
||||
if (my_hash_insert_with_hash_value(
|
||||
&db_conn->lock_table_hash,
|
||||
tmp_link_for_hash2->db_table_str_hash_value,
|
||||
(uchar*) tmp_link_for_hash2))
|
||||
#else
|
||||
if (my_hash_insert(&db_conn->lock_table_hash,
|
||||
(uchar*) tmp_link_for_hash2))
|
||||
#endif
|
||||
{
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
}
|
||||
|
|
|
@ -125,7 +125,6 @@ public:
|
|||
bool use_fields,
|
||||
spider_fields *fields
|
||||
);
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
int open_item_sum_func(
|
||||
Item_sum *item_sum,
|
||||
ha_spider *spider,
|
||||
|
@ -135,7 +134,6 @@ public:
|
|||
bool use_fields,
|
||||
spider_fields *fields
|
||||
);
|
||||
#endif
|
||||
size_t escape_string(
|
||||
char *to,
|
||||
const char *from,
|
||||
|
@ -523,9 +521,7 @@ public:
|
|||
spider_string *db_names_str;
|
||||
spider_string *db_table_str;
|
||||
spider_string *nextval_str;
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
my_hash_value_type *db_table_str_hash_value;
|
||||
#endif
|
||||
uint table_nm_max_length;
|
||||
uint db_nm_max_length;
|
||||
uint nextval_max_length;
|
||||
|
@ -745,7 +741,6 @@ public:
|
|||
int append_update_set(
|
||||
spider_string *str
|
||||
);
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
int append_direct_update_set_part();
|
||||
int append_direct_update_set(
|
||||
spider_string *str
|
||||
|
@ -764,7 +759,6 @@ public:
|
|||
const char *alias,
|
||||
uint alias_length
|
||||
);
|
||||
#endif
|
||||
int append_select_part(
|
||||
ulong sql_type
|
||||
);
|
||||
|
@ -961,7 +955,6 @@ public:
|
|||
const char *alias,
|
||||
uint alias_length
|
||||
);
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
int append_sum_select_part(
|
||||
ulong sql_type,
|
||||
const char *alias,
|
||||
|
@ -972,14 +965,12 @@ public:
|
|||
const char *alias,
|
||||
uint alias_length
|
||||
);
|
||||
#endif
|
||||
void set_order_pos(
|
||||
ulong sql_type
|
||||
);
|
||||
void set_order_to_pos(
|
||||
ulong sql_type
|
||||
);
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
int append_group_by_part(
|
||||
const char *alias,
|
||||
uint alias_length,
|
||||
|
@ -990,7 +981,6 @@ public:
|
|||
const char *alias,
|
||||
uint alias_length
|
||||
);
|
||||
#endif
|
||||
int append_key_order_for_merge_with_alias_part(
|
||||
const char *alias,
|
||||
uint alias_length,
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#define MYSQL_SERVER 1
|
||||
#include <my_global.h>
|
||||
#include "mysql_version.h"
|
||||
#include "spd_environ.h"
|
||||
#include "sql_priv.h"
|
||||
#include "probes_mysql.h"
|
||||
#include "sql_class.h"
|
||||
|
@ -279,10 +278,8 @@ int spider_udf_direct_sql_create_conn_key(
|
|||
spider_create_conn_key_add_one(&counter, &tmp_name, direct_sql->tgt_filedsn);
|
||||
spider_create_conn_key_add_one(&counter, &tmp_name, direct_sql->tgt_driver);
|
||||
tmp_name++;
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
direct_sql->conn_key_hash_value = my_calc_hash(&spider_open_connections,
|
||||
(uchar*) direct_sql->conn_key, direct_sql->conn_key_length);
|
||||
#endif
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
@ -457,14 +454,9 @@ SPIDER_CONN *spider_udf_direct_sql_create_conn(
|
|||
pthread_mutex_unlock(&spider_conn_id_mutex);
|
||||
|
||||
pthread_mutex_lock(&spider_ipport_conn_mutex);
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
if ((ip_port_conn = (SPIDER_IP_PORT_CONN*) my_hash_search_using_hash_value(
|
||||
&spider_ipport_conns, conn->conn_key_hash_value,
|
||||
(uchar*)conn->conn_key, conn->conn_key_length)))
|
||||
#else
|
||||
if ((ip_port_conn = (SPIDER_IP_PORT_CONN*) my_hash_search(
|
||||
&spider_ipport_conns, (uchar*)conn->conn_key, conn->conn_key_length)))
|
||||
#endif
|
||||
{ /* exists, +1 */
|
||||
pthread_mutex_unlock(&spider_ipport_conn_mutex);
|
||||
pthread_mutex_lock(&ip_port_conn->mutex);
|
||||
|
@ -521,18 +513,11 @@ SPIDER_CONN *spider_udf_direct_sql_get_conn(
|
|||
SPIDER_CONN *conn = NULL;
|
||||
DBUG_ENTER("spider_udf_direct_sql_get_conn");
|
||||
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
if (
|
||||
!(conn = (SPIDER_CONN*) my_hash_search_using_hash_value(
|
||||
&trx->trx_conn_hash, direct_sql->conn_key_hash_value,
|
||||
(uchar*) direct_sql->conn_key, direct_sql->conn_key_length))
|
||||
)
|
||||
#else
|
||||
if (
|
||||
!(conn = (SPIDER_CONN*) my_hash_search(&trx->trx_conn_hash,
|
||||
(uchar*) direct_sql->conn_key, direct_sql->conn_key_length))
|
||||
)
|
||||
#endif
|
||||
{
|
||||
if (
|
||||
(
|
||||
|
@ -541,14 +526,9 @@ SPIDER_CONN *spider_udf_direct_sql_get_conn(
|
|||
)
|
||||
) {
|
||||
pthread_mutex_lock(&spider_conn_mutex);
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
if (!(conn = (SPIDER_CONN*) my_hash_search_using_hash_value(
|
||||
&spider_open_connections, direct_sql->conn_key_hash_value,
|
||||
(uchar*) direct_sql->conn_key, direct_sql->conn_key_length)))
|
||||
#else
|
||||
if (!(conn = (SPIDER_CONN*) my_hash_search(&spider_open_connections,
|
||||
(uchar*) direct_sql->conn_key, direct_sql->conn_key_length)))
|
||||
#endif
|
||||
{
|
||||
pthread_mutex_unlock(&spider_conn_mutex);
|
||||
DBUG_PRINT("info",("spider create new conn"));
|
||||
|
@ -556,12 +536,7 @@ SPIDER_CONN *spider_udf_direct_sql_get_conn(
|
|||
error_num)))
|
||||
goto error;
|
||||
} else {
|
||||
#ifdef HASH_UPDATE_WITH_HASH_VALUE
|
||||
my_hash_delete_with_hash_value(&spider_open_connections,
|
||||
conn->conn_key_hash_value, (uchar*) conn);
|
||||
#else
|
||||
my_hash_delete(&spider_open_connections, (uchar*) conn);
|
||||
#endif
|
||||
pthread_mutex_unlock(&spider_conn_mutex);
|
||||
DBUG_PRINT("info",("spider get global conn"));
|
||||
}
|
||||
|
@ -575,12 +550,7 @@ SPIDER_CONN *spider_udf_direct_sql_get_conn(
|
|||
conn->priority = direct_sql->priority;
|
||||
|
||||
uint old_elements = trx->trx_conn_hash.array.max_element;
|
||||
#ifdef HASH_UPDATE_WITH_HASH_VALUE
|
||||
if (my_hash_insert_with_hash_value(&trx->trx_conn_hash,
|
||||
direct_sql->conn_key_hash_value, (uchar*) conn))
|
||||
#else
|
||||
if (my_hash_insert(&trx->trx_conn_hash, (uchar*) conn))
|
||||
#endif
|
||||
{
|
||||
spider_free_conn(conn);
|
||||
*error_num = HA_ERR_OUT_OF_MEM;
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
/* Copyright (C) 2008-2020 Kentoku Shiba
|
||||
Copyright (C) 2017-2020 MariaDB corp
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
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 functionality offered by MySQL or MariaDB
|
||||
*/
|
||||
|
||||
#ifndef SPD_ENVIRON_INCLUDED
|
||||
|
||||
#define SPIDER_HANDLER_START_BULK_INSERT_HAS_FLAGS
|
||||
|
||||
#define SPIDER_SUPPORT_CREATE_OR_REPLACE_TABLE
|
||||
#define SPIDER_NET_HAS_THD
|
||||
|
||||
#define HANDLER_HAS_TOP_TABLE_FIELDS
|
||||
#define HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
#define HANDLER_HAS_DIRECT_AGGREGATE
|
||||
#define PARTITION_HAS_GET_PART_SPEC
|
||||
#define HA_EXTRA_HAS_STARTING_ORDERED_INDEX_SCAN
|
||||
#define HANDLER_HAS_NEED_INFO_FOR_AUTO_INC
|
||||
#define HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT
|
||||
|
||||
#define SPIDER_UPDATE_ROW_HAS_CONST_NEW_DATA
|
||||
|
||||
#define SPIDER_MDEV_16246
|
||||
|
||||
#define SPIDER_USE_CONST_ITEM_FOR_STRING_INT_REAL_DECIMAL_DATE_ITEM
|
||||
#define SPIDER_SQL_CACHE_IS_IN_LEX
|
||||
#define SPIDER_LIKE_FUNC_HAS_GET_NEGATED
|
||||
#define HA_HAS_CHECKSUM_EXTENDED
|
||||
|
||||
#define SPIDER_I_S_USE_SHOW_FOR_COLUMN
|
||||
#endif /* SPD_ENVIRON_INCLUDED */
|
|
@ -17,7 +17,6 @@
|
|||
#define MYSQL_SERVER 1
|
||||
#include <my_global.h>
|
||||
#include "mysql_version.h"
|
||||
#include "spd_environ.h"
|
||||
#include "sql_priv.h"
|
||||
#include "probes_mysql.h"
|
||||
#include "sql_class.h"
|
||||
|
@ -1033,10 +1032,8 @@ static int spider_prepare_init_scan(
|
|||
for (link_idx = 0; link_idx < (int) share->link_count; ++link_idx)
|
||||
spider->sql_kind[link_idx] = SPIDER_SQL_KIND_SQL;
|
||||
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
spider->do_direct_update = FALSE;
|
||||
spider->direct_update_kinds = 0;
|
||||
#endif
|
||||
spider_get_select_limit(spider, &select_lex, &select_limit, &offset_limit);
|
||||
direct_order_limit = spider_param_direct_order_limit(thd,
|
||||
share->direct_order_limit);
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#define MYSQL_SERVER 1
|
||||
#include <my_global.h>
|
||||
#include "mysql_version.h"
|
||||
#include "spd_environ.h"
|
||||
#include "sql_priv.h"
|
||||
#include "probes_mysql.h"
|
||||
#include "sql_class.h"
|
||||
|
@ -42,7 +41,6 @@ static struct st_mysql_storage_engine spider_i_s_info =
|
|||
{ MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION };
|
||||
|
||||
namespace Show {
|
||||
#ifdef SPIDER_I_S_USE_SHOW_FOR_COLUMN
|
||||
static ST_FIELD_INFO spider_i_s_alloc_mem_fields_info[] =
|
||||
{
|
||||
Column("ID", ULong(10), NOT_NULL, "id"),
|
||||
|
@ -55,27 +53,6 @@ static ST_FIELD_INFO spider_i_s_alloc_mem_fields_info[] =
|
|||
Column("FREE_MEM_COUNT", ULonglong(20), NULLABLE, "free_mem_count"),
|
||||
CEnd()
|
||||
};
|
||||
#else
|
||||
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}
|
||||
};
|
||||
#endif
|
||||
} // namespace Show
|
||||
|
||||
static int spider_i_s_alloc_mem_fill_table(
|
||||
|
@ -183,7 +160,6 @@ struct st_maria_plugin spider_i_s_alloc_mem_maria =
|
|||
extern SPIDER_DBTON spider_dbton[SPIDER_DBTON_SIZE];
|
||||
|
||||
namespace Show {
|
||||
#ifdef SPIDER_I_S_USE_SHOW_FOR_COLUMN
|
||||
static ST_FIELD_INFO spider_i_s_wrapper_protocols_fields_info[] =
|
||||
{
|
||||
Column("WRAPPER_NAME", Varchar(NAME_CHAR_LEN), NOT_NULL, ""),
|
||||
|
@ -192,16 +168,6 @@ static ST_FIELD_INFO spider_i_s_wrapper_protocols_fields_info[] =
|
|||
Column("WRAPPER_MATURITY", Varchar(12), NOT_NULL, ""),
|
||||
CEnd()
|
||||
};
|
||||
#else
|
||||
static ST_FIELD_INFO spider_i_s_wrapper_protocols_fields_info[] =
|
||||
{
|
||||
{"WRAPPER_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
|
||||
{"WRAPPER_VERSION", 20, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
|
||||
{"WRAPPER_DESCRIPTION", 65535, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN_TABLE},
|
||||
{"WRAPPER_MATURITY", 12, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
|
||||
{0, 0, MYSQL_TYPE_STRING, 0, 0, 0, 0}
|
||||
};
|
||||
#endif
|
||||
} // namespace Show
|
||||
|
||||
static int spider_i_s_wrapper_protocols_fill_table(
|
||||
|
|
|
@ -90,8 +90,6 @@
|
|||
#define SPIDER_ENGINE_CONDITION_PUSHDOWN_IS_ALWAYS_ON
|
||||
#define SPIDER_XID_USES_xid_cache_iterate
|
||||
|
||||
#define SPIDER_Item_args_arg_count_IS_PROTECTED
|
||||
|
||||
#define SPIDER_Item_func_conv_charset_conv_charset collation.collation
|
||||
|
||||
#define SPIDER_WITHOUT_HA_STATISTIC_INCREMENT
|
||||
|
@ -128,8 +126,6 @@
|
|||
#define SPIDER_item_name_length(A) (A)->name.length
|
||||
const LEX_CSTRING SPIDER_empty_string = {"", 0};
|
||||
|
||||
#define SPIDER_HAS_HASH_VALUE_TYPE
|
||||
|
||||
#define SPIDER_date_mode_t(A) date_mode_t(A)
|
||||
#define SPIDER_str_to_datetime(A,B,C,D,E) str_to_datetime_or_date(A,B,C,D,E)
|
||||
#define SPIDER_get_linkage(A) A->get_linkage()
|
||||
|
@ -498,9 +494,7 @@ typedef struct st_spider_link_for_hash
|
|||
ha_spider *spider;
|
||||
int link_idx;
|
||||
spider_string *db_table_str;
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
my_hash_value_type db_table_str_hash_value;
|
||||
#endif
|
||||
} SPIDER_LINK_FOR_HASH;
|
||||
|
||||
/* alter table */
|
||||
|
@ -510,9 +504,7 @@ typedef struct st_spider_alter_table
|
|||
char *table_name;
|
||||
uint table_name_length;
|
||||
char *tmp_char;
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
my_hash_value_type table_name_hash_value;
|
||||
#endif
|
||||
longlong tmp_priority;
|
||||
uint link_count;
|
||||
uint all_link_count;
|
||||
|
@ -614,9 +606,7 @@ typedef struct st_spider_conn
|
|||
uint conn_kind;
|
||||
char *conn_key;
|
||||
uint conn_key_length;
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
my_hash_value_type conn_key_hash_value;
|
||||
#endif
|
||||
int link_idx;
|
||||
spider_db_conn *db_conn;
|
||||
uint opened_handlers;
|
||||
|
@ -829,9 +819,7 @@ typedef struct st_spider_lgtm_tblhnd_share
|
|||
{
|
||||
char *table_name;
|
||||
uint table_name_length;
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
my_hash_value_type table_path_hash_value;
|
||||
#endif
|
||||
pthread_mutex_t auto_increment_mutex;
|
||||
volatile bool auto_increment_init;
|
||||
volatile ulonglong auto_increment_lclval;
|
||||
|
@ -854,9 +842,7 @@ typedef struct st_spider_wide_share
|
|||
{
|
||||
char *table_name;
|
||||
uint table_name_length;
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
my_hash_value_type table_path_hash_value;
|
||||
#endif
|
||||
uint use_count;
|
||||
THR_LOCK lock;
|
||||
pthread_mutex_t sts_mutex;
|
||||
|
@ -906,10 +892,8 @@ typedef struct st_spider_wide_handler
|
|||
#ifdef WITH_PARTITION_STORAGE_ENGINE
|
||||
SPIDER_PARTITION_HANDLER *partition_handler;
|
||||
#endif
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
List<Item> *direct_update_fields;
|
||||
List<Item> *direct_update_values;
|
||||
#endif
|
||||
TABLE_SHARE *top_share;
|
||||
enum thr_lock_type lock_type;
|
||||
uchar lock_table_type;
|
||||
|
@ -918,11 +902,9 @@ typedef struct st_spider_wide_handler
|
|||
int cond_check_error;
|
||||
uint sql_command;
|
||||
uint top_table_fields;
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
#ifdef INFO_KIND_FORCE_LIMIT_BEGIN
|
||||
longlong info_limit;
|
||||
#endif
|
||||
#endif
|
||||
#ifdef HA_CAN_BULK_ACCESS
|
||||
ulonglong external_lock_cnt;
|
||||
#endif
|
||||
|
@ -963,9 +945,7 @@ typedef struct st_spider_transaction
|
|||
bool updated_in_this_trx;
|
||||
|
||||
THD *thd;
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
my_hash_value_type thd_hash_value;
|
||||
#endif
|
||||
XID xid;
|
||||
HASH trx_conn_hash;
|
||||
uint trx_conn_hash_id;
|
||||
|
@ -1060,11 +1040,9 @@ typedef struct st_spider_share
|
|||
pthread_mutex_t crd_mutex;
|
||||
TABLE_SHARE *table_share;
|
||||
SPIDER_LGTM_TBLHND_SHARE *lgtm_tblhnd_share;
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
my_hash_value_type table_name_hash_value;
|
||||
#ifdef WITH_PARTITION_STORAGE_ENGINE
|
||||
my_hash_value_type table_path_hash_value;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
volatile bool init;
|
||||
|
@ -1239,9 +1217,7 @@ typedef struct st_spider_share
|
|||
char *bka_engine;
|
||||
int bka_engine_length;
|
||||
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
my_hash_value_type *conn_keys_hash_value;
|
||||
#endif
|
||||
char **server_names;
|
||||
char **tgt_table_names;
|
||||
char **tgt_dbs;
|
||||
|
@ -1410,9 +1386,7 @@ typedef struct st_spider_init_error_table
|
|||
{
|
||||
char *table_name;
|
||||
uint table_name_length;
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
my_hash_value_type table_name_hash_value;
|
||||
#endif
|
||||
bool init_error_with_message;
|
||||
char init_error_msg[MYSQL_ERRMSG_SIZE];
|
||||
volatile int init_error;
|
||||
|
@ -1493,9 +1467,7 @@ typedef struct st_spider_direct_sql
|
|||
uint tgt_driver_length;
|
||||
uint conn_key_length;
|
||||
uint dbton_id;
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
my_hash_value_type conn_key_hash_value;
|
||||
#endif
|
||||
|
||||
pthread_mutex_t *bg_mutex;
|
||||
pthread_cond_t *bg_cond;
|
||||
|
@ -1534,9 +1506,7 @@ typedef struct st_spider_table_mon_list
|
|||
{
|
||||
char *key;
|
||||
uint key_length;
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
my_hash_value_type key_hash_value;
|
||||
#endif
|
||||
|
||||
uint use_count;
|
||||
uint mutex_hash;
|
||||
|
@ -1691,9 +1661,7 @@ char *spider_create_string(
|
|||
typedef struct st_spider_ip_port_conn {
|
||||
char *key;
|
||||
size_t key_len;
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
my_hash_value_type key_hash_value;
|
||||
#endif
|
||||
char *remote_ip_str;
|
||||
long remote_port;
|
||||
ulong ip_port_count;
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#define MYSQL_SERVER 1
|
||||
#include <my_global.h>
|
||||
#include "mysql_version.h"
|
||||
#include "spd_environ.h"
|
||||
#include "sql_priv.h"
|
||||
#include "probes_mysql.h"
|
||||
#include "sql_class.h"
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
#define MYSQL_SERVER 1
|
||||
#include <my_global.h>
|
||||
#include "mysql_version.h"
|
||||
#include "spd_environ.h"
|
||||
#include "sql_priv.h"
|
||||
#include "probes_mysql.h"
|
||||
#include "sql_class.h"
|
||||
|
@ -126,7 +125,6 @@ static void spider_trx_status_var(THD *thd, SHOW_VAR *var, void *buff,
|
|||
}
|
||||
|
||||
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
static int spider_direct_update(THD *thd, SHOW_VAR *var, void *buff,
|
||||
system_status_var *, enum_var_type)
|
||||
{
|
||||
|
@ -142,7 +140,6 @@ static int spider_direct_delete(THD *thd, SHOW_VAR *var, void *buff,
|
|||
spider_trx_status_var(thd, var, buff, &SPIDER_TRX::direct_delete_count);
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
static int spider_direct_order_limit(THD *thd, SHOW_VAR *var, void *buff,
|
||||
system_status_var *, enum_var_type)
|
||||
|
@ -174,7 +171,6 @@ struct st_mysql_show_var spider_status_variables[] =
|
|||
(char *) &spider_mon_table_cache_version, SHOW_LONGLONG},
|
||||
{"Spider_mon_table_cache_version_req",
|
||||
(char *) &spider_mon_table_cache_version_req, SHOW_LONGLONG},
|
||||
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
|
||||
#ifdef SPIDER_HAS_SHOW_SIMPLE_FUNC
|
||||
{"Spider_direct_update", (char *) &spider_direct_update, SHOW_SIMPLE_FUNC},
|
||||
{"Spider_direct_delete", (char *) &spider_direct_delete, SHOW_SIMPLE_FUNC},
|
||||
|
@ -182,7 +178,6 @@ struct st_mysql_show_var spider_status_variables[] =
|
|||
{"Spider_direct_update", (char *) &spider_direct_update, SHOW_FUNC},
|
||||
{"Spider_direct_delete", (char *) &spider_direct_delete, SHOW_FUNC},
|
||||
#endif
|
||||
#endif
|
||||
#ifdef SPIDER_HAS_SHOW_SIMPLE_FUNC
|
||||
{"Spider_direct_order_limit",
|
||||
(char *) &spider_direct_order_limit, SHOW_SIMPLE_FUNC},
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#define MYSQL_SERVER 1
|
||||
#include <my_global.h>
|
||||
#include "mysql_version.h"
|
||||
#include "spd_environ.h"
|
||||
#include "sql_priv.h"
|
||||
#include "probes_mysql.h"
|
||||
#include "sql_class.h"
|
||||
|
@ -105,9 +104,7 @@ SPIDER_TABLE_MON_LIST *spider_get_ping_table_mon_list(
|
|||
SPIDER_TABLE_MON_LIST *table_mon_list;
|
||||
MEM_ROOT mem_root;
|
||||
ulonglong mon_table_cache_version;
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
my_hash_value_type hash_value;
|
||||
#endif
|
||||
DBUG_ENTER("spider_get_ping_table_mon_list");
|
||||
/* Reset the cache if the version does not match the requirement */
|
||||
if (spider_mon_table_cache_version != spider_mon_table_cache_version_req)
|
||||
|
@ -129,27 +126,17 @@ SPIDER_TABLE_MON_LIST *spider_get_ping_table_mon_list(
|
|||
spider_param_udf_table_mon_mutex_count());
|
||||
DBUG_PRINT("info",("spider hash key=%s", str->c_ptr()));
|
||||
DBUG_PRINT("info",("spider hash key length=%u", str->length()));
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
hash_value = my_calc_hash(
|
||||
&spider_udf_table_mon_list_hash[mutex_hash],
|
||||
(uchar*) str->c_ptr(), str->length());
|
||||
#endif
|
||||
pthread_mutex_lock(&spider_udf_table_mon_mutexes[mutex_hash]);
|
||||
mon_table_cache_version = (ulonglong) spider_mon_table_cache_version;
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
if (!(table_mon_list = (SPIDER_TABLE_MON_LIST *)
|
||||
my_hash_search_using_hash_value(
|
||||
&spider_udf_table_mon_list_hash[mutex_hash], hash_value,
|
||||
(uchar*) str->c_ptr(), str->length())) ||
|
||||
table_mon_list->mon_table_cache_version != mon_table_cache_version
|
||||
)
|
||||
#else
|
||||
if (!(table_mon_list = (SPIDER_TABLE_MON_LIST *) my_hash_search(
|
||||
&spider_udf_table_mon_list_hash[mutex_hash],
|
||||
(uchar*) str->c_ptr(), str->length())) ||
|
||||
table_mon_list->mon_table_cache_version != mon_table_cache_version
|
||||
)
|
||||
#endif
|
||||
{
|
||||
/* If table_mon_list is found but the cache version does not
|
||||
match, remove it from the hash and free it. */
|
||||
|
@ -171,17 +158,9 @@ SPIDER_TABLE_MON_LIST *spider_get_ping_table_mon_list(
|
|||
table_mon_list->mon_table_cache_version = mon_table_cache_version;
|
||||
uint old_elements =
|
||||
spider_udf_table_mon_list_hash[mutex_hash].array.max_element;
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
table_mon_list->key_hash_value = hash_value;
|
||||
#endif
|
||||
#ifdef HASH_UPDATE_WITH_HASH_VALUE
|
||||
if (my_hash_insert_with_hash_value(
|
||||
&spider_udf_table_mon_list_hash[mutex_hash],
|
||||
hash_value, (uchar*) table_mon_list))
|
||||
#else
|
||||
if (my_hash_insert(&spider_udf_table_mon_list_hash[mutex_hash],
|
||||
(uchar*) table_mon_list))
|
||||
#endif
|
||||
{
|
||||
spider_ping_table_free_mon_list(table_mon_list);
|
||||
*error_num = HA_ERR_OUT_OF_MEM;
|
||||
|
@ -230,13 +209,8 @@ void spider_release_ping_table_mon_list_loop(
|
|||
SPIDER_TABLE_MON_LIST *table_mon_list
|
||||
) {
|
||||
DBUG_ENTER("spider_release_ping_table_mon_list_loop");
|
||||
#ifdef HASH_UPDATE_WITH_HASH_VALUE
|
||||
my_hash_delete_with_hash_value(&spider_udf_table_mon_list_hash[mutex_hash],
|
||||
table_mon_list->key_hash_value, (uchar*) table_mon_list);
|
||||
#else
|
||||
my_hash_delete(&spider_udf_table_mon_list_hash[mutex_hash],
|
||||
(uchar*) table_mon_list);
|
||||
#endif
|
||||
while (TRUE)
|
||||
{
|
||||
if (table_mon_list->use_count)
|
||||
|
@ -280,22 +254,14 @@ int spider_release_ping_table_mon_list(
|
|||
|
||||
mutex_hash = spider_udf_calc_hash(conv_name_str.c_ptr_safe(),
|
||||
spider_param_udf_table_mon_mutex_count());
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
my_hash_value_type hash_value = my_calc_hash(
|
||||
&spider_udf_table_mon_list_hash[mutex_hash],
|
||||
(uchar*) conv_name_str.c_ptr(), conv_name_str.length());
|
||||
#endif
|
||||
pthread_mutex_lock(&spider_udf_table_mon_mutexes[mutex_hash]);
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
if ((table_mon_list = (SPIDER_TABLE_MON_LIST *)
|
||||
my_hash_search_using_hash_value(
|
||||
&spider_udf_table_mon_list_hash[mutex_hash], hash_value,
|
||||
(uchar*) conv_name_str.c_ptr(), conv_name_str.length())))
|
||||
#else
|
||||
if ((table_mon_list = (SPIDER_TABLE_MON_LIST *) my_hash_search(
|
||||
&spider_udf_table_mon_list_hash[mutex_hash],
|
||||
(uchar*) conv_name_str.c_ptr(), conv_name_str.length())))
|
||||
#endif
|
||||
spider_release_ping_table_mon_list_loop(mutex_hash, table_mon_list);
|
||||
pthread_mutex_unlock(&spider_udf_table_mon_mutexes[mutex_hash]);
|
||||
my_afree(buf);
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
#define MYSQL_SERVER 1
|
||||
#include <my_global.h>
|
||||
#include "mysql_version.h"
|
||||
#include "spd_environ.h"
|
||||
#include "sql_priv.h"
|
||||
#include "probes_mysql.h"
|
||||
#include "sql_class.h"
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#define MYSQL_SERVER 1
|
||||
#include <my_global.h>
|
||||
#include "mysql_version.h"
|
||||
#include "spd_environ.h"
|
||||
#include "sql_priv.h"
|
||||
#include "probes_mysql.h"
|
||||
#include "my_getopt.h"
|
||||
|
@ -4090,10 +4089,8 @@ int spider_create_conn_keys(
|
|||
__func__, __FILE__, __LINE__, MYF(MY_WME | MY_ZEROFILL),
|
||||
&share->conn_keys, sizeof(char *) * share->all_link_count,
|
||||
&share->conn_keys_lengths, length_base,
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
&share->conn_keys_hash_value,
|
||||
sizeof(my_hash_value_type) * share->all_link_count,
|
||||
#endif
|
||||
&tmp_name, sizeof(char) * share->conn_keys_charlen,
|
||||
&share->sql_dbton_ids, length_base,
|
||||
NullS))
|
||||
|
@ -4155,11 +4152,9 @@ int spider_create_conn_keys(
|
|||
spider_create_conn_key_add_one(&counter, &tmp_name, share->tgt_drivers[roop_count]);
|
||||
tmp_name++;
|
||||
tmp_name++;
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
share->conn_keys_hash_value[roop_count] = my_calc_hash(
|
||||
&spider_open_connections, (uchar*) share->conn_keys[roop_count],
|
||||
share->conn_keys_lengths[roop_count]);
|
||||
#endif
|
||||
}
|
||||
for (roop_count2 = 0; roop_count2 < SPIDER_DBTON_SIZE; roop_count2++)
|
||||
{
|
||||
|
@ -4182,9 +4177,7 @@ SPIDER_SHARE *spider_create_share(
|
|||
#ifdef WITH_PARTITION_STORAGE_ENGINE
|
||||
partition_info *part_info,
|
||||
#endif
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
my_hash_value_type hash_value,
|
||||
#endif
|
||||
int *error_num
|
||||
) {
|
||||
int bitmap_size, roop_count;
|
||||
|
@ -4196,9 +4189,7 @@ SPIDER_SHARE *spider_create_share(
|
|||
uchar *tmp_cardinality_upd, *tmp_table_mon_mutex_bitmap;
|
||||
char buf[MAX_FIELD_WIDTH], *buf_pos;
|
||||
char link_idx_str[SPIDER_SQL_INT_LEN];
|
||||
#ifdef HA_HAS_CHECKSUM_EXTENDED
|
||||
bool checksum_support = TRUE;
|
||||
#endif
|
||||
DBUG_ENTER("spider_create_share");
|
||||
length = (uint) strlen(table_name);
|
||||
bitmap_size = spider_bitmap_size(table_share->fields);
|
||||
|
@ -4233,13 +4224,11 @@ SPIDER_SHARE *spider_create_share(
|
|||
share->table_mon_mutex_bitmap = tmp_table_mon_mutex_bitmap;
|
||||
share->bitmap_size = bitmap_size;
|
||||
share->table_share = table_share;
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
share->table_name_hash_value = hash_value;
|
||||
#ifdef WITH_PARTITION_STORAGE_ENGINE
|
||||
share->table_path_hash_value = my_calc_hash(&spider_open_tables,
|
||||
(uchar*) table_share->path.str, table_share->path.length);
|
||||
#endif
|
||||
#endif
|
||||
#ifndef WITHOUT_SPIDER_BG_SEARCH
|
||||
share->table.s = table_share;
|
||||
share->table.field = table_share->field;
|
||||
|
@ -4312,14 +4301,9 @@ SPIDER_SHARE *spider_create_share(
|
|||
goto error_init_crd_mutex;
|
||||
}
|
||||
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
if (!(share->lgtm_tblhnd_share =
|
||||
spider_get_lgtm_tblhnd_share(tmp_name, length, hash_value, FALSE, TRUE,
|
||||
error_num)))
|
||||
#else
|
||||
if (!(share->lgtm_tblhnd_share =
|
||||
spider_get_lgtm_tblhnd_share(tmp_name, length, FALSE, TRUE, error_num)))
|
||||
#endif
|
||||
{
|
||||
goto error_get_lgtm_tblhnd_share;
|
||||
}
|
||||
|
@ -4342,24 +4326,20 @@ SPIDER_SHARE *spider_create_share(
|
|||
{
|
||||
goto error_init_dbton;
|
||||
}
|
||||
#ifdef HA_HAS_CHECKSUM_EXTENDED
|
||||
if (
|
||||
spider_dbton[roop_count].db_access_type == SPIDER_DB_ACCESS_TYPE_SQL &&
|
||||
!share->dbton_share[roop_count]->checksum_support()
|
||||
) {
|
||||
checksum_support = FALSE;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#ifdef HA_HAS_CHECKSUM_EXTENDED
|
||||
if (checksum_support)
|
||||
{
|
||||
share->additional_table_flags |=
|
||||
HA_HAS_OLD_CHECKSUM |
|
||||
HA_HAS_NEW_CHECKSUM;
|
||||
}
|
||||
#endif
|
||||
DBUG_RETURN(share);
|
||||
|
||||
/*
|
||||
|
@ -4434,10 +4414,8 @@ SPIDER_SHARE *spider_get_share(
|
|||
DBUG_ENTER("spider_get_share");
|
||||
top_share = spider->wide_handler->top_share;
|
||||
length = (uint) strlen(table_name);
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
my_hash_value_type hash_value = my_calc_hash(&spider_open_tables,
|
||||
(uchar*) table_name, length);
|
||||
#endif
|
||||
if (top_share)
|
||||
{
|
||||
lex_str.length = top_share->path.length + SPIDER_SQL_LOP_CHK_PRM_PRF_LEN;
|
||||
|
@ -4482,34 +4460,22 @@ SPIDER_SHARE *spider_get_share(
|
|||
my_afree(loop_check_buf);
|
||||
}
|
||||
pthread_mutex_lock(&spider_tbl_mutex);
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
if (!(share = (SPIDER_SHARE*) my_hash_search_using_hash_value(
|
||||
&spider_open_tables, hash_value, (uchar*) table_name, length)))
|
||||
#else
|
||||
if (!(share = (SPIDER_SHARE*) my_hash_search(&spider_open_tables,
|
||||
(uchar*) table_name, length)))
|
||||
#endif
|
||||
{
|
||||
if (!(share = spider_create_share(
|
||||
table_name, table_share,
|
||||
#ifdef WITH_PARTITION_STORAGE_ENGINE
|
||||
table->part_info,
|
||||
#endif
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
hash_value,
|
||||
#endif
|
||||
error_num
|
||||
))) {
|
||||
goto error_alloc_share;
|
||||
}
|
||||
|
||||
uint old_elements = spider_open_tables.array.max_element;
|
||||
#ifdef HASH_UPDATE_WITH_HASH_VALUE
|
||||
if (my_hash_insert_with_hash_value(&spider_open_tables, hash_value,
|
||||
(uchar*) share))
|
||||
#else
|
||||
if (my_hash_insert(&spider_open_tables, (uchar*) share))
|
||||
#endif
|
||||
{
|
||||
*error_num = HA_ERR_OUT_OF_MEM;
|
||||
goto error_hash_insert;
|
||||
|
@ -4662,14 +4628,9 @@ SPIDER_SHARE *spider_get_share(
|
|||
spider_free_share(share);
|
||||
goto error_sts_spider_init;
|
||||
}
|
||||
#ifdef HASH_UPDATE_WITH_HASH_VALUE
|
||||
share->sts_thread = &spider_table_sts_threads[
|
||||
hash_value % spider_param_table_sts_thread_count()];
|
||||
#else
|
||||
share->sts_thread = &spider_table_sts_threads[
|
||||
my_calc_hash(&spider_open_tables, (uchar*) table_name, length) %
|
||||
spider_param_table_sts_thread_count()];
|
||||
#endif
|
||||
share->sts_spider_init = TRUE;
|
||||
}
|
||||
pthread_mutex_unlock(&share->mutex);
|
||||
|
@ -4690,14 +4651,9 @@ SPIDER_SHARE *spider_get_share(
|
|||
spider_free_share(share);
|
||||
goto error_crd_spider_init;
|
||||
}
|
||||
#ifdef HASH_UPDATE_WITH_HASH_VALUE
|
||||
share->crd_thread = &spider_table_crd_threads[
|
||||
hash_value % spider_param_table_crd_thread_count()];
|
||||
#else
|
||||
share->crd_thread = &spider_table_crd_threads[
|
||||
my_calc_hash(&spider_open_tables, (uchar*) table_name, length) %
|
||||
spider_param_table_crd_thread_count()];
|
||||
#endif
|
||||
share->crd_spider_init = TRUE;
|
||||
}
|
||||
pthread_mutex_unlock(&share->mutex);
|
||||
|
@ -5156,14 +5112,9 @@ SPIDER_SHARE *spider_get_share(
|
|||
spider_free_share(share);
|
||||
goto error_sts_spider_init;
|
||||
}
|
||||
#ifdef HASH_UPDATE_WITH_HASH_VALUE
|
||||
share->sts_thread = &spider_table_sts_threads[
|
||||
hash_value % spider_param_table_sts_thread_count()];
|
||||
#else
|
||||
share->sts_thread = &spider_table_sts_threads[
|
||||
my_calc_hash(&spider_open_tables, (uchar*) table_name, length) %
|
||||
spider_param_table_sts_thread_count()];
|
||||
#endif
|
||||
share->sts_spider_init = TRUE;
|
||||
}
|
||||
pthread_mutex_unlock(&share->mutex);
|
||||
|
@ -5181,14 +5132,9 @@ SPIDER_SHARE *spider_get_share(
|
|||
spider_free_share(share);
|
||||
goto error_crd_spider_init;
|
||||
}
|
||||
#ifdef HASH_UPDATE_WITH_HASH_VALUE
|
||||
share->crd_thread = &spider_table_crd_threads[
|
||||
hash_value % spider_param_table_crd_thread_count()];
|
||||
#else
|
||||
share->crd_thread = &spider_table_crd_threads[
|
||||
my_calc_hash(&spider_open_tables, (uchar*) table_name, length) %
|
||||
spider_param_table_crd_thread_count()];
|
||||
#endif
|
||||
share->crd_spider_init = TRUE;
|
||||
}
|
||||
pthread_mutex_unlock(&share->mutex);
|
||||
|
@ -5551,12 +5497,7 @@ int spider_free_share(
|
|||
}
|
||||
#endif
|
||||
spider_free_share_alloc(share);
|
||||
#ifdef HASH_UPDATE_WITH_HASH_VALUE
|
||||
my_hash_delete_with_hash_value(&spider_open_tables,
|
||||
share->table_name_hash_value, (uchar*) share);
|
||||
#else
|
||||
my_hash_delete(&spider_open_tables, (uchar*) share);
|
||||
#endif
|
||||
pthread_mutex_destroy(&share->crd_mutex);
|
||||
pthread_mutex_destroy(&share->sts_mutex);
|
||||
pthread_mutex_destroy(&share->mutex);
|
||||
|
@ -5576,19 +5517,12 @@ void spider_update_link_status_for_share(
|
|||
SPIDER_SHARE *share;
|
||||
DBUG_ENTER("spider_update_link_status_for_share");
|
||||
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
my_hash_value_type hash_value = my_calc_hash(&spider_open_tables,
|
||||
(uchar*) table_name, table_name_length);
|
||||
#endif
|
||||
pthread_mutex_lock(&spider_tbl_mutex);
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
if ((share = (SPIDER_SHARE*) my_hash_search_using_hash_value(
|
||||
&spider_open_tables, hash_value, (uchar*) table_name,
|
||||
table_name_length)))
|
||||
#else
|
||||
if ((share = (SPIDER_SHARE*) my_hash_search(&spider_open_tables,
|
||||
(uchar*) table_name, table_name_length)))
|
||||
#endif
|
||||
{
|
||||
DBUG_PRINT("info", ("spider share->link_status_init=%s",
|
||||
share->link_status_init ? "TRUE" : "FALSE"));
|
||||
|
@ -5603,7 +5537,6 @@ void spider_update_link_status_for_share(
|
|||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
SPIDER_LGTM_TBLHND_SHARE *spider_get_lgtm_tblhnd_share(
|
||||
const char *table_name,
|
||||
uint table_name_length,
|
||||
|
@ -5612,15 +5545,6 @@ SPIDER_LGTM_TBLHND_SHARE *spider_get_lgtm_tblhnd_share(
|
|||
bool need_to_create,
|
||||
int *error_num
|
||||
)
|
||||
#else
|
||||
SPIDER_LGTM_TBLHND_SHARE *spider_get_lgtm_tblhnd_share(
|
||||
const char *table_name,
|
||||
uint table_name_length,
|
||||
bool locked,
|
||||
bool need_to_create,
|
||||
int *error_num
|
||||
)
|
||||
#endif
|
||||
{
|
||||
SPIDER_LGTM_TBLHND_SHARE *lgtm_tblhnd_share;
|
||||
char *tmp_name;
|
||||
|
@ -5628,16 +5552,10 @@ SPIDER_LGTM_TBLHND_SHARE *spider_get_lgtm_tblhnd_share(
|
|||
|
||||
if (!locked)
|
||||
pthread_mutex_lock(&spider_lgtm_tblhnd_share_mutex);
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
if (!(lgtm_tblhnd_share = (SPIDER_LGTM_TBLHND_SHARE*)
|
||||
my_hash_search_using_hash_value(
|
||||
&spider_lgtm_tblhnd_share_hash, hash_value,
|
||||
(uchar*) table_name, table_name_length)))
|
||||
#else
|
||||
if (!(lgtm_tblhnd_share = (SPIDER_LGTM_TBLHND_SHARE*) my_hash_search(
|
||||
&spider_lgtm_tblhnd_share_hash,
|
||||
(uchar*) table_name, table_name_length)))
|
||||
#endif
|
||||
{
|
||||
DBUG_PRINT("info",("spider create new lgtm tblhnd share"));
|
||||
if (!(lgtm_tblhnd_share = (SPIDER_LGTM_TBLHND_SHARE *)
|
||||
|
@ -5654,9 +5572,7 @@ SPIDER_LGTM_TBLHND_SHARE *spider_get_lgtm_tblhnd_share(
|
|||
lgtm_tblhnd_share->table_name = tmp_name;
|
||||
memcpy(lgtm_tblhnd_share->table_name, table_name,
|
||||
lgtm_tblhnd_share->table_name_length);
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
lgtm_tblhnd_share->table_path_hash_value = hash_value;
|
||||
#endif
|
||||
|
||||
if (mysql_mutex_init(spd_key_mutex_share_auto_increment,
|
||||
&lgtm_tblhnd_share->auto_increment_mutex, MY_MUTEX_INIT_FAST))
|
||||
|
@ -5666,13 +5582,8 @@ SPIDER_LGTM_TBLHND_SHARE *spider_get_lgtm_tblhnd_share(
|
|||
}
|
||||
|
||||
uint old_elements = spider_lgtm_tblhnd_share_hash.array.max_element;
|
||||
#ifdef HASH_UPDATE_WITH_HASH_VALUE
|
||||
if (my_hash_insert_with_hash_value(&spider_lgtm_tblhnd_share_hash,
|
||||
hash_value, (uchar*) lgtm_tblhnd_share))
|
||||
#else
|
||||
if (my_hash_insert(&spider_lgtm_tblhnd_share_hash,
|
||||
(uchar*) lgtm_tblhnd_share))
|
||||
#endif
|
||||
{
|
||||
*error_num = HA_ERR_OUT_OF_MEM;
|
||||
goto error_hash_insert;
|
||||
|
@ -5708,12 +5619,7 @@ void spider_free_lgtm_tblhnd_share_alloc(
|
|||
DBUG_ENTER("spider_free_lgtm_tblhnd_share");
|
||||
if (!locked)
|
||||
pthread_mutex_lock(&spider_lgtm_tblhnd_share_mutex);
|
||||
#ifdef HASH_UPDATE_WITH_HASH_VALUE
|
||||
my_hash_delete_with_hash_value(&spider_lgtm_tblhnd_share_hash,
|
||||
lgtm_tblhnd_share->table_path_hash_value, (uchar*) lgtm_tblhnd_share);
|
||||
#else
|
||||
my_hash_delete(&spider_lgtm_tblhnd_share_hash, (uchar*) lgtm_tblhnd_share);
|
||||
#endif
|
||||
pthread_mutex_destroy(&lgtm_tblhnd_share->auto_increment_mutex);
|
||||
spider_free(spider_current_trx, lgtm_tblhnd_share, MYF(0));
|
||||
if (!locked)
|
||||
|
@ -5732,16 +5638,10 @@ SPIDER_WIDE_SHARE *spider_get_wide_share(
|
|||
DBUG_ENTER("spider_get_wide_share");
|
||||
|
||||
pthread_mutex_lock(&spider_wide_share_mutex);
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
if (!(wide_share = (SPIDER_WIDE_SHARE*)
|
||||
my_hash_search_using_hash_value(
|
||||
&spider_open_wide_share, share->table_path_hash_value,
|
||||
(uchar*) table_share->path.str, table_share->path.length)))
|
||||
#else
|
||||
if (!(wide_share = (SPIDER_WIDE_SHARE*) my_hash_search(
|
||||
&spider_open_wide_share,
|
||||
(uchar*) table_share->path.str, table_share->path.length)))
|
||||
#endif
|
||||
{
|
||||
DBUG_PRINT("info",("spider create new wide share"));
|
||||
if (!(wide_share = (SPIDER_WIDE_SHARE *)
|
||||
|
@ -5761,9 +5661,7 @@ SPIDER_WIDE_SHARE *spider_get_wide_share(
|
|||
wide_share->table_name = tmp_name;
|
||||
memcpy(wide_share->table_name, table_share->path.str,
|
||||
wide_share->table_name_length);
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
wide_share->table_path_hash_value = share->table_path_hash_value;
|
||||
#endif
|
||||
wide_share->cardinality = tmp_cardinality;
|
||||
|
||||
wide_share->crd_get_time = wide_share->sts_get_time =
|
||||
|
@ -5786,13 +5684,7 @@ SPIDER_WIDE_SHARE *spider_get_wide_share(
|
|||
thr_lock_init(&wide_share->lock);
|
||||
|
||||
uint old_elements = spider_open_wide_share.array.max_element;
|
||||
#ifdef HASH_UPDATE_WITH_HASH_VALUE
|
||||
if (my_hash_insert_with_hash_value(&spider_open_wide_share,
|
||||
share->table_path_hash_value,
|
||||
(uchar*) wide_share))
|
||||
#else
|
||||
if (my_hash_insert(&spider_open_wide_share, (uchar*) wide_share))
|
||||
#endif
|
||||
{
|
||||
*error_num = HA_ERR_OUT_OF_MEM;
|
||||
goto error_hash_insert;
|
||||
|
@ -5830,12 +5722,7 @@ int spider_free_wide_share(
|
|||
if (!--wide_share->use_count)
|
||||
{
|
||||
thr_lock_delete(&wide_share->lock);
|
||||
#ifdef HASH_UPDATE_WITH_HASH_VALUE
|
||||
my_hash_delete_with_hash_value(&spider_open_wide_share,
|
||||
wide_share->table_path_hash_value, (uchar*) wide_share);
|
||||
#else
|
||||
my_hash_delete(&spider_open_wide_share, (uchar*) wide_share);
|
||||
#endif
|
||||
pthread_mutex_destroy(&wide_share->crd_mutex);
|
||||
pthread_mutex_destroy(&wide_share->sts_mutex);
|
||||
spider_free(spider_current_trx, wide_share, MYF(0));
|
||||
|
@ -6307,14 +6194,8 @@ int spider_db_done(
|
|||
while ((table_mon_list = (SPIDER_TABLE_MON_LIST *) my_hash_element(
|
||||
&spider_udf_table_mon_list_hash[roop_count], 0)))
|
||||
{
|
||||
#ifdef HASH_UPDATE_WITH_HASH_VALUE
|
||||
my_hash_delete_with_hash_value(
|
||||
&spider_udf_table_mon_list_hash[roop_count],
|
||||
table_mon_list->key_hash_value, (uchar*) table_mon_list);
|
||||
#else
|
||||
my_hash_delete(&spider_udf_table_mon_list_hash[roop_count],
|
||||
(uchar*) table_mon_list);
|
||||
#endif
|
||||
spider_ping_table_free_mon_list(table_mon_list);
|
||||
}
|
||||
spider_free_mem_calc(spider_current_trx,
|
||||
|
@ -6350,12 +6231,7 @@ int spider_db_done(
|
|||
pthread_mutex_lock(&spider_conn_mutex);
|
||||
while ((conn = (SPIDER_CONN*) my_hash_element(&spider_open_connections, 0)))
|
||||
{
|
||||
#ifdef HASH_UPDATE_WITH_HASH_VALUE
|
||||
my_hash_delete_with_hash_value(&spider_open_connections,
|
||||
conn->conn_key_hash_value, (uchar*) conn);
|
||||
#else
|
||||
my_hash_delete(&spider_open_connections, (uchar*) conn);
|
||||
#endif
|
||||
spider_free_conn(conn);
|
||||
}
|
||||
pthread_mutex_unlock(&spider_conn_mutex);
|
||||
|
@ -6398,14 +6274,8 @@ int spider_db_done(
|
|||
while ((spider_init_error_table = (SPIDER_INIT_ERROR_TABLE*)
|
||||
my_hash_element(&spider_init_error_tables, 0)))
|
||||
{
|
||||
#ifdef HASH_UPDATE_WITH_HASH_VALUE
|
||||
my_hash_delete_with_hash_value(&spider_init_error_tables,
|
||||
spider_init_error_table->table_name_hash_value,
|
||||
(uchar*) spider_init_error_table);
|
||||
#else
|
||||
my_hash_delete(&spider_init_error_tables,
|
||||
(uchar*) spider_init_error_table);
|
||||
#endif
|
||||
spider_free(NULL, spider_init_error_table, MYF(0));
|
||||
}
|
||||
pthread_mutex_unlock(&spider_init_error_tbl_mutex);
|
||||
|
@ -7405,16 +7275,10 @@ SPIDER_INIT_ERROR_TABLE *spider_get_init_error_table(
|
|||
char *tmp_name;
|
||||
DBUG_ENTER("spider_get_init_error_table");
|
||||
pthread_mutex_lock(&spider_init_error_tbl_mutex);
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
if (!(spider_init_error_table = (SPIDER_INIT_ERROR_TABLE *)
|
||||
my_hash_search_using_hash_value(
|
||||
&spider_init_error_tables, share->table_name_hash_value,
|
||||
(uchar*) share->table_name, share->table_name_length)))
|
||||
#else
|
||||
if (!(spider_init_error_table = (SPIDER_INIT_ERROR_TABLE *) my_hash_search(
|
||||
&spider_init_error_tables,
|
||||
(uchar*) share->table_name, share->table_name_length)))
|
||||
#endif
|
||||
{
|
||||
if (!create)
|
||||
{
|
||||
|
@ -7433,18 +7297,11 @@ SPIDER_INIT_ERROR_TABLE *spider_get_init_error_table(
|
|||
memcpy(tmp_name, share->table_name, share->table_name_length);
|
||||
spider_init_error_table->table_name = tmp_name;
|
||||
spider_init_error_table->table_name_length = share->table_name_length;
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
spider_init_error_table->table_name_hash_value =
|
||||
share->table_name_hash_value;
|
||||
#endif
|
||||
uint old_elements = spider_init_error_tables.array.max_element;
|
||||
#ifdef HASH_UPDATE_WITH_HASH_VALUE
|
||||
if (my_hash_insert_with_hash_value(&spider_init_error_tables,
|
||||
share->table_name_hash_value, (uchar*) spider_init_error_table))
|
||||
#else
|
||||
if (my_hash_insert(&spider_init_error_tables,
|
||||
(uchar*) spider_init_error_table))
|
||||
#endif
|
||||
{
|
||||
spider_free(trx, spider_init_error_table, MYF(0));
|
||||
pthread_mutex_unlock(&spider_init_error_tbl_mutex);
|
||||
|
@ -7467,29 +7324,16 @@ void spider_delete_init_error_table(
|
|||
) {
|
||||
SPIDER_INIT_ERROR_TABLE *spider_init_error_table;
|
||||
uint length = strlen(name);
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
my_hash_value_type hash_value = my_calc_hash(&spider_open_tables,
|
||||
(uchar*) name, length);
|
||||
#endif
|
||||
DBUG_ENTER("spider_delete_init_error_table");
|
||||
pthread_mutex_lock(&spider_init_error_tbl_mutex);
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
if ((spider_init_error_table = (SPIDER_INIT_ERROR_TABLE *)
|
||||
my_hash_search_using_hash_value(&spider_init_error_tables, hash_value,
|
||||
(uchar*) name, length)))
|
||||
#else
|
||||
if ((spider_init_error_table = (SPIDER_INIT_ERROR_TABLE *) my_hash_search(
|
||||
&spider_init_error_tables, (uchar*) name, length)))
|
||||
#endif
|
||||
{
|
||||
#ifdef HASH_UPDATE_WITH_HASH_VALUE
|
||||
my_hash_delete_with_hash_value(&spider_init_error_tables,
|
||||
spider_init_error_table->table_name_hash_value,
|
||||
(uchar*) spider_init_error_table);
|
||||
#else
|
||||
my_hash_delete(&spider_init_error_tables,
|
||||
(uchar*) spider_init_error_table);
|
||||
#endif
|
||||
spider_free(spider_current_trx, spider_init_error_table, MYF(0));
|
||||
}
|
||||
pthread_mutex_unlock(&spider_init_error_tbl_mutex);
|
||||
|
@ -8084,9 +7928,7 @@ bool spider_check_direct_order_limit(
|
|||
DBUG_PRINT("info",("spider with distinct"));
|
||||
spider->result_list.direct_distinct = TRUE;
|
||||
}
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
spider->result_list.direct_aggregate = spider_param_direct_aggregate(thd);
|
||||
#endif
|
||||
DBUG_PRINT("info",("spider select_limit=%lld", select_limit));
|
||||
DBUG_PRINT("info",("spider offset_limit=%lld", offset_limit));
|
||||
if (
|
||||
|
@ -8105,22 +7947,17 @@ bool spider_check_direct_order_limit(
|
|||
DBUG_PRINT("info",("spider first_check is FALSE"));
|
||||
first_check = FALSE;
|
||||
spider->result_list.direct_distinct = FALSE;
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
spider->result_list.direct_aggregate = FALSE;
|
||||
#endif
|
||||
} else if (spider_db_append_condition(spider, NULL, 0, TRUE))
|
||||
{
|
||||
DBUG_PRINT("info",("spider FALSE by condition"));
|
||||
first_check = FALSE;
|
||||
spider->result_list.direct_distinct = FALSE;
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
spider->result_list.direct_aggregate = FALSE;
|
||||
#endif
|
||||
} else if (spider->sql_kinds & SPIDER_SQL_KIND_HANDLER)
|
||||
{
|
||||
DBUG_PRINT("info",("spider sql_kinds with SPIDER_SQL_KIND_HANDLER"));
|
||||
spider->result_list.direct_distinct = FALSE;
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
spider->result_list.direct_aggregate = FALSE;
|
||||
} else if (
|
||||
!select_lex->group_list.elements &&
|
||||
|
@ -8158,7 +7995,6 @@ bool spider_check_direct_order_limit(
|
|||
first_check = FALSE;
|
||||
spider->result_list.direct_distinct = FALSE;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
longlong direct_order_limit = spider_param_direct_order_limit(thd,
|
||||
|
@ -8170,10 +8006,8 @@ bool spider_check_direct_order_limit(
|
|||
first_check ? "TRUE" : "FALSE"));
|
||||
DBUG_PRINT("info",("spider (select_lex->options & OPTION_FOUND_ROWS)=%s",
|
||||
select_lex && (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 ? select_lex->group_list.elements : 0));
|
||||
DBUG_PRINT("info",("spider select_lex->with_sum_func=%s",
|
||||
|
@ -8187,9 +8021,7 @@ bool spider_check_direct_order_limit(
|
|||
!select_lex->limit_params.explicit_limit ||
|
||||
(select_lex->options & OPTION_FOUND_ROWS) ||
|
||||
(
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
!spider->result_list.direct_aggregate &&
|
||||
#endif
|
||||
(
|
||||
select_lex->group_list.elements ||
|
||||
select_lex->with_sum_func
|
||||
|
@ -8223,7 +8055,6 @@ bool spider_check_direct_order_limit(
|
|||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
bool spider_all_part_in_order(
|
||||
ORDER *order,
|
||||
TABLE *table
|
||||
|
@ -8300,7 +8131,6 @@ Field *spider_field_exchange(
|
|||
DBUG_PRINT("info",("spider out field=%p", field));
|
||||
DBUG_RETURN(field);
|
||||
}
|
||||
#endif
|
||||
|
||||
int spider_set_direct_limit_offset(
|
||||
ha_spider *spider
|
||||
|
@ -8333,9 +8163,7 @@ int spider_set_direct_limit_offset(
|
|||
|
||||
if (
|
||||
spider->wide_handler->sql_command != SQLCOM_SELECT ||
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
spider->result_list.direct_aggregate ||
|
||||
#endif
|
||||
spider->result_list.direct_order_limit ||
|
||||
spider->prev_index_rnd_init != SPD_RND // must be RND_INIT and not be INDEX_INIT
|
||||
)
|
||||
|
@ -8590,10 +8418,8 @@ int spider_discover_table_structure(
|
|||
#ifdef WITH_PARTITION_STORAGE_ENGINE
|
||||
str_len = str.length();
|
||||
#endif
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
my_hash_value_type hash_value = my_calc_hash(&spider_open_tables,
|
||||
(uchar*) table_name, table_name_length);
|
||||
#endif
|
||||
if (!(trx = spider_get_trx(thd, TRUE, &error_num)))
|
||||
{
|
||||
DBUG_PRINT("info",("spider spider_get_trx error"));
|
||||
|
@ -8610,9 +8436,7 @@ int spider_discover_table_structure(
|
|||
#ifdef WITH_PARTITION_STORAGE_ENGINE
|
||||
NULL,
|
||||
#endif
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
hash_value,
|
||||
#endif
|
||||
&error_num
|
||||
))) {
|
||||
DBUG_RETURN(error_num);
|
||||
|
@ -8628,7 +8452,6 @@ int spider_discover_table_structure(
|
|||
SPIDER_SYS_TABLES_TABLE_NAME_LEN, TRUE, &open_tables_backup, FALSE,
|
||||
&error_num))
|
||||
) {
|
||||
#ifdef SPIDER_SUPPORT_CREATE_OR_REPLACE_TABLE
|
||||
if (thd->lex->create_info.or_replace())
|
||||
{
|
||||
error_num = spider_delete_tables(table_tables,
|
||||
|
@ -8636,11 +8459,8 @@ int spider_discover_table_structure(
|
|||
}
|
||||
if (!error_num)
|
||||
{
|
||||
#endif
|
||||
error_num = spider_insert_tables(table_tables, spider_share);
|
||||
#ifdef SPIDER_SUPPORT_CREATE_OR_REPLACE_TABLE
|
||||
}
|
||||
#endif
|
||||
spider_close_sys_table(thd, table_tables,
|
||||
&open_tables_backup, FALSE);
|
||||
}
|
||||
|
@ -8671,9 +8491,7 @@ int spider_discover_table_structure(
|
|||
DBUG_PRINT("info",("spider tmp_name=%s", tmp_name));
|
||||
if (!(spider_share = spider_create_share(tmp_name, share,
|
||||
part_info,
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
hash_value,
|
||||
#endif
|
||||
&error_num
|
||||
))) {
|
||||
DBUG_RETURN(error_num);
|
||||
|
@ -8699,9 +8517,7 @@ int spider_discover_table_structure(
|
|||
DBUG_PRINT("info",("spider tmp_name=%s", tmp_name));
|
||||
if (!(spider_share = spider_create_share(tmp_name, share,
|
||||
part_info,
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
hash_value,
|
||||
#endif
|
||||
&error_num
|
||||
))) {
|
||||
DBUG_RETURN(error_num);
|
||||
|
@ -8742,15 +8558,12 @@ int spider_discover_table_structure(
|
|||
DBUG_PRINT("info",("spider tmp_name=%s", tmp_name));
|
||||
if (!(spider_share = spider_create_share(tmp_name, share,
|
||||
part_info,
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
hash_value,
|
||||
#endif
|
||||
&error_num
|
||||
))) {
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
|
||||
#ifdef SPIDER_SUPPORT_CREATE_OR_REPLACE_TABLE
|
||||
if (thd->lex->create_info.or_replace())
|
||||
{
|
||||
error_num = spider_delete_tables(table_tables,
|
||||
|
@ -8758,11 +8571,8 @@ int spider_discover_table_structure(
|
|||
}
|
||||
if (!error_num)
|
||||
{
|
||||
#endif
|
||||
error_num = spider_insert_tables(table_tables, spider_share);
|
||||
#ifdef SPIDER_SUPPORT_CREATE_OR_REPLACE_TABLE
|
||||
}
|
||||
#endif
|
||||
|
||||
spider_free_share_resource_only(spider_share);
|
||||
if (error_num)
|
||||
|
@ -8780,15 +8590,12 @@ int spider_discover_table_structure(
|
|||
DBUG_PRINT("info",("spider tmp_name=%s", tmp_name));
|
||||
if (!(spider_share = spider_create_share(tmp_name, share,
|
||||
part_info,
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
hash_value,
|
||||
#endif
|
||||
&error_num
|
||||
))) {
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
|
||||
#ifdef SPIDER_SUPPORT_CREATE_OR_REPLACE_TABLE
|
||||
if (thd->lex->create_info.or_replace())
|
||||
{
|
||||
error_num = spider_delete_tables(table_tables,
|
||||
|
@ -8796,11 +8603,8 @@ int spider_discover_table_structure(
|
|||
}
|
||||
if (!error_num)
|
||||
{
|
||||
#endif
|
||||
error_num = spider_insert_tables(table_tables, spider_share);
|
||||
#ifdef SPIDER_SUPPORT_CREATE_OR_REPLACE_TABLE
|
||||
}
|
||||
#endif
|
||||
|
||||
spider_free_share_resource_only(spider_share);
|
||||
if (error_num)
|
||||
|
|
|
@ -175,7 +175,6 @@ int spider_create_conn_keys(
|
|||
SPIDER_SHARE *share
|
||||
);
|
||||
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
SPIDER_LGTM_TBLHND_SHARE *spider_get_lgtm_tblhnd_share(
|
||||
const char *table_name,
|
||||
uint table_name_length,
|
||||
|
@ -184,15 +183,6 @@ SPIDER_LGTM_TBLHND_SHARE *spider_get_lgtm_tblhnd_share(
|
|||
bool need_to_create,
|
||||
int *error_num
|
||||
);
|
||||
#else
|
||||
SPIDER_LGTM_TBLHND_SHARE *spider_get_lgtm_tblhnd_share(
|
||||
const char *table_name,
|
||||
uint table_name_length,
|
||||
bool locked,
|
||||
bool need_to_create,
|
||||
int *error_num
|
||||
);
|
||||
#endif
|
||||
|
||||
void spider_free_lgtm_tblhnd_share_alloc(
|
||||
SPIDER_LGTM_TBLHND_SHARE *lgtm_tblhnd_share,
|
||||
|
@ -205,9 +195,7 @@ SPIDER_SHARE *spider_create_share(
|
|||
#ifdef WITH_PARTITION_STORAGE_ENGINE
|
||||
partition_info *part_info,
|
||||
#endif
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
my_hash_value_type hash_value,
|
||||
#endif
|
||||
int *error_num
|
||||
);
|
||||
|
||||
|
@ -443,7 +431,6 @@ bool spider_check_direct_order_limit(
|
|||
ha_spider *spider
|
||||
);
|
||||
|
||||
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|
||||
bool spider_all_part_in_order(
|
||||
ORDER *order,
|
||||
TABLE *table
|
||||
|
@ -453,7 +440,6 @@ Field *spider_field_exchange(
|
|||
handler *handler,
|
||||
Field *field
|
||||
);
|
||||
#endif
|
||||
|
||||
int spider_set_direct_limit_offset(
|
||||
ha_spider *spider
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#define MYSQL_SERVER 1
|
||||
#include <my_global.h>
|
||||
#include "mysql_version.h"
|
||||
#include "spd_environ.h"
|
||||
#include "sql_priv.h"
|
||||
#include "probes_mysql.h"
|
||||
#include "sql_class.h"
|
||||
|
@ -379,12 +378,7 @@ void spider_free_trx_alter_table_alloc(
|
|||
SPIDER_ALTER_TABLE *alter_table
|
||||
) {
|
||||
DBUG_ENTER("spider_free_trx_alter_table_alloc");
|
||||
#ifdef HASH_UPDATE_WITH_HASH_VALUE
|
||||
my_hash_delete_with_hash_value(&trx->trx_alter_table_hash,
|
||||
alter_table->table_name_hash_value, (uchar*) alter_table);
|
||||
#else
|
||||
my_hash_delete(&trx->trx_alter_table_hash, (uchar*) alter_table);
|
||||
#endif
|
||||
if (alter_table->tmp_char)
|
||||
spider_free(trx, alter_table->tmp_char, MYF(0));
|
||||
spider_free(trx, alter_table, MYF(0));
|
||||
|
@ -601,11 +595,9 @@ int spider_create_trx_alter_table(
|
|||
alter_table->table_name = tmp_name;
|
||||
memcpy(alter_table->table_name, share->table_name, share->table_name_length);
|
||||
alter_table->table_name_length = share->table_name_length;
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
DBUG_PRINT("info",("spider table_name_hash_value=%u",
|
||||
share->table_name_hash_value));
|
||||
alter_table->table_name_hash_value = share->table_name_hash_value;
|
||||
#endif
|
||||
alter_table->tmp_priority = share->priority;
|
||||
alter_table->link_count = share->link_count;
|
||||
alter_table->all_link_count = share->all_link_count;
|
||||
|
@ -834,12 +826,7 @@ int spider_create_trx_alter_table(
|
|||
share_alter->tmp_link_statuses_length;
|
||||
|
||||
old_elements = trx->trx_alter_table_hash.array.max_element;
|
||||
#ifdef HASH_UPDATE_WITH_HASH_VALUE
|
||||
if (my_hash_insert_with_hash_value(&trx->trx_alter_table_hash,
|
||||
alter_table->table_name_hash_value, (uchar*) alter_table))
|
||||
#else
|
||||
if (my_hash_insert(&trx->trx_alter_table_hash, (uchar*) alter_table))
|
||||
#endif
|
||||
{
|
||||
error_num = HA_ERR_OUT_OF_MEM;
|
||||
goto error;
|
||||
|
@ -1241,13 +1228,11 @@ SPIDER_TRX *spider_get_trx(
|
|||
trx->trx_ha_hash.array.size_of_element);
|
||||
|
||||
trx->thd = (THD*) thd;
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
if (thd)
|
||||
trx->thd_hash_value = my_calc_hash(&spider_allocated_thds,
|
||||
(uchar*) thd, sizeof(THD *));
|
||||
else
|
||||
trx->thd_hash_value = 0;
|
||||
#endif
|
||||
pthread_mutex_lock(&spider_thread_id_mutex);
|
||||
trx->spider_thread_id = spider_thread_id;
|
||||
++spider_thread_id;
|
||||
|
@ -1334,12 +1319,7 @@ SPIDER_TRX *spider_get_trx(
|
|||
{
|
||||
pthread_mutex_lock(&spider_allocated_thds_mutex);
|
||||
uint old_elements = spider_allocated_thds.array.max_element;
|
||||
#ifdef HASH_UPDATE_WITH_HASH_VALUE
|
||||
if (my_hash_insert_with_hash_value(&spider_allocated_thds,
|
||||
trx->thd_hash_value, (uchar*) thd))
|
||||
#else
|
||||
if (my_hash_insert(&spider_allocated_thds, (uchar*) thd))
|
||||
#endif
|
||||
{
|
||||
pthread_mutex_unlock(&spider_allocated_thds_mutex);
|
||||
goto error_allocated_thds_insert;
|
||||
|
@ -1445,12 +1425,7 @@ int spider_free_trx(
|
|||
{
|
||||
if (need_lock)
|
||||
pthread_mutex_lock(&spider_allocated_thds_mutex);
|
||||
#ifdef HASH_UPDATE_WITH_HASH_VALUE
|
||||
my_hash_delete_with_hash_value(&spider_allocated_thds,
|
||||
trx->thd_hash_value, (uchar*) trx->thd);
|
||||
#else
|
||||
my_hash_delete(&spider_allocated_thds, (uchar*) trx->thd);
|
||||
#endif
|
||||
if (need_lock)
|
||||
pthread_mutex_unlock(&spider_allocated_thds_mutex);
|
||||
}
|
||||
|
@ -1578,13 +1553,11 @@ static int spider_xa_lock(
|
|||
DBUG_ENTER("spider_xa_lock");
|
||||
#ifdef SPIDER_XID_USES_xid_cache_iterate
|
||||
#else
|
||||
#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
|
||||
#endif
|
||||
old_proc_info = thd_proc_info(thd, "Locking xid by Spider");
|
||||
#ifdef SPIDER_XID_USES_xid_cache_iterate
|
||||
|
@ -1600,33 +1573,18 @@ static int spider_xa_lock(
|
|||
#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()))
|
||||
#endif
|
||||
{
|
||||
error_num = ER_SPIDER_XA_LOCKED_NUM;
|
||||
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
|
||||
{
|
||||
error_num = HA_ERR_OUT_OF_MEM;
|
||||
goto error;
|
||||
|
@ -1661,13 +1619,6 @@ static int spider_xa_unlock(
|
|||
DBUG_ENTER("spider_xa_unlock");
|
||||
#ifdef SPIDER_XID_USES_xid_cache_iterate
|
||||
#else
|
||||
#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
|
||||
#endif
|
||||
old_proc_info = thd_proc_info(thd, "Unlocking xid by Spider");
|
||||
#ifdef SPIDER_XID_USES_xid_cache_iterate
|
||||
|
@ -1678,17 +1629,7 @@ static int spider_xa_unlock(
|
|||
#else
|
||||
pthread_mutex_lock(spd_db_att_LOCK_xid_cache);
|
||||
#endif
|
||||
#if defined(SPIDER_HAS_HASH_VALUE_TYPE) && defined(HASH_UPDATE_WITH_HASH_VALUE)
|
||||
#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
|
||||
|
@ -3849,12 +3790,7 @@ int spider_create_trx_ha(
|
|||
) {
|
||||
DBUG_PRINT("info",("spider need recreate"));
|
||||
need_create = TRUE;
|
||||
#ifdef HASH_UPDATE_WITH_HASH_VALUE
|
||||
my_hash_delete_with_hash_value(&trx->trx_ha_hash,
|
||||
share->table_name_hash_value, (uchar*) trx_ha);
|
||||
#else
|
||||
my_hash_delete(&trx->trx_ha_hash, (uchar*) trx_ha);
|
||||
#endif
|
||||
spider_free(trx, trx_ha, MYF(0));
|
||||
} else {
|
||||
DBUG_PRINT("info",("spider use this"));
|
||||
|
@ -3884,12 +3820,7 @@ int spider_create_trx_ha(
|
|||
trx_ha->conn_can_fo = conn_can_fo;
|
||||
trx_ha->wait_for_reusing = FALSE;
|
||||
uint old_elements = trx->trx_ha_hash.array.max_element;
|
||||
#ifdef HASH_UPDATE_WITH_HASH_VALUE
|
||||
if (my_hash_insert_with_hash_value(&trx->trx_ha_hash,
|
||||
share->table_name_hash_value, (uchar*) trx_ha))
|
||||
#else
|
||||
if (my_hash_insert(&trx->trx_ha_hash, (uchar*) trx_ha))
|
||||
#endif
|
||||
{
|
||||
spider_free(trx, trx_ha, MYF(0));
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
|
@ -3921,14 +3852,9 @@ SPIDER_TRX_HA *spider_check_trx_ha(
|
|||
link_bitmap_size, which is an indication of a share that has been
|
||||
freed. Delete the trx_ha and return NULL on mismatch.
|
||||
*/
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
if ((trx_ha = (SPIDER_TRX_HA *) my_hash_search_using_hash_value(
|
||||
&trx->trx_ha_hash, share->table_name_hash_value,
|
||||
(uchar*) share->table_name, share->table_name_length)))
|
||||
#else
|
||||
if ((trx_ha = (SPIDER_TRX_HA *) my_hash_search(&trx->trx_ha_hash,
|
||||
(uchar*) share->table_name, share->table_name_length)))
|
||||
#endif
|
||||
{
|
||||
if (trx_ha->share == share && trx_ha->link_count == share->link_count &&
|
||||
trx_ha->link_bitmap_size == share->link_bitmap_size)
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
|
||||
#define MYSQL_SERVER 1
|
||||
#include <my_global.h>
|
||||
#include "spd_environ.h"
|
||||
#include "mysql.h"
|
||||
#include "spd_udf.h"
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue