Merge master

This commit is contained in:
lazio579 2018-12-20 08:03:37 +08:00
commit f08817525c
7 changed files with 35 additions and 0 deletions

View File

@ -927,6 +927,20 @@ void admin_set_maintain(network_mysqld_con* con, int mode)
network_mysqld_con_send_ok_full(con->client, affected, 0,2,0);
}
void admin_set_charset_check(network_mysqld_con* con, int mode)
{
if (con->is_admin_client) {
return;
}
int affected = 0;
if (con->srv->charset_check != mode) {
con->srv->charset_check = mode;
affected = 1;
}
network_mysqld_con_send_ok_full(con->client, affected, 0,2,0);
}
void admin_show_maintain(network_mysqld_con* con)
{
if (con->is_processed_by_subordinate) {
@ -1983,6 +1997,7 @@ static struct sql_help_entry_t {
{"delete allow_ip/deny_ip '<user>@<address>'", "delete address from white list of module", ALL_HELP},
{"set reduce_conns (true|false)", "reduce idle connections if set to true", ALL_HELP},
{"set maintain (true|false)", "close all client connections if set to true", ALL_HELP},
{"set charset_check (true|false)", "check the client charset is equal to the default charset", ALL_HELP},
{"refresh conns", "refresh all server connections", ALL_HELP},
{"show maintain status", "show maintain status", ALL_HELP},
{"show status [like '%pattern%']", "show select/update/insert/delete statistics", ALL_HELP},

View File

@ -23,6 +23,7 @@ void admin_acl_add_rule(network_mysqld_con *con, gboolean is_white, char *addr);
void admin_acl_delete_rule(network_mysqld_con *con, gboolean is_white, char* ip);
void admin_set_reduce_conns(network_mysqld_con* con, int mode);
void admin_set_maintain(network_mysqld_con* con, int mode);
void admin_set_charset_check(network_mysqld_con* con, int mode);
void admin_show_maintain(network_mysqld_con* con);
void admin_show_status(network_mysqld_con* con, const char* like);
void admin_show_variables(network_mysqld_con* con, const char* like);

View File

@ -211,6 +211,9 @@ cmd ::= SET REDUCE_CONNS boolean(X) SEMI. {
cmd ::= SET MAINTAIN boolean(X) SEMI. {
admin_set_maintain(con, X);
}
cmd ::= SET CHARSET_CHECK boolean(X) SEMI. {
admin_set_charset_check(con, X);
}
cmd ::= REFRESH_CONNS SEMI. {
admin_set_server_conn_refresh(con);
}

View File

@ -77,6 +77,7 @@
"master" return TK_MASTER;
"slave" return TK_SLAVE;
"maintain" return TK_MAINTAIN;
"charset_check" return TK_CHARSET_CHECK;
"status" return TK_STATUS;
"variables" return TK_VARIABLES;
"conn_num" return TK_CONN_NUM;

View File

@ -834,6 +834,13 @@ adjust_charset(network_mysqld_con *con, mysqld_query_attr_t *query_attr)
g_string_assign_len(con->server->charset, charset->str, charset->len);
}
if (con->srv->charset_check) {
if (strcmp(con->client->charset->str, con->srv->default_charset) != 0) {
g_message("%s: client charset:%s, default charset:%s, client address:%s", G_STRLOC,
con->client->charset->str, con->srv->default_charset, con->client->src->name->str);
}
}
if (!query_attr->charset_client_set) {
if (!g_string_equal(con->client->charset_client, con->server->charset_client)) {
if (con->client->charset_client->len > 0) {

View File

@ -1607,6 +1607,13 @@ check_and_set_attr_bitmap(network_mysqld_con *con)
g_warning("%s: not support different sql modes", G_STRLOC);
}
if (con->srv->charset_check) {
if (strcmp(con->client->charset->str, con->srv->default_charset) != 0) {
g_message("%s: client charset:%s, default charset:%s, client address:%s", G_STRLOC,
con->client->charset->str, con->srv->default_charset, con->client->src->name->str);
}
}
if (!g_string_equal(con->client->charset, ss->server->charset)) {
ss->attr_diff |= ATTR_DIF_CHARSET;
con->unmatched_attribute |= ATTR_DIF_CHARSET;

View File

@ -150,6 +150,7 @@ struct chassis {
unsigned int is_manual_down:1;
unsigned int is_reduce_conns:1;
unsigned int xa_log_detailed:1;
unsigned int charset_check:1;
unsigned int check_slave_delay:1;
unsigned int complement_conn_flag:1;
unsigned int disable_dns_cache:1;