upgrade

package
v0.0.0-...-db6441f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 3, 2025 License: BSD-2-Clause Imports: 27 Imported by: 0

README

Upgrade procedure

The operator does the upgrade using PostgreSQL's pg_upgrade --link mode. Usually this results in little downtime. The upgrade has the following stages:

  • preupgrade
  • preupgrade-sync
  • scaledown
  • primary-upgrade
  • secondary-upgrade
  • primary-upgrade-move
  • postupgrade

Upgrade stages

Preupgrade

Database settings which are needed for initdb are extracted from current running database.

Database is reachable in this stage.

preuprgrade.go

Preupgrade-sync

Database is reconfigured to listen on different port (55432) to ensure no clients are connected. Then, the operator starts a job to monitor replicas that they are caught up with primary. It does this by issuing CHECKPOINT on primary, then waiting for wal to be replicated, then issuing CHECKPOINT in replicas. Then repeat this cycle until WAL position does not change on primary.

During this, database is not reachable.

preuprgrade-sync.go

Scaledown

Database is stopped in this phase.

scaledown.go

Primary upgrade

Primary node is upgraded, and new database system id is returned. Upgraded database is in data.new, which will be moved to its final location later.

primary-upgrade

Secondary upgrade

Secondaries are upgraded as recommended.

secondary-upgrade

Primary upgrade move

The new database in data.new on primary is moved back to its final data directory.

primary-upgrade-move

Postupgrade

Database is started, can accept connections. After available, the operator updates all extensions in all databases, then runs ANALYZE on all databases.

postupgrade.go

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handle

func Handle(ctx pcontext.Context, p *v1alpha1.PatroniPostgres) (ret ctrl.Result, err error)

Types

type UpgradeJob

type UpgradeJob interface {
	Mode() string
	ActiveDeadlineSeconds() int64
	DBPort() int
	CustomizePodSpec(*v1.PodSpec)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL