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

pg_upgrade: dramatically reduce memory consumption

Report from Jeff Janes
This commit is contained in:
Bruce Momjian
2014-02-12 16:35:24 -05:00
parent f9bb944cd8
commit 2a2e40aaaa
3 changed files with 66 additions and 34 deletions

View File

@ -707,20 +707,18 @@ create_script_for_old_cluster_deletion(char **deletion_script_file_name)
fprintf(script, "\n");
/* remove PG_VERSION? */
if (GET_MAJOR_VERSION(old_cluster.major_version) <= 804)
fprintf(script, RM_CMD " %s%s%cPG_VERSION\n",
fprintf(script, RM_CMD " %s%cPG_VERSION\n",
fix_path_separator(os_info.old_tablespaces[tblnum]),
fix_path_separator(old_cluster.tablespace_suffix),
PATH_SEPARATOR);
for (dbnum = 0; dbnum < old_cluster.dbarr.ndbs; dbnum++)
{
fprintf(script, RMDIR_CMD " %s%s%c%d\n",
fprintf(script, RMDIR_CMD " %s%c%d\n",
fix_path_separator(os_info.old_tablespaces[tblnum]),
fix_path_separator(old_cluster.tablespace_suffix),
PATH_SEPARATOR, old_cluster.dbarr.dbs[dbnum].db_oid);
}
}
else
{
char *suffix_path = pg_strdup(old_cluster.tablespace_suffix);
/*
* Simply delete the tablespace directory, which might be ".old"
@ -728,7 +726,9 @@ create_script_for_old_cluster_deletion(char **deletion_script_file_name)
*/
fprintf(script, RMDIR_CMD " %s%s\n",
fix_path_separator(os_info.old_tablespaces[tblnum]),
fix_path_separator(old_cluster.tablespace_suffix));
fix_path_separator(suffix_path));
pfree(suffix_path);
}
}
fclose(script);