Changed the client library to only mark memory as THREAD_SPECIFIC if one has called
mysql_options() with MYSQL_OPT_USE_THREAD_SPECIFIC_MEMORY include/mysql.h: Added MYSQL_OPT_USE_THREAD_SPECIFIC_MEMORY include/mysql.h.pp: Updated file sql-common/client.c: Marked client memory as THREAD_SPECIFIC sql/event_db_repository.cc: Fixed compiler warning sql/slave.cc: Marked client memory as THREAD_SPECIFIC storage/federatedx/federatedx_io_mysql.cc: Marked client memory as THREAD_SPECIFIC storage/federatedx/ha_federatedx.cc: Marked client memory as THREAD_SPECIFIC storage/sphinx/ha_sphinx.cc: Marked client memory as THREAD_SPECIFIC
This commit is contained in:
parent
8e52698580
commit
8b714e507f
@ -169,7 +169,7 @@ enum mysql_option
|
||||
MYSQL_OPT_SSL_VERIFY_SERVER_CERT, MYSQL_PLUGIN_DIR, MYSQL_DEFAULT_AUTH,
|
||||
MYSQL_PROGRESS_CALLBACK,
|
||||
/* MariaDB options */
|
||||
MYSQL_OPT_NONBLOCK=6000
|
||||
MYSQL_OPT_NONBLOCK=6000, MYSQL_OPT_USE_THREAD_SPECIFIC_MEMORY
|
||||
};
|
||||
|
||||
/**
|
||||
@ -194,7 +194,7 @@ struct st_mysql_options {
|
||||
unsigned long max_allowed_packet;
|
||||
my_bool use_ssl; /* if to use SSL or not */
|
||||
my_bool compress,named_pipe;
|
||||
my_bool unused1;
|
||||
my_bool use_thread_specific_memory;
|
||||
my_bool unused2;
|
||||
my_bool unused3;
|
||||
my_bool unused4;
|
||||
|
@ -83,7 +83,7 @@ enum enum_mysql_set_option
|
||||
my_bool my_net_init(NET *net, Vio* vio, unsigned int my_flags);
|
||||
void my_net_local_init(NET *net);
|
||||
void net_end(NET *net);
|
||||
void net_clear(NET *net, my_bool clear_buffer);
|
||||
void net_clear(NET *net, my_bool clear_buffer);
|
||||
my_bool net_realloc(NET *net, size_t length);
|
||||
my_bool net_flush(NET *net);
|
||||
my_bool my_net_write(NET *net,const unsigned char *packet, size_t len);
|
||||
@ -263,7 +263,7 @@ enum mysql_option
|
||||
MYSQL_REPORT_DATA_TRUNCATION, MYSQL_OPT_RECONNECT,
|
||||
MYSQL_OPT_SSL_VERIFY_SERVER_CERT, MYSQL_PLUGIN_DIR, MYSQL_DEFAULT_AUTH,
|
||||
MYSQL_PROGRESS_CALLBACK,
|
||||
MYSQL_OPT_NONBLOCK=6000
|
||||
MYSQL_OPT_NONBLOCK=6000, MYSQL_OPT_USE_THREAD_SPECIFIC_MEMORY
|
||||
};
|
||||
struct st_mysql_options_extention;
|
||||
struct st_mysql_options {
|
||||
@ -282,7 +282,7 @@ struct st_mysql_options {
|
||||
unsigned long max_allowed_packet;
|
||||
my_bool use_ssl;
|
||||
my_bool compress,named_pipe;
|
||||
my_bool unused1;
|
||||
my_bool use_thread_specific_memory;
|
||||
my_bool unused2;
|
||||
my_bool unused3;
|
||||
my_bool unused4;
|
||||
|
@ -892,7 +892,9 @@ void free_old_query(MYSQL *mysql)
|
||||
if (mysql->fields)
|
||||
free_root(&mysql->field_alloc,MYF(0));
|
||||
/* Assume rowlength < 8192 */
|
||||
init_alloc_root(&mysql->field_alloc, 8192, 0, MYF(MY_THREAD_SPECIFIC));
|
||||
init_alloc_root(&mysql->field_alloc, 8192, 0,
|
||||
MYF(mysql->options.use_thread_specific_memory ?
|
||||
MY_THREAD_SPECIFIC : 0));
|
||||
mysql->fields= 0;
|
||||
mysql->field_count= 0; /* For API */
|
||||
mysql->warning_count= 0;
|
||||
@ -1578,7 +1580,9 @@ MYSQL_DATA *cli_read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
/* Assume rowlength < 8192 */
|
||||
init_alloc_root(&result->alloc, 8192, 0, MYF(MY_THREAD_SPECIFIC));
|
||||
init_alloc_root(&result->alloc, 8192, 0,
|
||||
MYF(mysql->options.use_thread_specific_memory ?
|
||||
MY_THREAD_SPECIFIC : 0));
|
||||
result->alloc.min_malloc=sizeof(MYSQL_ROWS);
|
||||
prev_ptr= &result->data;
|
||||
result->rows=0;
|
||||
@ -4206,6 +4210,9 @@ mysql_options(MYSQL *mysql,enum mysql_option option, const void *arg)
|
||||
case MYSQL_OPT_RECONNECT:
|
||||
mysql->reconnect= *(my_bool *) arg;
|
||||
break;
|
||||
case MYSQL_OPT_USE_THREAD_SPECIFIC_MEMORY:
|
||||
mysql->options.use_thread_specific_memory= *(my_bool *) arg;
|
||||
break;
|
||||
case MYSQL_OPT_SSL_VERIFY_SERVER_CERT:
|
||||
if (*(my_bool*) arg)
|
||||
mysql->options.client_flag|= CLIENT_SSL_VERIFY_SERVER_CERT;
|
||||
|
@ -163,7 +163,7 @@ const TABLE_FIELD_TYPE event_table_fields[ET_FIELD_COUNT] =
|
||||
};
|
||||
|
||||
static const TABLE_FIELD_DEF
|
||||
event_table_def= {ET_FIELD_COUNT, event_table_fields};
|
||||
event_table_def= {ET_FIELD_COUNT, event_table_fields, 0, (uint*) 0};
|
||||
|
||||
class Event_db_intact : public Table_check_intact
|
||||
{
|
||||
|
10
sql/slave.cc
10
sql/slave.cc
@ -5004,6 +5004,7 @@ static int connect_to_master(THD* thd, MYSQL* mysql, Master_info* mi,
|
||||
int last_errno= -2; // impossible error
|
||||
ulong err_count=0;
|
||||
char llbuff[22];
|
||||
my_bool my_true= 1;
|
||||
DBUG_ENTER("connect_to_master");
|
||||
|
||||
#ifndef DBUG_OFF
|
||||
@ -5015,6 +5016,8 @@ static int connect_to_master(THD* thd, MYSQL* mysql, Master_info* mi,
|
||||
|
||||
mysql_options(mysql, MYSQL_OPT_CONNECT_TIMEOUT, (char *) &slave_net_timeout);
|
||||
mysql_options(mysql, MYSQL_OPT_READ_TIMEOUT, (char *) &slave_net_timeout);
|
||||
mysql_options(mysql, MYSQL_OPT_USE_THREAD_SPECIFIC_MEMORY,
|
||||
(char*) &my_true);
|
||||
|
||||
#ifdef HAVE_OPENSSL
|
||||
if (mi->ssl)
|
||||
@ -5130,14 +5133,15 @@ MYSQL *rpl_connect_master(MYSQL *mysql)
|
||||
{
|
||||
THD *thd= current_thd;
|
||||
Master_info *mi= my_pthread_getspecific_ptr(Master_info*, RPL_MASTER_INFO);
|
||||
bool allocated= false;
|
||||
my_bool my_true= 1;
|
||||
|
||||
if (!mi)
|
||||
{
|
||||
sql_print_error("'rpl_connect_master' must be called in slave I/O thread context.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool allocated= false;
|
||||
|
||||
if (!mysql)
|
||||
{
|
||||
if(!(mysql= mysql_init(NULL)))
|
||||
@ -5157,6 +5161,8 @@ MYSQL *rpl_connect_master(MYSQL *mysql)
|
||||
*/
|
||||
mysql_options(mysql, MYSQL_OPT_CONNECT_TIMEOUT, (char *) &slave_net_timeout);
|
||||
mysql_options(mysql, MYSQL_OPT_READ_TIMEOUT, (char *) &slave_net_timeout);
|
||||
mysql_options(mysql, MYSQL_OPT_USE_THREAD_SPECIFIC_MEMORY,
|
||||
(char*) &my_true);
|
||||
|
||||
#ifdef HAVE_OPENSSL
|
||||
if (mi->ssl)
|
||||
|
@ -423,8 +423,10 @@ int federatedx_io_mysql::actual_query(const char *buffer, uint length)
|
||||
|
||||
if (!mysql.net.vio)
|
||||
{
|
||||
my_bool my_true= 1;
|
||||
|
||||
if (!(mysql_init(&mysql)))
|
||||
DBUG_RETURN(-1);
|
||||
DBUG_RETURN(-1);
|
||||
|
||||
/*
|
||||
BUG# 17044 Federated Storage Engine is not UTF8 clean
|
||||
@ -433,6 +435,8 @@ int federatedx_io_mysql::actual_query(const char *buffer, uint length)
|
||||
*/
|
||||
/* this sets the csname like 'set names utf8' */
|
||||
mysql_options(&mysql, MYSQL_SET_CHARSET_NAME, get_charsetname());
|
||||
mysql_options(&mysql, MYSQL_OPT_USE_THREAD_SPECIFIC_MEMORY,
|
||||
(char*) &my_true);
|
||||
|
||||
if (!mysql_real_connect(&mysql,
|
||||
get_hostname(),
|
||||
|
@ -3593,12 +3593,15 @@ int ha_federatedx::discover_assisted(handlerton *hton, THD* thd,
|
||||
MYSQL_RES *res;
|
||||
MYSQL_ROW rdata;
|
||||
ulong *rlen;
|
||||
my_bool my_true= 1;
|
||||
|
||||
if (parse_url(thd->mem_root, &tmp_share, table_s, 1))
|
||||
return HA_WRONG_CREATE_OPTION;
|
||||
|
||||
mysql_init(&mysql);
|
||||
mysql_options(&mysql, MYSQL_SET_CHARSET_NAME, cs->csname);
|
||||
mysql_options(&mysql, MYSQL_OPT_USE_THREAD_SPECIFIC_MEMORY,
|
||||
(char*) &my_true);
|
||||
|
||||
if (!mysql_real_connect(&mysql, tmp_share.hostname, tmp_share.username,
|
||||
tmp_share.password, tmp_share.database,
|
||||
|
@ -2333,7 +2333,11 @@ int ha_sphinx::write_row ( byte * )
|
||||
SPH_RET ( ER_OUT_OF_RESOURCES );
|
||||
|
||||
unsigned int uTimeout = 1;
|
||||
mysql_options ( pConn, MYSQL_OPT_CONNECT_TIMEOUT, (const char*)&uTimeout );
|
||||
my_bool my_true= 1;
|
||||
mysql_options(pConn, MYSQL_OPT_CONNECT_TIMEOUT,
|
||||
(const char*) &uTimeout);
|
||||
mysql_options(pConn, MYSQL_OPT_USE_THREAD_SPECIFIC_MEMORY,
|
||||
(char*) &my_true);
|
||||
|
||||
if ( !mysql_real_connect ( pConn, m_pShare->m_sHost, "root", "", "", m_pShare->m_iPort, m_pShare->m_sSocket, 0 ) )
|
||||
SPH_RET ( HandleMysqlError ( pConn, ER_CONNECT_TO_FOREIGN_DATA_SOURCE ) );
|
||||
@ -2392,7 +2396,11 @@ int ha_sphinx::delete_row ( const byte * )
|
||||
SPH_RET ( ER_OUT_OF_RESOURCES );
|
||||
|
||||
unsigned int uTimeout = 1;
|
||||
mysql_options ( pConn, MYSQL_OPT_CONNECT_TIMEOUT, (const char*)&uTimeout );
|
||||
my_bool my_true= 1;
|
||||
mysql_options(pConn, MYSQL_OPT_CONNECT_TIMEOUT,
|
||||
(const char*) &uTimeout);
|
||||
mysql_options(pConn, MYSQL_OPT_USE_THREAD_SPECIFIC_MEMORY,
|
||||
(char*) &my_true);
|
||||
|
||||
if ( !mysql_real_connect ( pConn, m_pShare->m_sHost, "root", "", "", m_pShare->m_iPort, m_pShare->m_sSocket, 0 ) )
|
||||
SPH_RET ( HandleMysqlError ( pConn, ER_CONNECT_TO_FOREIGN_DATA_SOURCE ) );
|
||||
|
Loading…
x
Reference in New Issue
Block a user