1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-27641 Spider: remove #if MYSQL_VERSION_ID < ${VERSION}

This commit is contained in:
Nayuta Yanagisawa
2022-01-28 01:03:06 +09:00
parent 06bd93c377
commit cfd145faed
18 changed files with 6 additions and 665 deletions

View File

@@ -22,10 +22,6 @@
#include <my_global.h> #include <my_global.h>
#include "mysql_version.h" #include "mysql_version.h"
#include "spd_environ.h" #include "spd_environ.h"
#if MYSQL_VERSION_ID < 50500
#include "mysql_priv.h"
#include <mysql/plugin.h>
#else
#include "sql_priv.h" #include "sql_priv.h"
#include "probes_mysql.h" #include "probes_mysql.h"
#include "sql_class.h" #include "sql_class.h"
@@ -33,7 +29,6 @@
#ifdef HANDLER_HAS_DIRECT_AGGREGATE #ifdef HANDLER_HAS_DIRECT_AGGREGATE
#include "sql_select.h" #include "sql_select.h"
#endif #endif
#endif
#include "ha_partition.h" #include "ha_partition.h"
#include "spd_param.h" #include "spd_param.h"
#include "spd_err.h" #include "spd_err.h"
@@ -1024,9 +1019,6 @@ int ha_spider::external_lock(
DBUG_ENTER("ha_spider::external_lock"); DBUG_ENTER("ha_spider::external_lock");
DBUG_PRINT("info",("spider this=%p", this)); DBUG_PRINT("info",("spider this=%p", this));
DBUG_PRINT("info",("spider lock_type=%x", lock_type)); DBUG_PRINT("info",("spider lock_type=%x", lock_type));
#if MYSQL_VERSION_ID < 50500
DBUG_PRINT("info",("spider thd->options=%x", (int) thd->options));
#endif
#ifdef WITH_PARTITION_STORAGE_ENGINE #ifdef WITH_PARTITION_STORAGE_ENGINE
if ( if (
wide_handler->stage == SPD_HND_STAGE_EXTERNAL_LOCK && wide_handler->stage == SPD_HND_STAGE_EXTERNAL_LOCK &&
@@ -1433,14 +1425,11 @@ int ha_spider::extra(
if (!(wide_handler->trx = spider_get_trx(ha_thd(), TRUE, &error_num))) if (!(wide_handler->trx = spider_get_trx(ha_thd(), TRUE, &error_num)))
DBUG_RETURN(error_num); DBUG_RETURN(error_num);
break; break;
#if MYSQL_VERSION_ID < 50500
#else
case HA_EXTRA_ADD_CHILDREN_LIST: case HA_EXTRA_ADD_CHILDREN_LIST:
DBUG_PRINT("info",("spider HA_EXTRA_ADD_CHILDREN_LIST")); DBUG_PRINT("info",("spider HA_EXTRA_ADD_CHILDREN_LIST"));
if (!(wide_handler->trx = spider_get_trx(ha_thd(), TRUE, &error_num))) if (!(wide_handler->trx = spider_get_trx(ha_thd(), TRUE, &error_num)))
DBUG_RETURN(error_num); DBUG_RETURN(error_num);
break; break;
#endif
#if defined(HA_EXTRA_HAS_STARTING_ORDERED_INDEX_SCAN) || defined(HA_EXTRA_HAS_HA_EXTRA_USE_CMP_REF) #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 #ifdef HA_EXTRA_HAS_STARTING_ORDERED_INDEX_SCAN
case HA_EXTRA_STARTING_ORDERED_INDEX_SCAN: case HA_EXTRA_STARTING_ORDERED_INDEX_SCAN:
@@ -9914,14 +9903,10 @@ int ha_spider::direct_update_rows_init()
if (wide_handler->direct_update_fields) if (wide_handler->direct_update_fields)
{ {
if ( if (
#if MYSQL_VERSION_ID < 50500
!thd->variables.engine_condition_pushdown ||
#else
#ifdef SPIDER_ENGINE_CONDITION_PUSHDOWN_IS_ALWAYS_ON #ifdef SPIDER_ENGINE_CONDITION_PUSHDOWN_IS_ALWAYS_ON
#else #else
!(thd->variables.optimizer_switch & !(thd->variables.optimizer_switch &
OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN) || OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN) ||
#endif
#endif #endif
!select_lex || !select_lex ||
select_lex->table_list.elements != 1 || select_lex->table_list.elements != 1 ||
@@ -10449,14 +10434,10 @@ int ha_spider::direct_delete_rows_init()
wide_handler->cond_check = FALSE; wide_handler->cond_check = FALSE;
spider_get_select_limit(this, &select_lex, &select_limit, &offset_limit); spider_get_select_limit(this, &select_lex, &select_limit, &offset_limit);
if ( if (
#if MYSQL_VERSION_ID < 50500
!thd->variables.engine_condition_pushdown ||
#else
#ifdef SPIDER_ENGINE_CONDITION_PUSHDOWN_IS_ALWAYS_ON #ifdef SPIDER_ENGINE_CONDITION_PUSHDOWN_IS_ALWAYS_ON
#else #else
!(thd->variables.optimizer_switch & !(thd->variables.optimizer_switch &
OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN) || OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN) ||
#endif
#endif #endif
!select_lex || !select_lex ||
select_lex->table_list.elements != 1 || select_lex->table_list.elements != 1 ||

View File

@@ -18,17 +18,12 @@
#include <my_global.h> #include <my_global.h>
#include "mysql_version.h" #include "mysql_version.h"
#include "spd_environ.h" #include "spd_environ.h"
#if MYSQL_VERSION_ID < 50500
#include "mysql_priv.h"
#include <mysql/plugin.h>
#else
#include "sql_priv.h" #include "sql_priv.h"
#include "probes_mysql.h" #include "probes_mysql.h"
#include "sql_class.h" #include "sql_class.h"
#include "sql_partition.h" #include "sql_partition.h"
#include "sql_table.h" #include "sql_table.h"
#include "tztime.h" #include "tztime.h"
#endif
#include "spd_err.h" #include "spd_err.h"
#include "spd_param.h" #include "spd_param.h"
#include "spd_db_include.h" #include "spd_db_include.h"
@@ -160,12 +155,8 @@ int spider_conn_init(
) { ) {
int error_num = HA_ERR_OUT_OF_MEM; int error_num = HA_ERR_OUT_OF_MEM;
DBUG_ENTER("spider_conn_init"); DBUG_ENTER("spider_conn_init");
#if MYSQL_VERSION_ID < 50500
if (pthread_mutex_init(&conn->loop_check_mutex, MY_MUTEX_INIT_FAST))
#else
if (mysql_mutex_init(spd_key_mutex_conn_loop_check, &conn->loop_check_mutex, if (mysql_mutex_init(spd_key_mutex_conn_loop_check, &conn->loop_check_mutex,
MY_MUTEX_INIT_FAST)) MY_MUTEX_INIT_FAST))
#endif
{ {
goto error_loop_check_mutex_init; goto error_loop_check_mutex_init;
} }
@@ -634,12 +625,8 @@ SPIDER_CONN *spider_create_conn(
else else
conn->need_mon = need_mon; conn->need_mon = need_mon;
#if MYSQL_VERSION_ID < 50500
if (pthread_mutex_init(&conn->mta_conn_mutex, MY_MUTEX_INIT_FAST))
#else
if (mysql_mutex_init(spd_key_mutex_mta_conn, &conn->mta_conn_mutex, if (mysql_mutex_init(spd_key_mutex_mta_conn, &conn->mta_conn_mutex,
MY_MUTEX_INIT_FAST)) MY_MUTEX_INIT_FAST))
#endif
{ {
*error_num = HA_ERR_OUT_OF_MEM; *error_num = HA_ERR_OUT_OF_MEM;
goto error_mta_conn_mutex_init; goto error_mta_conn_mutex_init;
@@ -1929,43 +1916,27 @@ int spider_create_conn_thread(
DBUG_ENTER("spider_create_conn_thread"); DBUG_ENTER("spider_create_conn_thread");
if (conn && !conn->bg_init) if (conn && !conn->bg_init)
{ {
#if MYSQL_VERSION_ID < 50500
if (pthread_mutex_init(&conn->bg_conn_chain_mutex, MY_MUTEX_INIT_FAST))
#else
if (mysql_mutex_init(spd_key_mutex_bg_conn_chain, if (mysql_mutex_init(spd_key_mutex_bg_conn_chain,
&conn->bg_conn_chain_mutex, MY_MUTEX_INIT_FAST)) &conn->bg_conn_chain_mutex, MY_MUTEX_INIT_FAST))
#endif
{ {
error_num = HA_ERR_OUT_OF_MEM; error_num = HA_ERR_OUT_OF_MEM;
goto error_chain_mutex_init; goto error_chain_mutex_init;
} }
conn->bg_conn_chain_mutex_ptr = NULL; conn->bg_conn_chain_mutex_ptr = NULL;
#if MYSQL_VERSION_ID < 50500
if (pthread_mutex_init(&conn->bg_conn_sync_mutex, MY_MUTEX_INIT_FAST))
#else
if (mysql_mutex_init(spd_key_mutex_bg_conn_sync, if (mysql_mutex_init(spd_key_mutex_bg_conn_sync,
&conn->bg_conn_sync_mutex, MY_MUTEX_INIT_FAST)) &conn->bg_conn_sync_mutex, MY_MUTEX_INIT_FAST))
#endif
{ {
error_num = HA_ERR_OUT_OF_MEM; error_num = HA_ERR_OUT_OF_MEM;
goto error_sync_mutex_init; goto error_sync_mutex_init;
} }
#if MYSQL_VERSION_ID < 50500
if (pthread_mutex_init(&conn->bg_conn_mutex, MY_MUTEX_INIT_FAST))
#else
if (mysql_mutex_init(spd_key_mutex_bg_conn, &conn->bg_conn_mutex, if (mysql_mutex_init(spd_key_mutex_bg_conn, &conn->bg_conn_mutex,
MY_MUTEX_INIT_FAST)) MY_MUTEX_INIT_FAST))
#endif
{ {
error_num = HA_ERR_OUT_OF_MEM; error_num = HA_ERR_OUT_OF_MEM;
goto error_mutex_init; goto error_mutex_init;
} }
#if MYSQL_VERSION_ID < 50500
if (pthread_mutex_init(&conn->bg_job_stack_mutex, MY_MUTEX_INIT_FAST))
#else
if (mysql_mutex_init(spd_key_mutex_bg_job_stack, &conn->bg_job_stack_mutex, if (mysql_mutex_init(spd_key_mutex_bg_job_stack, &conn->bg_job_stack_mutex,
MY_MUTEX_INIT_FAST)) MY_MUTEX_INIT_FAST))
#endif
{ {
error_num = HA_ERR_OUT_OF_MEM; error_num = HA_ERR_OUT_OF_MEM;
goto error_job_stack_mutex_init; goto error_job_stack_mutex_init;
@@ -1982,36 +1953,22 @@ int spider_create_conn_thread(
conn->bg_job_stack.max_element * conn->bg_job_stack.max_element *
conn->bg_job_stack.size_of_element); conn->bg_job_stack.size_of_element);
conn->bg_job_stack_cur_pos = 0; conn->bg_job_stack_cur_pos = 0;
#if MYSQL_VERSION_ID < 50500
if (pthread_cond_init(&conn->bg_conn_sync_cond, NULL))
#else
if (mysql_cond_init(spd_key_cond_bg_conn_sync, if (mysql_cond_init(spd_key_cond_bg_conn_sync,
&conn->bg_conn_sync_cond, NULL)) &conn->bg_conn_sync_cond, NULL))
#endif
{ {
error_num = HA_ERR_OUT_OF_MEM; error_num = HA_ERR_OUT_OF_MEM;
goto error_sync_cond_init; goto error_sync_cond_init;
} }
#if MYSQL_VERSION_ID < 50500
if (pthread_cond_init(&conn->bg_conn_cond, NULL))
#else
if (mysql_cond_init(spd_key_cond_bg_conn, if (mysql_cond_init(spd_key_cond_bg_conn,
&conn->bg_conn_cond, NULL)) &conn->bg_conn_cond, NULL))
#endif
{ {
error_num = HA_ERR_OUT_OF_MEM; error_num = HA_ERR_OUT_OF_MEM;
goto error_cond_init; goto error_cond_init;
} }
pthread_mutex_lock(&conn->bg_conn_mutex); pthread_mutex_lock(&conn->bg_conn_mutex);
#if MYSQL_VERSION_ID < 50500
if (pthread_create(&conn->bg_thread, &spider_pt_attr,
spider_bg_conn_action, (void *) conn)
)
#else
if (mysql_thread_create(spd_key_thd_bg, &conn->bg_thread, if (mysql_thread_create(spd_key_thd_bg, &conn->bg_thread,
&spider_pt_attr, spider_bg_conn_action, (void *) conn) &spider_pt_attr, spider_bg_conn_action, (void *) conn)
) )
#endif
{ {
pthread_mutex_unlock(&conn->bg_conn_mutex); pthread_mutex_unlock(&conn->bg_conn_mutex);
error_num = HA_ERR_OUT_OF_MEM; error_num = HA_ERR_OUT_OF_MEM;
@@ -3001,35 +2958,21 @@ int spider_create_sts_thread(
DBUG_ENTER("spider_create_sts_thread"); DBUG_ENTER("spider_create_sts_thread");
if (!share->bg_sts_init) if (!share->bg_sts_init)
{ {
#if MYSQL_VERSION_ID < 50500
if (pthread_cond_init(&share->bg_sts_cond, NULL))
#else
if (mysql_cond_init(spd_key_cond_bg_sts, if (mysql_cond_init(spd_key_cond_bg_sts,
&share->bg_sts_cond, NULL)) &share->bg_sts_cond, NULL))
#endif
{ {
error_num = HA_ERR_OUT_OF_MEM; error_num = HA_ERR_OUT_OF_MEM;
goto error_cond_init; goto error_cond_init;
} }
#if MYSQL_VERSION_ID < 50500
if (pthread_cond_init(&share->bg_sts_sync_cond, NULL))
#else
if (mysql_cond_init(spd_key_cond_bg_sts_sync, if (mysql_cond_init(spd_key_cond_bg_sts_sync,
&share->bg_sts_sync_cond, NULL)) &share->bg_sts_sync_cond, NULL))
#endif
{ {
error_num = HA_ERR_OUT_OF_MEM; error_num = HA_ERR_OUT_OF_MEM;
goto error_sync_cond_init; goto error_sync_cond_init;
} }
#if MYSQL_VERSION_ID < 50500
if (pthread_create(&share->bg_sts_thread, &spider_pt_attr,
spider_bg_sts_action, (void *) share)
)
#else
if (mysql_thread_create(spd_key_thd_bg_sts, &share->bg_sts_thread, if (mysql_thread_create(spd_key_thd_bg_sts, &share->bg_sts_thread,
&spider_pt_attr, spider_bg_sts_action, (void *) share) &spider_pt_attr, spider_bg_sts_action, (void *) share)
) )
#endif
{ {
error_num = HA_ERR_OUT_OF_MEM; error_num = HA_ERR_OUT_OF_MEM;
goto error_thread_create; goto error_thread_create;
@@ -3342,35 +3285,21 @@ int spider_create_crd_thread(
DBUG_ENTER("spider_create_crd_thread"); DBUG_ENTER("spider_create_crd_thread");
if (!share->bg_crd_init) if (!share->bg_crd_init)
{ {
#if MYSQL_VERSION_ID < 50500
if (pthread_cond_init(&share->bg_crd_cond, NULL))
#else
if (mysql_cond_init(spd_key_cond_bg_crd, if (mysql_cond_init(spd_key_cond_bg_crd,
&share->bg_crd_cond, NULL)) &share->bg_crd_cond, NULL))
#endif
{ {
error_num = HA_ERR_OUT_OF_MEM; error_num = HA_ERR_OUT_OF_MEM;
goto error_cond_init; goto error_cond_init;
} }
#if MYSQL_VERSION_ID < 50500
if (pthread_cond_init(&share->bg_crd_sync_cond, NULL))
#else
if (mysql_cond_init(spd_key_cond_bg_crd_sync, if (mysql_cond_init(spd_key_cond_bg_crd_sync,
&share->bg_crd_sync_cond, NULL)) &share->bg_crd_sync_cond, NULL))
#endif
{ {
error_num = HA_ERR_OUT_OF_MEM; error_num = HA_ERR_OUT_OF_MEM;
goto error_sync_cond_init; goto error_sync_cond_init;
} }
#if MYSQL_VERSION_ID < 50500
if (pthread_create(&share->bg_crd_thread, &spider_pt_attr,
spider_bg_crd_action, (void *) share)
)
#else
if (mysql_thread_create(spd_key_thd_bg_crd, &share->bg_crd_thread, if (mysql_thread_create(spd_key_thd_bg_crd, &share->bg_crd_thread,
&spider_pt_attr, spider_bg_crd_action, (void *) share) &spider_pt_attr, spider_bg_crd_action, (void *) share)
) )
#endif
{ {
error_num = HA_ERR_OUT_OF_MEM; error_num = HA_ERR_OUT_OF_MEM;
goto error_thread_create; goto error_thread_create;
@@ -3763,13 +3692,8 @@ int spider_create_mon_threads(
{ {
if ( if (
share->monitoring_bg_kind[roop_count] && share->monitoring_bg_kind[roop_count] &&
#if MYSQL_VERSION_ID < 50500
pthread_mutex_init(&share->bg_mon_mutexes[roop_count],
MY_MUTEX_INIT_FAST)
#else
mysql_mutex_init(spd_key_mutex_bg_mon, mysql_mutex_init(spd_key_mutex_bg_mon,
&share->bg_mon_mutexes[roop_count], MY_MUTEX_INIT_FAST) &share->bg_mon_mutexes[roop_count], MY_MUTEX_INIT_FAST)
#endif
) { ) {
error_num = HA_ERR_OUT_OF_MEM; error_num = HA_ERR_OUT_OF_MEM;
my_afree(buf); my_afree(buf);
@@ -3781,12 +3705,8 @@ int spider_create_mon_threads(
{ {
if ( if (
share->monitoring_bg_kind[roop_count] && share->monitoring_bg_kind[roop_count] &&
#if MYSQL_VERSION_ID < 50500
pthread_cond_init(&share->bg_mon_conds[roop_count], NULL)
#else
mysql_cond_init(spd_key_cond_bg_mon, mysql_cond_init(spd_key_cond_bg_mon,
&share->bg_mon_conds[roop_count], NULL) &share->bg_mon_conds[roop_count], NULL)
#endif
) { ) {
error_num = HA_ERR_OUT_OF_MEM; error_num = HA_ERR_OUT_OF_MEM;
my_afree(buf); my_afree(buf);
@@ -3798,12 +3718,8 @@ int spider_create_mon_threads(
{ {
if ( if (
share->monitoring_bg_kind[roop_count] && share->monitoring_bg_kind[roop_count] &&
#if MYSQL_VERSION_ID < 50500
pthread_cond_init(&share->bg_mon_sleep_conds[roop_count], NULL)
#else
mysql_cond_init(spd_key_cond_bg_mon_sleep, mysql_cond_init(spd_key_cond_bg_mon_sleep,
&share->bg_mon_sleep_conds[roop_count], NULL) &share->bg_mon_sleep_conds[roop_count], NULL)
#endif
) { ) {
error_num = HA_ERR_OUT_OF_MEM; error_num = HA_ERR_OUT_OF_MEM;
my_afree(buf); my_afree(buf);
@@ -3818,16 +3734,10 @@ int spider_create_mon_threads(
{ {
link_pack.link_idx = roop_count; link_pack.link_idx = roop_count;
pthread_mutex_lock(&share->bg_mon_mutexes[roop_count]); pthread_mutex_lock(&share->bg_mon_mutexes[roop_count]);
#if MYSQL_VERSION_ID < 50500
if (pthread_create(&share->bg_mon_threads[roop_count],
&spider_pt_attr, spider_bg_mon_action, (void *) &link_pack)
)
#else
if (mysql_thread_create(spd_key_thd_bg_mon, if (mysql_thread_create(spd_key_thd_bg_mon,
&share->bg_mon_threads[roop_count], &spider_pt_attr, &share->bg_mon_threads[roop_count], &spider_pt_attr,
spider_bg_mon_action, (void *) &link_pack) spider_bg_mon_action, (void *) &link_pack)
) )
#endif
{ {
error_num = HA_ERR_OUT_OF_MEM; error_num = HA_ERR_OUT_OF_MEM;
my_afree(buf); my_afree(buf);
@@ -4413,21 +4323,13 @@ SPIDER_IP_PORT_CONN* spider_create_ipport_conn(SPIDER_CONN *conn)
goto err_return_direct; goto err_return_direct;
} }
#if MYSQL_VERSION_ID < 50500
if (pthread_mutex_init(&ret->mutex, MY_MUTEX_INIT_FAST))
#else
if (mysql_mutex_init(spd_key_mutex_conn_i, &ret->mutex, MY_MUTEX_INIT_FAST)) if (mysql_mutex_init(spd_key_mutex_conn_i, &ret->mutex, MY_MUTEX_INIT_FAST))
#endif
{ {
//error //error
goto err_malloc_key; goto err_malloc_key;
} }
#if MYSQL_VERSION_ID < 50500
if (pthread_cond_init(&ret->cond, NULL))
#else
if (mysql_cond_init(spd_key_cond_conn_i, &ret->cond, NULL)) if (mysql_cond_init(spd_key_cond_conn_i, &ret->cond, NULL))
#endif
{ {
pthread_mutex_destroy(&ret->mutex); pthread_mutex_destroy(&ret->mutex);
goto err_malloc_key; goto err_malloc_key;

View File

@@ -18,17 +18,12 @@
#include <my_global.h> #include <my_global.h>
#include "mysql_version.h" #include "mysql_version.h"
#include "spd_environ.h" #include "spd_environ.h"
#if MYSQL_VERSION_ID < 50500
#include "mysql_priv.h"
#include <mysql/plugin.h>
#else
#include "sql_priv.h" #include "sql_priv.h"
#include "probes_mysql.h" #include "probes_mysql.h"
#include "sql_class.h" #include "sql_class.h"
#include "sql_base.h" #include "sql_base.h"
#include "sql_partition.h" #include "sql_partition.h"
#include "transaction.h" #include "transaction.h"
#endif
#include "spd_err.h" #include "spd_err.h"
#include "spd_param.h" #include "spd_param.h"
#include "spd_db_include.h" #include "spd_db_include.h"
@@ -847,13 +842,8 @@ long long spider_copy_tables_body(
thd->handler_tables_hash.records != 0 || thd->handler_tables_hash.records != 0 ||
thd->derived_tables != 0 || thd->derived_tables != 0 ||
thd->lock != 0 || thd->lock != 0 ||
#if MYSQL_VERSION_ID < 50500
thd->locked_tables != 0 ||
thd->prelocked_mode != NON_PRELOCKED
#else
thd->locked_tables_list.locked_tables() || thd->locked_tables_list.locked_tables() ||
thd->locked_tables_mode != LTM_NONE thd->locked_tables_mode != LTM_NONE
#endif
) { ) {
if (thd->open_tables != 0) if (thd->open_tables != 0)
{ {
@@ -876,18 +866,6 @@ long long spider_copy_tables_body(
my_printf_error(ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_NUM, my_printf_error(ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_NUM,
ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_STR_WITH_PTR, MYF(0), ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_STR_WITH_PTR, MYF(0),
"thd->lock", thd->lock); "thd->lock", thd->lock);
#if MYSQL_VERSION_ID < 50500
} else if (thd->locked_tables != 0)
{
my_printf_error(ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_NUM,
ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_STR_WITH_PTR, MYF(0),
"thd->locked_tables", thd->locked_tables);
} else if (thd->prelocked_mode != NON_PRELOCKED)
{
my_printf_error(ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_NUM,
ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_STR_WITH_NUM, MYF(0),
"thd->prelocked_mode", (longlong) thd->prelocked_mode);
#else
} else if (thd->locked_tables_list.locked_tables()) } else if (thd->locked_tables_list.locked_tables())
{ {
my_printf_error(ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_NUM, my_printf_error(ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_NUM,
@@ -899,7 +877,6 @@ long long spider_copy_tables_body(
my_printf_error(ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_NUM, my_printf_error(ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_NUM,
ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_STR_WITH_NUM, MYF(0), ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_STR_WITH_NUM, MYF(0),
"thd->locked_tables_mode", (longlong) thd->locked_tables_mode); "thd->locked_tables_mode", (longlong) thd->locked_tables_mode);
#endif
} }
goto error; goto error;
} }
@@ -991,9 +968,7 @@ long long spider_copy_tables_body(
copy_tables->trx->trx_start = TRUE; copy_tables->trx->trx_start = TRUE;
copy_tables->trx->updated_in_this_trx = FALSE; copy_tables->trx->updated_in_this_trx = FALSE;
DBUG_PRINT("info",("spider trx->updated_in_this_trx=FALSE")); DBUG_PRINT("info",("spider trx->updated_in_this_trx=FALSE"));
#if MYSQL_VERSION_ID < 50500
if (open_and_lock_tables(thd, table_list))
#else
MDL_REQUEST_INIT(&table_list->mdl_request, MDL_REQUEST_INIT(&table_list->mdl_request,
MDL_key::TABLE, MDL_key::TABLE,
SPIDER_TABLE_LIST_db_str(table_list), SPIDER_TABLE_LIST_db_str(table_list),
@@ -1002,7 +977,6 @@ long long spider_copy_tables_body(
MDL_TRANSACTION MDL_TRANSACTION
); );
if (open_and_lock_tables(thd, table_list, FALSE, 0)) if (open_and_lock_tables(thd, table_list, FALSE, 0))
#endif
{ {
thd->m_reprepare_observer = reprepare_observer_backup; thd->m_reprepare_observer = reprepare_observer_backup;
copy_tables->trx->trx_start = FALSE; copy_tables->trx->trx_start = FALSE;
@@ -1223,11 +1197,7 @@ long long spider_copy_tables_body(
*/ */
if (table_list->table) if (table_list->table)
{ {
#if MYSQL_VERSION_ID < 50500
ha_autocommit_or_rollback(thd, 0);
#else
(thd->is_error() ? trans_rollback_stmt(thd) : trans_commit_stmt(thd)); (thd->is_error() ? trans_rollback_stmt(thd) : trans_commit_stmt(thd));
#endif
close_thread_tables(thd); close_thread_tables(thd);
} }
if (spider) if (spider)
@@ -1285,11 +1255,7 @@ error:
} }
if (table_list && table_list->table) if (table_list && table_list->table)
{ {
#if MYSQL_VERSION_ID < 50500
ha_autocommit_or_rollback(thd, 0);
#else
(thd->is_error() ? trans_rollback_stmt(thd) : trans_commit_stmt(thd)); (thd->is_error() ? trans_rollback_stmt(thd) : trans_commit_stmt(thd));
#endif
close_thread_tables(thd); close_thread_tables(thd);
} }
if (spider) if (spider)

View File

@@ -18,10 +18,6 @@
#include <my_global.h> #include <my_global.h>
#include "mysql_version.h" #include "mysql_version.h"
#include "spd_environ.h" #include "spd_environ.h"
#if MYSQL_VERSION_ID < 50500
#include "mysql_priv.h"
#include <mysql/plugin.h>
#else
#include "sql_priv.h" #include "sql_priv.h"
#include "probes_mysql.h" #include "probes_mysql.h"
#include "sql_class.h" #include "sql_class.h"
@@ -33,7 +29,6 @@
#ifdef HANDLER_HAS_DIRECT_AGGREGATE #ifdef HANDLER_HAS_DIRECT_AGGREGATE
#include "sql_select.h" #include "sql_select.h"
#endif #endif
#endif
#include "sql_common.h" #include "sql_common.h"
#include <errmsg.h> #include <errmsg.h>
#include "spd_err.h" #include "spd_err.h"
@@ -6569,11 +6564,7 @@ int spider_db_update_auto_increment(
if ( if (
table->s->next_number_keypart == 0 && table->s->next_number_keypart == 0 &&
mysql_bin_log.is_open() && mysql_bin_log.is_open() &&
#if MYSQL_VERSION_ID < 50500
!thd->current_stmt_binlog_row_based
#else
!thd->is_current_stmt_binlog_format_row() !thd->is_current_stmt_binlog_format_row()
#endif
) { ) {
if ( if (
spider->check_partitioned() && spider->check_partitioned() &&
@@ -6602,11 +6593,7 @@ int spider_db_update_auto_increment(
if ( if (
table->s->next_number_keypart == 0 && table->s->next_number_keypart == 0 &&
mysql_bin_log.is_open() && mysql_bin_log.is_open() &&
#if MYSQL_VERSION_ID < 50500
!thd->current_stmt_binlog_row_based
#else
!thd->is_current_stmt_binlog_format_row() !thd->is_current_stmt_binlog_format_row()
#endif
) { ) {
for (roop_count = 0; roop_count < (int) affected_rows; roop_count++) for (roop_count = 0; roop_count < (int) affected_rows; roop_count++)
push_warning_printf(thd, SPIDER_WARN_LEVEL_NOTE, push_warning_printf(thd, SPIDER_WARN_LEVEL_NOTE,
@@ -8882,11 +8869,7 @@ int spider_db_print_item_type_default(
{ {
if (spider->share->access_charset->cset == system_charset_info->cset) if (spider->share->access_charset->cset == system_charset_info->cset)
{ {
#if MYSQL_VERSION_ID < 50500
item->print(str->get_str(), QT_IS);
#else
item->print(str->get_str(), QT_TO_SYSTEM_CHARSET); item->print(str->get_str(), QT_TO_SYSTEM_CHARSET);
#endif
} else { } else {
item->print(str->get_str(), QT_ORDINARY); item->print(str->get_str(), QT_ORDINARY);
} }
@@ -10059,13 +10042,8 @@ int spider_db_udf_direct_sql(
spider_param_ping_interval_at_trx_start(thd); spider_param_ping_interval_at_trx_start(thd);
time_t tmp_time = (time_t) time((time_t*) 0); time_t tmp_time = (time_t) time((time_t*) 0);
bool need_trx_end, need_all_commit, insert_start = FALSE; bool need_trx_end, need_all_commit, insert_start = FALSE;
#if MYSQL_VERSION_ID < 50500
#else
enum_sql_command sql_command_backup; enum_sql_command sql_command_backup;
#endif
DBUG_ENTER("spider_db_udf_direct_sql"); DBUG_ENTER("spider_db_udf_direct_sql");
#if MYSQL_VERSION_ID < 50500
#else
if (direct_sql->real_table_used) if (direct_sql->real_table_used)
{ {
if (spider_sys_open_and_lock_tables(c_thd, &direct_sql->table_list_first, if (spider_sys_open_and_lock_tables(c_thd, &direct_sql->table_list_first,
@@ -10084,7 +10062,6 @@ int spider_db_udf_direct_sql(
direct_sql->open_tables_thd = c_thd; direct_sql->open_tables_thd = c_thd;
roop_count = 0; roop_count = 0;
} }
#endif
if (c_thd != thd) if (c_thd != thd)
{ {
@@ -10092,21 +10069,15 @@ int spider_db_udf_direct_sql(
need_trx_end = TRUE; need_trx_end = TRUE;
} else { } else {
need_all_commit = FALSE; need_all_commit = FALSE;
#if MYSQL_VERSION_ID < 50500
#else
if (direct_sql->real_table_used) if (direct_sql->real_table_used)
{ {
need_trx_end = TRUE; need_trx_end = TRUE;
} else { } else {
#endif
if (c_thd->transaction->stmt.ha_list) if (c_thd->transaction->stmt.ha_list)
need_trx_end = FALSE; need_trx_end = FALSE;
else else
need_trx_end = TRUE; need_trx_end = TRUE;
#if MYSQL_VERSION_ID < 50500
#else
} }
#endif
} }
if (!conn->disable_reconnect) if (!conn->disable_reconnect)
@@ -10126,11 +10097,8 @@ int spider_db_udf_direct_sql(
DBUG_RETURN(ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM); DBUG_RETURN(ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM);
} }
#if MYSQL_VERSION_ID < 50500
#else
sql_command_backup = c_thd->lex->sql_command; sql_command_backup = c_thd->lex->sql_command;
c_thd->lex->sql_command = SQLCOM_INSERT; c_thd->lex->sql_command = SQLCOM_INSERT;
#endif
pthread_mutex_assert_not_owner(&conn->mta_conn_mutex); pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
pthread_mutex_lock(&conn->mta_conn_mutex); pthread_mutex_lock(&conn->mta_conn_mutex);
@@ -10213,9 +10181,6 @@ int spider_db_udf_direct_sql(
for (; roop_count2 < set_off; roop_count2++) for (; roop_count2 < set_off; roop_count2++)
bitmap_clear_bit(table->write_set, (uint) roop_count2); bitmap_clear_bit(table->write_set, (uint) roop_count2);
#if MYSQL_VERSION_ID < 50500
if (table->file->has_transactions())
#endif
{ {
THR_LOCK_DATA *to[2]; THR_LOCK_DATA *to[2];
table->file->store_lock(table->in_use, to, table->file->store_lock(table->in_use, to,
@@ -10226,8 +10191,6 @@ int spider_db_udf_direct_sql(
table->file->print_error(error_num, MYF(0)); table->file->print_error(error_num, MYF(0));
break; break;
} }
#if MYSQL_VERSION_ID < 50500
#else
if ( if (
table->s->tmp_table == NO_TMP_TABLE && table->s->tmp_table == NO_TMP_TABLE &&
table->pos_in_table_list table->pos_in_table_list
@@ -10249,7 +10212,6 @@ int spider_db_udf_direct_sql(
next_tables = next_tables->next_global; next_tables = next_tables->next_global;
} }
} }
#endif
} }
if (direct_sql->iop) if (direct_sql->iop)
@@ -10311,13 +10273,8 @@ int spider_db_udf_direct_sql(
else if (direct_sql->iop[roop_count] == 2) else if (direct_sql->iop[roop_count] == 2)
table->file->extra(HA_EXTRA_WRITE_CANNOT_REPLACE); table->file->extra(HA_EXTRA_WRITE_CANNOT_REPLACE);
} }
#if MYSQL_VERSION_ID < 50500
if (table->file->has_transactions())
#endif
{ {
table->file->ha_external_unlock(table->in_use); table->file->ha_external_unlock(table->in_use);
#if MYSQL_VERSION_ID < 50500
#else
if ( if (
table->s->tmp_table == NO_TMP_TABLE && table->s->tmp_table == NO_TMP_TABLE &&
table->pos_in_table_list table->pos_in_table_list
@@ -10333,7 +10290,6 @@ int spider_db_udf_direct_sql(
next_tables = next_tables->next_global; next_tables = next_tables->next_global;
} }
} }
#endif
} }
table->file->ha_reset(); table->file->ha_reset();
table->in_use = thd; table->in_use = thd;
@@ -10396,10 +10352,7 @@ int spider_db_udf_direct_sql(
} }
} }
} }
#if MYSQL_VERSION_ID < 50500
#else
c_thd->lex->sql_command = sql_command_backup; c_thd->lex->sql_command = sql_command_backup;
#endif
DBUG_RETURN(error_num); DBUG_RETURN(error_num);
} }

View File

@@ -18,14 +18,9 @@
#include <my_global.h> #include <my_global.h>
#include "mysql_version.h" #include "mysql_version.h"
#include "spd_environ.h" #include "spd_environ.h"
#if MYSQL_VERSION_ID < 50500
#include "mysql_priv.h"
#include <mysql/plugin.h>
#else
#include "sql_priv.h" #include "sql_priv.h"
#include "probes_mysql.h" #include "probes_mysql.h"
#include "sql_class.h" #include "sql_class.h"
#endif
#include "sql_common.h" #include "sql_common.h"
#include <mysql.h> #include <mysql.h>
#include <errmsg.h> #include <errmsg.h>

View File

@@ -18,10 +18,6 @@
#include <my_global.h> #include <my_global.h>
#include "mysql_version.h" #include "mysql_version.h"
#include "spd_environ.h" #include "spd_environ.h"
#if MYSQL_VERSION_ID < 50500
#include "mysql_priv.h"
#include <mysql/plugin.h>
#else
#include "sql_priv.h" #include "sql_priv.h"
#include "probes_mysql.h" #include "probes_mysql.h"
#include "sql_class.h" #include "sql_class.h"
@@ -32,7 +28,6 @@
#ifdef HANDLER_HAS_DIRECT_AGGREGATE #ifdef HANDLER_HAS_DIRECT_AGGREGATE
#include "sql_select.h" #include "sql_select.h"
#endif #endif
#endif
#include "sql_common.h" #include "sql_common.h"
#include <mysql.h> #include <mysql.h>
#include <errmsg.h> #include <errmsg.h>
@@ -2301,13 +2296,8 @@ int spider_db_mbase::print_warnings(
if (db_conn->status == MYSQL_STATUS_READY) if (db_conn->status == MYSQL_STATUS_READY)
{ {
if ( if (
#if MYSQL_VERSION_ID < 50500
!(db_conn->last_used_con->server_status & SERVER_MORE_RESULTS_EXISTS) &&
db_conn->last_used_con->warning_count
#else
!(db_conn->server_status & SERVER_MORE_RESULTS_EXISTS) && !(db_conn->server_status & SERVER_MORE_RESULTS_EXISTS) &&
db_conn->warning_count db_conn->warning_count
#endif
) { ) {
if ( if (
spider_param_dry_access() || spider_param_dry_access() ||
@@ -2440,11 +2430,7 @@ int spider_db_mbase::next_result()
strmov(db_conn->net.sqlstate, "00000"); strmov(db_conn->net.sqlstate, "00000");
db_conn->affected_rows = ~(my_ulonglong) 0; db_conn->affected_rows = ~(my_ulonglong) 0;
#if MYSQL_VERSION_ID < 50500
if (db_conn->last_used_con->server_status & SERVER_MORE_RESULTS_EXISTS)
#else
if (db_conn->server_status & SERVER_MORE_RESULTS_EXISTS) if (db_conn->server_status & SERVER_MORE_RESULTS_EXISTS)
#endif
{ {
if ((status = db_conn->methods->read_query_result(db_conn)) > 0) if ((status = db_conn->methods->read_query_result(db_conn)) > 0)
DBUG_RETURN(spider_db_errorno(conn)); DBUG_RETURN(spider_db_errorno(conn));
@@ -2458,11 +2444,7 @@ uint spider_db_mbase::affected_rows()
MYSQL *last_used_con; MYSQL *last_used_con;
DBUG_ENTER("spider_db_mbase::affected_rows"); DBUG_ENTER("spider_db_mbase::affected_rows");
DBUG_PRINT("info",("spider this=%p", this)); DBUG_PRINT("info",("spider this=%p", this));
#if MYSQL_VERSION_ID < 50500
last_used_con = db_conn->last_used_con;
#else
last_used_con = db_conn; last_used_con = db_conn;
#endif
DBUG_RETURN((uint) last_used_con->affected_rows); DBUG_RETURN((uint) last_used_con->affected_rows);
} }
@@ -2471,11 +2453,7 @@ uint spider_db_mbase::matched_rows()
MYSQL *last_used_con; MYSQL *last_used_con;
DBUG_ENTER("spider_db_mysql::matched_rows"); DBUG_ENTER("spider_db_mysql::matched_rows");
DBUG_PRINT("info", ("spider this=%p", this)); DBUG_PRINT("info", ("spider this=%p", this));
#if MYSQL_VERSION_ID < 50500
last_used_con = db_conn->last_used_con;
#else
last_used_con = db_conn; last_used_con = db_conn;
#endif
/* Rows matched: 65 Changed: 65 Warnings: 0 */ /* Rows matched: 65 Changed: 65 Warnings: 0 */
const char *info = last_used_con->info; const char *info = last_used_con->info;
if (!info) if (!info)
@@ -2500,11 +2478,7 @@ bool spider_db_mbase::inserted_info(
{ {
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
#if MYSQL_VERSION_ID < 50500
last_used_con = db_conn->last_used_con;
#else
last_used_con = db_conn; last_used_con = db_conn;
#endif
/* Records: 10 Duplicates: 4 Warnings: 0 */ /* Records: 10 Duplicates: 4 Warnings: 0 */
const char *info = last_used_con->info; const char *info = last_used_con->info;
if (!info) if (!info)
@@ -2546,11 +2520,7 @@ ulonglong spider_db_mbase::last_insert_id()
MYSQL *last_used_con; MYSQL *last_used_con;
DBUG_ENTER("spider_db_mbase::last_insert_id"); DBUG_ENTER("spider_db_mbase::last_insert_id");
DBUG_PRINT("info",("spider this=%p", this)); DBUG_PRINT("info",("spider this=%p", this));
#if MYSQL_VERSION_ID < 50500
last_used_con = db_conn->last_used_con;
#else
last_used_con = db_conn; last_used_con = db_conn;
#endif
DBUG_RETURN((uint) last_used_con->insert_id); DBUG_RETURN((uint) last_used_con->insert_id);
} }
@@ -6177,11 +6147,7 @@ int spider_db_mbase_util::open_item_func(
DBUG_RETURN(HA_ERR_OUT_OF_MEM); DBUG_RETURN(HA_ERR_OUT_OF_MEM);
str->q_append(SPIDER_SQL_CAST_STR, SPIDER_SQL_CAST_LEN); str->q_append(SPIDER_SQL_CAST_STR, SPIDER_SQL_CAST_LEN);
} }
#if MYSQL_VERSION_ID < 50500
item_func->print(tmp_str.get_str(), QT_IS);
#else
item_func->print(tmp_str.get_str(), QT_TO_SYSTEM_CHARSET); item_func->print(tmp_str.get_str(), QT_TO_SYSTEM_CHARSET);
#endif
tmp_str.mem_calc(); tmp_str.mem_calc();
if (tmp_str.reserve(1)) if (tmp_str.reserve(1))
DBUG_RETURN(HA_ERR_OUT_OF_MEM); DBUG_RETURN(HA_ERR_OUT_OF_MEM);
@@ -6314,11 +6280,7 @@ int spider_db_mbase_util::open_item_func(
DBUG_RETURN(HA_ERR_OUT_OF_MEM); DBUG_RETURN(HA_ERR_OUT_OF_MEM);
str->q_append(SPIDER_SQL_CAST_STR, SPIDER_SQL_CAST_LEN); str->q_append(SPIDER_SQL_CAST_STR, SPIDER_SQL_CAST_LEN);
} }
#if MYSQL_VERSION_ID < 50500
item_func->print(tmp_str.get_str(), QT_IS);
#else
item_func->print(tmp_str.get_str(), QT_TO_SYSTEM_CHARSET); item_func->print(tmp_str.get_str(), QT_TO_SYSTEM_CHARSET);
#endif
tmp_str.mem_calc(); tmp_str.mem_calc();
if (tmp_str.reserve(1)) if (tmp_str.reserve(1))
DBUG_RETURN(HA_ERR_OUT_OF_MEM); DBUG_RETURN(HA_ERR_OUT_OF_MEM);
@@ -6470,11 +6432,7 @@ int spider_db_mbase_util::open_item_func(
DBUG_RETURN(HA_ERR_OUT_OF_MEM); DBUG_RETURN(HA_ERR_OUT_OF_MEM);
str->q_append(SPIDER_SQL_CAST_STR, SPIDER_SQL_CAST_LEN); str->q_append(SPIDER_SQL_CAST_STR, SPIDER_SQL_CAST_LEN);
} }
#if MYSQL_VERSION_ID < 50500
item_func->print(tmp_str.get_str(), QT_IS);
#else
item_func->print(tmp_str.get_str(), QT_TO_SYSTEM_CHARSET); item_func->print(tmp_str.get_str(), QT_TO_SYSTEM_CHARSET);
#endif
tmp_str.mem_calc(); tmp_str.mem_calc();
if (tmp_str.reserve(1)) if (tmp_str.reserve(1))
DBUG_RETURN(HA_ERR_OUT_OF_MEM); DBUG_RETURN(HA_ERR_OUT_OF_MEM);

View File

@@ -18,10 +18,6 @@
#include <my_global.h> #include <my_global.h>
#include "mysql_version.h" #include "mysql_version.h"
#include "spd_environ.h" #include "spd_environ.h"
#if MYSQL_VERSION_ID < 50500
#include "mysql_priv.h"
#include <mysql/plugin.h>
#else
#include "sql_priv.h" #include "sql_priv.h"
#include "probes_mysql.h" #include "probes_mysql.h"
#include "sql_class.h" #include "sql_class.h"
@@ -29,7 +25,6 @@
#include "sql_base.h" #include "sql_base.h"
#include "sql_servers.h" #include "sql_servers.h"
#include "tztime.h" #include "tztime.h"
#endif
#include "spd_err.h" #include "spd_err.h"
#include "spd_param.h" #include "spd_param.h"
#include "spd_db_include.h" #include "spd_db_include.h"
@@ -113,21 +108,6 @@ int spider_udf_direct_sql_create_table_list(
} else } else
break; break;
} }
#if MYSQL_VERSION_ID < 50500
if (!(direct_sql->db_names = (char**)
spider_bulk_malloc(spider_current_trx, 31, MYF(MY_WME | MY_ZEROFILL),
&direct_sql->db_names, (uint) (sizeof(char*) * table_count),
&direct_sql->table_names, (uint) (sizeof(char*) * table_count),
&direct_sql->tables, (uint) (sizeof(TABLE*) * table_count),
&tmp_name_ptr, (uint) (sizeof(char) * (
table_name_list_length +
thd->db_length * table_count +
2 * table_count
)),
&direct_sql->iop, (uint) (sizeof(int) * table_count),
NullS))
)
#else
if (!(direct_sql->db_names = (char**) if (!(direct_sql->db_names = (char**)
spider_bulk_malloc(spider_current_trx, 31, MYF(MY_WME | MY_ZEROFILL), spider_bulk_malloc(spider_current_trx, 31, MYF(MY_WME | MY_ZEROFILL),
&direct_sql->db_names, (uint) (sizeof(char*) * table_count), &direct_sql->db_names, (uint) (sizeof(char*) * table_count),
@@ -144,7 +124,6 @@ int spider_udf_direct_sql_create_table_list(
(uint) (sizeof(uchar) * ((table_count + 7) / 8)), (uint) (sizeof(uchar) * ((table_count + 7) / 8)),
NullS)) NullS))
) )
#endif
DBUG_RETURN(HA_ERR_OUT_OF_MEM); DBUG_RETURN(HA_ERR_OUT_OF_MEM);
tmp_ptr = table_name_list; tmp_ptr = table_name_list;
@@ -576,12 +555,8 @@ SPIDER_CONN *spider_udf_direct_sql_create_conn(
conn->semi_trx_chk = FALSE; conn->semi_trx_chk = FALSE;
conn->conn_kind = SPIDER_CONN_KIND_MYSQL; conn->conn_kind = SPIDER_CONN_KIND_MYSQL;
#if MYSQL_VERSION_ID < 50500
if (pthread_mutex_init(&conn->mta_conn_mutex, MY_MUTEX_INIT_FAST))
#else
if (mysql_mutex_init(spd_key_mutex_mta_conn, &conn->mta_conn_mutex, if (mysql_mutex_init(spd_key_mutex_mta_conn, &conn->mta_conn_mutex,
MY_MUTEX_INIT_FAST)) MY_MUTEX_INIT_FAST))
#endif
{ {
*error_num = HA_ERR_OUT_OF_MEM; *error_num = HA_ERR_OUT_OF_MEM;
goto error_mta_conn_mutex_init; goto error_mta_conn_mutex_init;
@@ -1023,10 +998,7 @@ int spider_udf_parse_direct_sql_param(
direct_sql->net_write_timeout = -1; direct_sql->net_write_timeout = -1;
direct_sql->bulk_insert_rows = -1; direct_sql->bulk_insert_rows = -1;
direct_sql->connection_channel = -1; direct_sql->connection_channel = -1;
#if MYSQL_VERSION_ID < 50500
#else
direct_sql->use_real_table = -1; direct_sql->use_real_table = -1;
#endif
direct_sql->error_rw_mode = -1; direct_sql->error_rw_mode = -1;
for (roop_count = 0; roop_count < direct_sql->table_count; roop_count++) for (roop_count = 0; roop_count < direct_sql->table_count; roop_count++)
direct_sql->iop[roop_count] = -1; direct_sql->iop[roop_count] = -1;
@@ -1100,10 +1072,7 @@ int spider_udf_parse_direct_sql_param(
SPIDER_PARAM_STR("srv", server_name); SPIDER_PARAM_STR("srv", server_name);
SPIDER_PARAM_INT_WITH_MAX("svc", tgt_ssl_vsc, 0, 1); SPIDER_PARAM_INT_WITH_MAX("svc", tgt_ssl_vsc, 0, 1);
SPIDER_PARAM_INT_WITH_MAX("tlm", table_loop_mode, 0, 2); SPIDER_PARAM_INT_WITH_MAX("tlm", table_loop_mode, 0, 2);
#if MYSQL_VERSION_ID < 50500
#else
SPIDER_PARAM_INT_WITH_MAX("urt", use_real_table, 0, 1); SPIDER_PARAM_INT_WITH_MAX("urt", use_real_table, 0, 1);
#endif
SPIDER_PARAM_INT("wto", net_write_timeout, 0); SPIDER_PARAM_INT("wto", net_write_timeout, 0);
error_num = param_string_parse.print_param_error(); error_num = param_string_parse.print_param_error();
goto error; goto error;
@@ -1153,10 +1122,7 @@ int spider_udf_parse_direct_sql_param(
error_num = param_string_parse.print_param_error(); error_num = param_string_parse.print_param_error();
goto error; goto error;
case 14: case 14:
#if MYSQL_VERSION_ID < 50500
#else
SPIDER_PARAM_INT_WITH_MAX("use_real_table", use_real_table, 0, 1); SPIDER_PARAM_INT_WITH_MAX("use_real_table", use_real_table, 0, 1);
#endif
error_num = param_string_parse.print_param_error(); error_num = param_string_parse.print_param_error();
goto error; goto error;
case 15: case 15:
@@ -1443,11 +1409,8 @@ int spider_udf_set_direct_sql_param_default(
direct_sql->bulk_insert_rows = 3000; direct_sql->bulk_insert_rows = 3000;
if (direct_sql->connection_channel == -1) if (direct_sql->connection_channel == -1)
direct_sql->connection_channel = 0; direct_sql->connection_channel = 0;
#if MYSQL_VERSION_ID < 50500
#else
if (direct_sql->use_real_table == -1) if (direct_sql->use_real_table == -1)
direct_sql->use_real_table = 0; direct_sql->use_real_table = 0;
#endif
if (direct_sql->error_rw_mode == -1) if (direct_sql->error_rw_mode == -1)
direct_sql->error_rw_mode = 0; direct_sql->error_rw_mode = 0;
for (roop_count = 0; roop_count < direct_sql->table_count; roop_count++) for (roop_count = 0; roop_count < direct_sql->table_count; roop_count++)
@@ -1479,14 +1442,11 @@ void spider_udf_free_direct_sql_alloc(
pthread_mutex_unlock(direct_sql->bg_mutex); pthread_mutex_unlock(direct_sql->bg_mutex);
} }
#endif #endif
#if MYSQL_VERSION_ID < 50500
#else
if (direct_sql->real_table_used && direct_sql->open_tables_thd) if (direct_sql->real_table_used && direct_sql->open_tables_thd)
{ {
spider_sys_close_table(direct_sql->open_tables_thd, spider_sys_close_table(direct_sql->open_tables_thd,
&direct_sql->open_tables_backup); &direct_sql->open_tables_backup);
} }
#endif
if (direct_sql->server_name) if (direct_sql->server_name)
{ {
spider_free(spider_current_trx, direct_sql->server_name, MYF(0)); spider_free(spider_current_trx, direct_sql->server_name, MYF(0));
@@ -1582,11 +1542,8 @@ long long spider_direct_sql_body(
char *sql; char *sql;
TABLE_LIST table_list; TABLE_LIST table_list;
SPIDER_BG_DIRECT_SQL *bg_direct_sql; SPIDER_BG_DIRECT_SQL *bg_direct_sql;
#if MYSQL_VERSION_ID < 50500
#else
TABLE_LIST *real_table_list_last = NULL; TABLE_LIST *real_table_list_last = NULL;
uint use_real_table = 0; uint use_real_table = 0;
#endif
DBUG_ENTER("spider_direct_sql_body"); DBUG_ENTER("spider_direct_sql_body");
SPIDER_BACKUP_DASTATUS; SPIDER_BACKUP_DASTATUS;
if (!(direct_sql = (SPIDER_DIRECT_SQL *) if (!(direct_sql = (SPIDER_DIRECT_SQL *)
@@ -1670,11 +1627,8 @@ long long spider_direct_sql_body(
} }
trx->updated_in_this_trx = TRUE; trx->updated_in_this_trx = TRUE;
DBUG_PRINT("info",("spider trx->updated_in_this_trx=TRUE")); DBUG_PRINT("info",("spider trx->updated_in_this_trx=TRUE"));
#if MYSQL_VERSION_ID < 50500
#else
use_real_table = spider_param_udf_ds_use_real_table(thd, use_real_table = spider_param_udf_ds_use_real_table(thd,
direct_sql->use_real_table); direct_sql->use_real_table);
#endif
for (roop_count = 0; roop_count < direct_sql->table_count; roop_count++) for (roop_count = 0; roop_count < direct_sql->table_count; roop_count++)
{ {
#ifdef SPIDER_NEED_INIT_ONE_TABLE_FOR_FIND_TEMPORARY_TABLE #ifdef SPIDER_NEED_INIT_ONE_TABLE_FOR_FIND_TEMPORARY_TABLE
@@ -1705,19 +1659,14 @@ long long spider_direct_sql_body(
if (!(direct_sql->tables[roop_count] = if (!(direct_sql->tables[roop_count] =
spider_find_temporary_table(thd, &table_list))) spider_find_temporary_table(thd, &table_list)))
{ {
#if MYSQL_VERSION_ID < 50500
#else
if (!use_real_table) if (!use_real_table)
{ {
#endif
error_num = ER_SPIDER_UDF_TMP_TABLE_NOT_FOUND_NUM; error_num = ER_SPIDER_UDF_TMP_TABLE_NOT_FOUND_NUM;
my_printf_error(ER_SPIDER_UDF_TMP_TABLE_NOT_FOUND_NUM, my_printf_error(ER_SPIDER_UDF_TMP_TABLE_NOT_FOUND_NUM,
ER_SPIDER_UDF_TMP_TABLE_NOT_FOUND_STR, ER_SPIDER_UDF_TMP_TABLE_NOT_FOUND_STR,
MYF(0), SPIDER_TABLE_LIST_db_str(&table_list), MYF(0), SPIDER_TABLE_LIST_db_str(&table_list),
SPIDER_TABLE_LIST_table_name_str(&table_list)); SPIDER_TABLE_LIST_table_name_str(&table_list));
goto error; goto error;
#if MYSQL_VERSION_ID < 50500
#else
} }
TABLE_LIST *tables = &direct_sql->table_list[roop_count]; TABLE_LIST *tables = &direct_sql->table_list[roop_count];
#ifdef SPIDER_use_LEX_CSTRING_for_database_tablename_alias #ifdef SPIDER_use_LEX_CSTRING_for_database_tablename_alias
@@ -1744,7 +1693,6 @@ long long spider_direct_sql_body(
real_table_list_last = tables; real_table_list_last = tables;
spider_set_bit(direct_sql->real_table_bitmap, roop_count); spider_set_bit(direct_sql->real_table_bitmap, roop_count);
direct_sql->real_table_used = TRUE; direct_sql->real_table_used = TRUE;
#endif
} }
} }
if ((error_num = spider_udf_direct_sql_create_conn_key(direct_sql))) if ((error_num = spider_udf_direct_sql_create_conn_key(direct_sql)))
@@ -1861,22 +1809,14 @@ my_bool spider_direct_sql_init_body(
strcpy(message, "spider_bg_direct_sql() out of memory"); strcpy(message, "spider_bg_direct_sql() out of memory");
goto error; goto error;
} }
#if MYSQL_VERSION_ID < 50500
if (pthread_mutex_init(&bg_direct_sql->bg_mutex, MY_MUTEX_INIT_FAST))
#else
if (mysql_mutex_init(spd_key_mutex_bg_direct_sql, if (mysql_mutex_init(spd_key_mutex_bg_direct_sql,
&bg_direct_sql->bg_mutex, MY_MUTEX_INIT_FAST)) &bg_direct_sql->bg_mutex, MY_MUTEX_INIT_FAST))
#endif
{ {
strcpy(message, "spider_bg_direct_sql() out of memory"); strcpy(message, "spider_bg_direct_sql() out of memory");
goto error_mutex_init; goto error_mutex_init;
} }
#if MYSQL_VERSION_ID < 50500
if (pthread_cond_init(&bg_direct_sql->bg_cond, NULL))
#else
if (mysql_cond_init(spd_key_cond_bg_direct_sql, if (mysql_cond_init(spd_key_cond_bg_direct_sql,
&bg_direct_sql->bg_cond, NULL)) &bg_direct_sql->bg_cond, NULL))
#endif
{ {
strcpy(message, "spider_bg_direct_sql() out of memory"); strcpy(message, "spider_bg_direct_sql() out of memory");
goto error_cond_init; goto error_cond_init;

View File

@@ -18,16 +18,11 @@
#include <my_global.h> #include <my_global.h>
#include "mysql_version.h" #include "mysql_version.h"
#include "spd_environ.h" #include "spd_environ.h"
#if MYSQL_VERSION_ID < 50500
#include "mysql_priv.h"
#include <mysql/plugin.h>
#else
#include "sql_priv.h" #include "sql_priv.h"
#include "probes_mysql.h" #include "probes_mysql.h"
#include "sql_class.h" #include "sql_class.h"
#include "sql_partition.h" #include "sql_partition.h"
#include "ha_partition.h" #include "ha_partition.h"
#endif
#include "sql_common.h" #include "sql_common.h"
#include <errmsg.h> #include <errmsg.h>
#include "spd_err.h" #include "spd_err.h"

View File

@@ -18,16 +18,11 @@
#include <my_global.h> #include <my_global.h>
#include "mysql_version.h" #include "mysql_version.h"
#include "spd_environ.h" #include "spd_environ.h"
#if MYSQL_VERSION_ID < 50500
#include "mysql_priv.h"
#include <mysql/plugin.h>
#else
#include "sql_priv.h" #include "sql_priv.h"
#include "probes_mysql.h" #include "probes_mysql.h"
#include "sql_class.h" #include "sql_class.h"
#include "sql_partition.h" #include "sql_partition.h"
#include "sql_show.h" #include "sql_show.h"
#endif
#include "spd_db_include.h" #include "spd_db_include.h"
#include "spd_include.h" #include "spd_include.h"
#include "spd_table.h" #include "spd_table.h"
@@ -162,9 +157,7 @@ struct st_mysql_plugin spider_i_s_alloc_mem =
NULL, NULL,
NULL, NULL,
NULL, NULL,
#if MYSQL_VERSION_ID >= 50600
0, 0,
#endif
}; };
#ifdef MARIADB_BASE_VERSION #ifdef MARIADB_BASE_VERSION
@@ -286,9 +279,7 @@ struct st_mysql_plugin spider_i_s_wrapper_protocols =
NULL, NULL,
NULL, NULL,
NULL, NULL,
#if MYSQL_VERSION_ID >= 50600
0, 0,
#endif
}; };
#ifdef MARIADB_BASE_VERSION #ifdef MARIADB_BASE_VERSION

View File

@@ -17,11 +17,6 @@
#define SPIDER_DETAIL_VERSION "3.3.15" #define SPIDER_DETAIL_VERSION "3.3.15"
#define SPIDER_HEX_VERSION 0x0303 #define SPIDER_HEX_VERSION 0x0303
#if MYSQL_VERSION_ID < 50500
#define spider_my_free(A,B) my_free(A,B)
#define pthread_mutex_assert_owner(A)
#define pthread_mutex_assert_not_owner(A)
#else
#define spider_my_free(A,B) my_free(A) #define spider_my_free(A,B) my_free(A)
#ifdef pthread_mutex_t #ifdef pthread_mutex_t
#undef pthread_mutex_t #undef pthread_mutex_t
@@ -70,28 +65,18 @@
#endif #endif
#define pthread_cond_destroy mysql_cond_destroy #define pthread_cond_destroy mysql_cond_destroy
#define my_sprintf(A,B) sprintf B #define my_sprintf(A,B) sprintf B
#endif
#define spider_stmt_da_message(A) thd_get_error_message(A) #define spider_stmt_da_message(A) thd_get_error_message(A)
#define spider_stmt_da_sql_errno(A) thd_get_error_number(A) #define spider_stmt_da_sql_errno(A) thd_get_error_number(A)
#define spider_user_defined_key_parts(A) (A)->user_defined_key_parts #define spider_user_defined_key_parts(A) (A)->user_defined_key_parts
#define spider_join_table_count(A) (A)->table_count #define spider_join_table_count(A) (A)->table_count
#define SPIDER_CAN_BG_UPDATE (1LL << 39) #define SPIDER_CAN_BG_UPDATE (1LL << 39)
#if MYSQL_VERSION_ID >= 100304
#define SPIDER_ALTER_PARTITION_ADD ALTER_PARTITION_ADD #define SPIDER_ALTER_PARTITION_ADD ALTER_PARTITION_ADD
#define SPIDER_ALTER_PARTITION_DROP ALTER_PARTITION_DROP #define SPIDER_ALTER_PARTITION_DROP ALTER_PARTITION_DROP
#define SPIDER_ALTER_PARTITION_COALESCE ALTER_PARTITION_COALESCE #define SPIDER_ALTER_PARTITION_COALESCE ALTER_PARTITION_COALESCE
#define SPIDER_ALTER_PARTITION_REORGANIZE ALTER_PARTITION_REORGANIZE #define SPIDER_ALTER_PARTITION_REORGANIZE ALTER_PARTITION_REORGANIZE
#define SPIDER_ALTER_PARTITION_TABLE_REORG ALTER_PARTITION_TABLE_REORG #define SPIDER_ALTER_PARTITION_TABLE_REORG ALTER_PARTITION_TABLE_REORG
#define SPIDER_ALTER_PARTITION_REBUILD ALTER_PARTITION_REBUILD #define SPIDER_ALTER_PARTITION_REBUILD ALTER_PARTITION_REBUILD
#else
#define SPIDER_ALTER_PARTITION_ADD Alter_info::ALTER_ADD_PARTITION
#define SPIDER_ALTER_PARTITION_DROP Alter_info::ALTER_DROP_PARTITION
#define SPIDER_ALTER_PARTITION_COALESCE Alter_info::ALTER_COALESCE_PARTITION
#define SPIDER_ALTER_PARTITION_REORGANIZE Alter_info::ALTER_REORGANIZE_PARTITION
#define SPIDER_ALTER_PARTITION_TABLE_REORG Alter_info::ALTER_TABLE_REORG
#define SPIDER_ALTER_PARTITION_REBUILD Alter_info::ALTER_REBUILD_PARTITION
#endif
#define SPIDER_WARN_LEVEL_WARN Sql_condition::WARN_LEVEL_WARN #define SPIDER_WARN_LEVEL_WARN Sql_condition::WARN_LEVEL_WARN
#define SPIDER_WARN_LEVEL_NOTE Sql_condition::WARN_LEVEL_NOTE #define SPIDER_WARN_LEVEL_NOTE Sql_condition::WARN_LEVEL_NOTE
#define SPIDER_THD_KILL_CONNECTION KILL_CONNECTION #define SPIDER_THD_KILL_CONNECTION KILL_CONNECTION
@@ -118,15 +103,7 @@
#define SPIDER_open_temporary_table #define SPIDER_open_temporary_table
#if defined(MARIADB_BASE_VERSION) #if defined(MARIADB_BASE_VERSION)
#if MYSQL_VERSION_ID >= 100209
#define SPIDER_generate_partition_syntax(A,B,C,D,E,F,G,H) generate_partition_syntax(A,B,C,E,F,G) #define SPIDER_generate_partition_syntax(A,B,C,D,E,F,G,H) generate_partition_syntax(A,B,C,E,F,G)
#elif MYSQL_VERSION_ID >= 100200
#define SPIDER_generate_partition_syntax(A,B,C,D,E,F,G,H) generate_partition_syntax(A,B,C,D,E,F,G,H)
#elif MYSQL_VERSION_ID >= 100007
#define SPIDER_generate_partition_syntax(A,B,C,D,E,F,G,H) generate_partition_syntax(B,C,D,E,F,G,H)
#else
#define SPIDER_generate_partition_syntax(A,B,C,D,E,F,G,H) generate_partition_syntax(B,C,D,E,F,G)
#endif
#else #else
#define SPIDER_generate_partition_syntax(A,B,C,D,E,F,G,H) #define SPIDER_generate_partition_syntax(A,B,C,D,E,F,G,H)
#endif #endif
@@ -154,9 +131,7 @@
#define SPIDER_item_name_length(A) (A)->name.length #define SPIDER_item_name_length(A) (A)->name.length
const LEX_CSTRING SPIDER_empty_string = {"", 0}; const LEX_CSTRING SPIDER_empty_string = {"", 0};
#if MYSQL_VERSION_ID >= 50500
#define SPIDER_HAS_HASH_VALUE_TYPE #define SPIDER_HAS_HASH_VALUE_TYPE
#endif
#define SPIDER_date_mode_t(A) date_mode_t(A) #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_str_to_datetime(A,B,C,D,E) str_to_datetime_or_date(A,B,C,D,E)
@@ -1153,8 +1128,6 @@ typedef struct st_spider_direct_sql
TABLE **tables; TABLE **tables;
int *iop; int *iop;
#if MYSQL_VERSION_ID < 50500
#else
/* for using real table */ /* for using real table */
bool real_table_used; bool real_table_used;
TABLE_LIST *table_list_first; TABLE_LIST *table_list_first;
@@ -1162,7 +1135,6 @@ typedef struct st_spider_direct_sql
uchar *real_table_bitmap; uchar *real_table_bitmap;
SPIDER_Open_tables_backup open_tables_backup; SPIDER_Open_tables_backup open_tables_backup;
THD *open_tables_thd; THD *open_tables_thd;
#endif
char *sql; char *sql;
ulong sql_length; ulong sql_length;
@@ -1179,10 +1151,7 @@ typedef struct st_spider_direct_sql
int net_write_timeout; int net_write_timeout;
longlong bulk_insert_rows; longlong bulk_insert_rows;
int connection_channel; int connection_channel;
#if MYSQL_VERSION_ID < 50500
#else
int use_real_table; int use_real_table;
#endif
int error_rw_mode; int error_rw_mode;
char *server_name; char *server_name;

View File

@@ -18,15 +18,10 @@
#include <my_global.h> #include <my_global.h>
#include "mysql_version.h" #include "mysql_version.h"
#include "spd_environ.h" #include "spd_environ.h"
#if MYSQL_VERSION_ID < 50500
#include "mysql_priv.h"
#include <mysql/plugin.h>
#else
#include "sql_priv.h" #include "sql_priv.h"
#include "probes_mysql.h" #include "probes_mysql.h"
#include "sql_class.h" #include "sql_class.h"
#include "sql_analyse.h" #include "sql_analyse.h"
#endif
#include "spd_db_include.h" #include "spd_db_include.h"
#include "spd_include.h" #include "spd_include.h"
#include "spd_malloc.h" #include "spd_malloc.h"

View File

@@ -17,15 +17,10 @@
#include <my_global.h> #include <my_global.h>
#include "mysql_version.h" #include "mysql_version.h"
#include "spd_environ.h" #include "spd_environ.h"
#if MYSQL_VERSION_ID < 50500
#include "mysql_priv.h"
#include <mysql/plugin.h>
#else
#include "sql_priv.h" #include "sql_priv.h"
#include "probes_mysql.h" #include "probes_mysql.h"
#include "sql_class.h" #include "sql_class.h"
#include "sql_partition.h" #include "sql_partition.h"
#endif
#include <my_getopt.h> #include <my_getopt.h>
#include "spd_err.h" #include "spd_err.h"
#include "spd_db_include.h" #include "spd_db_include.h"
@@ -135,13 +130,8 @@ struct st_mysql_show_var spider_status_variables[] =
}; };
typedef DECLARE_MYSQL_THDVAR_SIMPLE(thdvar_int_t, int); typedef DECLARE_MYSQL_THDVAR_SIMPLE(thdvar_int_t, int);
#if MYSQL_VERSION_ID < 50500
extern bool throw_bounds_warning(THD *thd, bool fixed, bool unsignd,
const char *name, long long val);
#else
extern bool throw_bounds_warning(THD *thd, const char *name, bool fixed, extern bool throw_bounds_warning(THD *thd, const char *name, bool fixed,
bool is_unsignd, longlong v); bool is_unsignd, longlong v);
#endif
static my_bool spider_support_xa; static my_bool spider_support_xa;
static MYSQL_SYSVAR_BOOL( static MYSQL_SYSVAR_BOOL(
@@ -714,14 +704,9 @@ static int spider_param_semi_table_lock_check(
(long) ((MYSQL_SYSVAR_NAME(thdvar_int_t) *) var)->blk_sz; (long) ((MYSQL_SYSVAR_NAME(thdvar_int_t) *) var)->blk_sz;
options.arg_type = REQUIRED_ARG; options.arg_type = REQUIRED_ARG;
*((int *) save) = (int) getopt_ll_limit_value(tmp, &options, &fixed); *((int *) save) = (int) getopt_ll_limit_value(tmp, &options, &fixed);
#if MYSQL_VERSION_ID < 50500
DBUG_RETURN(throw_bounds_warning(thd, fixed, FALSE,
((MYSQL_SYSVAR_NAME(thdvar_int_t) *) var)->name, (long long) tmp));
#else
DBUG_RETURN(throw_bounds_warning(thd, DBUG_RETURN(throw_bounds_warning(thd,
((MYSQL_SYSVAR_NAME(thdvar_int_t) *) var)->name, fixed, FALSE, ((MYSQL_SYSVAR_NAME(thdvar_int_t) *) var)->name, fixed, FALSE,
(longlong) tmp)); (longlong) tmp));
#endif
} }
/* /*
@@ -778,14 +763,9 @@ static int spider_param_semi_table_lock_connection_check(
(long) ((MYSQL_SYSVAR_NAME(thdvar_int_t) *) var)->blk_sz; (long) ((MYSQL_SYSVAR_NAME(thdvar_int_t) *) var)->blk_sz;
options.arg_type = REQUIRED_ARG; options.arg_type = REQUIRED_ARG;
*((int *) save) = (int) getopt_ll_limit_value(tmp, &options, &fixed); *((int *) save) = (int) getopt_ll_limit_value(tmp, &options, &fixed);
#if MYSQL_VERSION_ID < 50500
DBUG_RETURN(throw_bounds_warning(thd, fixed, FALSE,
((MYSQL_SYSVAR_NAME(thdvar_int_t) *) var)->name, (long long) tmp));
#else
DBUG_RETURN(throw_bounds_warning(thd, DBUG_RETURN(throw_bounds_warning(thd,
((MYSQL_SYSVAR_NAME(thdvar_int_t) *) var)->name, fixed, FALSE, ((MYSQL_SYSVAR_NAME(thdvar_int_t) *) var)->name, fixed, FALSE,
(longlong) tmp)); (longlong) tmp));
#endif
} }
/* /*
@@ -2568,8 +2548,6 @@ int spider_param_bulk_access_free(
} }
#endif #endif
#if MYSQL_VERSION_ID < 50500
#else
/* /*
-1 :use UDF parameter -1 :use UDF parameter
0 :can not use 0 :can not use
@@ -2595,7 +2573,6 @@ int spider_param_udf_ds_use_real_table(
DBUG_RETURN(THDVAR(thd, udf_ds_use_real_table) == -1 ? DBUG_RETURN(THDVAR(thd, udf_ds_use_real_table) == -1 ?
udf_ds_use_real_table : THDVAR(thd, udf_ds_use_real_table)); udf_ds_use_real_table : THDVAR(thd, udf_ds_use_real_table));
} }
#endif
static my_bool spider_general_log; static my_bool spider_general_log;
static MYSQL_SYSVAR_BOOL( static MYSQL_SYSVAR_BOOL(
@@ -3274,10 +3251,7 @@ static struct st_mysql_sys_var* spider_system_variables[] = {
#ifdef HA_CAN_BULK_ACCESS #ifdef HA_CAN_BULK_ACCESS
MYSQL_SYSVAR(bulk_access_free), MYSQL_SYSVAR(bulk_access_free),
#endif #endif
#if MYSQL_VERSION_ID < 50500
#else
MYSQL_SYSVAR(udf_ds_use_real_table), MYSQL_SYSVAR(udf_ds_use_real_table),
#endif
MYSQL_SYSVAR(general_log), MYSQL_SYSVAR(general_log),
MYSQL_SYSVAR(index_hint_pushdown), MYSQL_SYSVAR(index_hint_pushdown),
MYSQL_SYSVAR(max_connections), MYSQL_SYSVAR(max_connections),
@@ -3318,9 +3292,7 @@ mysql_declare_plugin(spider)
spider_status_variables, spider_status_variables,
spider_system_variables, spider_system_variables,
NULL, NULL,
#if MYSQL_VERSION_ID >= 50600
0, 0,
#endif
}, },
spider_i_s_alloc_mem, spider_i_s_alloc_mem,
spider_i_s_wrapper_protocols spider_i_s_wrapper_protocols

View File

@@ -342,13 +342,10 @@ int spider_param_bulk_access_free(
int bulk_access_free int bulk_access_free
); );
#endif #endif
#if MYSQL_VERSION_ID < 50500
#else
int spider_param_udf_ds_use_real_table( int spider_param_udf_ds_use_real_table(
THD *thd, THD *thd,
int udf_ds_use_real_table int udf_ds_use_real_table
); );
#endif
my_bool spider_param_general_log(); my_bool spider_param_general_log();
my_bool spider_param_index_hint_pushdown( my_bool spider_param_index_hint_pushdown(
THD *thd THD *thd

View File

@@ -18,16 +18,11 @@
#include <my_global.h> #include <my_global.h>
#include "mysql_version.h" #include "mysql_version.h"
#include "spd_environ.h" #include "spd_environ.h"
#if MYSQL_VERSION_ID < 50500
#include "mysql_priv.h"
#include <mysql/plugin.h>
#else
#include "sql_priv.h" #include "sql_priv.h"
#include "probes_mysql.h" #include "probes_mysql.h"
#include "sql_class.h" #include "sql_class.h"
#include "sql_partition.h" #include "sql_partition.h"
#include "sql_acl.h" #include "sql_acl.h"
#endif
#include "spd_err.h" #include "spd_err.h"
#include "spd_param.h" #include "spd_param.h"
#include "spd_db_include.h" #include "spd_db_include.h"
@@ -581,43 +576,26 @@ SPIDER_TABLE_MON_LIST *spider_get_ping_table_tgt(
if (tmp_share->link_statuses[0] == SPIDER_LINK_STATUS_NG) if (tmp_share->link_statuses[0] == SPIDER_LINK_STATUS_NG)
table_mon_list->mon_status = SPIDER_LINK_MON_NG; table_mon_list->mon_status = SPIDER_LINK_MON_NG;
#if MYSQL_VERSION_ID < 50500
if (pthread_mutex_init(&table_mon_list->caller_mutex, MY_MUTEX_INIT_FAST))
#else
if (mysql_mutex_init(spd_key_mutex_mon_list_caller, if (mysql_mutex_init(spd_key_mutex_mon_list_caller,
&table_mon_list->caller_mutex, MY_MUTEX_INIT_FAST)) &table_mon_list->caller_mutex, MY_MUTEX_INIT_FAST))
#endif
{ {
*error_num = HA_ERR_OUT_OF_MEM; *error_num = HA_ERR_OUT_OF_MEM;
goto error_caller_mutex_init; goto error_caller_mutex_init;
} }
#if MYSQL_VERSION_ID < 50500
if (pthread_mutex_init(&table_mon_list->receptor_mutex, MY_MUTEX_INIT_FAST))
#else
if (mysql_mutex_init(spd_key_mutex_mon_list_receptor, if (mysql_mutex_init(spd_key_mutex_mon_list_receptor,
&table_mon_list->receptor_mutex, MY_MUTEX_INIT_FAST)) &table_mon_list->receptor_mutex, MY_MUTEX_INIT_FAST))
#endif
{ {
*error_num = HA_ERR_OUT_OF_MEM; *error_num = HA_ERR_OUT_OF_MEM;
goto error_receptor_mutex_init; goto error_receptor_mutex_init;
} }
#if MYSQL_VERSION_ID < 50500
if (pthread_mutex_init(&table_mon_list->monitor_mutex, MY_MUTEX_INIT_FAST))
#else
if (mysql_mutex_init(spd_key_mutex_mon_list_monitor, if (mysql_mutex_init(spd_key_mutex_mon_list_monitor,
&table_mon_list->monitor_mutex, MY_MUTEX_INIT_FAST)) &table_mon_list->monitor_mutex, MY_MUTEX_INIT_FAST))
#endif
{ {
*error_num = HA_ERR_OUT_OF_MEM; *error_num = HA_ERR_OUT_OF_MEM;
goto error_monitor_mutex_init; goto error_monitor_mutex_init;
} }
#if MYSQL_VERSION_ID < 50500
if (pthread_mutex_init(&table_mon_list->update_status_mutex,
MY_MUTEX_INIT_FAST))
#else
if (mysql_mutex_init(spd_key_mutex_mon_list_update_status, if (mysql_mutex_init(spd_key_mutex_mon_list_update_status,
&table_mon_list->update_status_mutex, MY_MUTEX_INIT_FAST)) &table_mon_list->update_status_mutex, MY_MUTEX_INIT_FAST))
#endif
{ {
*error_num = HA_ERR_OUT_OF_MEM; *error_num = HA_ERR_OUT_OF_MEM;
goto error_update_status_mutex_init; goto error_update_status_mutex_init;
@@ -1091,13 +1069,8 @@ long long spider_ping_table_body(
thd->handler_tables_hash.records != 0 || thd->handler_tables_hash.records != 0 ||
thd->derived_tables != 0 || thd->derived_tables != 0 ||
thd->lock != 0 || thd->lock != 0 ||
#if MYSQL_VERSION_ID < 50500
thd->locked_tables != 0 ||
thd->prelocked_mode != NON_PRELOCKED
#else
thd->locked_tables_list.locked_tables() || thd->locked_tables_list.locked_tables() ||
thd->locked_tables_mode != LTM_NONE thd->locked_tables_mode != LTM_NONE
#endif
) { ) {
if (thd->open_tables != 0) if (thd->open_tables != 0)
{ {
@@ -1120,18 +1093,6 @@ long long spider_ping_table_body(
my_printf_error(ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_NUM, my_printf_error(ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_NUM,
ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_STR_WITH_PTR, MYF(0), ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_STR_WITH_PTR, MYF(0),
"thd->lock", thd->lock); "thd->lock", thd->lock);
#if MYSQL_VERSION_ID < 50500
} else if (thd->locked_tables != 0)
{
my_printf_error(ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_NUM,
ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_STR_WITH_PTR, MYF(0),
"thd->locked_tables", thd->locked_tables);
} else if (thd->prelocked_mode != NON_PRELOCKED)
{
my_printf_error(ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_NUM,
ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_STR_WITH_NUM, MYF(0),
"thd->prelocked_mode", (longlong) thd->prelocked_mode);
#else
} else if (thd->locked_tables_list.locked_tables()) } else if (thd->locked_tables_list.locked_tables())
{ {
my_printf_error(ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_NUM, my_printf_error(ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_NUM,
@@ -1143,7 +1104,6 @@ long long spider_ping_table_body(
my_printf_error(ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_NUM, my_printf_error(ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_NUM,
ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_STR_WITH_NUM, MYF(0), ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_STR_WITH_NUM, MYF(0),
"thd->locked_tables_mode", (longlong) thd->locked_tables_mode); "thd->locked_tables_mode", (longlong) thd->locked_tables_mode);
#endif
} }
goto error; goto error;
} }

View File

@@ -17,17 +17,12 @@
#include <my_global.h> #include <my_global.h>
#include "mysql_version.h" #include "mysql_version.h"
#include "spd_environ.h" #include "spd_environ.h"
#if MYSQL_VERSION_ID < 50500
#include "mysql_priv.h"
#include <mysql/plugin.h>
#else
#include "sql_priv.h" #include "sql_priv.h"
#include "probes_mysql.h" #include "probes_mysql.h"
#include "sql_class.h" #include "sql_class.h"
#include "key.h" #include "key.h"
#include "sql_base.h" #include "sql_base.h"
#include "tztime.h" #include "tztime.h"
#endif
#include "sql_select.h" #include "sql_select.h"
#include "spd_err.h" #include "spd_err.h"
#include "spd_param.h" #include "spd_param.h"
@@ -245,22 +240,9 @@ TABLE *spider_open_sys_table(
) { ) {
TABLE *table; TABLE *table;
TABLE_LIST tables; TABLE_LIST tables;
#if MYSQL_VERSION_ID < 50500
TABLE_SHARE *table_share;
char table_key[MAX_DBKEY_LENGTH];
uint table_key_length;
#endif
DBUG_ENTER("spider_open_sys_table"); DBUG_ENTER("spider_open_sys_table");
#if MYSQL_VERSION_ID < 50500
memset(&tables, 0, sizeof(TABLE_LIST));
SPIDER_TABLE_LIST_db_str(&tables) = (char*)"mysql";
SPIDER_TABLE_LIST_db_length(&tables) = sizeof("mysql") - 1;
SPIDER_TABLE_LIST_alias_str(&tables) =
SPIDER_TABLE_LIST_table_name_str(&tables) = (char *) table_name;
SPIDER_TABLE_LIST_table_name_length(&tables) = table_name_length;
tables.lock_type = (write ? TL_WRITE : TL_READ);
#else
#ifdef SPIDER_use_LEX_CSTRING_for_database_tablename_alias #ifdef SPIDER_use_LEX_CSTRING_for_database_tablename_alias
LEX_CSTRING db_name = LEX_CSTRING db_name =
{ {
@@ -278,18 +260,7 @@ TABLE *spider_open_sys_table(
"mysql", sizeof("mysql") - 1, table_name, table_name_length, table_name, "mysql", sizeof("mysql") - 1, table_name, table_name_length, table_name,
(write ? TL_WRITE : TL_READ)); (write ? TL_WRITE : TL_READ));
#endif #endif
#endif
#if MYSQL_VERSION_ID < 50500
if (need_lock)
{
#endif
#if MYSQL_VERSION_ID < 50500
if (!(table = open_performance_schema_table(thd, &tables,
open_tables_backup)))
#else
if (!(table = spider_sys_open_table(thd, &tables, open_tables_backup))) if (!(table = spider_sys_open_table(thd, &tables, open_tables_backup)))
#endif
{ {
my_printf_error(ER_SPIDER_CANT_OPEN_SYS_TABLE_NUM, my_printf_error(ER_SPIDER_CANT_OPEN_SYS_TABLE_NUM,
ER_SPIDER_CANT_OPEN_SYS_TABLE_STR, MYF(0), ER_SPIDER_CANT_OPEN_SYS_TABLE_STR, MYF(0),
@@ -297,38 +268,6 @@ TABLE *spider_open_sys_table(
*error_num = ER_SPIDER_CANT_OPEN_SYS_TABLE_NUM; *error_num = ER_SPIDER_CANT_OPEN_SYS_TABLE_NUM;
DBUG_RETURN(NULL); DBUG_RETURN(NULL);
} }
#if MYSQL_VERSION_ID < 50500
} else {
SPIDER_reset_n_backup_open_tables_state(thd, open_tables_backup, NULL);
if (!(table = (TABLE*) spider_malloc(spider_current_trx, 12,
sizeof(*table), MYF(MY_WME))))
{
*error_num = HA_ERR_OUT_OF_MEM;
goto error_malloc;
}
table_key_length =
create_table_def_key(thd, table_key, &tables, FALSE);
if (!(table_share = get_table_share(thd,
&tables, table_key, table_key_length, 0, error_num)))
goto error;
if (open_table_from_share(thd, table_share, tables.alias,
(uint) (HA_OPEN_KEYFILE | HA_OPEN_RNDFILE | HA_GET_INDEX),
READ_KEYINFO | COMPUTE_TYPES | EXTRA_RECORD,
(uint) HA_OPEN_IGNORE_IF_LOCKED | HA_OPEN_FROM_SQL_LAYER,
table, FALSE)
) {
release_table_share(table_share, RELEASE_NORMAL);
my_printf_error(ER_SPIDER_CANT_OPEN_SYS_TABLE_NUM,
ER_SPIDER_CANT_OPEN_SYS_TABLE_STR, MYF(0),
"mysql", table_name);
*error_num = ER_SPIDER_CANT_OPEN_SYS_TABLE_NUM;
goto error;
}
}
#endif
switch (table_name_length) switch (table_name_length)
{ {
case 9: case 9:
@@ -589,13 +528,6 @@ TABLE *spider_open_sys_table(
break; break;
} }
DBUG_RETURN(table); DBUG_RETURN(table);
#if MYSQL_VERSION_ID < 50500
error:
spider_free(spider_current_trx, table, MYF(0));
error_malloc:
SPIDER_restore_backup_open_tables_state(thd, open_tables_backup);
#endif
error_col_num_chk: error_col_num_chk:
DBUG_RETURN(NULL); DBUG_RETURN(NULL);
} }
@@ -607,24 +539,10 @@ void spider_close_sys_table(
bool need_lock bool need_lock
) { ) {
DBUG_ENTER("spider_close_sys_table"); DBUG_ENTER("spider_close_sys_table");
#if MYSQL_VERSION_ID < 50500
if (need_lock)
{
close_performance_schema_table(thd, open_tables_backup);
} else {
table->file->ha_reset();
closefrm(table, TRUE);
spider_free(spider_current_trx, table, MYF(0));
SPIDER_restore_backup_open_tables_state(thd, open_tables_backup);
}
#else
spider_sys_close_table(thd, open_tables_backup); spider_sys_close_table(thd, open_tables_backup);
#endif
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
#if MYSQL_VERSION_ID < 50500
#else
bool spider_sys_open_and_lock_tables( bool spider_sys_open_and_lock_tables(
THD *thd, THD *thd,
TABLE_LIST **tables, TABLE_LIST **tables,
@@ -692,7 +610,6 @@ void spider_sys_close_table(
} }
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
#endif
int spider_sys_index_init( int spider_sys_index_init(
TABLE *table, TABLE *table,

View File

@@ -103,8 +103,6 @@ void spider_close_sys_table(
bool need_lock bool need_lock
); );
#if MYSQL_VERSION_ID < 50500
#else
bool spider_sys_open_and_lock_tables( bool spider_sys_open_and_lock_tables(
THD *thd, THD *thd,
TABLE_LIST **tables, TABLE_LIST **tables,
@@ -121,7 +119,6 @@ void spider_sys_close_table(
THD *thd, THD *thd,
SPIDER_Open_tables_backup *open_tables_backup SPIDER_Open_tables_backup *open_tables_backup
); );
#endif
int spider_sys_index_init( int spider_sys_index_init(
TABLE *table, TABLE *table,

View File

@@ -18,10 +18,6 @@
#include <my_global.h> #include <my_global.h>
#include "mysql_version.h" #include "mysql_version.h"
#include "spd_environ.h" #include "spd_environ.h"
#if MYSQL_VERSION_ID < 50500
#include "mysql_priv.h"
#include <mysql/plugin.h>
#else
#include "sql_priv.h" #include "sql_priv.h"
#include "probes_mysql.h" #include "probes_mysql.h"
#include "my_getopt.h" #include "my_getopt.h"
@@ -32,7 +28,6 @@
#include "tztime.h" #include "tztime.h"
#include "sql_parse.h" #include "sql_parse.h"
#include "create_options.h" #include "create_options.h"
#endif
#include "spd_err.h" #include "spd_err.h"
#include "spd_param.h" #include "spd_param.h"
#include "spd_db_include.h" #include "spd_db_include.h"
@@ -2058,12 +2053,8 @@ int spider_parse_connect_info(
#endif #endif
DBUG_ENTER("spider_parse_connect_info"); DBUG_ENTER("spider_parse_connect_info");
#ifdef WITH_PARTITION_STORAGE_ENGINE #ifdef WITH_PARTITION_STORAGE_ENGINE
#if MYSQL_VERSION_ID < 50500
DBUG_PRINT("info",("spider partition_info=%s", table_share->partition_info));
#else
DBUG_PRINT("info",("spider partition_info=%s", DBUG_PRINT("info",("spider partition_info=%s",
table_share->partition_info_str)); table_share->partition_info_str));
#endif
DBUG_PRINT("info",("spider part_info=%p", part_info)); DBUG_PRINT("info",("spider part_info=%p", part_info));
#endif #endif
DBUG_PRINT("info",("spider s->db=%s", table_share->db.str)); DBUG_PRINT("info",("spider s->db=%s", table_share->db.str));
@@ -4593,34 +4584,22 @@ SPIDER_SHARE *spider_create_share(
if (share->table_count_mode & 2) if (share->table_count_mode & 2)
share->additional_table_flags |= HA_HAS_RECORDS; share->additional_table_flags |= HA_HAS_RECORDS;
#if MYSQL_VERSION_ID < 50500
if (pthread_mutex_init(&share->mutex, MY_MUTEX_INIT_FAST))
#else
if (mysql_mutex_init(spd_key_mutex_share, if (mysql_mutex_init(spd_key_mutex_share,
&share->mutex, MY_MUTEX_INIT_FAST)) &share->mutex, MY_MUTEX_INIT_FAST))
#endif
{ {
*error_num = HA_ERR_OUT_OF_MEM; *error_num = HA_ERR_OUT_OF_MEM;
goto error_init_mutex; goto error_init_mutex;
} }
#if MYSQL_VERSION_ID < 50500
if (pthread_mutex_init(&share->sts_mutex, MY_MUTEX_INIT_FAST))
#else
if (mysql_mutex_init(spd_key_mutex_share_sts, if (mysql_mutex_init(spd_key_mutex_share_sts,
&share->sts_mutex, MY_MUTEX_INIT_FAST)) &share->sts_mutex, MY_MUTEX_INIT_FAST))
#endif
{ {
*error_num = HA_ERR_OUT_OF_MEM; *error_num = HA_ERR_OUT_OF_MEM;
goto error_init_sts_mutex; goto error_init_sts_mutex;
} }
#if MYSQL_VERSION_ID < 50500
if (pthread_mutex_init(&share->crd_mutex, MY_MUTEX_INIT_FAST))
#else
if (mysql_mutex_init(spd_key_mutex_share_crd, if (mysql_mutex_init(spd_key_mutex_share_crd,
&share->crd_mutex, MY_MUTEX_INIT_FAST)) &share->crd_mutex, MY_MUTEX_INIT_FAST))
#endif
{ {
*error_num = HA_ERR_OUT_OF_MEM; *error_num = HA_ERR_OUT_OF_MEM;
goto error_init_crd_mutex; goto error_init_crd_mutex;
@@ -6015,13 +5994,8 @@ SPIDER_LGTM_TBLHND_SHARE *spider_get_lgtm_tblhnd_share(
lgtm_tblhnd_share->table_path_hash_value = hash_value; lgtm_tblhnd_share->table_path_hash_value = hash_value;
#endif #endif
#if MYSQL_VERSION_ID < 50500
if (pthread_mutex_init(&lgtm_tblhnd_share->auto_increment_mutex,
MY_MUTEX_INIT_FAST))
#else
if (mysql_mutex_init(spd_key_mutex_share_auto_increment, if (mysql_mutex_init(spd_key_mutex_share_auto_increment,
&lgtm_tblhnd_share->auto_increment_mutex, MY_MUTEX_INIT_FAST)) &lgtm_tblhnd_share->auto_increment_mutex, MY_MUTEX_INIT_FAST))
#endif
{ {
*error_num = HA_ERR_OUT_OF_MEM; *error_num = HA_ERR_OUT_OF_MEM;
goto error_init_auto_increment_mutex; goto error_init_auto_increment_mutex;
@@ -6131,23 +6105,15 @@ SPIDER_WIDE_SHARE *spider_get_wide_share(
wide_share->crd_get_time = wide_share->sts_get_time = wide_share->crd_get_time = wide_share->sts_get_time =
share->crd_get_time; share->crd_get_time;
#if MYSQL_VERSION_ID < 50500
if (pthread_mutex_init(&wide_share->sts_mutex, MY_MUTEX_INIT_FAST))
#else
if (mysql_mutex_init(spd_key_mutex_wide_share_sts, if (mysql_mutex_init(spd_key_mutex_wide_share_sts,
&wide_share->sts_mutex, MY_MUTEX_INIT_FAST)) &wide_share->sts_mutex, MY_MUTEX_INIT_FAST))
#endif
{ {
*error_num = HA_ERR_OUT_OF_MEM; *error_num = HA_ERR_OUT_OF_MEM;
goto error_init_sts_mutex; goto error_init_sts_mutex;
} }
#if MYSQL_VERSION_ID < 50500
if (pthread_mutex_init(&wide_share->crd_mutex, MY_MUTEX_INIT_FAST))
#else
if (mysql_mutex_init(spd_key_mutex_wide_share_crd, if (mysql_mutex_init(spd_key_mutex_wide_share_crd,
&wide_share->crd_mutex, MY_MUTEX_INIT_FAST)) &wide_share->crd_mutex, MY_MUTEX_INIT_FAST))
#endif
{ {
*error_num = HA_ERR_OUT_OF_MEM; *error_num = HA_ERR_OUT_OF_MEM;
goto error_init_crd_mutex; goto error_init_crd_mutex;
@@ -6978,99 +6944,54 @@ int spider_db_init(
*/ */
#endif #endif
#if MYSQL_VERSION_ID < 50500
if (pthread_mutex_init(&spider_tbl_mutex, MY_MUTEX_INIT_FAST))
#else
if (mysql_mutex_init(spd_key_mutex_tbl, if (mysql_mutex_init(spd_key_mutex_tbl,
&spider_tbl_mutex, MY_MUTEX_INIT_FAST)) &spider_tbl_mutex, MY_MUTEX_INIT_FAST))
#endif
goto error_tbl_mutex_init; goto error_tbl_mutex_init;
#if MYSQL_VERSION_ID < 50500
if (pthread_mutex_init(&spider_thread_id_mutex, MY_MUTEX_INIT_FAST))
#else
if (mysql_mutex_init(spd_key_thread_id, if (mysql_mutex_init(spd_key_thread_id,
&spider_thread_id_mutex, MY_MUTEX_INIT_FAST)) &spider_thread_id_mutex, MY_MUTEX_INIT_FAST))
#endif
goto error_thread_id_mutex_init; goto error_thread_id_mutex_init;
#if MYSQL_VERSION_ID < 50500
if (pthread_mutex_init(&spider_conn_id_mutex, MY_MUTEX_INIT_FAST))
#else
if (mysql_mutex_init(spd_key_conn_id, if (mysql_mutex_init(spd_key_conn_id,
&spider_conn_id_mutex, MY_MUTEX_INIT_FAST)) &spider_conn_id_mutex, MY_MUTEX_INIT_FAST))
#endif
goto error_conn_id_mutex_init; goto error_conn_id_mutex_init;
#if MYSQL_VERSION_ID < 50500
if (pthread_mutex_init(&spider_ipport_conn_mutex, MY_MUTEX_INIT_FAST))
#else
if (mysql_mutex_init(spd_key_mutex_ipport_count, if (mysql_mutex_init(spd_key_mutex_ipport_count,
&spider_ipport_conn_mutex, MY_MUTEX_INIT_FAST)) &spider_ipport_conn_mutex, MY_MUTEX_INIT_FAST))
#endif
goto error_ipport_count_mutex_init; goto error_ipport_count_mutex_init;
#if MYSQL_VERSION_ID < 50500
if (pthread_mutex_init(&spider_init_error_tbl_mutex, MY_MUTEX_INIT_FAST))
#else
if (mysql_mutex_init(spd_key_mutex_init_error_tbl, if (mysql_mutex_init(spd_key_mutex_init_error_tbl,
&spider_init_error_tbl_mutex, MY_MUTEX_INIT_FAST)) &spider_init_error_tbl_mutex, MY_MUTEX_INIT_FAST))
#endif
goto error_init_error_tbl_mutex_init; goto error_init_error_tbl_mutex_init;
#ifdef WITH_PARTITION_STORAGE_ENGINE #ifdef WITH_PARTITION_STORAGE_ENGINE
#if MYSQL_VERSION_ID < 50500
if (pthread_mutex_init(&spider_wide_share_mutex, MY_MUTEX_INIT_FAST))
#else
if (mysql_mutex_init(spd_key_mutex_wide_share, if (mysql_mutex_init(spd_key_mutex_wide_share,
&spider_wide_share_mutex, MY_MUTEX_INIT_FAST)) &spider_wide_share_mutex, MY_MUTEX_INIT_FAST))
#endif
goto error_wide_share_mutex_init; goto error_wide_share_mutex_init;
#endif #endif
#if MYSQL_VERSION_ID < 50500
if (pthread_mutex_init(&spider_lgtm_tblhnd_share_mutex, MY_MUTEX_INIT_FAST))
#else
if (mysql_mutex_init(spd_key_mutex_lgtm_tblhnd_share, if (mysql_mutex_init(spd_key_mutex_lgtm_tblhnd_share,
&spider_lgtm_tblhnd_share_mutex, MY_MUTEX_INIT_FAST)) &spider_lgtm_tblhnd_share_mutex, MY_MUTEX_INIT_FAST))
#endif
goto error_lgtm_tblhnd_share_mutex_init; goto error_lgtm_tblhnd_share_mutex_init;
#if MYSQL_VERSION_ID < 50500
if (pthread_mutex_init(&spider_conn_mutex, MY_MUTEX_INIT_FAST))
#else
if (mysql_mutex_init(spd_key_mutex_conn, if (mysql_mutex_init(spd_key_mutex_conn,
&spider_conn_mutex, MY_MUTEX_INIT_FAST)) &spider_conn_mutex, MY_MUTEX_INIT_FAST))
#endif
goto error_conn_mutex_init; goto error_conn_mutex_init;
#if MYSQL_VERSION_ID < 50500
if (pthread_mutex_init(&spider_open_conn_mutex, MY_MUTEX_INIT_FAST))
#else
if (mysql_mutex_init(spd_key_mutex_open_conn, if (mysql_mutex_init(spd_key_mutex_open_conn,
&spider_open_conn_mutex, MY_MUTEX_INIT_FAST)) &spider_open_conn_mutex, MY_MUTEX_INIT_FAST))
#endif
goto error_open_conn_mutex_init; goto error_open_conn_mutex_init;
#if MYSQL_VERSION_ID < 50500
if (pthread_mutex_init(&spider_allocated_thds_mutex, MY_MUTEX_INIT_FAST))
#else
if (mysql_mutex_init(spd_key_mutex_allocated_thds, if (mysql_mutex_init(spd_key_mutex_allocated_thds,
&spider_allocated_thds_mutex, MY_MUTEX_INIT_FAST)) &spider_allocated_thds_mutex, MY_MUTEX_INIT_FAST))
#endif
goto error_allocated_thds_mutex_init; goto error_allocated_thds_mutex_init;
#if MYSQL_VERSION_ID < 50500
if (pthread_mutex_init(&spider_mon_table_cache_mutex, MY_MUTEX_INIT_FAST))
#else
if (mysql_mutex_init(spd_key_mutex_mon_table_cache, if (mysql_mutex_init(spd_key_mutex_mon_table_cache,
&spider_mon_table_cache_mutex, MY_MUTEX_INIT_FAST)) &spider_mon_table_cache_mutex, MY_MUTEX_INIT_FAST))
#endif
goto error_mon_table_cache_mutex_init; goto error_mon_table_cache_mutex_init;
#if MYSQL_VERSION_ID < 50500
if (pthread_mutex_init(&spider_mem_calc_mutex, MY_MUTEX_INIT_FAST))
#else
if (mysql_mutex_init(spd_key_mutex_mem_calc, if (mysql_mutex_init(spd_key_mutex_mem_calc,
&spider_mem_calc_mutex, MY_MUTEX_INIT_FAST)) &spider_mem_calc_mutex, MY_MUTEX_INIT_FAST))
#endif
goto error_mem_calc_mutex_init; goto error_mem_calc_mutex_init;
if (my_hash_init(PSI_INSTRUMENT_ME, &spider_open_tables, spd_charset_utf8mb3_bin, 32, 0, 0, if (my_hash_init(PSI_INSTRUMENT_ME, &spider_open_tables, spd_charset_utf8mb3_bin, 32, 0, 0,
@@ -7164,25 +7085,16 @@ int spider_db_init(
roop_count < (int) spider_param_udf_table_mon_mutex_count(); roop_count < (int) spider_param_udf_table_mon_mutex_count();
roop_count++) roop_count++)
{ {
#if MYSQL_VERSION_ID < 50500
if (pthread_mutex_init(&spider_udf_table_mon_mutexes[roop_count],
MY_MUTEX_INIT_FAST))
#else
if (mysql_mutex_init(spd_key_mutex_udf_table_mon, if (mysql_mutex_init(spd_key_mutex_udf_table_mon,
&spider_udf_table_mon_mutexes[roop_count], MY_MUTEX_INIT_FAST)) &spider_udf_table_mon_mutexes[roop_count], MY_MUTEX_INIT_FAST))
#endif
goto error_init_udf_table_mon_mutex; goto error_init_udf_table_mon_mutex;
} }
for (roop_count = 0; for (roop_count = 0;
roop_count < (int) spider_param_udf_table_mon_mutex_count(); roop_count < (int) spider_param_udf_table_mon_mutex_count();
roop_count++) roop_count++)
{ {
#if MYSQL_VERSION_ID < 50500
if (pthread_cond_init(&spider_udf_table_mon_conds[roop_count], NULL))
#else
if (mysql_cond_init(spd_key_cond_udf_table_mon, if (mysql_cond_init(spd_key_cond_udf_table_mon,
&spider_udf_table_mon_conds[roop_count], NULL)) &spider_udf_table_mon_conds[roop_count], NULL))
#endif
goto error_init_udf_table_mon_cond; goto error_init_udf_table_mon_cond;
} }
for (roop_count = 0; for (roop_count = 0;
@@ -8555,15 +8467,11 @@ bool spider_check_direct_order_limit(
DBUG_PRINT("info",("spider select_limit=%lld", select_limit)); DBUG_PRINT("info",("spider select_limit=%lld", select_limit));
DBUG_PRINT("info",("spider offset_limit=%lld", offset_limit)); DBUG_PRINT("info",("spider offset_limit=%lld", offset_limit));
if ( if (
#if MYSQL_VERSION_ID < 50500
!thd->variables.engine_condition_pushdown ||
#else
#ifdef SPIDER_ENGINE_CONDITION_PUSHDOWN_IS_ALWAYS_ON #ifdef SPIDER_ENGINE_CONDITION_PUSHDOWN_IS_ALWAYS_ON
#else #else
!(thd->variables.optimizer_switch & !(thd->variables.optimizer_switch &
OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN) || OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN) ||
#endif #endif
#endif
#ifdef SPIDER_NEED_CHECK_CONDITION_AT_CHECKING_DIRECT_ORDER_LIMIT #ifdef SPIDER_NEED_CHECK_CONDITION_AT_CHECKING_DIRECT_ORDER_LIMIT
!spider->condition || !spider->condition ||
#endif #endif
@@ -8835,14 +8743,10 @@ int spider_set_direct_limit_offset(
// contain where // contain where
if ( if (
#if MYSQL_VERSION_ID < 50500
!thd->variables.engine_condition_pushdown ||
#else
#ifdef SPIDER_ENGINE_CONDITION_PUSHDOWN_IS_ALWAYS_ON #ifdef SPIDER_ENGINE_CONDITION_PUSHDOWN_IS_ALWAYS_ON
#else #else
!(thd->variables.optimizer_switch & !(thd->variables.optimizer_switch &
OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN) || OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN) ||
#endif
#endif #endif
// conditions is null may be no where condition in rand_init // conditions is null may be no where condition in rand_init
spider->wide_handler->condition spider->wide_handler->condition
@@ -9506,46 +9410,27 @@ int spider_create_sts_threads(
) { ) {
int error_num; int error_num;
DBUG_ENTER("spider_create_sts_threads"); DBUG_ENTER("spider_create_sts_threads");
#if MYSQL_VERSION_ID < 50500
if (pthread_mutex_init(&spider_thread->mutex,
MY_MUTEX_INIT_FAST))
#else
if (mysql_mutex_init(spd_key_mutex_bg_stss, if (mysql_mutex_init(spd_key_mutex_bg_stss,
&spider_thread->mutex, MY_MUTEX_INIT_FAST)) &spider_thread->mutex, MY_MUTEX_INIT_FAST))
#endif
{ {
error_num = HA_ERR_OUT_OF_MEM; error_num = HA_ERR_OUT_OF_MEM;
goto error_mutex_init; goto error_mutex_init;
} }
#if MYSQL_VERSION_ID < 50500
if (pthread_cond_init(&spider_thread->cond, NULL))
#else
if (mysql_cond_init(spd_key_cond_bg_stss, if (mysql_cond_init(spd_key_cond_bg_stss,
&spider_thread->cond, NULL)) &spider_thread->cond, NULL))
#endif
{ {
error_num = HA_ERR_OUT_OF_MEM; error_num = HA_ERR_OUT_OF_MEM;
goto error_cond_init; goto error_cond_init;
} }
#if MYSQL_VERSION_ID < 50500
if (pthread_cond_init(&spider_thread->sync_cond, NULL))
#else
if (mysql_cond_init(spd_key_cond_bg_sts_syncs, if (mysql_cond_init(spd_key_cond_bg_sts_syncs,
&spider_thread->sync_cond, NULL)) &spider_thread->sync_cond, NULL))
#endif
{ {
error_num = HA_ERR_OUT_OF_MEM; error_num = HA_ERR_OUT_OF_MEM;
goto error_sync_cond_init; goto error_sync_cond_init;
} }
#if MYSQL_VERSION_ID < 50500
if (pthread_create(&spider_thread->thread, &spider_pt_attr,
spider_table_bg_sts_action, (void *) spider_thread)
)
#else
if (mysql_thread_create(spd_key_thd_bg_stss, &spider_thread->thread, if (mysql_thread_create(spd_key_thd_bg_stss, &spider_thread->thread,
&spider_pt_attr, spider_table_bg_sts_action, (void *) spider_thread) &spider_pt_attr, spider_table_bg_sts_action, (void *) spider_thread)
) )
#endif
{ {
error_num = HA_ERR_OUT_OF_MEM; error_num = HA_ERR_OUT_OF_MEM;
goto error_thread_create; goto error_thread_create;
@@ -9593,46 +9478,27 @@ int spider_create_crd_threads(
) { ) {
int error_num; int error_num;
DBUG_ENTER("spider_create_crd_threads"); DBUG_ENTER("spider_create_crd_threads");
#if MYSQL_VERSION_ID < 50500
if (pthread_mutex_init(&spider_thread->mutex,
MY_MUTEX_INIT_FAST))
#else
if (mysql_mutex_init(spd_key_mutex_bg_crds, if (mysql_mutex_init(spd_key_mutex_bg_crds,
&spider_thread->mutex, MY_MUTEX_INIT_FAST)) &spider_thread->mutex, MY_MUTEX_INIT_FAST))
#endif
{ {
error_num = HA_ERR_OUT_OF_MEM; error_num = HA_ERR_OUT_OF_MEM;
goto error_mutex_init; goto error_mutex_init;
} }
#if MYSQL_VERSION_ID < 50500
if (pthread_cond_init(&spider_thread->cond, NULL))
#else
if (mysql_cond_init(spd_key_cond_bg_crds, if (mysql_cond_init(spd_key_cond_bg_crds,
&spider_thread->cond, NULL)) &spider_thread->cond, NULL))
#endif
{ {
error_num = HA_ERR_OUT_OF_MEM; error_num = HA_ERR_OUT_OF_MEM;
goto error_cond_init; goto error_cond_init;
} }
#if MYSQL_VERSION_ID < 50500
if (pthread_cond_init(&spider_thread->sync_cond, NULL))
#else
if (mysql_cond_init(spd_key_cond_bg_crd_syncs, if (mysql_cond_init(spd_key_cond_bg_crd_syncs,
&spider_thread->sync_cond, NULL)) &spider_thread->sync_cond, NULL))
#endif
{ {
error_num = HA_ERR_OUT_OF_MEM; error_num = HA_ERR_OUT_OF_MEM;
goto error_sync_cond_init; goto error_sync_cond_init;
} }
#if MYSQL_VERSION_ID < 50500
if (pthread_create(&spider_thread->thread, &spider_pt_attr,
spider_table_bg_crd_action, (void *) spider_thread)
)
#else
if (mysql_thread_create(spd_key_thd_bg_crds, &spider_thread->thread, if (mysql_thread_create(spd_key_thd_bg_crds, &spider_thread->thread,
&spider_pt_attr, spider_table_bg_crd_action, (void *) spider_thread) &spider_pt_attr, spider_table_bg_crd_action, (void *) spider_thread)
) )
#endif
{ {
error_num = HA_ERR_OUT_OF_MEM; error_num = HA_ERR_OUT_OF_MEM;
goto error_thread_create; goto error_thread_create;

View File

@@ -18,16 +18,11 @@
#include <my_global.h> #include <my_global.h>
#include "mysql_version.h" #include "mysql_version.h"
#include "spd_environ.h" #include "spd_environ.h"
#if MYSQL_VERSION_ID < 50500
#include "mysql_priv.h"
#include <mysql/plugin.h>
#else
#include "sql_priv.h" #include "sql_priv.h"
#include "probes_mysql.h" #include "probes_mysql.h"
#include "sql_class.h" #include "sql_class.h"
#include "sql_partition.h" #include "sql_partition.h"
#include "records.h" #include "records.h"
#endif
#include "spd_err.h" #include "spd_err.h"
#include "spd_param.h" #include "spd_param.h"
#include "spd_db_include.h" #include "spd_db_include.h"
@@ -1206,13 +1201,8 @@ SPIDER_TRX *spider_get_trx(
roop_count < (int) spider_param_udf_table_lock_mutex_count(); roop_count < (int) spider_param_udf_table_lock_mutex_count();
roop_count++) roop_count++)
{ {
#if MYSQL_VERSION_ID < 50500
if (pthread_mutex_init(&trx->udf_table_mutexes[roop_count],
MY_MUTEX_INIT_FAST))
#else
if (mysql_mutex_init(spd_key_mutex_udf_table, if (mysql_mutex_init(spd_key_mutex_udf_table,
&trx->udf_table_mutexes[roop_count], MY_MUTEX_INIT_FAST)) &trx->udf_table_mutexes[roop_count], MY_MUTEX_INIT_FAST))
#endif
goto error_init_udf_table_mutex; goto error_init_udf_table_mutex;
} }
@@ -3846,9 +3836,6 @@ THD *spider_create_tmp_thd()
if (!(thd = SPIDER_new_THD((my_thread_id) 0))) if (!(thd = SPIDER_new_THD((my_thread_id) 0)))
DBUG_RETURN(NULL); DBUG_RETURN(NULL);
thd->killed = NOT_KILLED; thd->killed = NOT_KILLED;
#if MYSQL_VERSION_ID < 50500
thd->locked_tables = FALSE;
#endif
thd->proc_info = ""; thd->proc_info = "";
thd->thread_stack = (char*) &thd; thd->thread_stack = (char*) &thd;
thd->store_globals(); thd->store_globals();