mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
fix for MariaDB 10.0.9
This commit is contained in:
@@ -4403,12 +4403,12 @@ int ha_spider::read_multi_range_first_internal(
|
||||
#ifdef HA_MRR_USE_DEFAULT_IMPL
|
||||
(error_num = spider_db_append_key_where(
|
||||
&mrr_cur_range.start_key,
|
||||
test(mrr_cur_range.range_flag & EQ_RANGE) ?
|
||||
SPIDER_TEST(mrr_cur_range.range_flag & EQ_RANGE) ?
|
||||
NULL : &mrr_cur_range.end_key, this))
|
||||
#else
|
||||
(error_num = spider_db_append_key_where(
|
||||
&multi_range_curr->start_key,
|
||||
test(multi_range_curr->range_flag & EQ_RANGE) ?
|
||||
SPIDER_TEST(multi_range_curr->range_flag & EQ_RANGE) ?
|
||||
NULL : &multi_range_curr->end_key, this))
|
||||
#endif
|
||||
)
|
||||
@@ -4849,9 +4849,9 @@ int ha_spider::read_multi_range_first_internal(
|
||||
!(sql_kinds & SPIDER_SQL_KIND_HS) &&
|
||||
#endif
|
||||
#ifdef HA_MRR_USE_DEFAULT_IMPL
|
||||
test(mrr_cur_range.range_flag & EQ_RANGE)
|
||||
SPIDER_TEST(mrr_cur_range.range_flag & EQ_RANGE)
|
||||
#else
|
||||
test(multi_range_curr->range_flag & EQ_RANGE)
|
||||
SPIDER_TEST(multi_range_curr->range_flag & EQ_RANGE)
|
||||
#endif
|
||||
) {
|
||||
if (
|
||||
@@ -4966,11 +4966,11 @@ int ha_spider::read_multi_range_first_internal(
|
||||
{
|
||||
if (
|
||||
#ifdef HA_MRR_USE_DEFAULT_IMPL
|
||||
!test(mrr_cur_range.range_flag & EQ_RANGE) ||
|
||||
!SPIDER_TEST(mrr_cur_range.range_flag & EQ_RANGE) ||
|
||||
result_list.tmp_table_join_key_part_map !=
|
||||
mrr_cur_range.start_key.keypart_map
|
||||
#else
|
||||
!test(multi_range_curr->range_flag & EQ_RANGE) ||
|
||||
!SPIDER_TEST(multi_range_curr->range_flag & EQ_RANGE) ||
|
||||
result_list.tmp_table_join_key_part_map !=
|
||||
multi_range_curr->start_key.keypart_map
|
||||
#endif
|
||||
@@ -5138,12 +5138,12 @@ int ha_spider::read_multi_range_first_internal(
|
||||
#ifdef HA_MRR_USE_DEFAULT_IMPL
|
||||
(error_num = spider_db_append_key_where(
|
||||
&mrr_cur_range.start_key,
|
||||
test(mrr_cur_range.range_flag & EQ_RANGE) ?
|
||||
SPIDER_TEST(mrr_cur_range.range_flag & EQ_RANGE) ?
|
||||
NULL : &mrr_cur_range.end_key, this))
|
||||
#else
|
||||
(error_num = spider_db_append_key_where(
|
||||
&multi_range_curr->start_key,
|
||||
test(multi_range_curr->range_flag & EQ_RANGE) ?
|
||||
SPIDER_TEST(multi_range_curr->range_flag & EQ_RANGE) ?
|
||||
NULL : &multi_range_curr->end_key, this))
|
||||
#endif
|
||||
)
|
||||
@@ -5813,12 +5813,12 @@ int ha_spider::read_multi_range_next(
|
||||
#ifdef HA_MRR_USE_DEFAULT_IMPL
|
||||
(error_num = spider_db_append_key_where(
|
||||
&mrr_cur_range.start_key,
|
||||
test(mrr_cur_range.range_flag & EQ_RANGE) ?
|
||||
SPIDER_TEST(mrr_cur_range.range_flag & EQ_RANGE) ?
|
||||
NULL : &mrr_cur_range.end_key, this))
|
||||
#else
|
||||
(error_num = spider_db_append_key_where(
|
||||
&multi_range_curr->start_key,
|
||||
test(multi_range_curr->range_flag & EQ_RANGE) ?
|
||||
SPIDER_TEST(multi_range_curr->range_flag & EQ_RANGE) ?
|
||||
NULL : &multi_range_curr->end_key, this))
|
||||
#endif
|
||||
)
|
||||
@@ -6270,9 +6270,9 @@ int ha_spider::read_multi_range_next(
|
||||
!(sql_kinds & SPIDER_SQL_KIND_HS) &&
|
||||
#endif
|
||||
#ifdef HA_MRR_USE_DEFAULT_IMPL
|
||||
test(mrr_cur_range.range_flag & EQ_RANGE)
|
||||
SPIDER_TEST(mrr_cur_range.range_flag & EQ_RANGE)
|
||||
#else
|
||||
test(multi_range_curr->range_flag & EQ_RANGE)
|
||||
SPIDER_TEST(multi_range_curr->range_flag & EQ_RANGE)
|
||||
#endif
|
||||
) {
|
||||
if (
|
||||
@@ -6388,11 +6388,11 @@ int ha_spider::read_multi_range_next(
|
||||
{
|
||||
if (
|
||||
#ifdef HA_MRR_USE_DEFAULT_IMPL
|
||||
!test(mrr_cur_range.range_flag & EQ_RANGE) ||
|
||||
!SPIDER_TEST(mrr_cur_range.range_flag & EQ_RANGE) ||
|
||||
result_list.tmp_table_join_key_part_map !=
|
||||
mrr_cur_range.start_key.keypart_map
|
||||
#else
|
||||
!test(multi_range_curr->range_flag & EQ_RANGE) ||
|
||||
!SPIDER_TEST(multi_range_curr->range_flag & EQ_RANGE) ||
|
||||
result_list.tmp_table_join_key_part_map !=
|
||||
multi_range_curr->start_key.keypart_map
|
||||
#endif
|
||||
@@ -6555,12 +6555,12 @@ int ha_spider::read_multi_range_next(
|
||||
#ifdef HA_MRR_USE_DEFAULT_IMPL
|
||||
(error_num = spider_db_append_key_where(
|
||||
&mrr_cur_range.start_key,
|
||||
test(mrr_cur_range.range_flag & EQ_RANGE) ?
|
||||
SPIDER_TEST(mrr_cur_range.range_flag & EQ_RANGE) ?
|
||||
NULL : &mrr_cur_range.end_key, this))
|
||||
#else
|
||||
(error_num = spider_db_append_key_where(
|
||||
&multi_range_curr->start_key,
|
||||
test(multi_range_curr->range_flag & EQ_RANGE) ?
|
||||
SPIDER_TEST(multi_range_curr->range_flag & EQ_RANGE) ?
|
||||
NULL : &multi_range_curr->end_key, this))
|
||||
#endif
|
||||
)
|
||||
|
@@ -2874,10 +2874,15 @@ void *spider_bg_sts_action(
|
||||
if (spider.search_link_idx == -1)
|
||||
{
|
||||
spider_trx_set_link_idx_for_all(&spider);
|
||||
/*
|
||||
spider.search_link_idx = spider_conn_next_link_idx(
|
||||
thd, share->link_statuses, share->access_balances,
|
||||
spider.conn_link_idx, spider.search_link_idx, share->link_count,
|
||||
SPIDER_LINK_STATUS_OK);
|
||||
*/
|
||||
spider.search_link_idx = spider_conn_first_link_idx(thd,
|
||||
share->link_statuses, share->access_balances, spider.conn_link_idx,
|
||||
share->link_count, SPIDER_LINK_STATUS_OK);
|
||||
}
|
||||
if (spider.search_link_idx >= 0)
|
||||
{
|
||||
@@ -2893,6 +2898,7 @@ void *spider_bg_sts_action(
|
||||
&error_num);
|
||||
conns[spider.search_link_idx]->error_mode = 0;
|
||||
pthread_mutex_unlock(&spider_global_trx_mutex);
|
||||
/*
|
||||
if (
|
||||
error_num &&
|
||||
share->monitoring_kind[spider.search_link_idx] &&
|
||||
@@ -2915,8 +2921,10 @@ void *spider_bg_sts_action(
|
||||
);
|
||||
lex_end(thd->lex);
|
||||
}
|
||||
*/
|
||||
spider.search_link_idx = -1;
|
||||
}
|
||||
if (conns[spider.search_link_idx])
|
||||
if (spider.search_link_idx != -1 && conns[spider.search_link_idx])
|
||||
{
|
||||
#ifdef WITH_PARTITION_STORAGE_ENGINE
|
||||
if (spider_get_sts(share, spider.search_link_idx,
|
||||
@@ -2931,6 +2939,7 @@ void *spider_bg_sts_action(
|
||||
2, HA_STATUS_CONST | HA_STATUS_VARIABLE))
|
||||
#endif
|
||||
{
|
||||
/*
|
||||
if (
|
||||
share->monitoring_kind[spider.search_link_idx] &&
|
||||
need_mons[spider.search_link_idx]
|
||||
@@ -2952,6 +2961,7 @@ void *spider_bg_sts_action(
|
||||
);
|
||||
lex_end(thd->lex);
|
||||
}
|
||||
*/
|
||||
spider.search_link_idx = -1;
|
||||
}
|
||||
}
|
||||
@@ -3256,10 +3266,15 @@ void *spider_bg_crd_action(
|
||||
if (spider.search_link_idx == -1)
|
||||
{
|
||||
spider_trx_set_link_idx_for_all(&spider);
|
||||
/*
|
||||
spider.search_link_idx = spider_conn_next_link_idx(
|
||||
thd, share->link_statuses, share->access_balances,
|
||||
spider.conn_link_idx, spider.search_link_idx, share->link_count,
|
||||
SPIDER_LINK_STATUS_OK);
|
||||
*/
|
||||
spider.search_link_idx = spider_conn_first_link_idx(thd,
|
||||
share->link_statuses, share->access_balances, spider.conn_link_idx,
|
||||
share->link_count, SPIDER_LINK_STATUS_OK);
|
||||
}
|
||||
if (spider.search_link_idx >= 0)
|
||||
{
|
||||
@@ -3275,6 +3290,7 @@ void *spider_bg_crd_action(
|
||||
&error_num);
|
||||
conns[spider.search_link_idx]->error_mode = 0;
|
||||
pthread_mutex_unlock(&spider_global_trx_mutex);
|
||||
/*
|
||||
if (
|
||||
error_num &&
|
||||
share->monitoring_kind[spider.search_link_idx] &&
|
||||
@@ -3297,8 +3313,10 @@ void *spider_bg_crd_action(
|
||||
);
|
||||
lex_end(thd->lex);
|
||||
}
|
||||
*/
|
||||
spider.search_link_idx = -1;
|
||||
}
|
||||
if (conns[spider.search_link_idx])
|
||||
if (spider.search_link_idx != -1 && conns[spider.search_link_idx])
|
||||
{
|
||||
#ifdef WITH_PARTITION_STORAGE_ENGINE
|
||||
if (spider_get_crd(share, spider.search_link_idx,
|
||||
@@ -3313,6 +3331,7 @@ void *spider_bg_crd_action(
|
||||
2))
|
||||
#endif
|
||||
{
|
||||
/*
|
||||
if (
|
||||
share->monitoring_kind[spider.search_link_idx] &&
|
||||
need_mons[spider.search_link_idx]
|
||||
@@ -3334,6 +3353,7 @@ void *spider_bg_crd_action(
|
||||
);
|
||||
lex_end(thd->lex);
|
||||
}
|
||||
*/
|
||||
spider.search_link_idx = -1;
|
||||
}
|
||||
}
|
||||
|
@@ -9025,16 +9025,19 @@ int spider_db_udf_ping_table(
|
||||
bool use_where,
|
||||
longlong limit
|
||||
) {
|
||||
int error_num, need_mon = 0;
|
||||
uint tmp_conn_link_idx = 0;
|
||||
ha_spider spider;
|
||||
int error_num;
|
||||
DBUG_ENTER("spider_db_udf_ping_table");
|
||||
if (!pthread_mutex_trylock(&table_mon_list->monitor_mutex))
|
||||
{
|
||||
int need_mon = 0;
|
||||
uint tmp_conn_link_idx = 0;
|
||||
ha_spider spider;
|
||||
uchar db_request_phase = 0;
|
||||
spider.share = share;
|
||||
spider.trx = trx;
|
||||
spider.need_mons = &need_mon;
|
||||
spider.conn_link_idx = &tmp_conn_link_idx;
|
||||
spider.db_request_phase = &db_request_phase;
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
conn->need_mon = &need_mon;
|
||||
|
@@ -3262,10 +3262,15 @@ int spider_db_handlersocket_util::open_item_func(
|
||||
func_name_length = strlen(func_name);
|
||||
DBUG_PRINT("info",("spider func_name = %s", func_name));
|
||||
DBUG_PRINT("info",("spider func_name_length = %d", func_name_length));
|
||||
if (str->reserve(SPIDER_SQL_MBR_LEN + func_name_length +
|
||||
SPIDER_SQL_OPEN_PAREN_LEN))
|
||||
if (str->reserve(
|
||||
#ifndef SPIDER_ITEM_GEOFUNC_NAME_HAS_MBR
|
||||
SPIDER_SQL_MBR_LEN +
|
||||
#endif
|
||||
func_name_length + SPIDER_SQL_OPEN_PAREN_LEN))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
#ifndef SPIDER_ITEM_GEOFUNC_NAME_HAS_MBR
|
||||
str->q_append(SPIDER_SQL_MBR_STR, SPIDER_SQL_MBR_LEN);
|
||||
#endif
|
||||
str->q_append(func_name, func_name_length);
|
||||
str->q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN);
|
||||
}
|
||||
|
@@ -36,6 +36,10 @@
|
||||
#define SPIDER_HAS_DECIMAL_OPERATION_RESULTS_VALUE_TYPE
|
||||
#endif
|
||||
|
||||
#if defined(MARIADB_BASE_VERSION)
|
||||
#define SPIDER_ITEM_GEOFUNC_NAME_HAS_MBR
|
||||
#endif
|
||||
|
||||
class spider_db_conn;
|
||||
typedef spider_db_conn SPIDER_DB_CONN;
|
||||
class spider_db_result;
|
||||
|
@@ -3649,10 +3649,15 @@ int spider_db_mysql_util::open_item_func(
|
||||
func_name_length = strlen(func_name);
|
||||
DBUG_PRINT("info",("spider func_name = %s", func_name));
|
||||
DBUG_PRINT("info",("spider func_name_length = %d", func_name_length));
|
||||
if (str->reserve(SPIDER_SQL_MBR_LEN + func_name_length +
|
||||
SPIDER_SQL_OPEN_PAREN_LEN))
|
||||
if (str->reserve(
|
||||
#ifndef SPIDER_ITEM_GEOFUNC_NAME_HAS_MBR
|
||||
SPIDER_SQL_MBR_LEN +
|
||||
#endif
|
||||
func_name_length + SPIDER_SQL_OPEN_PAREN_LEN))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
#ifndef SPIDER_ITEM_GEOFUNC_NAME_HAS_MBR
|
||||
str->q_append(SPIDER_SQL_MBR_STR, SPIDER_SQL_MBR_LEN);
|
||||
#endif
|
||||
str->q_append(func_name, func_name_length);
|
||||
str->q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN);
|
||||
}
|
||||
|
@@ -3550,10 +3550,15 @@ int spider_db_oracle_util::open_item_func(
|
||||
func_name_length = strlen(func_name);
|
||||
DBUG_PRINT("info",("spider func_name = %s", func_name));
|
||||
DBUG_PRINT("info",("spider func_name_length = %d", func_name_length));
|
||||
if (str->reserve(SPIDER_SQL_MBR_LEN + func_name_length +
|
||||
SPIDER_SQL_OPEN_PAREN_LEN))
|
||||
if (str->reserve(
|
||||
#ifndef SPIDER_ITEM_GEOFUNC_NAME_HAS_MBR
|
||||
SPIDER_SQL_MBR_LEN +
|
||||
#endif
|
||||
func_name_length + SPIDER_SQL_OPEN_PAREN_LEN))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
#ifndef SPIDER_ITEM_GEOFUNC_NAME_HAS_MBR
|
||||
str->q_append(SPIDER_SQL_MBR_STR, SPIDER_SQL_MBR_LEN);
|
||||
#endif
|
||||
str->q_append(func_name, func_name_length);
|
||||
str->q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN);
|
||||
}
|
||||
|
@@ -99,6 +99,12 @@
|
||||
#define SPIDER_WARN_LEVEL_NOTE MYSQL_ERROR::WARN_LEVEL_NOTE
|
||||
#endif
|
||||
|
||||
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100009
|
||||
#define SPIDER_TEST(A) MY_TEST(A)
|
||||
#else
|
||||
#define SPIDER_TEST(A) test(A)
|
||||
#endif
|
||||
|
||||
#if MYSQL_VERSION_ID >= 50500
|
||||
#define SPIDER_HAS_HASH_VALUE_TYPE
|
||||
#endif
|
||||
|
@@ -7713,8 +7713,23 @@ bool spider_check_direct_order_limit(
|
||||
|
||||
longlong direct_order_limit = spider_param_direct_order_limit(thd,
|
||||
share->direct_order_limit);
|
||||
DBUG_PRINT("info",("spider direct_order_limit=%lld", direct_order_limit));
|
||||
if (direct_order_limit)
|
||||
{
|
||||
DBUG_PRINT("info",("spider first_check=%s",
|
||||
first_check ? "TRUE" : "FALSE"));
|
||||
DBUG_PRINT("info",("spider (select_lex->options & OPTION_FOUND_ROWS)=%s",
|
||||
(select_lex->options & OPTION_FOUND_ROWS) ? "TRUE" : "FALSE"));
|
||||
DBUG_PRINT("info",("spider direct_aggregate=%s",
|
||||
spider->result_list.direct_aggregate ? "TRUE" : "FALSE"));
|
||||
DBUG_PRINT("info",("spider select_lex->group_list.elements=%u",
|
||||
select_lex->group_list.elements));
|
||||
DBUG_PRINT("info",("spider select_lex->with_sum_func=%s",
|
||||
select_lex->with_sum_func ? "TRUE" : "FALSE"));
|
||||
DBUG_PRINT("info",("spider select_lex->having=%s",
|
||||
select_lex->having ? "TRUE" : "FALSE"));
|
||||
DBUG_PRINT("info",("spider select_lex->order_list.elements=%u",
|
||||
select_lex->order_list.elements));
|
||||
if (
|
||||
!first_check ||
|
||||
!select_lex->explicit_limit ||
|
||||
|
Reference in New Issue
Block a user