MXS-1929: Make services destroyable

Services can now be destroyed if they have no active listeners and they
are not linked to servers. When these conditions are met, the service will
be destroyed when the last session for the service is closed.

The closing of a service will close all listeners that were once assigned
to the service. This allows closing of the ports at runtime which
previously was done only on shutdown.

Exposed the command through the REST API but not through MaxAdmin as it is
deprecated.
This commit is contained in:
Markus Mäkelä
2018-07-18 10:03:54 +03:00
parent 18c1ec2678
commit 5a40064826
7 changed files with 163 additions and 4 deletions

View File

@ -40,10 +40,31 @@ SERVICE* service_alloc(const char *name, const char *router, MXS_CONFIG_PARAMETE
/**
* Free a service
*
* @note Must not be called if the service has any active client connections or
* active listeners
*
* @param service Service to free
*/
void service_free(SERVICE* service);
/**
* Mark a service for destruction
*
* Once the service reference count drops down to zero, the service is destroyed.
*
* @param service Service to destroy
*/
void service_destroy(SERVICE *service);
/**
* Check whether a service can be destroyed
*
* @param service Service to check
*
* @return True if service can be destroyed
*/
bool service_can_be_destroyed(SERVICE *service);
/**
* @brief Shut all services down
*