1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

Allow parallel copy/link in pg_upgrade

This patch implements parallel copying/linking of files by tablespace
using the --jobs option in pg_upgrade.
This commit is contained in:
Bruce Momjian
2013-01-09 08:57:47 -05:00
parent c00dc337b8
commit a89c46f9bc
8 changed files with 256 additions and 73 deletions

View File

@ -106,20 +106,25 @@ create_rel_filename_map(const char *old_data, const char *new_data,
* relation belongs to the default tablespace, hence relfiles should
* exist in the data directories.
*/
snprintf(map->old_dir, sizeof(map->old_dir), "%s/base/%u", old_data,
old_db->db_oid);
snprintf(map->new_dir, sizeof(map->new_dir), "%s/base/%u", new_data,
new_db->db_oid);
strlcpy(map->old_tablespace, old_data, sizeof(map->old_tablespace));
strlcpy(map->new_tablespace, new_data, sizeof(map->new_tablespace));
strlcpy(map->old_tablespace_suffix, "/base", sizeof(map->old_tablespace_suffix));
strlcpy(map->new_tablespace_suffix, "/base", sizeof(map->new_tablespace_suffix));
}
else
{
/* relation belongs to a tablespace, so use the tablespace location */
snprintf(map->old_dir, sizeof(map->old_dir), "%s%s/%u", old_rel->tablespace,
old_cluster.tablespace_suffix, old_db->db_oid);
snprintf(map->new_dir, sizeof(map->new_dir), "%s%s/%u", new_rel->tablespace,
new_cluster.tablespace_suffix, new_db->db_oid);
strlcpy(map->old_tablespace, old_rel->tablespace, sizeof(map->old_tablespace));
strlcpy(map->new_tablespace, new_rel->tablespace, sizeof(map->new_tablespace));
strlcpy(map->old_tablespace_suffix, old_cluster.tablespace_suffix,
sizeof(map->old_tablespace_suffix));
strlcpy(map->new_tablespace_suffix, new_cluster.tablespace_suffix,
sizeof(map->new_tablespace_suffix));
}
map->old_db_oid = old_db->db_oid;
map->new_db_oid = new_db->db_oid;
/*
* old_relfilenode might differ from pg_class.oid (and hence
* new_relfilenode) because of CLUSTER, REINDEX, or VACUUM FULL.