HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

What happens if I interrupt or cancel `pg_upgradecluster`?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
interruptwhatpg_upgradeclustercancelhappens

Problem

I'm upgrading a PostgreSQL 9.5 cluster to 9.6 using pg_upgradecluster. It's taking an awful lot of time, so I'd like to cancel the process, delete unneeded databases, and start again. What are the risks?

Solution

By default, pg_upgradecluster doesn't use pg_upgrade. It's creating a logical dump with pg_dump and restoring it (with pg_restore) on the new cluster.

To avoid this and speed up the process, you need to add the -m upgrade option.
If you need to speed up the process once more, you can add the --link so that the upgarde will be inplace. Be carefull, you can't cancel the process if you did it or you will loose your cluster.

If you didn't use the -m upgrade option and the --link option, you can cancel the process, drop the new cluster and create it again:

pg_dropcluster 9.6 
pg_createcluster 9.6 

Code Snippets

pg_dropcluster 9.6 <cluster_name>
pg_createcluster 9.6 <cluster_name>

Context

StackExchange Database Administrators Q#173382, answer score: 7

Revisions (0)

No revisions yet.