refine 'config reload' error message

This commit is contained in:
tsthght 2018-07-18 16:11:10 +08:00
parent 125baabc4c
commit 600144c937
3 changed files with 15 additions and 6 deletions

View File

@ -1259,8 +1259,13 @@ void admin_set_config(network_mysqld_con* con, char* key, char* value)
static void admin_reload_settings(network_mysqld_con* con) static void admin_reload_settings(network_mysqld_con* con)
{ {
GList *options = admin_get_all_options(con->srv); GList *options = admin_get_all_options(con->srv);
gint ret = chassis_config_reload_options(con->srv->config_manager);
if (!chassis_config_reload_options(con->srv->config_manager)) { if (ret == -1) {
network_mysqld_con_send_error(con->client,
C("Can't connect to remote or can't get config"));
return;
}
if (ret == -2) {
network_mysqld_con_send_error(con->client, network_mysqld_con_send_error(con->client,
C("Can't load options, only support remote config")); C("Can't load options, only support remote config"));
return; return;

View File

@ -320,14 +320,18 @@ chassis_config_load_options_mysql(chassis_config_t *conf)
return FALSE; return FALSE;
} }
gboolean chassis_config_reload_options(chassis_config_t *conf) gint chassis_config_reload_options(chassis_config_t *conf)
{ {
switch (conf->type) { switch (conf->type) {
case CHASSIS_CONF_MYSQL: case CHASSIS_CONF_MYSQL:
return chassis_config_load_options_mysql(conf); if(chassis_config_load_options_mysql(conf)) {
return 0;
} else {
return -1;
}
default: default:
/* TODO g_critical(G_STRLOC " not implemented"); */ /* TODO g_critical(G_STRLOC " not implemented"); */
return FALSE; return -2;
} }
} }

View File

@ -36,7 +36,7 @@ chassis_config_t *chassis_config_from_local_dir(char *dir, char *conf_file);
void chassis_config_free(chassis_config_t *); void chassis_config_free(chassis_config_t *);
gboolean chassis_config_reload_options(chassis_config_t *conf); gint chassis_config_reload_options(chassis_config_t *conf);
GHashTable *chassis_config_get_options(chassis_config_t *); GHashTable *chassis_config_get_options(chassis_config_t *);