Only serialize created servers

Any changes to servers that aren't created online need to be manually
added to the configuration file in order for them to take effect after the
restart.
This commit is contained in:
Markus Mäkelä 2016-12-19 18:13:36 +02:00
parent aae84144ea
commit 180728dde6
3 changed files with 9 additions and 1 deletions

View File

@ -117,6 +117,7 @@ typedef struct server
int persistmax; /**< Maximum pool size actually achieved since startup */
uint8_t charset; /**< Default server character set */
bool is_active; /**< Server is active and has not been "destroyed" */
bool created_online; /**< Whether this server was created after startup */
#if defined(SS_DEBUG)
skygw_chk_t server_chk_tail;
#endif

View File

@ -139,6 +139,9 @@ bool runtime_create_server(const char *name, const char *address, const char *po
if (server && server_serialize(server))
{
/** Mark that the server was created after startup */
server->created_online = true;
MXS_NOTICE("Created server '%s' at %s:%u", server->unique_name,
server->name, server->port);
rval = true;
@ -288,7 +291,10 @@ bool runtime_alter_server(SERVER *server, char *key, char *value)
if (valid)
{
server_serialize(server);
if (server->created_online)
{
server_serialize(server);
}
MXS_NOTICE("Updated server '%s': %s=%s", server->unique_name, key, value);
}

View File

@ -136,6 +136,7 @@ SERVER* server_alloc(const char *name, const char *address, unsigned short port,
server->monuser[0] = '\0';
server->monpw[0] = '\0';
server->is_active = true;
server->created_online = false;
server->charset = SERVER_DEFAULT_CHARSET;
spinlock_acquire(&server_spin);