Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkg/helm/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ spec:
{{- with omit .Values.commonLabels "app" }}
{{- . | toYaml | nindent 8 }}
{{- end }}
{{- if or (not (empty .Values.commonAnnotations)) (not .Values.existingSecret) .Values.preferences.enabled .Values.serverDefinitions.enabled }}
{{- if or (not (empty .Values.commonAnnotations)) (empty .Values.auth.existingSecret) .Values.preferences.enabled .Values.serverDefinitions.enabled }}
annotations:
{{- with .Values.commonAnnotations }}
{{- . | toYaml | nindent 8 }}
{{- end }}
{{- if not .Values.existingSecret }}
{{- if empty .Values.auth.existingSecret }}
checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}
{{- end }}
{{- if and .Values.config_local.enabled (empty .Values.config_local.existingSecret) }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
{% if data.vacuum_parallel %}{{ maintenance_options.append('PARALLEL ' + data.vacuum_parallel) or "" }}{% endif %}
{% if data.buffer_usage_limit %}{{ maintenance_options.append('BUFFER_USAGE_LIMIT "' + data.buffer_usage_limit + '"') or "" }}{% endif %}
{% if data.reindex_tablespace %}{{ maintenance_options.append('TABLESPACE ' + conn|qtIdent(data.reindex_tablespace)) or "" }}{% endif %}
{% if data.reindex_concurrently %}{{ maintenance_options.append('CONCURRENTLY') or "" }}{% endif %}
{% if data.op == "VACUUM" %}
VACUUM{% for option in maintenance_options %}{% if loop.first %} ({% endif %}{{ option }}{% if not loop.last %}, {% endif %}{% if loop.last %}){% endif %}{% endfor %}{% if data.schema %} {{ conn|qtIdent(data.schema) }}.{{ conn|qtIdent(data.table) }}{% endif %};
{% endif %}
Expand All @@ -23,9 +22,9 @@ ANALYZE{% for option in maintenance_options %}{% if loop.first %} ({% endif %}{{
{% endif %}
{% if data.op == "REINDEX" %}
{% if index_name %}
REINDEX{% for option in maintenance_options %}{% if loop.first %} ({% endif %}{{ option }}{% if not loop.last %}, {% endif %}{% if loop.last %}){% endif %}{% endfor %} INDEX {{ conn|qtIdent(data.schema, index_name) }};
REINDEX{% for option in maintenance_options %}{% if loop.first %} ({% endif %}{{ option }}{% if not loop.last %}, {% endif %}{% if loop.last %}){% endif %}{% endfor %} INDEX{% if data.reindex_concurrently %} CONCURRENTLY{% endif %} {{ conn|qtIdent(data.schema, index_name) }};
{% else %}
REINDEX{% for option in maintenance_options %}{% if loop.first %} ({% endif %}{{ option }}{% if not loop.last %}, {% endif %}{% if loop.last %}){% endif %}{% endfor %}{% if not data.schema and not data.reindex_system %} DATABASE {{ conn|qtIdent(data.database) }}{% elif not data.schema and data.reindex_system%} SYSTEM {{ conn|qtIdent(data.database) }}{% elif data.schema and not data.table and not data.primary_key and not data.unique_constraint and not data.index and not data.mview %} SCHEMA {{ conn|qtIdent(data.schema) }}{% else %} TABLE {{ conn|qtIdent(data.schema, data.table) }}{% endif %};
REINDEX{% for option in maintenance_options %}{% if loop.first %} ({% endif %}{{ option }}{% if not loop.last %}, {% endif %}{% if loop.last %}){% endif %}{% endfor %}{% if not data.schema and not data.reindex_system %} DATABASE{% if data.reindex_concurrently %} CONCURRENTLY{% endif %} {{ conn|qtIdent(data.database) }}{% elif not data.schema and data.reindex_system%} SYSTEM {{ conn|qtIdent(data.database) }}{% elif data.schema and not data.table and not data.primary_key and not data.unique_constraint and not data.index and not data.mview %} SCHEMA{% if data.reindex_concurrently %} CONCURRENTLY{% endif %} {{ conn|qtIdent(data.schema) }}{% else %} TABLE{% if data.reindex_concurrently %} CONCURRENTLY{% endif %} {{ conn|qtIdent(data.schema, data.table) }}{% endif %};
Comment thread
coderabbitai[bot] marked this conversation as resolved.
{% endif %}
{% endif %}
{% if data.op == "CLUSTER" %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ class MaintenanceCreateJobTest(BaseTestGenerator):
verbose=True
),
url=MAINTENANCE_URL,
expected_cmd_opts=['REINDEX (VERBOSE, CONCURRENTLY) DATABASE '
expected_cmd_opts=['REINDEX (VERBOSE) DATABASE CONCURRENTLY '
'postgres;\n'],
server_min_version=120000,
message='REINDEX CONCURRENTLY is not supported by EPAS/PG server '
Expand Down Expand Up @@ -606,6 +606,29 @@ class MaintenanceCreateJobTest(BaseTestGenerator):
url=MAINTENANCE_URL,
expected_cmd_opts=['REINDEX (VERBOSE) SCHEMA my_schema;\n'],
)),
('When maintenance the object with the REINDEX CONCURRENTLY SCHEMA',
dict(
class_params=dict(
sid=1,
name='test_maintenance_server',
port=5444,
host='localhost',
username='postgres'
),
params=dict(
database='postgres',
schema='my_schema',
op='REINDEX',
reindex_concurrently=True,
verbose=True
),
url=MAINTENANCE_URL,
expected_cmd_opts=['REINDEX (VERBOSE) SCHEMA CONCURRENTLY '
'my_schema;\n'],
server_min_version=120000,
message='REINDEX CONCURRENTLY SCHEMA is not supported by '
'EPAS/PG server less than 12.0'
)),
('When maintenance the object with the REINDEX TABLE',
dict(
class_params=dict(
Expand Down Expand Up @@ -643,7 +666,7 @@ class MaintenanceCreateJobTest(BaseTestGenerator):
verbose=True
),
url=MAINTENANCE_URL,
expected_cmd_opts=['REINDEX (VERBOSE, CONCURRENTLY) TABLE '
expected_cmd_opts=['REINDEX (VERBOSE) TABLE CONCURRENTLY '
'my_schema.my_table;\n'],
server_min_version=120000,
message='REINDEX CONCURRENTLY TABLE is not supported by '
Expand Down Expand Up @@ -710,7 +733,7 @@ class MaintenanceCreateJobTest(BaseTestGenerator):
verbose=True
),
url=MAINTENANCE_URL,
expected_cmd_opts=['REINDEX (VERBOSE, CONCURRENTLY) INDEX '
expected_cmd_opts=['REINDEX (VERBOSE) INDEX CONCURRENTLY '
'my_schema.my_index;\n'],
server_min_version=120000,
message='REINDEX CONCURRENTLY is not supported by EPAS/PG server '
Expand Down
Loading