Change max long query time

This commit is contained in:
lazio579 2018-11-19 11:35:24 +08:00
parent 0810424e55
commit 953b25d5ac
8 changed files with 38 additions and 13 deletions

View File

@ -900,6 +900,18 @@ void admin_set_reduce_conns(network_mysqld_con* con, int mode)
}
}
void admin_set_server_conn_refresh(network_mysqld_con* con)
{
g_message("%s:call admin_set_server_conn_refresh", G_STRLOC);
if (con->is_admin_client) {
return;
}
con->srv->need_to_refresh_server_connections = 1;
network_mysqld_con_send_ok_full(con->client, 1, 0, 2, 0);
}
void admin_set_maintain(network_mysqld_con* con, int mode)
{
if (con->is_admin_client) {
@ -1656,6 +1668,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},
{"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},
{"show variables [like '%pattern%']", NULL, ALL_HELP},

View File

@ -26,6 +26,7 @@ void admin_set_maintain(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);
void admin_set_server_conn_refresh(network_mysqld_con* con);
void admin_select_version(network_mysqld_con* con);
void admin_select_connection_stat(network_mysqld_con* con, int backend_ndx, char *user);
void admin_select_user_password(network_mysqld_con* con, char* from_table, char *user);

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 ::= REFRESH_CONNS SEMI. {
admin_set_server_conn_refresh(con);
}
cmd ::= SHOW MAINTAIN STATUS SEMI. {
admin_show_maintain(con);
}
@ -487,5 +490,5 @@ cmd ::=REMOVE BACKEND WHERE equation(Z) SEMI. {
char* val = token_strdup(Z.right);
admin_delete_backend(con, key, val);
free(key);
free(val);
}
free(val);
}

View File

@ -64,6 +64,7 @@
"deny_ip" return TK_DENY_IP;
"conn_details" return TK_CONN_DETAILS;
"version" return TK_VERSION;
"refresh_conns" return TK_REFRESH_CONNS;
"get" return TK_GET;
"user" return TK_USER;
"password" return TK_PASSWORD;

View File

@ -55,7 +55,7 @@ typedef struct chassis chassis;
#define MAX_SERVER_NUM_FOR_PREPARE 32
#define MAX_WORK_PROCESSES 64
#define MAX_WORK_PROCESSES_SHIFT 6
#define MAX_QUERY_TIME 1000
#define MAX_QUERY_TIME 65536
#define MAX_WAIT_TIME 1024
#define MAX_TRY_NUM 6
#define MAX_CREATE_CONN_NUM 512

View File

@ -198,7 +198,7 @@ chassis_frontend_new(void)
frontend->default_query_cache_timeout = 100;
frontend->client_idle_timeout = 8 * HOURS;
frontend->maintained_client_idle_timeout = 30;
frontend->long_query_time = MAX_QUERY_TIME;
frontend->long_query_time = 1000;
frontend->cetus_max_allowed_packet = MAX_ALLOWED_PACKET_DEFAULT;
frontend->disable_dns_cache = 0;
@ -764,15 +764,21 @@ init_parameters(struct chassis_frontend_t *frontend, chassis *srv)
srv->check_dns = frontend->check_dns;
if (frontend->trx_isolation_level != NULL) {
if (strcasecmp(frontend->trx_isolation_level, "REPEATABLE READ") == 0) {
if (strcasecmp(frontend->trx_isolation_level, "REPEATABLE READ") == 0 ||
strcasecmp(frontend->trx_isolation_level, "REPEATABLE-READ"))
{
srv->internal_trx_isolation_level = TF_REPEATABLE_READ;
srv->trx_isolation_level = g_strdup("REPEATABLE READ");
} else if (strcasecmp(frontend->trx_isolation_level, "READ COMMITTED") == 0) {
srv->trx_isolation_level = g_strdup("REPEATABLE-READ");
} else if (strcasecmp(frontend->trx_isolation_level, "READ COMMITTED") == 0 ||
strcasecmp(frontend->trx_isolation_level, "READ-COMMITTED") == 0)
{
srv->internal_trx_isolation_level = TF_READ_COMMITTED;
srv->trx_isolation_level = g_strdup("READ COMMITTED");
} else if (strcasecmp(frontend->trx_isolation_level, "READ UNCOMMITTED") == 0) {
srv->trx_isolation_level = g_strdup("READ-COMMITTED");
} else if (strcasecmp(frontend->trx_isolation_level, "READ UNCOMMITTED") == 0 ||
strcasecmp(frontend->trx_isolation_level, "READ-UNCOMMITTED") == 0)
{
srv->internal_trx_isolation_level = TF_READ_UNCOMMITTED;
srv->trx_isolation_level = g_strdup("READ UNCOMMITTED");
srv->trx_isolation_level = g_strdup("READ-UNCOMMITTED");
} else if (strcasecmp(frontend->trx_isolation_level, "SERIALIZABLE") == 0) {
srv->internal_trx_isolation_level = TF_SERIALIZABLE;
srv->trx_isolation_level = g_strdup("SERIALIZABLE");
@ -780,12 +786,12 @@ init_parameters(struct chassis_frontend_t *frontend, chassis *srv)
srv->internal_trx_isolation_level = TF_READ_COMMITTED;
g_warning("trx isolation level:%s is not expected, use READ COMMITTED instead",
frontend->trx_isolation_level);
srv->trx_isolation_level = g_strdup("READ COMMITTED");
srv->trx_isolation_level = g_strdup("READ-COMMITTED");
}
} else {
g_message("trx isolation level is not set");
srv->internal_trx_isolation_level = TF_READ_COMMITTED;
srv->trx_isolation_level = g_strdup("READ COMMITTED");
srv->trx_isolation_level = g_strdup("READ-COMMITTED");
}
g_message("trx isolation level value:%s", srv->trx_isolation_level);

View File

@ -255,7 +255,7 @@ network_pool_add_conn(network_mysqld_con *con, int is_swap)
CHECK_PENDING_EVENT(&(con->server->event));
if (con->srv->server_conn_refresh_time <= con->server->create_time) {
g_debug("%s: add conn fd:%d to pool:%p ", G_STRLOC, con->server->fd, backend->pool);
g_debug("%s: add conn fd:%d to pool:%p ", G_STRLOC, con->server->fd, st->backend->pool);
con->server->is_multi_stmt_set = con->client->is_multi_stmt_set;
network_pool_add_idle_conn(st->backend->pool, con->srv, con->server);
} else {

View File

@ -5130,6 +5130,7 @@ check_old_server_connection(gpointer data, gpointer user_data)
chas->complement_conn_flag = 1;
network_connection_pool_remove(entry);
g_message("%s: call check_old_server_connection", G_STRLOC);
}
static void