From ab589faf2c4134cf282d5a7187dce52fd4a2fa19 Mon Sep 17 00:00:00 2001 From: Elaine McCloskey <44435892+elainemccloskey@users.noreply.github.com> Date: Wed, 20 Jul 2022 16:09:32 +0100 Subject: [PATCH 1/3] (SUP-3409) Update puppet strings comments --- manifests/init.pp | 5 +++-- manifests/pg_repack.pp | 3 ++- manifests/postgresql_settings.pp | 3 ++- manifests/postgresql_settings/table_settings.pp | 3 ++- manifests/set_puppetdb_table_autovacuum_cost_delay_zero.pp | 3 ++- manifests/set_table_attribute.pp | 3 ++- 6 files changed, 13 insertions(+), 7 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index d83c332..e54ad42 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,6 +1,7 @@ -# Tuning, maintenance, and backups for PE PostgreSQL. +# Tuning, maintenance for PE PostgreSQL. # -# @summary Tuning, maintenance, and backups for PE PostgreSQL. +# @summary +# Tuning, maintenance for PE PostgreSQL. class pe_databases ( Variant[Boolean,Undef] $manage_database_backups = undef, diff --git a/manifests/pg_repack.pp b/manifests/pg_repack.pp index c19aaa5..0a6fbf6 100644 --- a/manifests/pg_repack.pp +++ b/manifests/pg_repack.pp @@ -1,6 +1,7 @@ # Maintenance pg_repack # -# @summary Maintenance pg_repack +# @summary +# Provides systemd timers to pg_repack tables in the pe-puppetdb database class pe_databases::pg_repack ( Boolean $disable_maintenance = false, diff --git a/manifests/postgresql_settings.pp b/manifests/postgresql_settings.pp index a9f9332..d3eb1c9 100644 --- a/manifests/postgresql_settings.pp +++ b/manifests/postgresql_settings.pp @@ -1,6 +1,7 @@ # Tune PostgreSQL # -# @summary Tune PostgreSQL +# @summary +# Tune PostgreSQL settings class pe_databases::postgresql_settings ( # lint:ignore:140chars diff --git a/manifests/postgresql_settings/table_settings.pp b/manifests/postgresql_settings/table_settings.pp index d016d60..2f56e4e 100644 --- a/manifests/postgresql_settings/table_settings.pp +++ b/manifests/postgresql_settings/table_settings.pp @@ -1,6 +1,7 @@ # Tune PostgreSQL table settings # -# @summary Tune PostgreSQL table settings +# @summary +# Tune PostgreSQL table settings class pe_databases::postgresql_settings::table_settings ( # lint:ignore:140chars diff --git a/manifests/set_puppetdb_table_autovacuum_cost_delay_zero.pp b/manifests/set_puppetdb_table_autovacuum_cost_delay_zero.pp index b4c755e..9b890b0 100644 --- a/manifests/set_puppetdb_table_autovacuum_cost_delay_zero.pp +++ b/manifests/set_puppetdb_table_autovacuum_cost_delay_zero.pp @@ -1,6 +1,7 @@ # Defined type for PostgreSQL autovacuum_cost_delay # -# @summary Defined type for PostgreSQL autovacuum_cost_delay +# @summary +# Defined type for PostgreSQL autovacuum_cost_delay define pe_databases::set_puppetdb_table_autovacuum_cost_delay_zero ( String $table_name = $title, diff --git a/manifests/set_table_attribute.pp b/manifests/set_table_attribute.pp index a392999..d45cf9b 100644 --- a/manifests/set_table_attribute.pp +++ b/manifests/set_table_attribute.pp @@ -1,6 +1,7 @@ # Defined type for PostgreSQL table attributes # -# @summary Defined type for PostgreSQL table attributes +# @summary +# Defined type for PostgreSQL table attributes define pe_databases::set_table_attribute ( String $db, From 798f066e832133ac3066b1666c430550b2e6ccc8 Mon Sep 17 00:00:00 2001 From: Elaine McCloskey <44435892+elainemccloskey@users.noreply.github.com> Date: Thu, 21 Jul 2022 12:14:09 +0100 Subject: [PATCH 2/3] Update comments & remove backup param --- manifests/collect.pp | 5 +++++ manifests/init.pp | 16 ++++++++++------ manifests/pg_repack.pp | 5 ++++- manifests/postgresql_settings.pp | 7 ++++++- manifests/postgresql_settings/table_settings.pp | 2 +- ..._puppetdb_table_autovacuum_cost_delay_zero.pp | 4 +++- manifests/set_table_attribute.pp | 11 ++++++++++- 7 files changed, 39 insertions(+), 11 deletions(-) diff --git a/manifests/collect.pp b/manifests/collect.pp index fa0df3e..1905bc9 100644 --- a/manifests/collect.pp +++ b/manifests/collect.pp @@ -1,4 +1,9 @@ # Create systemd units for repacking a given database type +# @param database_type [String] The database to repack, uses titles from pg_repack.pp +# @param command [String] defined in pg_repack.pp +# @param disable_maintenance [Boolean] to disable maintenance mode (Default: false) +# @param on_cal [String] values can be found in pg_repack.pp +# define pe_databases::collect ( String $database_type = $title, String $command = undef, diff --git a/manifests/init.pp b/manifests/init.pp index e54ad42..24af400 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,10 +1,14 @@ -# Tuning, maintenance for PE PostgreSQL. -# -# @summary -# Tuning, maintenance for PE PostgreSQL. - +# @summary Tuning, maintenance for PE PostgreSQL. +# +# @param disable_maintenance [Boolean] true or false (Default: false) +# Disable or enable maintenance mode +# @param manage_postgresql_settings [Boolean] true or false (Default: true) +# Manage PostgreSQL settings +# @param manage_table_settings [Boolean] true or false (Default: false) +# Manage table settings +# @param install_dir [String] Directory to install module into (Default: "/opt/puppetlabs/pe_databases") +# @param scripts_dir [String] Directory to install scripts into (Default: "${install_dir}/scripts") class pe_databases ( - Variant[Boolean,Undef] $manage_database_backups = undef, # Manage the inclusion of the pg_repack class Boolean $manage_database_maintenance = true, # Manage the state of the maintenance tasks, i.e. systemd services and timers diff --git a/manifests/pg_repack.pp b/manifests/pg_repack.pp index 0a6fbf6..9d46360 100644 --- a/manifests/pg_repack.pp +++ b/manifests/pg_repack.pp @@ -2,7 +2,10 @@ # # @summary # Provides systemd timers to pg_repack tables in the pe-puppetdb database - +# +# @param disable_maintenance [Boolean] true or false (Default: false) +# Disable or enable maintenance mode +# @param jobs [Integer] How many jobs to run in parallel class pe_databases::pg_repack ( Boolean $disable_maintenance = false, Integer $jobs = $facts['processors']['count'] / 4 diff --git a/manifests/postgresql_settings.pp b/manifests/postgresql_settings.pp index d3eb1c9..b3adc3e 100644 --- a/manifests/postgresql_settings.pp +++ b/manifests/postgresql_settings.pp @@ -2,7 +2,12 @@ # # @summary # Tune PostgreSQL settings - +# +# @param maintenance_work_mem [String] Increase to improve speed of speed of vacuuming and reindexing (Example "1GB") +# @param work_mem [String] Allows PostgreSQL to do larger in-memory sorts (Default: "4MB") +# @param autovacumn_work_mem [String] Similar to but for maintenance_work_mem autovacuum processes only (Example "256MB") +# @param autovacuum_max_workers [Integer] Maximum number of autovacuum processes to run concurrently (Default: 3) +# class pe_databases::postgresql_settings ( # lint:ignore:140chars Float[0,1] $autovacuum_vacuum_scale_factor = 0.08, diff --git a/manifests/postgresql_settings/table_settings.pp b/manifests/postgresql_settings/table_settings.pp index 2f56e4e..6b05d6a 100644 --- a/manifests/postgresql_settings/table_settings.pp +++ b/manifests/postgresql_settings/table_settings.pp @@ -2,7 +2,7 @@ # # @summary # Tune PostgreSQL table settings - +# class pe_databases::postgresql_settings::table_settings ( # lint:ignore:140chars Boolean $manage_reports_autovacuum_cost_delay = lookup('pe_databases::postgresql_settings::manage_reports_autovacuum_cost_delay', {'default_value' => true}), diff --git a/manifests/set_puppetdb_table_autovacuum_cost_delay_zero.pp b/manifests/set_puppetdb_table_autovacuum_cost_delay_zero.pp index 9b890b0..ed2fdfb 100644 --- a/manifests/set_puppetdb_table_autovacuum_cost_delay_zero.pp +++ b/manifests/set_puppetdb_table_autovacuum_cost_delay_zero.pp @@ -2,7 +2,9 @@ # # @summary # Defined type for PostgreSQL autovacuum_cost_delay - +# +# @param table_name [String] +# Name of the table define pe_databases::set_puppetdb_table_autovacuum_cost_delay_zero ( String $table_name = $title, ) { diff --git a/manifests/set_table_attribute.pp b/manifests/set_table_attribute.pp index d45cf9b..bdd4018 100644 --- a/manifests/set_table_attribute.pp +++ b/manifests/set_table_attribute.pp @@ -2,7 +2,16 @@ # # @summary # Defined type for PostgreSQL table attributes - +# +# @param db [String] +# Name of the database, this is pe-puppetdb for the uses of this module. +# @param table_name [String] +# Name of the table in the database. +# @param table_attribute [String] +# Set to the table attribute value. +# @param table_attribute_value [String] +# Value of setting for the table set in table_settings.pp +# define pe_databases::set_table_attribute ( String $db, String $table_name, From 2028739f6e9082a588fe1ded422debaf9d08a08b Mon Sep 17 00:00:00 2001 From: Elaine McCloskey <44435892+elainemccloskey@users.noreply.github.com> Date: Thu, 21 Jul 2022 12:26:51 +0100 Subject: [PATCH 3/3] Update comments & remove backups param --- spec/classes/pg_repack_spec.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/spec/classes/pg_repack_spec.rb b/spec/classes/pg_repack_spec.rb index e5454f9..c37aba1 100644 --- a/spec/classes/pg_repack_spec.rb +++ b/spec/classes/pg_repack_spec.rb @@ -5,7 +5,6 @@ context "on #{os}" do let(:pre_condition) do "class { 'pe_databases': - manage_database_backups => false, manage_postgresql_settings => false, manage_table_settings => false, }"