Skip to content

make systemd timers configurable #109

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,23 @@
# 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")
# @param facts_tables_repack_timer [String] The Systemd timer for the pg_repack job affecting the 'facts' tables
# @param catalogs_tables_repack_timer [String]The Systemd timer for the pg_repack job affecting the 'catalog' tables
# @param other_tables_repack_timer [String] The Systemd timer for the pg_repack job affecting the 'other' tables
# @param reports_tables_repack_timer [String] The Systemd timer for the pg_repack job affecting the 'reports' tables
# @param resource_events_tables_repack_timer [String] The Systemd timer for the pg_repack job affecting the 'resource_events' tables
class pe_databases (
Boolean $manage_database_maintenance = true,
Boolean $disable_maintenance = false,
Boolean $manage_postgresql_settings = true,
Boolean $manage_table_settings = false,
String $install_dir = '/opt/puppetlabs/pe_databases',
String $scripts_dir = "${install_dir}/scripts"
Boolean $manage_database_maintenance = true,
Boolean $disable_maintenance = false,
Boolean $manage_postgresql_settings = true,
Boolean $manage_table_settings = false,
String[1] $install_dir = '/opt/puppetlabs/pe_databases',
String[1] $scripts_dir = "${install_dir}/scripts",
String[1] $facts_tables_repack_timer = 'Tue,Sat *-*-* 04:30:00',
String[1] $catalogs_tables_repack_timer = 'Sun,Thu *-*-* 04:30:00',
String[1] $other_tables_repack_timer = '*-*-20 05:30:00',
String[1] $reports_tables_repack_timer = '*-*-10 05:30:00',
String[1] $resource_events_tables_repack_timer = '*-*-15 05:30:00',
) {
$psql_version = $facts['pe_postgresql_info']['installed_server_version'] ? {
undef => undef,
Expand Down
24 changes: 17 additions & 7 deletions manifests/pg_repack.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,19 @@
# @param disable_maintenance [Boolean] true or false (Default: false)
# Disable or enable maintenance mode
# @param jobs [Integer] How many jobs to run in parallel
# @param facts_tables_repack_timer [String] The Systemd timer for the pg_repack job affecting the 'facts' tables
# @param catalogs_tables_repack_timer [String]The Systemd timer for the pg_repack job affecting the 'catalog' tables
# @param other_tables_repack_timer [String] The Systemd timer for the pg_repack job affecting the 'other' tables
# @param reports_tables_repack_timer [String] The Systemd timer for the pg_repack job affecting the 'reports' tables
# @param resource_events_tables_repack_timer [String] The Systemd timer for the pg_repack job affecting the 'resource_events' tables
class pe_databases::pg_repack (
Boolean $disable_maintenance = false,
Integer $jobs = $facts['processors']['count'] / 4
Boolean $disable_maintenance = false,
Integer $jobs = $facts['processors']['count'] / 4,
String[1] $facts_tables_repack_timer = $pe_databases::facts_tables_repack_timer,
String[1] $catalogs_tables_repack_timer = $pe_databases::catalogs_tables_repack_timer,
String[1] $other_tables_repack_timer = $pe_databases::other_tables_repack_timer,
String[1] $reports_tables_repack_timer = $pe_databases::reports_tables_repack_timer,
String[1] $resource_events_tables_repack_timer = $pe_databases::resource_events_tables_repack_timer,
) {
# PE 2019.1 starting shipping versioned pe-postgres packages where all paths are versioned.
# So, prior to 2019.1 use a non-versioned path, and after use a versioned path.
Expand All @@ -33,34 +43,34 @@
pe_databases::collect { 'facts':
disable_maintenance => $disable_maintenance,
command => "${repack} ${repack_jobs} ${facts_tables}",
on_cal => 'Tue,Sat *-*-* 04:30:00',
on_cal => $facts_tables_repack_timer,
}

pe_databases::collect { 'catalogs':
disable_maintenance => $disable_maintenance,
command => "${repack} ${repack_jobs} ${catalogs_tables}",
on_cal => 'Sun,Thu *-*-* 04:30:00',
on_cal => $catalogs_tables_repack_timer,
}

pe_databases::collect { 'other':
disable_maintenance => $disable_maintenance,
command => "${repack} ${repack_jobs} ${other_tables}",
on_cal => '*-*-20 05:30:00',
on_cal => $other_tables_repack_timer,
}

if versioncmp($facts['pe_server_version'], '2019.7.0') < 0 {
pe_databases::collect { 'reports':
disable_maintenance => $disable_maintenance,
command => "${repack} ${repack_jobs} ${reports_table}",
on_cal => '*-*-10 05:30:00',
on_cal => $reports_tables_repack_timer,
}
}

if versioncmp($facts['pe_server_version'], '2019.3.0') < 0 {
pe_databases::collect { 'resource_events':
disable_maintenance => $disable_maintenance,
command => "${repack} ${repack_jobs} ${resource_events_table}",
on_cal => '*-*-15 05:30:00',
on_cal => $resource_events_tables_repack_timer,
}
}

Expand Down