Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

puppet: Allow overrides of computed PostgreSQL config settings.

Alex Vandiverf47d150fb55c
diff --git a/puppet/zulip/manifests/profile/postgresql.pp b/puppet/zulip/manifests/profile/postgresql.pp
index 88e4f5c842a..f42658afe39 100644
--- a/puppet/zulip/manifests/profile/postgresql.pp
+++ b/puppet/zulip/manifests/profile/postgresql.pp
@@ -10,11 +10,10 @@ class zulip::profile::postgresql {
} else {
$total_postgres_memory_mb = zulipconf('postgresql', 'memory', $zulip::common::total_memory_mb)
}
- $work_mem = $total_postgres_memory_mb / 256
- $shared_buffers = $total_postgres_memory_mb / 4
- $effective_cache_size = $total_postgres_memory_mb * 10 / 16
- $maintenance_work_mem = $total_postgres_memory_mb / 16
-
+ $work_mem = zulipconf('postgresql', 'work_mem', sprintf('%dMB', $total_postgres_memory_mb / 256))
+ $shared_buffers = zulipconf('postgresql', 'shared_buffers', sprintf('%dMB', $total_postgres_memory_mb / 4))
+ $effective_cache_size = zulipconf('postgresql', 'effective_cache_size', sprintf('%dMB', $total_postgres_memory_mb * 10 / 16))
+ $maintenance_work_mem = zulipconf('postgresql', 'maintenance_work_mem', sprintf('%dMB', $total_postgres_memory_mb / 16))
$random_page_cost = zulipconf('postgresql', 'random_page_cost', undef)
$effective_io_concurrency = zulipconf('postgresql', 'effective_io_concurrency', undef)
diff --git a/puppet/zulip/templates/postgresql/14/postgresql.conf.template.erb b/puppet/zulip/templates/postgresql/14/postgresql.conf.template.erb
index 8758bfa19cc..983a5e9f7fd 100644
--- a/puppet/zulip/templates/postgresql/14/postgresql.conf.template.erb
+++ b/puppet/zulip/templates/postgresql/14/postgresql.conf.template.erb
@@ -822,10 +822,10 @@ vacuum_freeze_table_age = 1800000000
# Performance settings
max_connections = 1000
-maintenance_work_mem = <%= scope["zulip::profile::postgresql::maintenance_work_mem"] %>MB
-effective_cache_size = <%= scope["zulip::profile::postgresql::effective_cache_size"] %>MB
-work_mem = <%= scope["zulip::profile::postgresql::work_mem"] %>MB
-shared_buffers = <%= scope["zulip::profile::postgresql::shared_buffers"] %>MB
+maintenance_work_mem = <%= scope["zulip::profile::postgresql::maintenance_work_mem"] %>
+effective_cache_size = <%= scope["zulip::profile::postgresql::effective_cache_size"] %>
+work_mem = <%= scope["zulip::profile::postgresql::work_mem"] %>
+shared_buffers = <%= scope["zulip::profile::postgresql::shared_buffers"] %>
wal_buffers = 4MB
checkpoint_completion_target = 0.7
<% unless @random_page_cost.nil? -%>
diff --git a/puppet/zulip/templates/postgresql/zulip.conf.template.erb b/puppet/zulip/templates/postgresql/zulip.conf.template.erb
index f9200cb26f9..9a5c6232740 100644
--- a/puppet/zulip/templates/postgresql/zulip.conf.template.erb
+++ b/puppet/zulip/templates/postgresql/zulip.conf.template.erb
@@ -26,10 +26,10 @@ vacuum_freeze_table_age = 1800000000
# Performance settings
max_connections = 1000
-maintenance_work_mem = <%= scope["zulip::profile::postgresql::maintenance_work_mem"] %>MB
-effective_cache_size = <%= scope["zulip::profile::postgresql::effective_cache_size"] %>MB
-work_mem = <%= scope["zulip::profile::postgresql::work_mem"] %>MB
-shared_buffers = <%= scope["zulip::profile::postgresql::shared_buffers"] %>MB
+maintenance_work_mem = <%= scope["zulip::profile::postgresql::maintenance_work_mem"] %>
+effective_cache_size = <%= scope["zulip::profile::postgresql::effective_cache_size"] %>
+work_mem = <%= scope["zulip::profile::postgresql::work_mem"] %>
+shared_buffers = <%= scope["zulip::profile::postgresql::shared_buffers"] %>
wal_buffers = 4MB
checkpoint_completion_target = 0.7
<% unless @random_page_cost.nil? -%>