Browse Source

Add max_connections configuration option

Allow the user to change the number of connections to the database
cluster units to their needs.
The default value is the same as without the configuration option.

Closes-Bug: #1929826
Change-Id: I10556e9d373cd8505c4e2e96d2b6031fe4ee9166
changes/28/819428/3
Olivier Dufour-Cuvillier 6 months ago
parent
commit
01587ab402
  1. 8
      src/config.yaml
  2. 1
      src/lib/charm/openstack/mysql_router.py
  3. 6
      unit_tests/test_lib_charm_openstack_mysql_router.py

8
src/config.yaml

@ -44,3 +44,11 @@ options:
Time (in seconds) until the cache becomes invalid if not refreshed.
Defaults to -1 (infinite). The value must be larger than
auth_cache_refresh_interval else Router won't start.
max_connections:
type: int
default: 512
description: |
Maximum number of connections to allow in direction to each MySQL
routing sessions, with one for the RW unit and another one for the RO
units of the MySQL innodb cluster. Defaults to 512. A valid range is
between 1 and 65535.

1
src/lib/charm/openstack/mysql_router.py

@ -673,6 +673,7 @@ class MySQLRouterCharm(charms_openstack.charm.OpenStackCharm):
},
"DEFAULT": {
"pid_file": self.mysqlrouter_pid_file,
"max_connections": str(self.options.max_connections),
}
}

6
unit_tests/test_lib_charm_openstack_mysql_router.py

@ -695,6 +695,7 @@ class TestMySQLRouterCharm(test_utils.PatchHelper):
"ttl": '5',
"auth_cache_ttl": '10',
"auth_cache_refresh_interval": '7',
"max_connections": '1000',
}
def _fake_config(key=None):
@ -711,10 +712,13 @@ class TestMySQLRouterCharm(test_utils.PatchHelper):
mrc.name = 'foobar'
mrc.update_config_parameters = _mock_update_config_parameters
_metadata_config = _config_data.copy()
_metadata_config.pop('max_connections')
_params = {
'metadata_cache:jujuCluster': _config_data,
'metadata_cache:jujuCluster': _metadata_config,
'DEFAULT': {
'client_ssl_mode': "PASSTHROUGH",
'max_connections': _config_data['max_connections'],
'pid_file': '/run/mysql/mysqlrouter-foobar.pid'
},
}

Loading…
Cancel
Save