mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
change variable import
This commit is contained in:
@@ -146,7 +146,7 @@ extern char log_error_file[FN_REFLEN], *opt_tc_log_file;
|
||||
extern const double log_10[309];
|
||||
extern ulonglong keybuff_size;
|
||||
extern ulonglong thd_startup_options;
|
||||
extern MYSQL_PLUGIN_IMPORT ulong thread_id;
|
||||
extern ulong thread_id;
|
||||
extern ulong binlog_cache_use, binlog_cache_disk_use;
|
||||
extern ulong binlog_stmt_cache_use, binlog_stmt_cache_disk_use;
|
||||
extern ulong aborted_threads,aborted_connects;
|
||||
|
||||
@@ -1028,8 +1028,8 @@ typedef struct st_xid_state {
|
||||
uint rm_error;
|
||||
} XID_STATE;
|
||||
|
||||
extern MYSQL_PLUGIN_IMPORT mysql_mutex_t LOCK_xid_cache;
|
||||
extern MYSQL_PLUGIN_IMPORT HASH xid_cache;
|
||||
extern mysql_mutex_t LOCK_xid_cache;
|
||||
extern HASH xid_cache;
|
||||
bool xid_cache_init(void);
|
||||
void xid_cache_free(void);
|
||||
XID_STATE *xid_cache_search(XID *xid);
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
#include "spd_ping_table.h"
|
||||
#include "spd_malloc.h"
|
||||
|
||||
extern ulong *spd_db_att_thread_id;
|
||||
|
||||
extern handlerton *spider_hton_ptr;
|
||||
extern SPIDER_DBTON spider_dbton[SPIDER_DBTON_SIZE];
|
||||
pthread_mutex_t spider_conn_id_mutex;
|
||||
@@ -2118,7 +2120,7 @@ void *spider_bg_conn_action(
|
||||
DBUG_RETURN(NULL);
|
||||
}
|
||||
pthread_mutex_lock(&LOCK_thread_count);
|
||||
thd->thread_id = thread_id++;
|
||||
thd->thread_id = (*spd_db_att_thread_id)++;
|
||||
pthread_mutex_unlock(&LOCK_thread_count);
|
||||
#ifdef HAVE_PSI_INTERFACE
|
||||
mysql_thread_set_psi_id(thd->thread_id);
|
||||
@@ -2648,7 +2650,7 @@ void *spider_bg_sts_action(
|
||||
DBUG_RETURN(NULL);
|
||||
}
|
||||
pthread_mutex_lock(&LOCK_thread_count);
|
||||
thd->thread_id = thread_id++;
|
||||
thd->thread_id = (*spd_db_att_thread_id)++;
|
||||
pthread_mutex_unlock(&LOCK_thread_count);
|
||||
#ifdef HAVE_PSI_INTERFACE
|
||||
mysql_thread_set_psi_id(thd->thread_id);
|
||||
@@ -3026,7 +3028,7 @@ void *spider_bg_crd_action(
|
||||
DBUG_RETURN(NULL);
|
||||
}
|
||||
pthread_mutex_lock(&LOCK_thread_count);
|
||||
thd->thread_id = thread_id++;
|
||||
thd->thread_id = (*spd_db_att_thread_id)++;
|
||||
pthread_mutex_unlock(&LOCK_thread_count);
|
||||
#ifdef HAVE_PSI_INTERFACE
|
||||
mysql_thread_set_psi_id(thd->thread_id);
|
||||
@@ -3474,7 +3476,7 @@ void *spider_bg_mon_action(
|
||||
DBUG_RETURN(NULL);
|
||||
}
|
||||
pthread_mutex_lock(&LOCK_thread_count);
|
||||
thd->thread_id = thread_id++;
|
||||
thd->thread_id = (*spd_db_att_thread_id)++;
|
||||
pthread_mutex_unlock(&LOCK_thread_count);
|
||||
#ifdef HAVE_PSI_INTERFACE
|
||||
mysql_thread_set_psi_id(thd->thread_id);
|
||||
|
||||
@@ -38,6 +38,10 @@
|
||||
#include "spd_ping_table.h"
|
||||
#include "spd_malloc.h"
|
||||
|
||||
ulong *spd_db_att_thread_id;
|
||||
pthread_mutex_t *spd_db_att_LOCK_xid_cache;
|
||||
HASH *spd_db_att_xid_cache;
|
||||
|
||||
handlerton *spider_hton_ptr;
|
||||
SPIDER_DBTON spider_dbton[SPIDER_DBTON_SIZE];
|
||||
extern SPIDER_DBTON spider_dbton_mysql;
|
||||
@@ -5955,6 +5959,26 @@ int spider_db_init(
|
||||
memset(&spider_alloc_mem_count, 0, sizeof(spider_alloc_mem_count));
|
||||
memset(&spider_free_mem_count, 0, sizeof(spider_free_mem_count));
|
||||
|
||||
#ifdef _WIN32
|
||||
HMODULE current_module = GetModuleHandle(NULL);
|
||||
spd_db_att_thread_id = (ulong *)
|
||||
GetProcAddress(current_module, "?thread_id@@3KA");
|
||||
spd_db_att_LOCK_xid_cache = (pthread_mutex_t *)
|
||||
#if MYSQL_VERSION_ID < 50500
|
||||
GetProcAddress(current_module,
|
||||
"?LOCK_xid_cache@@3U_RTL_CRITICAL_SECTION@@A");
|
||||
#else
|
||||
GetProcAddress(current_module,
|
||||
"?LOCK_xid_cache@@3Ust_mysql_mutex@@A");
|
||||
#endif
|
||||
spd_db_att_xid_cache = (HASH *)
|
||||
GetProcAddress(current_module, "?xid_cache@@3Ust_hash@@A");
|
||||
#else
|
||||
spd_db_att_thread_id = &thread_id;
|
||||
spd_db_att_LOCK_xid_cache = &LOCK_xid_cache;
|
||||
spd_db_att_xid_cache = &xid_cache;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PSI_INTERFACE
|
||||
init_spider_psi_keys();
|
||||
#endif
|
||||
|
||||
@@ -38,6 +38,9 @@
|
||||
#include "spd_ping_table.h"
|
||||
#include "spd_malloc.h"
|
||||
|
||||
extern pthread_mutex_t *spd_db_att_LOCK_xid_cache;
|
||||
extern HASH *spd_db_att_xid_cache;
|
||||
|
||||
extern handlerton *spider_hton_ptr;
|
||||
pthread_mutex_t spider_thread_id_mutex;
|
||||
ulonglong spider_thread_id = 1;
|
||||
@@ -1499,15 +1502,15 @@ int spider_xa_lock(
|
||||
int error_num;
|
||||
DBUG_ENTER("spider_xa_lock");
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
my_hash_value_type hash_value = my_calc_hash(&xid_cache,
|
||||
my_hash_value_type hash_value = my_calc_hash(spd_db_att_xid_cache,
|
||||
(uchar*) xid_state->xid.key(), xid_state->xid.key_length());
|
||||
#endif
|
||||
pthread_mutex_lock(&LOCK_xid_cache);
|
||||
pthread_mutex_lock(spd_db_att_LOCK_xid_cache);
|
||||
#ifdef SPIDER_HAS_HASH_VALUE_TYPE
|
||||
if (my_hash_search_using_hash_value(&xid_cache, hash_value,
|
||||
if (my_hash_search_using_hash_value(spd_db_att_xid_cache, hash_value,
|
||||
xid_state->xid.key(), xid_state->xid.key_length()))
|
||||
#else
|
||||
if (my_hash_search(&xid_cache,
|
||||
if (my_hash_search(spd_db_att_xid_cache,
|
||||
xid_state->xid.key(), xid_state->xid.key_length()))
|
||||
#endif
|
||||
{
|
||||
@@ -1515,20 +1518,20 @@ int spider_xa_lock(
|
||||
goto error;
|
||||
}
|
||||
#ifdef HASH_UPDATE_WITH_HASH_VALUE
|
||||
if (my_hash_insert_with_hash_value(&xid_cache, hash_value,
|
||||
if (my_hash_insert_with_hash_value(spd_db_att_xid_cache, hash_value,
|
||||
(uchar*)xid_state))
|
||||
#else
|
||||
if (my_hash_insert(&xid_cache, (uchar*)xid_state))
|
||||
if (my_hash_insert(spd_db_att_xid_cache, (uchar*)xid_state))
|
||||
#endif
|
||||
{
|
||||
error_num = HA_ERR_OUT_OF_MEM;
|
||||
goto error;
|
||||
}
|
||||
pthread_mutex_unlock(&LOCK_xid_cache);
|
||||
pthread_mutex_unlock(spd_db_att_LOCK_xid_cache);
|
||||
DBUG_RETURN(0);
|
||||
|
||||
error:
|
||||
pthread_mutex_unlock(&LOCK_xid_cache);
|
||||
pthread_mutex_unlock(spd_db_att_LOCK_xid_cache);
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
|
||||
@@ -1537,16 +1540,16 @@ int spider_xa_unlock(
|
||||
) {
|
||||
DBUG_ENTER("spider_xa_unlock");
|
||||
#if defined(SPIDER_HAS_HASH_VALUE_TYPE) && defined(HASH_UPDATE_WITH_HASH_VALUE)
|
||||
my_hash_value_type hash_value = my_calc_hash(&xid_cache,
|
||||
my_hash_value_type hash_value = my_calc_hash(spd_db_att_xid_cache,
|
||||
(uchar*) xid_state->xid.key(), xid_state->xid.key_length());
|
||||
#endif
|
||||
pthread_mutex_lock(&LOCK_xid_cache);
|
||||
pthread_mutex_lock(spd_db_att_LOCK_xid_cache);
|
||||
#if defined(SPIDER_HAS_HASH_VALUE_TYPE) && defined(HASH_UPDATE_WITH_HASH_VALUE)
|
||||
my_hash_delete_with_hash_value(&xid_cache, hash_value, (uchar *)xid_state);
|
||||
my_hash_delete_with_hash_value(spd_db_att_xid_cache, hash_value, (uchar *)xid_state);
|
||||
#else
|
||||
my_hash_delete(&xid_cache, (uchar *)xid_state);
|
||||
my_hash_delete(spd_db_att_xid_cache, (uchar *)xid_state);
|
||||
#endif
|
||||
pthread_mutex_unlock(&LOCK_xid_cache);
|
||||
pthread_mutex_unlock(spd_db_att_LOCK_xid_cache);
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user