Better hanlding of configuration file

Bug fixes:
proxysql stop/start was causing a crash when trying to read from a config file already closed
fixed a typo in server_capabilities
mysql_threads can now be changed if the MySQL module is not running
pull/248/head
René Cannaò 11 years ago
parent e6c37eca3e
commit 4ebd9e15d2

@ -456,7 +456,7 @@ bool Standard_MySQL_Threads_Handler::set_variable(char *name, char *value) { //
return false;
}
}
if (!strcmp(name,"server_capbilities")) {
if (!strcmp(name,"server_capabilities")) {
int intv=atoi(value);
if (intv > 10 && intv <= 65535) {
variables.server_capabilities=intv;
@ -494,7 +494,7 @@ bool Standard_MySQL_Threads_Handler::set_variable(char *name, char *value) { //
}
if (!strcmp(name,"threads")) {
unsigned int intv=atoi(value);
if ((num_threads==0 || num_threads==intv) && intv > 0 && intv < 128) {
if ((num_threads==0 || num_threads==intv || mysql_threads==NULL) && intv > 0 && intv < 256) {
num_threads=intv;
return true;
} else {
@ -597,6 +597,7 @@ Standard_MySQL_Threads_Handler::~Standard_MySQL_Threads_Handler() {
if (variables.default_schema) free(variables.default_schema);
if (variables.server_version) free(variables.server_version);
free(mysql_threads);
mysql_threads=NULL;
}
//extern Standard_MySQL_Threads_Handler *GloMTH;

@ -1580,12 +1580,22 @@ bool Standard_ProxySQL_Admin::init() {
#endif /* DEBUG */
if (GloVars.__cmd_proxysql_reload || GloVars.__cmd_proxysql_initial) {
if (GloVars.configfile_open) {
Read_MySQL_Servers_from_configfile();
Read_MySQL_Users_from_configfile();
Read_Global_Variables_from_configfile("admin");
Read_Global_Variables_from_configfile("mysql");
__insert_or_replace_disktable_select_maintable();
if (GloVars.configfile_open) {
if (GloVars.confFile->cfg) {
Read_MySQL_Servers_from_configfile();
Read_MySQL_Users_from_configfile();
Read_Global_Variables_from_configfile("admin");
Read_Global_Variables_from_configfile("mysql");
__insert_or_replace_disktable_select_maintable();
} else {
if (GloVars.confFile->OpenFile(GloVars.config_file)==true) {
Read_MySQL_Servers_from_configfile();
Read_MySQL_Users_from_configfile();
Read_Global_Variables_from_configfile("admin");
Read_Global_Variables_from_configfile("mysql");
__insert_or_replace_disktable_select_maintable();
}
}
}
}
flush_admin_variables___database_to_runtime(admindb,true);

@ -79,6 +79,7 @@ bool ProxySQL_ConfigFile::OpenFile(const char *__filename) {
void ProxySQL_ConfigFile::CloseFile() {
delete cfg;
cfg=NULL;
}
bool ProxySQL_ConfigFile::ReadGlobals() {

Loading…
Cancel
Save