|
1 | 1 | class pe_databases::postgresql_settings ( |
2 | | - Float[0,1] $autovacuum_vacuum_scale_factor = 0.08, |
3 | | - Float[0,1] $autovacuum_analyze_scale_factor = 0.04, |
4 | | - Boolean $manage_postgresql_service = true, |
5 | | - Boolean $all_in_one_pe_install = true, |
| 2 | + Float[0,1] $autovacuum_vacuum_scale_factor = 0.08, |
| 3 | + Float[0,1] $autovacuum_analyze_scale_factor = 0.04, |
| 4 | + Integer $autovacuum_max_workers = min(8, $::processors['count'] / 2), |
| 5 | + Integer $log_autovacuum_min_duration = 0, |
| 6 | + Integer $log_temp_files = 0, |
| 7 | + String $maintenance_work_mem = "${::memory['system']['total_bytes'] / 1024 / 1024 / 16}MB", |
| 8 | + String $work_mem = '8MB', |
| 9 | + Integer $max_connections = 1000, |
| 10 | + Float[0,1] $checkpoint_completion_target = 0.9, |
| 11 | + Float[0,1] $checkpoint_segments = 128, |
| 12 | + Boolean $manage_postgresql_service = true, |
| 13 | + Boolean $all_in_one_pe_install = true, |
| 14 | + Boolean $manage_fact_values_autovacuum_cost_delay = true, |
6 | 15 | ) { |
7 | 16 |
|
8 | 17 | $postgresql_service_resource_name = 'postgresqld' |
|
41 | 50 | postgresql_conf { 'autovacuum_analyze_scale_factor' : |
42 | 51 | value => "${autovacuum_analyze_scale_factor}", |
43 | 52 | } |
| 53 | + |
| 54 | + postgresql_conf { 'autovacuum_max_workers' : |
| 55 | + value => "${autovacuum_max_workers}", |
| 56 | + } |
| 57 | + |
| 58 | + postgresql_conf { 'log_autovacuum_min_duration' : |
| 59 | + value => "${log_autovacuum_min_duration}", |
| 60 | + } |
| 61 | + |
| 62 | + postgresql_conf { 'log_temp_files' : |
| 63 | + value => "${log_temp_files}", |
| 64 | + } |
| 65 | + |
| 66 | + postgresql_conf { 'maintenance_work_mem' : |
| 67 | + value => "${maintenance_work_mem}", |
| 68 | + } |
| 69 | + |
| 70 | + postgresql_conf { 'work_mem' : |
| 71 | + value => "${work_mem}", |
| 72 | + } |
| 73 | + |
| 74 | + postgresql_conf { 'max_connections' : |
| 75 | + value => "${max_connections}", |
| 76 | + } |
| 77 | + |
| 78 | + postgresql_conf { 'checkpoint_completion_target' : |
| 79 | + value => "${checkpoint_completion_target}", |
| 80 | + } |
| 81 | + |
| 82 | + postgresql_conf { 'checkpoint_segments' : |
| 83 | + value => "${checkpoint_segments}", |
| 84 | + } |
| 85 | + |
| 86 | + if $manage_fact_values_autovacuum_cost_delay { |
| 87 | + postgresql_psql { 'Set autovacuum_cost_delay=0 for fact_values' : |
| 88 | + command => 'ALTER TABLE fact_values SET ( autovacuum_vacuum_cost_delay = 0 )', |
| 89 | + unless => 'SELECT reloptions FROM pg_class WHERE relname = \'fact_values\' AND CAST(reloptions as text) LIKE \'%autovacuum_vacuum_cost_delay=0%\'', |
| 90 | + db => 'pe-puppetdb', |
| 91 | + psql_user => 'pe-postgres', |
| 92 | + psql_group => 'pe-postgres', |
| 93 | + psql_path => '/opt/puppetlabs/server/bin/psql', |
| 94 | + } |
| 95 | + } |
44 | 96 | } |
0 commit comments