Skip to content

Commit

Permalink
pg_upgrade: freeze coordinator data after relfilenode transfer
Browse files Browse the repository at this point in the history
Original commit message:
```
Tuples of catalog tables like gp_fastsequence, and pg_aoseg need to be
preserved. Tuples will be moved from old cluster to new cluster using
relfilenode transfer. To ensure that these tuple's relfrozenxid are
lower than their xmins, we first need to correct their relfrozenxid and
then freeze them. The process of correcting relfrozenxids already
happens on segments to ensure data visibility, so the same function was
repurposed for coordinator.
```

Full testing for 6 > 7 upgrade will be added in a followup commit.

reference commit:
pg_upgrade: freeze coordinator after relfilenode transfer
greenplum-db/gpdb@9cd8cd2630
  • Loading branch information
kyeap-vmware committed May 13, 2024
1 parent 9a3d88b commit 7148cd8
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions src/bin/pg_upgrade/pg_upgrade.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,12 +255,6 @@ main(int argc, char **argv)
*/
restore_aosegment_tables();

if (is_greenplum_dispatcher_mode())
{
/* freeze master data *right before* stopping */
freeze_master_data();
}

stop_postmaster(false);

/*
Expand All @@ -275,6 +269,23 @@ main(int argc, char **argv)
transfer_all_new_tablespaces(&old_cluster.dbarr, &new_cluster.dbarr,
old_cluster.pgdata, new_cluster.pgdata);

/*
* Tuples of gp_fastsequence are being upgraded using relfilenode transfer.
* Freezing coordinator's data must happen after relfilenodes land. We also
* need to fix the tuple's xmin to ensure they are lower than the
* relfrozenxid. Otherwise subsequent vacuums may fail.
*/
if (is_greenplum_dispatcher_mode())
{
start_postmaster(&new_cluster, true);

update_db_xids();
freeze_master_data();

stop_postmaster(false);
}


/* For non-master segments, uniquify the system identifier. */
if (!is_greenplum_dispatcher_mode())
reset_system_identifier();
Expand Down

0 comments on commit 7148cd8

Please sign in to comment.