You've already forked mariadb-connector-c
mirror of
https://github.com/mariadb-corporation/mariadb-connector-c.git
synced 2025-08-07 02:42:49 +03:00
Moved connection_handler to mysql->extension
This commit is contained in:
@@ -73,6 +73,9 @@ typedef struct st_connection_handler
|
|||||||
|
|
||||||
struct st_mariadb_net_extension {
|
struct st_mariadb_net_extension {
|
||||||
unsigned char *mbuff, *mbuff_end, *mbuff_pos;
|
unsigned char *mbuff, *mbuff_end, *mbuff_pos;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct st_mariadb_extension {
|
||||||
MA_CONNECTION_HANDLER *conn_hdlr;
|
MA_CONNECTION_HANDLER *conn_hdlr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -353,7 +353,7 @@ struct st_mysql_options {
|
|||||||
void *thd;
|
void *thd;
|
||||||
my_bool *unbuffered_fetch_owner;
|
my_bool *unbuffered_fetch_owner;
|
||||||
char *info_buffer;
|
char *info_buffer;
|
||||||
void *extension;
|
struct st_mariadb_extension *extension;
|
||||||
} MYSQL;
|
} MYSQL;
|
||||||
|
|
||||||
typedef struct st_mysql_res {
|
typedef struct st_mysql_res {
|
||||||
|
@@ -140,7 +140,7 @@ struct st_mariadb_methods MARIADB_DEFAULT_METHODS;
|
|||||||
#define native_password_plugin_name "mysql_native_password"
|
#define native_password_plugin_name "mysql_native_password"
|
||||||
|
|
||||||
#define IS_CONNHDLR_ACTIVE(mysql)\
|
#define IS_CONNHDLR_ACTIVE(mysql)\
|
||||||
(((mysql)->net.extension->conn_hdlr))
|
(((mysql)->extension->conn_hdlr))
|
||||||
|
|
||||||
static void end_server(MYSQL *mysql);
|
static void end_server(MYSQL *mysql);
|
||||||
static void mysql_close_memory(MYSQL *mysql);
|
static void mysql_close_memory(MYSQL *mysql);
|
||||||
@@ -182,7 +182,6 @@ void net_get_error(char *buf, size_t buf_len,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
** read a packet from server. Give error message if socket was down
|
** read a packet from server. Give error message if socket was down
|
||||||
** or packet is an error message
|
** or packet is an error message
|
||||||
@@ -391,7 +390,7 @@ mthd_my_send_cmd(MYSQL *mysql,enum enum_server_command command, const char *arg,
|
|||||||
|
|
||||||
if (IS_CONNHDLR_ACTIVE(mysql))
|
if (IS_CONNHDLR_ACTIVE(mysql))
|
||||||
{
|
{
|
||||||
result= mysql->net.extension->conn_hdlr->plugin->set_connection(mysql, command, arg, length, skipp_check, opt_arg);
|
result= mysql->extension->conn_hdlr->plugin->set_connection(mysql, command, arg, length, skipp_check, opt_arg);
|
||||||
if (result== -1)
|
if (result== -1)
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
@@ -952,12 +951,10 @@ mysql_init(MYSQL *mysql)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!(mysql->net.extension= (struct st_mariadb_net_extension *)
|
if (!(mysql->net.extension= (struct st_mariadb_net_extension *)
|
||||||
calloc(1, sizeof(struct st_mariadb_net_extension))))
|
calloc(1, sizeof(struct st_mariadb_net_extension))) ||
|
||||||
{
|
!(mysql->extension= (struct st_mariadb_extension *)
|
||||||
if (mysql->free_me)
|
calloc(1, sizeof(struct st_mariadb_extension))))
|
||||||
free(mysql);
|
goto error;
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
mysql->options.report_data_truncation= 1;
|
mysql->options.report_data_truncation= 1;
|
||||||
mysql->options.connect_timeout=CONNECT_TIMEOUT;
|
mysql->options.connect_timeout=CONNECT_TIMEOUT;
|
||||||
mysql->charset= ma_default_charset_info;
|
mysql->charset= ma_default_charset_info;
|
||||||
@@ -974,6 +971,10 @@ mysql_init(MYSQL *mysql)
|
|||||||
#endif
|
#endif
|
||||||
mysql->options.reconnect= 0;
|
mysql->options.reconnect= 0;
|
||||||
return mysql;
|
return mysql;
|
||||||
|
error:
|
||||||
|
if (mysql->free_me)
|
||||||
|
free(mysql);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int STDCALL
|
int STDCALL
|
||||||
@@ -1109,7 +1110,7 @@ mysql_real_connect(MYSQL *mysql, const char *host, const char *user,
|
|||||||
if (!(plugin= (MARIADB_CONNECTION_PLUGIN *)mysql_client_find_plugin(mysql, plugin_name, MARIADB_CLIENT_CONNECTION_PLUGIN)))
|
if (!(plugin= (MARIADB_CONNECTION_PLUGIN *)mysql_client_find_plugin(mysql, plugin_name, MARIADB_CLIENT_CONNECTION_PLUGIN)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (!(mysql->net.extension->conn_hdlr= (MA_CONNECTION_HANDLER *)calloc(1, sizeof(MA_CONNECTION_HANDLER))))
|
if (!(mysql->extension->conn_hdlr= (MA_CONNECTION_HANDLER *)calloc(1, sizeof(MA_CONNECTION_HANDLER))))
|
||||||
{
|
{
|
||||||
SET_CLIENT_ERROR(mysql, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
SET_CLIENT_ERROR(mysql, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -1118,15 +1119,15 @@ mysql_real_connect(MYSQL *mysql, const char *host, const char *user,
|
|||||||
/* save URL for reconnect */
|
/* save URL for reconnect */
|
||||||
OPT_SET_EXTENDED_VALUE_STR(&mysql->options, url, host);
|
OPT_SET_EXTENDED_VALUE_STR(&mysql->options, url, host);
|
||||||
|
|
||||||
mysql->net.extension->conn_hdlr->plugin= plugin;
|
mysql->extension->conn_hdlr->plugin= plugin;
|
||||||
|
|
||||||
if (plugin && plugin->connect)
|
if (plugin && plugin->connect)
|
||||||
{
|
{
|
||||||
MYSQL *my= plugin->connect(mysql, end, user, passwd, db, port, unix_socket, client_flag);
|
MYSQL *my= plugin->connect(mysql, end, user, passwd, db, port, unix_socket, client_flag);
|
||||||
if (!my)
|
if (!my)
|
||||||
{
|
{
|
||||||
free(mysql->net.extension->conn_hdlr);
|
free(mysql->extension->conn_hdlr);
|
||||||
mysql->net.extension->conn_hdlr= NULL;
|
mysql->extension->conn_hdlr= NULL;
|
||||||
}
|
}
|
||||||
return my;
|
return my;
|
||||||
}
|
}
|
||||||
@@ -1536,8 +1537,8 @@ my_bool STDCALL mariadb_reconnect(MYSQL *mysql)
|
|||||||
/* check if connection handler is active */
|
/* check if connection handler is active */
|
||||||
if (IS_CONNHDLR_ACTIVE(mysql))
|
if (IS_CONNHDLR_ACTIVE(mysql))
|
||||||
{
|
{
|
||||||
if (mysql->net.extension->conn_hdlr->plugin && mysql->net.extension->conn_hdlr->plugin->reconnect)
|
if (mysql->extension->conn_hdlr->plugin && mysql->extension->conn_hdlr->plugin->reconnect)
|
||||||
return(mysql->net.extension->conn_hdlr->plugin->reconnect(mysql));
|
return(mysql->extension->conn_hdlr->plugin->reconnect(mysql));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mysql->options.reconnect ||
|
if (!mysql->options.reconnect ||
|
||||||
@@ -1551,10 +1552,10 @@ my_bool STDCALL mariadb_reconnect(MYSQL *mysql)
|
|||||||
|
|
||||||
mysql_init(&tmp_mysql);
|
mysql_init(&tmp_mysql);
|
||||||
tmp_mysql.options=mysql->options;
|
tmp_mysql.options=mysql->options;
|
||||||
if (mysql->net.extension->conn_hdlr)
|
if (mysql->extension->conn_hdlr)
|
||||||
{
|
{
|
||||||
tmp_mysql.net.extension->conn_hdlr= mysql->net.extension->conn_hdlr;
|
tmp_mysql.extension->conn_hdlr= mysql->extension->conn_hdlr;
|
||||||
mysql->net.extension->conn_hdlr= 0;
|
mysql->extension->conn_hdlr= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* don't reread options from configuration files */
|
/* don't reread options from configuration files */
|
||||||
@@ -1839,9 +1840,9 @@ mysql_close(MYSQL *mysql)
|
|||||||
{
|
{
|
||||||
if (mysql) /* Some simple safety */
|
if (mysql) /* Some simple safety */
|
||||||
{
|
{
|
||||||
if (mysql->net.extension->conn_hdlr)
|
if (mysql->extension->conn_hdlr)
|
||||||
{
|
{
|
||||||
MA_CONNECTION_HANDLER *p= mysql->net.extension->conn_hdlr;
|
MA_CONNECTION_HANDLER *p= mysql->extension->conn_hdlr;
|
||||||
p->plugin->close(mysql);
|
p->plugin->close(mysql);
|
||||||
free(p);
|
free(p);
|
||||||
}
|
}
|
||||||
|
@@ -245,21 +245,21 @@ my_bool aurora_parse_url(const char *url, AURORA *aurora)
|
|||||||
int aurora_get_instance_type(MYSQL *mysql)
|
int aurora_get_instance_type(MYSQL *mysql)
|
||||||
{
|
{
|
||||||
int rc= -1;
|
int rc= -1;
|
||||||
MA_CONNECTION_HANDLER *save_hdlr= mysql->net.extension->conn_hdlr;
|
MA_CONNECTION_HANDLER *save_hdlr= mysql->extension->conn_hdlr;
|
||||||
|
|
||||||
char *query= "select variable_value from information_schema.global_variables where variable_name='INNODB_READ_ONLY' AND variable_value='OFF'";
|
char *query= "select variable_value from information_schema.global_variables where variable_name='INNODB_READ_ONLY' AND variable_value='OFF'";
|
||||||
|
|
||||||
if (!mysql)
|
if (!mysql)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
mysql->net.extension->conn_hdlr= 0;
|
mysql->extension->conn_hdlr= 0;
|
||||||
if (!mariadb_api->mysql_query(mysql, query))
|
if (!mariadb_api->mysql_query(mysql, query))
|
||||||
{
|
{
|
||||||
MYSQL_RES *res= mariadb_api->mysql_store_result(mysql);
|
MYSQL_RES *res= mariadb_api->mysql_store_result(mysql);
|
||||||
rc= mariadb_api->mysql_num_rows(res) ? AURORA_PRIMARY : AURORA_REPLICA;
|
rc= mariadb_api->mysql_num_rows(res) ? AURORA_PRIMARY : AURORA_REPLICA;
|
||||||
mariadb_api->mysql_free_result(res);
|
mariadb_api->mysql_free_result(res);
|
||||||
}
|
}
|
||||||
mysql->net.extension->conn_hdlr= save_hdlr;
|
mysql->extension->conn_hdlr= save_hdlr;
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
@@ -280,9 +280,9 @@ int aurora_get_instance_type(MYSQL *mysql)
|
|||||||
my_bool aurora_get_primary_id(MYSQL *mysql, AURORA *aurora)
|
my_bool aurora_get_primary_id(MYSQL *mysql, AURORA *aurora)
|
||||||
{
|
{
|
||||||
my_bool rc= 0;
|
my_bool rc= 0;
|
||||||
MA_CONNECTION_HANDLER *save_hdlr= mysql->net.extension->conn_hdlr;
|
MA_CONNECTION_HANDLER *save_hdlr= mysql->extension->conn_hdlr;
|
||||||
|
|
||||||
mysql->net.extension->conn_hdlr= 0;
|
mysql->extension->conn_hdlr= 0;
|
||||||
if (!mariadb_api->mysql_query(mysql, "select server_id from information_schema.replica_host_status "
|
if (!mariadb_api->mysql_query(mysql, "select server_id from information_schema.replica_host_status "
|
||||||
"where session_id = 'MASTER_SESSION_ID'"))
|
"where session_id = 'MASTER_SESSION_ID'"))
|
||||||
{
|
{
|
||||||
@@ -302,7 +302,7 @@ my_bool aurora_get_primary_id(MYSQL *mysql, AURORA *aurora)
|
|||||||
mariadb_api->mysql_free_result(res);
|
mariadb_api->mysql_free_result(res);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mysql->net.extension->conn_hdlr= save_hdlr;
|
mysql->extension->conn_hdlr= save_hdlr;
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
@@ -393,7 +393,7 @@ void aurora_close_internal(MYSQL *mysql)
|
|||||||
{
|
{
|
||||||
if (mysql)
|
if (mysql)
|
||||||
{
|
{
|
||||||
mysql->net.extension->conn_hdlr= 0;
|
mysql->extension->conn_hdlr= 0;
|
||||||
memset(&mysql->options, 0, sizeof(struct st_mysql_options));
|
memset(&mysql->options, 0, sizeof(struct st_mysql_options));
|
||||||
mariadb_api->mysql_close(mysql);
|
mariadb_api->mysql_close(mysql);
|
||||||
}
|
}
|
||||||
@@ -421,7 +421,7 @@ my_bool aurora_find_replica(AURORA *aurora)
|
|||||||
mysql->options= aurora->save_mysql.options;
|
mysql->options= aurora->save_mysql.options;
|
||||||
|
|
||||||
/* don't execute init_command on slave */
|
/* don't execute init_command on slave */
|
||||||
// mysql->net.extension->conn_hdlr= aurora->save_mysql.net.extension->conn_hdlr;
|
// mysql->extension->conn_hdlr= aurora->save_mysql.extension->conn_hdlr;
|
||||||
if ((aurora_connect_instance(aurora, instance[random_pick], mysql)))
|
if ((aurora_connect_instance(aurora, instance[random_pick], mysql)))
|
||||||
{
|
{
|
||||||
switch (instance[random_pick]->type) {
|
switch (instance[random_pick]->type) {
|
||||||
@@ -522,7 +522,7 @@ MYSQL *aurora_connect(MYSQL *mysql, const char *host, const char *user, const ch
|
|||||||
const char *db, unsigned int port, const char *unix_socket, unsigned long client_flag)
|
const char *db, unsigned int port, const char *unix_socket, unsigned long client_flag)
|
||||||
{
|
{
|
||||||
AURORA *aurora= NULL;
|
AURORA *aurora= NULL;
|
||||||
MA_CONNECTION_HANDLER *save_hdlr= mysql->net.extension->conn_hdlr;
|
MA_CONNECTION_HANDLER *save_hdlr= mysql->extension->conn_hdlr;
|
||||||
|
|
||||||
if (!mariadb_api)
|
if (!mariadb_api)
|
||||||
mariadb_api= mysql->methods->api;
|
mariadb_api= mysql->methods->api;
|
||||||
@@ -564,7 +564,7 @@ MYSQL *aurora_connect(MYSQL *mysql, const char *host, const char *user, const ch
|
|||||||
if (!aurora_find_replica(aurora))
|
if (!aurora_find_replica(aurora))
|
||||||
aurora->mysql[AURORA_REPLICA]= NULL;
|
aurora->mysql[AURORA_REPLICA]= NULL;
|
||||||
else
|
else
|
||||||
aurora->mysql[AURORA_REPLICA]->net.extension->conn_hdlr= save_hdlr;
|
aurora->mysql[AURORA_REPLICA]->extension->conn_hdlr= save_hdlr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!aurora->mysql[AURORA_PRIMARY])
|
if (!aurora->mysql[AURORA_PRIMARY])
|
||||||
@@ -572,7 +572,7 @@ MYSQL *aurora_connect(MYSQL *mysql, const char *host, const char *user, const ch
|
|||||||
if (!aurora_find_primary(aurora))
|
if (!aurora_find_primary(aurora))
|
||||||
aurora->mysql[AURORA_PRIMARY]= NULL;
|
aurora->mysql[AURORA_PRIMARY]= NULL;
|
||||||
else
|
else
|
||||||
aurora->mysql[AURORA_PRIMARY]->net.extension->conn_hdlr= save_hdlr;
|
aurora->mysql[AURORA_PRIMARY]->extension->conn_hdlr= save_hdlr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!aurora->mysql[AURORA_PRIMARY] && !aurora->mysql[AURORA_REPLICA])
|
if (!aurora->mysql[AURORA_PRIMARY] && !aurora->mysql[AURORA_REPLICA])
|
||||||
@@ -582,7 +582,7 @@ MYSQL *aurora_connect(MYSQL *mysql, const char *host, const char *user, const ch
|
|||||||
aurora_switch_connection(mysql, aurora, AURORA_PRIMARY);
|
aurora_switch_connection(mysql, aurora, AURORA_PRIMARY);
|
||||||
else
|
else
|
||||||
aurora_switch_connection(mysql, aurora, AURORA_REPLICA);
|
aurora_switch_connection(mysql, aurora, AURORA_REPLICA);
|
||||||
mysql->net.extension->conn_hdlr= save_hdlr;
|
mysql->extension->conn_hdlr= save_hdlr;
|
||||||
return mysql;
|
return mysql;
|
||||||
error:
|
error:
|
||||||
aurora_close_memory(aurora);
|
aurora_close_memory(aurora);
|
||||||
@@ -594,7 +594,7 @@ error:
|
|||||||
my_bool aurora_reconnect(MYSQL *mysql)
|
my_bool aurora_reconnect(MYSQL *mysql)
|
||||||
{
|
{
|
||||||
AURORA *aurora;
|
AURORA *aurora;
|
||||||
MA_CONNECTION_HANDLER *save_hdlr= mysql->net.extension->conn_hdlr;
|
MA_CONNECTION_HANDLER *save_hdlr= mysql->extension->conn_hdlr;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* We can't determine if a new primary was promotoed, or if
|
/* We can't determine if a new primary was promotoed, or if
|
||||||
@@ -647,7 +647,7 @@ my_bool aurora_reconnect(MYSQL *mysql)
|
|||||||
/* {{{ void aurora_close */
|
/* {{{ void aurora_close */
|
||||||
void aurora_close(MYSQL *mysql)
|
void aurora_close(MYSQL *mysql)
|
||||||
{
|
{
|
||||||
MA_CONNECTION_HANDLER *hdlr= mysql->net.extension->conn_hdlr;
|
MA_CONNECTION_HANDLER *hdlr= mysql->extension->conn_hdlr;
|
||||||
AURORA *aurora;
|
AURORA *aurora;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -675,7 +675,7 @@ void aurora_close(MYSQL *mysql)
|
|||||||
/* free information */
|
/* free information */
|
||||||
end:
|
end:
|
||||||
aurora_close_memory(aurora);
|
aurora_close_memory(aurora);
|
||||||
mysql->net.extension->conn_hdlr= hdlr;
|
mysql->extension->conn_hdlr= hdlr;
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
@@ -718,7 +718,7 @@ my_bool is_replica_stmt(MYSQL *mysql, const char *buffer)
|
|||||||
int aurora_command(MYSQL *mysql,enum enum_server_command command, const char *arg,
|
int aurora_command(MYSQL *mysql,enum enum_server_command command, const char *arg,
|
||||||
size_t length, my_bool skipp_check, void *opt_arg)
|
size_t length, my_bool skipp_check, void *opt_arg)
|
||||||
{
|
{
|
||||||
MA_CONNECTION_HANDLER *save_hdlr= mysql->net.extension->conn_hdlr;
|
MA_CONNECTION_HANDLER *save_hdlr= mysql->extension->conn_hdlr;
|
||||||
AURORA *aurora= (AURORA *)save_hdlr->data;
|
AURORA *aurora= (AURORA *)save_hdlr->data;
|
||||||
|
|
||||||
/* if we don't have slave or slave became unavailable root traffic to master */
|
/* if we don't have slave or slave became unavailable root traffic to master */
|
||||||
@@ -736,9 +736,9 @@ int aurora_command(MYSQL *mysql,enum enum_server_command command, const char *ar
|
|||||||
/* we need to change default database on primary and replica */
|
/* we need to change default database on primary and replica */
|
||||||
if (aurora->mysql[AURORA_REPLICA] && mysql->thread_id == aurora->mysql[AURORA_PRIMARY]->thread_id)
|
if (aurora->mysql[AURORA_REPLICA] && mysql->thread_id == aurora->mysql[AURORA_PRIMARY]->thread_id)
|
||||||
{
|
{
|
||||||
aurora->mysql[AURORA_REPLICA]->net.extension->conn_hdlr= 0;
|
aurora->mysql[AURORA_REPLICA]->extension->conn_hdlr= 0;
|
||||||
mariadb_api->mysql_select_db(aurora->mysql[AURORA_REPLICA], arg);
|
mariadb_api->mysql_select_db(aurora->mysql[AURORA_REPLICA], arg);
|
||||||
aurora->mysql[AURORA_REPLICA]->net.extension->conn_hdlr= mysql->net.extension->conn_hdlr;
|
aurora->mysql[AURORA_REPLICA]->extension->conn_hdlr= mysql->extension->conn_hdlr;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case COM_QUERY:
|
case COM_QUERY:
|
||||||
@@ -763,7 +763,7 @@ int aurora_command(MYSQL *mysql,enum enum_server_command command, const char *ar
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
end:
|
end:
|
||||||
mysql->net.extension->conn_hdlr= save_hdlr;
|
mysql->extension->conn_hdlr= save_hdlr;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
@@ -182,7 +182,7 @@ MYSQL *repl_connect(MYSQL *mysql, const char *host, const char *user, const char
|
|||||||
const char *db, unsigned int port, const char *unix_socket, unsigned long clientflag)
|
const char *db, unsigned int port, const char *unix_socket, unsigned long clientflag)
|
||||||
{
|
{
|
||||||
REPL_DATA *data= NULL;
|
REPL_DATA *data= NULL;
|
||||||
MA_CONNECTION_HANDLER *hdlr= mysql->net.extension->conn_hdlr;
|
MA_CONNECTION_HANDLER *hdlr= mysql->extension->conn_hdlr;
|
||||||
|
|
||||||
if (!mariadb_api)
|
if (!mariadb_api)
|
||||||
mariadb_api= mysql->methods->api;
|
mariadb_api= mysql->methods->api;
|
||||||
@@ -243,7 +243,7 @@ error:
|
|||||||
|
|
||||||
void repl_close(MYSQL *mysql)
|
void repl_close(MYSQL *mysql)
|
||||||
{
|
{
|
||||||
MA_CONNECTION_HANDLER *hdlr= mysql->net.extension->conn_hdlr;
|
MA_CONNECTION_HANDLER *hdlr= mysql->extension->conn_hdlr;
|
||||||
REPL_DATA *data= (REPL_DATA *)hdlr->data;
|
REPL_DATA *data= (REPL_DATA *)hdlr->data;
|
||||||
|
|
||||||
/* restore master */
|
/* restore master */
|
||||||
@@ -262,7 +262,7 @@ void repl_close(MYSQL *mysql)
|
|||||||
/* free masrwe information and close connection */
|
/* free masrwe information and close connection */
|
||||||
free(data->url);
|
free(data->url);
|
||||||
free(data);
|
free(data);
|
||||||
mysql->net.extension->conn_hdlr->data= NULL;
|
mysql->extension->conn_hdlr->data= NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static my_bool is_slave_command(const char *buffer, size_t buffer_len)
|
static my_bool is_slave_command(const char *buffer, size_t buffer_len)
|
||||||
@@ -300,7 +300,7 @@ static my_bool is_slave_stmt(MYSQL *mysql, const char *buffer)
|
|||||||
int repl_command(MYSQL *mysql,enum enum_server_command command, const char *arg,
|
int repl_command(MYSQL *mysql,enum enum_server_command command, const char *arg,
|
||||||
size_t length, my_bool skipp_check, void *opt_arg)
|
size_t length, my_bool skipp_check, void *opt_arg)
|
||||||
{
|
{
|
||||||
REPL_DATA *data= (REPL_DATA *)mysql->net.extension->conn_hdlr->data;
|
REPL_DATA *data= (REPL_DATA *)mysql->extension->conn_hdlr->data;
|
||||||
|
|
||||||
/* if we don't have slave or slave became unavailable root traffic to master */
|
/* if we don't have slave or slave became unavailable root traffic to master */
|
||||||
if (!data->pvio[MARIADB_SLAVE] || !data->read_only)
|
if (!data->pvio[MARIADB_SLAVE] || !data->read_only)
|
||||||
@@ -333,7 +333,7 @@ int repl_command(MYSQL *mysql,enum enum_server_command command, const char *arg,
|
|||||||
|
|
||||||
int repl_set_options(MYSQL *mysql, enum mysql_option option, void *arg)
|
int repl_set_options(MYSQL *mysql, enum mysql_option option, void *arg)
|
||||||
{
|
{
|
||||||
REPL_DATA *data= (REPL_DATA *)mysql->net.extension->conn_hdlr->data;
|
REPL_DATA *data= (REPL_DATA *)mysql->extension->conn_hdlr->data;
|
||||||
|
|
||||||
switch(option) {
|
switch(option) {
|
||||||
case MARIADB_OPT_CONNECTION_READ_ONLY:
|
case MARIADB_OPT_CONNECTION_READ_ONLY:
|
||||||
|
@@ -913,7 +913,6 @@ static int test_get_options(MYSQL *my)
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct my_tests_st my_tests[] = {
|
struct my_tests_st my_tests[] = {
|
||||||
/*
|
|
||||||
{"test_get_options", test_get_options, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
{"test_get_options", test_get_options, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||||
{"test_wrong_bind_address", test_wrong_bind_address, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
{"test_wrong_bind_address", test_wrong_bind_address, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||||
{"test_bind_address", test_bind_address, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
{"test_bind_address", test_bind_address, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||||
@@ -927,7 +926,7 @@ struct my_tests_st my_tests[] = {
|
|||||||
{"test_compress", test_compress, TEST_CONNECTION_NONE, 0, NULL, NULL},
|
{"test_compress", test_compress, TEST_CONNECTION_NONE, 0, NULL, NULL},
|
||||||
{"test_reconnect", test_reconnect, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
{"test_reconnect", test_reconnect, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||||
{"test_conc21", test_conc21, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
{"test_conc21", test_conc21, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||||
{"test_conc26", test_conc26, TEST_CONNECTION_NONE, 0, NULL, NULL}, */
|
{"test_conc26", test_conc26, TEST_CONNECTION_NONE, 0, NULL, NULL},
|
||||||
{"test_connection_timeout", test_connection_timeout, TEST_CONNECTION_NONE, 0, NULL, NULL},
|
{"test_connection_timeout", test_connection_timeout, TEST_CONNECTION_NONE, 0, NULL, NULL},
|
||||||
{"test_connection_timeout2", test_connection_timeout2, TEST_CONNECTION_NONE, 0, NULL, NULL},
|
{"test_connection_timeout2", test_connection_timeout2, TEST_CONNECTION_NONE, 0, NULL, NULL},
|
||||||
{"test_connection_timeout3", test_connection_timeout3, TEST_CONNECTION_NONE, 0, NULL, NULL},
|
{"test_connection_timeout3", test_connection_timeout3, TEST_CONNECTION_NONE, 0, NULL, NULL},
|
||||||
|
@@ -1023,13 +1023,14 @@ static int test_remote1(MYSQL *mysql)
|
|||||||
|
|
||||||
static int test_remote2(MYSQL *my)
|
static int test_remote2(MYSQL *my)
|
||||||
{
|
{
|
||||||
MYSQL *mysql= mysql_init(NULL);
|
MYSQL *mysql;
|
||||||
|
|
||||||
if (!remote_plugin)
|
if (!remote_plugin)
|
||||||
{
|
{
|
||||||
diag("skip - no remote io plugin available");
|
diag("skip - no remote io plugin available");
|
||||||
return SKIP;
|
return SKIP;
|
||||||
}
|
}
|
||||||
|
mysql= mysql_init(NULL);
|
||||||
|
|
||||||
mysql_options(mysql, MYSQL_READ_DEFAULT_FILE, "http://localhost/test.cnf");
|
mysql_options(mysql, MYSQL_READ_DEFAULT_FILE, "http://localhost/test.cnf");
|
||||||
mysql_options(mysql, MYSQL_READ_DEFAULT_GROUP, "test");
|
mysql_options(mysql, MYSQL_READ_DEFAULT_GROUP, "test");
|
||||||
|
Reference in New Issue
Block a user