Remove repurposing of servers

This was not very safe or correct. For example statistics and parameters
were reused by a new server.
This commit is contained in:
Markus Mäkelä 2018-08-16 21:28:06 +03:00
parent 6a06654ee9
commit eddae78b42
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19
3 changed files with 1 additions and 50 deletions

View File

@ -375,23 +375,6 @@ inline bool server_is_disk_space_exhausted(const SERVER* server)
*/
extern SERVER* server_alloc(const char *name, MXS_CONFIG_PARAMETER* params);
/**
* @brief Find a server that can be reused
*
* A server that has been destroyed will not be deleted but only deactivated.
*
* @param name Name of the server
* @param protocol Protocol used by the server
* @param authenticator The authenticator module of the server
* @param address The network address of the new server
* @param port The port of the new server
*
* @return Repurposed SERVER or NULL if no servers matching the criteria were
* found
* @see runtime_create_server
*/
SERVER* server_repurpose_destroyed(const char *name, const char *protocol, const char *authenticator,
const char *address, const char *port);
/**
* @brief Serialize a server to a file
*

View File

@ -235,18 +235,7 @@ bool runtime_create_server(const char *name, const char *address, const char *po
config_replace_param(&ctx, "authenticator", authenticator);
}
/** First check if this service has been created before */
SERVER *server = server_repurpose_destroyed(name, protocol, authenticator,
address, port);
if (server)
{
MXS_INFO("Reusing server '%s'", name);
}
else
{
server = server_alloc(name, ctx.parameters);
}
SERVER *server = server_alloc(name, ctx.parameters);
if (server && server_serialize(server))
{

View File

@ -1252,27 +1252,6 @@ bool server_serialize(const SERVER *server)
return rval;
}
SERVER* server_repurpose_destroyed(const char *name, const char *protocol, const char *authenticator,
const char *address, const char *port)
{
Guard guard(server_lock);
for (Server* server : all_servers)
{
if (!server->is_active &&
strcmp(server->name, name) == 0 &&
strcmp(server->protocol, protocol) == 0 &&
strcmp(server->authenticator, authenticator) == 0)
{
snprintf(server->address, sizeof(server->address), "%s", address);
server->port = atoi(port);
server->is_active = true;
return server;
}
}
return nullptr;
}
/**
* Set a status bit in the server under a lock. This ensures synchronization
* with the server monitor thread. Calling this inside the monitor will likely