Add reconfiguration to router API
Added a new router API entry point that allows configuration changes after the instance has been created. This makes alterations to most service parameters at runtime possible. An option to reconfiguration would have been the creation of a new service and the eventual destruction of the old one. This would be a more complicated and costly method but from an architectural point of view it is interesting. The actual implementation of the configuration change is left to the router. Currently, only readwritesplit performs reconfiguration as implementing it with versioned configurations is very easy. Versioned configurations can be considered an adequate first step but it is not an optimal solution as it causes a bottleneck in the reference counting of the shared configuration. Thread-specific configuration definitions would make for a more efficient solution but the implementation is more complex.
This commit is contained in:
@ -429,7 +429,14 @@ json_t* RWSplit::diagnostics_json() const
|
||||
uint64_t RWSplit::getCapabilities()
|
||||
{
|
||||
return RCAP_TYPE_STMT_INPUT | RCAP_TYPE_TRANSACTION_TRACKING |
|
||||
RCAP_TYPE_PACKET_OUTPUT | RCAP_TYPE_SESSION_STATE_TRACKING;
|
||||
RCAP_TYPE_PACKET_OUTPUT | RCAP_TYPE_SESSION_STATE_TRACKING |
|
||||
RCAP_TYPE_RUNTIME_CONFIG;
|
||||
}
|
||||
|
||||
bool RWSplit::configure(MXS_CONFIG_PARAMETER* params)
|
||||
{
|
||||
m_config.reset(new Config(params));
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -445,7 +452,8 @@ extern "C" MXS_MODULE *MXS_CREATE_MODULE()
|
||||
"A Read/Write splitting router for enhancement read scalability",
|
||||
"V1.1.0",
|
||||
RCAP_TYPE_STMT_INPUT | RCAP_TYPE_TRANSACTION_TRACKING |
|
||||
RCAP_TYPE_PACKET_OUTPUT | RCAP_TYPE_SESSION_STATE_TRACKING,
|
||||
RCAP_TYPE_PACKET_OUTPUT | RCAP_TYPE_SESSION_STATE_TRACKING |
|
||||
RCAP_TYPE_RUNTIME_CONFIG,
|
||||
&RWSplit::s_object,
|
||||
NULL, /* Process init. */
|
||||
NULL, /* Process finish. */
|
||||
|
@ -298,6 +298,7 @@ public:
|
||||
*/
|
||||
uint64_t getCapabilities();
|
||||
|
||||
bool configure(MXS_CONFIG_PARAMETER* params);
|
||||
private:
|
||||
SERVICE* m_service; /**< Service where the router belongs*/
|
||||
SConfig m_config;
|
||||
|
Reference in New Issue
Block a user