In this blog post, we talk about how existing client connections are handled by the Tungsten Connector when a manual master role switch is invoked and how to adjust that behavior.
When a graceful switch is invoked via cctrl or the Tungsten Dashboard, by default the Connector will wait for five (5) seconds to allow in-flight activities to complete before forcibly disconnecting all active connections from the application side, no matter what type of query was in use.
If connections still exist after the timeout interval, they are forcibly closed, and the application will get back an error.
This configuration setting ONLY applies to a manual switch. During a failover caused by loss of MySQL availability, there is no wait and all connections are force-closed immediately.
This timeout is adjusted via the tpm option
connector-disconnect-timeout inside INI files).
If you increase this value, you delay the manual switch!
ONLY change this if you accept the fact that the manual switch process will last at least as long as this setting in seconds.
Please note that updating these values require a connector restart (usually happens automatically via tpm update) for the changes to be recognized. This wil disconnect all existing client application sessions.
Do not set this value to zero (0) or there will be no attempt to disconnect at all.
If you wish to disable the wait entirely, set
--property=waitForDisconnect=false in your configuration on the connector nodes and run
For example, to change the delay to 10 seconds instead of the default 5 seconds:
shell> ./tools/tpm configure alpha --connector-disconnect-timeout=10
shell> ./tools/tpm update
You may grep for the setting
waitForDisconnectTimeout located in
cluster-home/conf/router.properties to confirm the change has been applied.
In future articles, we will continue to cover more advanced subjects of interest!
Questions? Contact Continuent