diff --git a/src/charm.py b/src/charm.py index da921284c4..f4594ec698 100755 --- a/src/charm.py +++ b/src/charm.py @@ -83,6 +83,7 @@ PATRONI_CONF_PATH, PATRONI_PASSWORD_KEY, PEER, + PGPARAMS_DEFAULTS, PLUGIN_OVERRIDES, POSTGRESQL_SNAP_NAME, RAFT_PASSWORD_KEY, @@ -1996,6 +1997,12 @@ def update_config(self, is_creating_backup: bool = False, no_peers: bool = False pg_parameters = self.postgresql.build_postgresql_parameters( self.model.config, self.get_available_memory(), limit_memory ) + defaults = [] + for pg_param in pg_parameters: + if PGPARAMS_DEFAULTS.get(pg_param) == pg_parameters[pg_param]: + defaults.append(pg_param) + for key in defaults: + del pg_parameters[key] # Update and reload configuration based on TLS files availability. self._patroni.render_patroni_yml_file( diff --git a/src/constants.py b/src/constants.py index 7a431a1640..6f72fd19eb 100644 --- a/src/constants.py +++ b/src/constants.py @@ -89,3 +89,68 @@ SPI_MODULE = ["refint", "autoinc", "insert_username", "moddatetime"] PGBACKREST_LOGROTATE_FILE = "/etc/logrotate.d/pgbackrest.logrotate" + +PGPARAMS_DEFAULTS = { + "authentication_timeout": 60, + "statement_timeout": 0, + "parallel_leader_participation": True, + "synchronous_commit": "on", + "wal_keep_size": 0, + "default_text_search_config": "pg_catalog.simple", + "max_locks_per_transaction": 64, + "password_encryption": "scram-sha-256", + "synchronize_seqscans": True, + "client_min_messages": "notice", + "log_connections": False, + "log_disconnections": False, + "log_lock_waits": False, + "log_min_duration_statement": -1, + "track_functions": "none", + "maintenance_work_mem": 65536, + "max_prepared_transactions": 0, + "temp_buffers": 1024, + "work_mem": 4096, + "constraint_exclusion": "partition", + "cpu_index_tuple_cost": 0.005, + "cpu_operator_cost": 0.0025, + "cpu_tuple_cost": 0.01, + "cursor_tuple_fraction": 0.1, + "default_statistics_target": 100, + "enable_async_append": True, + "enable_bitmapscan": True, + "enable_gathermerge": True, + "enable_hashagg": True, + "enable_hashjoin": True, + "enable_incremental_sort": True, + "enable_indexonlyscan": True, + "enable_indexscan": True, + "enable_material": True, + "enable_memoize": True, + "enable_mergejoin": True, + "enable_nestloop": True, + "enable_parallel_append": True, + "enable_parallel_hash": True, + "enable_partition_pruning": True, + "enable_partitionwise_aggregate": False, + "enable_partitionwise_join": False, + "enable_seqscan": True, + "enable_sort": True, + "enable_tidscan": True, + "from_collapse_limit": 8, + "geqo": True, + "geqo_effort": 5, + "geqo_generations": 0, + "geqo_pool_size": 0, + "geqo_seed": 0, + "geqo_selection_bias": 2, + "geqo_threshold": 12, + "jit": True, + "jit_above_cost": 100000, + "jit_inline_above_cost": 500000, + "jit_optimize_above_cost": 500000, + "join_collapse_limit": 8, + "min_parallel_index_scan_size": 64, + "min_parallel_table_scan_size": 1024, + "parallel_setup_cost": 1000, + "parallel_tuple_cost": 0.1, +} diff --git a/tests/integration/ha_tests/test_self_healing.py b/tests/integration/ha_tests/test_self_healing.py index a5b4faddac..f3ddc6fe88 100644 --- a/tests/integration/ha_tests/test_self_healing.py +++ b/tests/integration/ha_tests/test_self_healing.py @@ -9,7 +9,6 @@ from pytest_operator.plugin import OpsTest from tenacity import Retrying, stop_after_delay, wait_fixed -from .. import markers from ..helpers import ( CHARM_BASE, db_connect, @@ -381,7 +380,6 @@ async def test_forceful_restart_without_data_and_transaction_logs( @pytest.mark.abort_on_fail -@markers.amd64_only async def test_network_cut(ops_test: OpsTest, continuous_writes, primary_start_timeout): """Completely cut and restore network.""" # Locate primary unit. @@ -470,7 +468,6 @@ async def test_network_cut(ops_test: OpsTest, continuous_writes, primary_start_t @pytest.mark.abort_on_fail -@markers.amd64_only async def test_network_cut_without_ip_change( ops_test: OpsTest, continuous_writes, primary_start_timeout ):