|
1 | 1 | # Maintenance pg_repack
|
2 | 2 | #
|
3 |
| -# @summary |
4 |
| -# Provides systemd timers to pg_repack tables in the pe-puppetdb database |
5 |
| -# |
| 3 | +# @summary |
| 4 | +# Provides systemd timers to pg_repack tables in a given database |
| 5 | +# @param fact_tables [Array] Array of 'fact' tables to repack |
| 6 | +# @param catalog_tables [Array] Array of 'catalog' tables to repack |
| 7 | +# @param other_tables [Array] Array of 'other' tables to repack |
| 8 | +# @param activity_tables [Array] Array of 'activity' tables to repack |
6 | 9 | # @param disable_maintenance [Boolean] true or false (Default: false)
|
7 | 10 | # Disable or enable maintenance mode
|
8 | 11 | # @param jobs [Integer] How many jobs to run in parallel
|
9 | 12 | # @param facts_tables_repack_timer [String] The Systemd timer for the pg_repack job affecting the 'facts' tables
|
10 | 13 | # @param catalogs_tables_repack_timer [String]The Systemd timer for the pg_repack job affecting the 'catalog' tables
|
11 | 14 | # @param other_tables_repack_timer [String] The Systemd timer for the pg_repack job affecting the 'other' tables
|
| 15 | +# @param activity_tables_repack_timer [String] The Systemd timer for the pg_repack job affecting the 'activity' tables |
12 | 16 | # @param reports_tables_repack_timer [String] Deprecated Parameter will be removed in future releases
|
13 | 17 | # @param resource_events_tables_repack_timer [String] Deprecated Parameter will be removed in future releases
|
14 | 18 | class pe_databases::pg_repack (
|
15 |
| - Boolean $disable_maintenance = false, |
16 |
| - Integer $jobs = $facts['processors']['count'] / 4, |
17 |
| - String[1] $facts_tables_repack_timer = $pe_databases::facts_tables_repack_timer, |
18 |
| - String[1] $catalogs_tables_repack_timer = $pe_databases::catalogs_tables_repack_timer, |
19 |
| - String[1] $other_tables_repack_timer = $pe_databases::other_tables_repack_timer, |
20 |
| - Optional[String] $reports_tables_repack_timer = undef, |
| 19 | + # Provided by module data |
| 20 | + Array $fact_tables, |
| 21 | + Array $catalog_tables, |
| 22 | + Array $other_tables, |
| 23 | + Array $activity_tables, |
| 24 | + Boolean $disable_maintenance = false, |
| 25 | + Integer $jobs = $facts['processors']['count'] / 4, |
| 26 | + String[1] $facts_tables_repack_timer = $pe_databases::facts_tables_repack_timer, |
| 27 | + String[1] $catalogs_tables_repack_timer = $pe_databases::catalogs_tables_repack_timer, |
| 28 | + String[1] $other_tables_repack_timer = $pe_databases::other_tables_repack_timer, |
| 29 | + String[1] $activity_tables_repack_timer = $pe_databases::activity_tables_repack_timer, |
| 30 | + Optional[String] $reports_tables_repack_timer = undef, |
21 | 31 | Optional[String] $resource_events_tables_repack_timer = undef,
|
22 | 32 | ) {
|
23 | 33 | puppet_enterprise::deprecated_parameter { 'pe_databases::pg_repack::reports_tables_repack_timer': }
|
|
26 | 36 | $postgresql_version = $facts['pe_postgresql_info']['installed_server_version']
|
27 | 37 | $repack_executable = "/opt/puppetlabs/server/apps/postgresql/${postgresql_version}/bin/pg_repack"
|
28 | 38 |
|
29 |
| - $repack_cmd = "${repack_executable} -d pe-puppetdb --jobs ${jobs}" |
30 |
| - |
31 |
| - $fact_tables = '-t factsets -t fact_paths' |
32 |
| - $catalog_tables = '-t catalogs -t catalog_resources -t catalog_inputs -t edges -t certnames' |
33 |
| - $other_tables = '-t producers -t resource_params -t resource_params_cache' |
| 39 | + $repack_cmd = "${repack_executable} --jobs ${jobs}" |
34 | 40 |
|
35 | 41 | pe_databases::collect { 'facts':
|
36 | 42 | disable_maintenance => $disable_maintenance,
|
37 |
| - command => "${repack_cmd} ${fact_tables}", |
| 43 | + command => "${repack_cmd} -d pe-puppetdb", |
38 | 44 | on_cal => $facts_tables_repack_timer,
|
| 45 | + tables => $fact_tables, |
39 | 46 | }
|
40 | 47 |
|
41 | 48 | pe_databases::collect { 'catalogs':
|
42 | 49 | disable_maintenance => $disable_maintenance,
|
43 |
| - command => "${repack_cmd} ${catalog_tables}", |
| 50 | + command => "${repack_cmd} -d pe-puppetdb", |
44 | 51 | on_cal => $catalogs_tables_repack_timer,
|
| 52 | + tables => $catalog_tables, |
45 | 53 | }
|
46 | 54 |
|
47 | 55 | pe_databases::collect { 'other':
|
48 | 56 | disable_maintenance => $disable_maintenance,
|
49 |
| - command => "${repack_cmd} ${other_tables}", |
| 57 | + command => "${repack_cmd} -d pe-puppetdb", |
50 | 58 | on_cal => $other_tables_repack_timer,
|
| 59 | + tables => $other_tables, |
| 60 | + } |
| 61 | + |
| 62 | + pe_databases::collect { 'activity': |
| 63 | + disable_maintenance => $disable_maintenance, |
| 64 | + command => "${repack_cmd} -d pe-activity", |
| 65 | + on_cal => $activity_tables_repack_timer, |
| 66 | + tables => $activity_tables, |
51 | 67 | }
|
52 | 68 |
|
53 | 69 | # Ensure legacy vaccum and pg_repack crons are purged.
|
|
0 commit comments