Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #include "postgres_fe.h"
00011
00012 #include "pg_upgrade.h"
00013
00014 #include <sys/types.h>
00015
00016 void
00017 generate_old_dump(void)
00018 {
00019 int dbnum;
00020
00021 prep_status("Creating dump of global objects");
00022
00023
00024 exec_prog(UTILITY_LOG_FILE, NULL, true,
00025 "\"%s/pg_dumpall\" %s --schema-only --globals-only --binary-upgrade %s -f %s",
00026 new_cluster.bindir, cluster_conn_opts(&old_cluster),
00027 log_opts.verbose ? "--verbose" : "",
00028 GLOBALS_DUMP_FILE);
00029 check_ok();
00030
00031 prep_status("Creating dump of database schemas\n");
00032
00033
00034 for (dbnum = 0; dbnum < old_cluster.dbarr.ndbs; dbnum++)
00035 {
00036 char sql_file_name[MAXPGPATH], log_file_name[MAXPGPATH];
00037 DbInfo *old_db = &old_cluster.dbarr.dbs[dbnum];
00038
00039 pg_log(PG_STATUS, "%s", old_db->db_name);
00040 snprintf(sql_file_name, sizeof(sql_file_name), DB_DUMP_FILE_MASK, old_db->db_oid);
00041 snprintf(log_file_name, sizeof(log_file_name), DB_DUMP_LOG_FILE_MASK, old_db->db_oid);
00042
00043 parallel_exec_prog(log_file_name, NULL,
00044 "\"%s/pg_dump\" %s --schema-only --binary-upgrade --format=custom %s --file=\"%s\" \"%s\"",
00045 new_cluster.bindir, cluster_conn_opts(&old_cluster),
00046 log_opts.verbose ? "--verbose" : "", sql_file_name, old_db->db_name);
00047 }
00048
00049
00050 while (reap_child(true) == true)
00051 ;
00052
00053 end_progress_output();
00054 check_ok();
00055 }