Use shared configurations in readwritesplit
By using a shared pointer instead of a plain object, we can replace the router configuration without it affecting existing sessions. This is a change that is required to enable runtime reconfiguration of readwritesplit.
This commit is contained in:
@ -200,6 +200,8 @@ struct Config
|
||||
bool optimistic_trx; /**< Enable optimistic transactions */
|
||||
};
|
||||
|
||||
typedef std::tr1::shared_ptr<Config> SConfig;
|
||||
|
||||
/**
|
||||
* The statistics for this router instance
|
||||
*/
|
||||
@ -226,11 +228,11 @@ class RWSplit: public mxs::Router<RWSplit, RWSplitSession>
|
||||
RWSplit& operator=(const RWSplit&);
|
||||
|
||||
public:
|
||||
RWSplit(SERVICE* service, const Config& config);
|
||||
RWSplit(SERVICE* service, SConfig config);
|
||||
~RWSplit();
|
||||
|
||||
SERVICE* service() const;
|
||||
const Config& config() const;
|
||||
SConfig config() const;
|
||||
Stats& stats();
|
||||
const Stats& stats() const;
|
||||
int max_slave_count() const;
|
||||
@ -298,7 +300,7 @@ public:
|
||||
|
||||
private:
|
||||
SERVICE* m_service; /**< Service where the router belongs*/
|
||||
Config m_config;
|
||||
SConfig m_config;
|
||||
Stats m_stats;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user