CLIP-1510: Update the the c3p0 database properties to hikari

This commit is contained in:
Adam Brokes 2022-06-16 16:20:46 +10:00
parent e57ce75076
commit 2ae983a0b7
No known key found for this signature in database
GPG Key ID: D0853F559CE0213B
2 changed files with 56 additions and 24 deletions

View File

@ -10,6 +10,12 @@
<property name="confluence.database.connection.type">database-type-standard</property> <property name="confluence.database.connection.type">database-type-standard</property>
<property name="webwork.multipart.saveDir">${localHome}/temp</property> <property name="webwork.multipart.saveDir">${localHome}/temp</property>
<property name="attachments.dir">${confluenceHome}/attachments</property> <property name="attachments.dir">${confluenceHome}/attachments</property>
{% if confluence_version.split(".")[1] | int() <= 13 %}
{% 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> <property name="lucene.index.dir">{{ atl_lucene_index_dir | default('${confluenceHome}/index') }}</property>
@ -30,14 +36,14 @@
<property name="hibernate.connection.driver_class">{{ databases[atl_db_type][0] }}</property> <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.dialect">com.atlassian.confluence.impl.hibernate.dialect.{{ databases[atl_db_type][1] }}</property>
<property name="hibernate.c3p0.min_size">{{ atl_db_poolminsize | default('20') }}</property> <property name="hibernate.{{ db_pool_variable }}.min_size">{{ atl_db_poolminsize | default('20') }}</property>
<property name="hibernate.c3p0.max_size">{{ atl_db_poolmaxsize | default('100') }}</property> <property name="hibernate.{{ db_pool_variable }}.max_size">{{ atl_db_poolmaxsize | default('100') }}</property>
<property name="hibernate.c3p0.timeout">{{ atl_db_timeout | default('30') }}</property> <property name="hibernate.{{ db_pool_variable }}.timeout">{{ atl_db_timeout | default('30') }}</property>
<property name="hibernate.c3p0.idle_test_period">{{ atl_db_idletestperiod | default('100') }}</property> <property name="hibernate.{{ db_pool_variable }}.idle_test_period">{{ atl_db_idletestperiod | default('100') }}</property>
<property name="hibernate.c3p0.max_statements">{{ atl_db_maxstatements | default('0') }}</property> <property name="hibernate.{{ db_pool_variable }}.max_statements">{{ atl_db_maxstatements | default('0') }}</property>
<property name="hibernate.c3p0.validate">{{ atl_db_validate | default('false') }}</property> <property name="hibernate.{{ db_pool_variable }}.validate">{{ atl_db_validate | default('true') }}</property>
<property name="hibernate.c3p0.acquire_increment">{{ atl_db_acquireincrement | default('1') }}</property> <property name="hibernate.{{ db_pool_variable }}.acquire_increment">{{ atl_db_acquireincrement | default('1') }}</property>
<property name="hibernate.c3p0.preferredTestQuery">{{ atl_db_validationquery | default('select 1') }}</property> <property name="hibernate.{{ db_pool_variable }}.preferredTestQuery">{{ atl_db_validationquery | default('select 1') }}</property>
{% endif %} {% endif %}
{% if atl_cluster_type is defined %} {% if atl_cluster_type is defined %}

View File

@ -279,14 +279,14 @@ def test_confluence_xml_postgres(docker_cli, image, run_user):
assert xml.findall('.//property[@name="hibernate.dialect"]')[0].text == "com.atlassian.confluence.impl.hibernate.dialect.PostgreSQLDialect" assert xml.findall('.//property[@name="hibernate.dialect"]')[0].text == "com.atlassian.confluence.impl.hibernate.dialect.PostgreSQLDialect"
assert xml.findall('.//property[@name="hibernate.connection.driver_class"]')[0].text == "org.postgresql.Driver" assert xml.findall('.//property[@name="hibernate.connection.driver_class"]')[0].text == "org.postgresql.Driver"
assert xml.findall('.//property[@name="hibernate.c3p0.min_size"]')[0].text == "20" assert xml.findall('.//property[@name="hibernate.hikari.min_size"]')[0].text == "20"
assert xml.findall('.//property[@name="hibernate.c3p0.max_size"]')[0].text == "100" assert xml.findall('.//property[@name="hibernate.hikari.max_size"]')[0].text == "100"
assert xml.findall('.//property[@name="hibernate.c3p0.timeout"]')[0].text == "30" assert xml.findall('.//property[@name="hibernate.hikari.timeout"]')[0].text == "30"
assert xml.findall('.//property[@name="hibernate.c3p0.idle_test_period"]')[0].text == "100" assert xml.findall('.//property[@name="hibernate.hikari.idle_test_period"]')[0].text == "100"
assert xml.findall('.//property[@name="hibernate.c3p0.max_statements"]')[0].text == "0" assert xml.findall('.//property[@name="hibernate.hikari.max_statements"]')[0].text == "0"
assert xml.findall('.//property[@name="hibernate.c3p0.validate"]')[0].text == "false" assert xml.findall('.//property[@name="hibernate.hikari.validate"]')[0].text == "true"
assert xml.findall('.//property[@name="hibernate.c3p0.acquire_increment"]')[0].text == "1" assert xml.findall('.//property[@name="hibernate.hikari.acquire_increment"]')[0].text == "1"
assert xml.findall('.//property[@name="hibernate.c3p0.preferredTestQuery"]')[0].text == "select 1" assert xml.findall('.//property[@name="hibernate.hikari.preferredTestQuery"]')[0].text == "select 1"
def test_confluence_xml_postgres_all_set(docker_cli, image, run_user): def test_confluence_xml_postgres_all_set(docker_cli, image, run_user):
@ -310,14 +310,14 @@ def test_confluence_xml_postgres_all_set(docker_cli, image, run_user):
xml = parse_xml(container, f'{get_app_home(container)}/confluence.cfg.xml') xml = parse_xml(container, f'{get_app_home(container)}/confluence.cfg.xml')
assert xml.findall('.//property[@name="hibernate.connection.driver_class"]')[0].text == "org.postgresql.Driver" assert xml.findall('.//property[@name="hibernate.connection.driver_class"]')[0].text == "org.postgresql.Driver"
assert xml.findall('.//property[@name="hibernate.dialect"]')[0].text == "com.atlassian.confluence.impl.hibernate.dialect.PostgreSQLDialect" assert xml.findall('.//property[@name="hibernate.dialect"]')[0].text == "com.atlassian.confluence.impl.hibernate.dialect.PostgreSQLDialect"
assert xml.findall('.//property[@name="hibernate.c3p0.min_size"]')[0].text == "x20" assert xml.findall('.//property[@name="hibernate.hikari.min_size"]')[0].text == "x20"
assert xml.findall('.//property[@name="hibernate.c3p0.max_size"]')[0].text == "x100" assert xml.findall('.//property[@name="hibernate.hikari.max_size"]')[0].text == "x100"
assert xml.findall('.//property[@name="hibernate.c3p0.timeout"]')[0].text == "x30" assert xml.findall('.//property[@name="hibernate.hikari.timeout"]')[0].text == "x30"
assert xml.findall('.//property[@name="hibernate.c3p0.idle_test_period"]')[0].text == "x100" assert xml.findall('.//property[@name="hibernate.hikari.idle_test_period"]')[0].text == "x100"
assert xml.findall('.//property[@name="hibernate.c3p0.max_statements"]')[0].text == "x0" assert xml.findall('.//property[@name="hibernate.hikari.max_statements"]')[0].text == "x0"
assert xml.findall('.//property[@name="hibernate.c3p0.validate"]')[0].text == "xfalse" assert xml.findall('.//property[@name="hibernate.hikari.validate"]')[0].text == "xfalse"
assert xml.findall('.//property[@name="hibernate.c3p0.acquire_increment"]')[0].text == "x1" assert xml.findall('.//property[@name="hibernate.hikari.acquire_increment"]')[0].text == "x1"
assert xml.findall('.//property[@name="hibernate.c3p0.preferredTestQuery"]')[0].text == "xselect 1" assert xml.findall('.//property[@name="hibernate.hikari.preferredTestQuery"]')[0].text == "xselect 1"
def test_confluence_xml_cluster_aws(docker_cli, image, run_user): def test_confluence_xml_cluster_aws(docker_cli, image, run_user):
@ -496,3 +496,29 @@ def test_confluence_xml_force_overwrite(docker_cli, image, run_user):
xml = parse_xml(tihost, cfg) xml = parse_xml(tihost, cfg)
assert xml.findall('.//property[@name="confluence.webapp.context.path"]')[0].text == "/myconf" assert xml.findall('.//property[@name="confluence.webapp.context.path"]')[0].text == "/myconf"
def test_confluence_db_pool_version_7_13(docker_cli, image, run_user):
environment = {
'CONFLUENCE_VERSION': '7.13.7',
'ATL_JDBC_URL': 'postgresql:hostname',
'ATL_DB_TYPE': 'postgresql'
}
container = run_image(docker_cli, image, user=run_user, environment=environment)
xml = parse_xml(container, f'{get_app_home(container)}/confluence.cfg.xml')
assert xml.findall('.//property[@name="hibernate.c3p0.min_size"]')[0].text == "20"
def test_confluence_db_pool_version_7_14(docker_cli, image, run_user):
environment = {
'CONFLUENCE_VERSION': '7.17.7',
'ATL_JDBC_URL': 'postgresql:hostname',
'ATL_DB_TYPE': 'postgresql'
}
container = run_image(docker_cli, image, user=run_user, environment=environment)
xml = parse_xml(container, f'{get_app_home(container)}/confluence.cfg.xml')
assert xml.findall('.//property[@name="hibernate.hikari.min_size"]')[0].text == "20"