Skip to content

MAINT try alternate migration approach #577

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
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
4 changes: 2 additions & 2 deletions .github/workflows/test-migration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ jobs:
- standard
- standard-with-dr
- large
# - extra-large
- extra-large
- large-with-dr
# - extra-large-with-dr
- extra-large-with-dr
version: [2021.7.9, 2023.8.2, 2025.2.0]
image: [almalinux-cloud/almalinux-8]
include:
Expand Down
22 changes: 14 additions & 8 deletions plans/migrate.pp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,15 @@
Peadm::SingleTargetSpec $new_primary_host,
Optional[String] $upgrade_version = undef,
Optional[Peadm::SingleTargetSpec] $replica_host = undef,
Optional[Peadm::SingleTargetSpec] $primary_postgresql_host = undef,
Optional[Peadm::SingleTargetSpec] $replica_postgresql_host = undef,
) {
out::message("old_primary_host: ${old_primary_host}")
out::message("new_primary_host: ${new_primary_host}")
out::message("upgrade_version: ${upgrade_version}")
out::message("replica_host: ${replica_host}")
out::message("primary_postgresql_host: ${primary_postgresql_host}")
out::message("replica_postgresql_host: ${replica_postgresql_host}")
# pre-migration checks
out::message('This plan is a work in progress and it is not recommended to be used until it is fully implemented and supported')
peadm::assert_supported_bolt_version()
Expand All @@ -26,7 +34,9 @@
$all_hosts = peadm::flatten_compact([
$old_primary_host,
$new_primary_host,
$replica_host ? { undef => [], default => [$replica_host] }
$replica_host ? { undef => [], default => [$replica_host] },
$primary_postgresql_host ? { undef => [], default => [$primary_postgresql_host] },
$replica_postgresql_host ? { undef => [], default => [$replica_postgresql_host] }
].flatten)
run_command('hostname', $all_hosts) # verify can connect to targets

Expand Down Expand Up @@ -67,6 +77,9 @@

run_plan('peadm::install', {
primary_host => $new_primary_host,
replica_host => $replica_host,
primary_postgresql_host => $primary_postgresql_host,
replica_postgresql_host => $replica_postgresql_host,
console_password => $old_primary_password,
code_manager_auto_configure => true,
download_mode => 'direct',
Expand Down Expand Up @@ -114,13 +127,6 @@
out::message('No nodes to purge from old configuration')
}

if $replica_host {
run_plan('peadm::add_replica', {
primary_host => $new_primary_host,
replica_host => $replica_host,
})
}

if $upgrade_version and $upgrade_version != '' and !empty($upgrade_version) {
run_plan('peadm::upgrade', {
primary_host => $new_primary_host,
Expand Down
9 changes: 6 additions & 3 deletions plans/restore.pp
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,12 @@
undef => $primary_target,
default => peadm::get_targets(getvar('cluster.params.primary_postgresql_host'), 1),
},
getvar('cluster.params.replica_postgresql_host') ? {
undef => $replica_target,
default => peadm::get_targets(getvar('cluster.params.replica_postgresql_host'), 1),
($restore_type != 'migration') ? {
true => getvar('cluster.params.replica_postgresql_host') ? {
undef => $replica_target,
default => peadm::get_targets(getvar('cluster.params.replica_postgresql_host'), 1),
},
default => [],
},
])

Expand Down
2 changes: 2 additions & 0 deletions spec/acceptance/peadm_spec/plans/test_migration.pp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
new_primary_host => $new_primary_target,
upgrade_version => $upgrade_version,
replica_host => $new_replica_target,
primary_postgresql_host => $new_primary_postgresql_target,
replica_postgresql_host => $new_replica_postgresql_target,
)

# run infra status on the new primary
Expand Down
Loading