|
9 | 9 | # @param facts_tables_repack_timer [String] The Systemd timer for the pg_repack job affecting the 'facts' tables
|
10 | 10 | # @param catalogs_tables_repack_timer [String]The Systemd timer for the pg_repack job affecting the 'catalog' tables
|
11 | 11 | # @param other_tables_repack_timer [String] The Systemd timer for the pg_repack job affecting the 'other' tables
|
12 |
| -# @param reports_tables_repack_timer [String] The Systemd timer for the pg_repack job affecting the 'reports' tables |
13 |
| -# @param resource_events_tables_repack_timer [String] The Systemd timer for the pg_repack job affecting the 'resource_events' tables |
14 | 12 | class pe_databases::pg_repack (
|
15 | 13 | Boolean $disable_maintenance = false,
|
16 | 14 | Integer $jobs = $facts['processors']['count'] / 4,
|
17 | 15 | String[1] $facts_tables_repack_timer = $pe_databases::facts_tables_repack_timer,
|
18 | 16 | String[1] $catalogs_tables_repack_timer = $pe_databases::catalogs_tables_repack_timer,
|
19 | 17 | String[1] $other_tables_repack_timer = $pe_databases::other_tables_repack_timer,
|
20 |
| - String[1] $reports_tables_repack_timer = $pe_databases::reports_tables_repack_timer, |
21 |
| - String[1] $resource_events_tables_repack_timer = $pe_databases::resource_events_tables_repack_timer, |
22 | 18 | ) {
|
23 |
| - # PE 2019.1 starting shipping versioned pe-postgres packages where all paths are versioned. |
24 |
| - # So, prior to 2019.1 use a non-versioned path, and after use a versioned path. |
25 |
| - # TODO: Use $pe_databases::psql_version after identifying why it is cast to ${psql_version}00000 in spec tests. |
26 | 19 | $postgresql_version = $facts['pe_postgresql_info']['installed_server_version']
|
27 |
| - $repack_executable = versioncmp('2019.1.0', $facts['pe_server_version']) ? { |
28 |
| - 1 => '/opt/puppetlabs/server/apps/postgresql/bin/pg_repack', |
29 |
| - default => "/opt/puppetlabs/server/apps/postgresql/${postgresql_version}/bin/pg_repack" |
30 |
| - } |
| 20 | + $repack_executable = "/opt/puppetlabs/server/apps/postgresql/${postgresql_version}/bin/pg_repack" |
31 | 21 |
|
32 |
| - $repack = "${repack_executable} -d pe-puppetdb" |
33 |
| - $repack_jobs = "--jobs ${jobs}" |
| 22 | + $repack_cmd = "${repack_executable} -d pe-puppetdb --jobs ${jobs}" |
34 | 23 |
|
35 |
| - $facts_tables = '-t factsets -t fact_paths' |
36 |
| - $catalogs_tables = versioncmp($facts['pe_server_version'], '2019.8.1') ? { |
37 |
| - 1 => '-t catalogs -t catalog_resources -t catalog_inputs -t edges -t certnames', |
38 |
| - default => '-t catalogs -t catalog_resources -t edges -t certnames' } |
39 |
| - $other_tables = '-t producers -t resource_params -t resource_params_cache' |
40 |
| - $reports_table = '-t reports' |
41 |
| - $resource_events_table = '-t resource_events' |
| 24 | + $fact_tables = '-t factsets -t fact_paths' |
| 25 | + $catalog_tables = '-t catalogs -t catalog_resources -t catalog_inputs -t edges -t certnames' |
| 26 | + $other_tables = '-t producers -t resource_params -t resource_params_cache' |
42 | 27 |
|
43 | 28 | pe_databases::collect { 'facts':
|
44 | 29 | disable_maintenance => $disable_maintenance,
|
45 |
| - command => "${repack} ${repack_jobs} ${facts_tables}", |
| 30 | + command => "${repack_cmd} ${fact_tables}", |
46 | 31 | on_cal => $facts_tables_repack_timer,
|
47 | 32 | }
|
48 | 33 |
|
49 | 34 | pe_databases::collect { 'catalogs':
|
50 | 35 | disable_maintenance => $disable_maintenance,
|
51 |
| - command => "${repack} ${repack_jobs} ${catalogs_tables}", |
| 36 | + command => "${repack_cmd} ${catalog_tables}", |
52 | 37 | on_cal => $catalogs_tables_repack_timer,
|
53 | 38 | }
|
54 | 39 |
|
55 | 40 | pe_databases::collect { 'other':
|
56 | 41 | disable_maintenance => $disable_maintenance,
|
57 |
| - command => "${repack} ${repack_jobs} ${other_tables}", |
| 42 | + command => "${repack_cmd} ${other_tables}", |
58 | 43 | on_cal => $other_tables_repack_timer,
|
59 | 44 | }
|
60 | 45 |
|
61 |
| - if versioncmp($facts['pe_server_version'], '2019.7.0') < 0 { |
62 |
| - pe_databases::collect { 'reports': |
63 |
| - disable_maintenance => $disable_maintenance, |
64 |
| - command => "${repack} ${repack_jobs} ${reports_table}", |
65 |
| - on_cal => $reports_tables_repack_timer, |
66 |
| - } |
67 |
| - } |
68 |
| - |
69 |
| - if versioncmp($facts['pe_server_version'], '2019.3.0') < 0 { |
70 |
| - pe_databases::collect { 'resource_events': |
71 |
| - disable_maintenance => $disable_maintenance, |
72 |
| - command => "${repack} ${repack_jobs} ${resource_events_table}", |
73 |
| - on_cal => $resource_events_tables_repack_timer, |
74 |
| - } |
75 |
| - } |
76 |
| - |
77 | 46 | # Ensure legacy vaccum and pg_repack crons are purged.
|
78 | 47 | # If someone upgrades from an ancient v0.x version of the pe_databases module to 2.0 or newer,
|
79 | 48 | # the old cron jobs running vaccuum full will not be cleaned up. This can result in a deadlock
|
|
0 commit comments