Skip to content

Commit 979a03c

Browse files
B00885424davidmalloncares
authored andcommitted
(PE-40386) Enable XL migration and testing
1 parent dd7f25a commit 979a03c

File tree

5 files changed

+34
-5
lines changed

5 files changed

+34
-5
lines changed

.github/workflows/test-migration.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
- standard
4141
- standard-with-dr
4242
- large
43-
# - extra-large
43+
- extra-large
4444
- large-with-dr
4545
# - extra-large-with-dr
4646
version: [2021.7.9, 2023.8.2, 2025.2.0]

REFERENCE.md

+9
Original file line numberDiff line numberDiff line change
@@ -1804,6 +1804,7 @@ The following parameters are available in the `peadm::add_database` plan:
18041804
* [`primary_host`](#-peadm--add_database--primary_host)
18051805
* [`mode`](#-peadm--add_database--mode)
18061806
* [`begin_at_step`](#-peadm--add_database--begin_at_step)
1807+
* [`is_migration`](#-peadm--add_database--is_migration)
18071808

18081809
##### <a name="-peadm--add_database--targets"></a>`targets`
18091810

@@ -1843,6 +1844,14 @@ Optional[Enum[
18431844

18441845
Default value: `undef`
18451846

1847+
##### <a name="-peadm--add_database--is_migration"></a>`is_migration`
1848+
1849+
Data type: `Optional[Boolean]`
1850+
1851+
1852+
1853+
Default value: `false`
1854+
18461855
### <a name="peadm--add_replica"></a>`peadm::add_replica`
18471856

18481857
Add or replace a replica host.

plans/add_database.pp

+9-3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
'update-db-settings',
1010
'cleanup-db',
1111
'finalize']] $begin_at_step = undef,
12+
Optional[Boolean] $is_migration = false,
1213
) {
1314
$primary_target = peadm::get_targets($primary_host, 1)
1415
$postgresql_target = peadm::get_targets($targets, 1)
@@ -22,8 +23,9 @@
2223

2324
$compilers = $peadm_config['params']['compilers']
2425

25-
# Bail if this is trying to be ran against Standard
26-
if $compilers.empty {
26+
# Bail if this is trying to be ran against Standard. We need to allow this plan to progress for a migration
27+
# though as initially the installation will not have compilers added
28+
if $compilers.empty and !$is_migration {
2729
fail_plan('Plan peadm::add_database is only applicable for L and XL deployments')
2830
}
2931

@@ -59,11 +61,15 @@
5961

6062
if $operating_mode == 'init' {
6163
# If no other PSQL node then match primary group letter
62-
$avail_group_letter = peadm::flatten_compact($roles['server'].map |$k,$v| {
64+
$calculated_group_letter = peadm::flatten_compact($roles['server'].map |$k,$v| {
6365
if $v == $primary_host {
6466
$k
6567
}
6668
})[0]
69+
$avail_group_letter = $calculated_group_letter ? {
70+
undef => $is_migration ? { true => 'A', default => undef },
71+
default => $calculated_group_letter,
72+
}
6773
# Assume PuppetDB backend hosted on Primary if in init mode
6874
$source_db_host = $primary_host
6975
} else {

plans/migrate.pp

+14-1
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,17 @@
88
# The new server that will become the PE primary server
99
# @param upgrade_version
1010
# Optional version to upgrade to after migration is complete
11+
# @param replica_host
12+
# Optional new server that will become the PE replica server
13+
# @param primary_postgresql_host
14+
# Optional new server that will become the primary postgresql server
1115
#
1216
plan peadm::migrate (
1317
Peadm::SingleTargetSpec $old_primary_host,
1418
Peadm::SingleTargetSpec $new_primary_host,
1519
Optional[String] $upgrade_version = undef,
1620
Optional[Peadm::SingleTargetSpec] $replica_host = undef,
21+
Optional[Peadm::SingleTargetSpec] $primary_postgresql_host = undef,
1722
) {
1823
# pre-migration checks
1924
out::message('This plan is a work in progress and it is not recommended to be used until it is fully implemented and supported')
@@ -25,7 +30,8 @@
2530

2631
$new_hosts = peadm::flatten_compact([
2732
$new_primary_host,
28-
$replica_host ? { undef => [], default => [$replica_host] }
33+
$replica_host ? { undef => [], default => [$replica_host] },
34+
$primary_postgresql_host ? { undef => [], default => [$primary_postgresql_host] }
2935
].flatten)
3036
$all_hosts = peadm::flatten_compact([
3137
$old_primary_host,
@@ -117,6 +123,13 @@
117123
out::message('No nodes to purge from old configuration')
118124
}
119125

126+
if $primary_postgresql_host {
127+
run_plan('peadm::add_database', targets => $primary_postgresql_host,
128+
primary_host => $new_primary_host,
129+
is_migration => true,
130+
)
131+
}
132+
120133
if $replica_host {
121134
run_plan('peadm::add_replica', {
122135
primary_host => $new_primary_host,

spec/acceptance/peadm_spec/plans/test_migration.pp

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
new_primary_host => $new_primary_target,
3131
upgrade_version => $upgrade_version,
3232
replica_host => $new_replica_target,
33+
primary_postgresql_host => $new_primary_postgresql_target,
3334
)
3435

3536
# run infra status on the new primary

0 commit comments

Comments
 (0)