|
| 1 | +# Tune PostgreSQL |
| 2 | +# |
| 3 | +# @summary Tune PostgreSQL |
| 4 | + |
1 | 5 | class pe_databases::postgresql_settings ( |
2 | | - #lint:ignore:2sp_soft_tabs |
3 | | - Float[0,1] $autovacuum_vacuum_scale_factor = 0.08, |
4 | | - Float[0,1] $autovacuum_analyze_scale_factor = 0.04, |
5 | | - Integer $autovacuum_max_workers = max( 3, min( 8, $facts['processors']['count'] / 3)), |
6 | | - Integer $log_autovacuum_min_duration = -1, |
7 | | - Integer $log_temp_files = -1, |
8 | | - String $work_mem = '8MB', |
9 | | - Integer $max_connections = 1000, |
10 | | - Hash $arbitrary_postgresql_conf_settings = {}, |
11 | | - Float[0,1] $checkpoint_completion_target = 0.9, |
12 | | - Integer $checkpoint_segments = 128, |
13 | | - Boolean $manage_postgresql_service = true, |
14 | | - Boolean $all_in_one_pe_install = true, |
15 | | - Boolean $manage_fact_values_autovacuum_cost_delay = true, |
| 6 | + # lint:ignore:140chars |
| 7 | + Float[0,1] $autovacuum_vacuum_scale_factor = 0.08, |
| 8 | + Float[0,1] $autovacuum_analyze_scale_factor = 0.04, |
| 9 | + Integer $autovacuum_max_workers = max(3, min(8, $facts['processors']['count'] / 3)), |
| 10 | + Integer $log_autovacuum_min_duration = -1, |
| 11 | + Integer $log_temp_files = -1, |
| 12 | + String $work_mem = '8MB', |
| 13 | + Integer $max_connections = 1000, |
| 14 | + Hash $arbitrary_postgresql_conf_settings = {}, |
| 15 | + Float[0,1] $checkpoint_completion_target = 0.9, |
| 16 | + Integer $checkpoint_segments = 128, |
| 17 | + Boolean $manage_postgresql_service = true, |
| 18 | + Boolean $all_in_one_pe_install = true, |
| 19 | + Boolean $manage_reports_autovacuum_cost_delay = true, |
16 | 20 | Optional[Float[0,1]] $factsets_autovacuum_vacuum_scale_factor = 0.80, |
17 | 21 | Optional[Float[0,1]] $reports_autovacuum_vacuum_scale_factor = 0.01, |
18 | | - Boolean $manage_reports_autovacuum_cost_delay = true, |
19 | | - String $maintenance_work_mem = $all_in_one_pe_install ? { |
20 | | - false => "${facts['memory']['system']['total_bytes'] / 1024 / 1024 / 3}MB", |
21 | | - true => "${facts['memory']['system']['total_bytes'] / 1024 / 1024 / 8}MB", |
22 | | - }, |
23 | | - String $autovacuum_work_mem = $all_in_one_pe_install ? { |
24 | | - false => "${facts['memory']['system']['total_bytes'] / 1024 / 1024 / 3/ $autovacuum_max_workers}MB", |
25 | | - true => "${facts['memory']['system']['total_bytes'] / 1024 / 1024 / 8/ $autovacuum_max_workers}MB", |
26 | | - }, |
27 | | - String $psql_version = $pe_databases::psql_version, |
28 | | - #lint:endignore |
| 22 | + String $maintenance_work_mem = $all_in_one_pe_install ? { |
| 23 | + false => "${facts['memory']['system']['total_bytes'] / 1024 / 1024 / 3}MB", |
| 24 | + true => "${facts['memory']['system']['total_bytes'] / 1024 / 1024 / 8}MB", |
| 25 | + }, |
| 26 | + String $autovacuum_work_mem = $all_in_one_pe_install ? { |
| 27 | + false => "${facts['memory']['system']['total_bytes'] / 1024 / 1024 / 3 / $autovacuum_max_workers}MB", |
| 28 | + true => "${facts['memory']['system']['total_bytes'] / 1024 / 1024 / 8 / $autovacuum_max_workers}MB", |
| 29 | + }, |
| 30 | + String $psql_version = $pe_databases::psql_version, |
| 31 | + # lint:endignore |
29 | 32 | ) { |
30 | 33 |
|
31 | 34 | $postgresql_service_resource_name = 'postgresqld' |
|
34 | 37 | true => Service[$postgresql_service_resource_name], |
35 | 38 | default => undef, |
36 | 39 | } |
37 | | - $notify_console_services = $all_in_one_pe_install ? { |
| 40 | + $notify_console_services = $all_in_one_pe_install ? { |
38 | 41 | true => Service['pe-console-services'], |
39 | 42 | default => undef, |
40 | 43 | } |
|
48 | 51 | } |
49 | 52 | } |
50 | 53 |
|
51 | | - #The value attribute of postgresql_conf requires a string despite validating a float above |
52 | | - #https://tickets.puppetlabs.com/browse/MODULES-2960 |
53 | | - #http://www.postgresql.org/docs/9.4/static/runtime-config-autovacuum.html |
| 54 | + # The value attribute of postgresql_conf requires a string despite validating a float above. |
| 55 | + # https://tickets.puppetlabs.com/browse/MODULES-2960 |
| 56 | + # http://www.postgresql.org/docs/9.4/static/runtime-config-autovacuum.html |
| 57 | + |
54 | 58 | Postgresql_conf { |
55 | 59 | ensure => present, |
56 | 60 | target => "/opt/puppetlabs/server/data/postgresql/${psql_version}/data/postgresql.conf", |
|
0 commit comments