CLIP-1510: Update hikari properties

This commit is contained in:
Adam Brokes 2022-07-29 09:42:50 +10:00
parent 1070b8fac4
commit ca5050cf02
No known key found for this signature in database
GPG Key ID: D0853F559CE0213B
2 changed files with 36 additions and 16 deletions

View File

@ -11,13 +11,6 @@
<property name="webwork.multipart.saveDir">${localHome}/temp</property>
<property name="attachments.dir">${confluenceHome}/attachments</property>
{# Confluence versions 7.13 and newer #}
{% if (confluence_version.split(".")[0] | int() == 7 and confluence_version.split(".")[1] | int() <= 13) or confluence_version.split(".")[0] | int() < 7 %}
{% set db_pool_variable = "c3p0" %}
{% else %}
{% set db_pool_variable = "hikari" %}
{% endif %}
<property name="lucene.index.dir">{{ atl_lucene_index_dir | default('${confluenceHome}/index') }}</property>
{# We need mappings for "oracle12c" and "oracle" to remain backwards compatible with Confluence 7.3.0 and earlier. Oracle 19c support was added in Confluence 7.3.1 and changed the database type name for oracle databases from "oracle12c" to "oracle" #}
@ -37,14 +30,23 @@
<property name="hibernate.connection.driver_class">{{ databases[atl_db_type][0] }}</property>
<property name="hibernate.dialect">com.atlassian.confluence.impl.hibernate.dialect.{{ databases[atl_db_type][1] }}</property>
<property name="hibernate.{{ db_pool_variable }}.min_size">{{ atl_db_poolminsize | default('20') }}</property>
<property name="hibernate.{{ db_pool_variable }}.max_size">{{ atl_db_poolmaxsize | default('100') }}</property>
<property name="hibernate.{{ db_pool_variable }}.timeout">{{ atl_db_timeout | default('30') }}</property>
<property name="hibernate.{{ db_pool_variable }}.idle_test_period">{{ atl_db_idletestperiod | default('100') }}</property>
<property name="hibernate.{{ db_pool_variable }}.max_statements">{{ atl_db_maxstatements | default('0') }}</property>
<property name="hibernate.{{ db_pool_variable }}.validate">{{ atl_db_validate | default('true') }}</property>
<property name="hibernate.{{ db_pool_variable }}.acquire_increment">{{ atl_db_acquireincrement | default('1') }}</property>
<property name="hibernate.{{ db_pool_variable }}.preferredTestQuery">{{ atl_db_validationquery | default('select 1') }}</property>
{# Confluence versions 7.13 and newer #}
{% if (confluence_version.split(".")[0] | int() == 7 and confluence_version.split(".")[1] | int() <= 13) or confluence_version.split(".")[0] | int() < 7 %}
<property name="hibernate.c3p0.min_size">{{ atl_db_poolminsize | default('20') }}</property>
<property name="hibernate.c3p0.max_size">{{ atl_db_poolmaxsize | default('100') }}</property>
<property name="hibernate.c3p0.timeout">{{ atl_db_timeout | default('30') }}</property>
<property name="hibernate.c3p0.idle_test_period">{{ atl_db_idletestperiod | default('100') }}</property>
<property name="hibernate.c3p0.max_statements">{{ atl_db_maxstatements | default('0') }}</property>
<property name="hibernate.c3p0.validate">{{ atl_db_validate | default('true') }}</property>
<property name="hibernate.c3p0.acquire_increment">{{ atl_db_acquireincrement | default('1') }}</property>
<property name="hibernate.c3p0.preferredTestQuery">{{ atl_db_validationquery | default('select 1') }}</property>
{% else %}
<property name="hibernate.hikari.idleTimeout">{{ (atl_db_timeout | default(30)) * 1000 }}</property>
<property name="hibernate.hikari.maximumPoolSize">{{ atl_db_poolmaxsize | default('100') }}</property>
<property name="hibernate.hikari.minimumIdle">{{ atl_db_poolminsize | default('20') }}</property>
<property name="hibernate.hikari.registerMbeans">true</property>
{% endif %}
{% endif %}
{% if atl_cluster_type is defined %}

View File

@ -498,6 +498,20 @@ def test_confluence_xml_force_overwrite(docker_cli, image, run_user):
assert xml.findall('.//property[@name="confluence.webapp.context.path"]')[0].text == "/myconf"
expected_db_properties = {
'hikari': {
'hibernate.hikari.idleTimeout': '30000',
'hibernate.hikari.registerMbeans': 'true',
'hibernate.hikari.maximumPoolSize': '100',
'hibernate.hikari.minimumIdle': '20',
},
'c3p0': {
'hibernate.c3p0.min_size': '20',
'hibernate.c3p0.max_size': '100',
'hibernate.c3p0.timeout': '30',
}
}
@pytest.mark.parametrize("version,db_property", [('7.13.7', 'c3p0'), ('7.17.7', 'hikari'), ('6.9.0', 'c3p0'), ('8.0.0', 'hikari')])
def test_confluence_db_pool_property(docker_cli, image, version, db_property):
environment = {
@ -509,4 +523,8 @@ def test_confluence_db_pool_property(docker_cli, image, version, db_property):
xml = parse_xml(container, f'{get_app_home(container)}/confluence.cfg.xml')
assert xml.findall(f'.//property[@name="hibernate.{db_property}.min_size"]')[0].text == "20"
expected = expected_db_properties[db_property]
for property, expected_value in expected.items():
assert xml.findall(f'.//property[@name="{property}"]')[0].text == expected_value