LCOV - differential code coverage report
Current view: top level - src/bin/pg_upgrade - dump.c (source / functions) Coverage Total Hit UBC CBC
Current: Differential Code Coverage 16@8cea358b128 vs 17@8cea358b128 Lines: 91.7 % 24 22 2 22
Current Date: 2024-04-14 14:21:10 Functions: 100.0 % 1 1 1
Baseline: 16@8cea358b128 Branches: 62.5 % 8 5 3 5
Baseline Date: 2024-04-14 14:21:09 Line coverage date bins:
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed (240..) days: 91.7 % 24 22 2 22
Function coverage date bins:
(240..) days: 100.0 % 1 1 1
Branch coverage date bins:
(240..) days: 62.5 % 8 5 3 5

 Age         Owner                    Branch data    TLA  Line data    Source code
                                  1                 :                : /*
                                  2                 :                :  *  dump.c
                                  3                 :                :  *
                                  4                 :                :  *  dump functions
                                  5                 :                :  *
                                  6                 :                :  *  Copyright (c) 2010-2024, PostgreSQL Global Development Group
                                  7                 :                :  *  src/bin/pg_upgrade/dump.c
                                  8                 :                :  */
                                  9                 :                : 
                                 10                 :                : #include "postgres_fe.h"
                                 11                 :                : 
                                 12                 :                : #include "fe_utils/string_utils.h"
                                 13                 :                : #include "pg_upgrade.h"
                                 14                 :                : 
                                 15                 :                : void
 4926 bruce@momjian.us           16                 :CBC           4 : generate_old_dump(void)
                                 17                 :                : {
                                 18                 :                :     int         dbnum;
                                 19                 :                : 
 4153                            20                 :              4 :     prep_status("Creating dump of global objects");
                                 21                 :                : 
                                 22                 :                :     /* run new pg_dumpall binary for globals */
 2288 bruce@momjian.us           23                 :UBC           0 :     exec_prog(UTILITY_LOG_FILE, NULL, true, true,
                                 24                 :                :               "\"%s/pg_dumpall\" %s --globals-only --quote-all-identifiers "
                                 25                 :                :               "--binary-upgrade %s -f \"%s/%s\"",
                                 26                 :                :               new_cluster.bindir, cluster_conn_opts(&old_cluster),
 4416 bruce@momjian.us           27         [ -  + ]:CBC           4 :               log_opts.verbose ? "--verbose" : "",
                                 28                 :                :               log_opts.dumpdir,
                                 29                 :                :               GLOBALS_DUMP_FILE);
 4153                            30                 :              4 :     check_ok();
                                 31                 :                : 
  783 andres@anarazel.de         32                 :              4 :     prep_status_progress("Creating dump of database schemas");
                                 33                 :                : 
                                 34                 :                :     /* create per-db dump files */
 4153 bruce@momjian.us           35         [ +  + ]:             16 :     for (dbnum = 0; dbnum < old_cluster.dbarr.ndbs; dbnum++)
                                 36                 :                :     {
                                 37                 :                :         char        sql_file_name[MAXPGPATH],
                                 38                 :                :                     log_file_name[MAXPGPATH];
 3993 tgl@sss.pgh.pa.us          39                 :             12 :         DbInfo     *old_db = &old_cluster.dbarr.dbs[dbnum];
                                 40                 :                :         PQExpBufferData connstr,
                                 41                 :                :                     escaped_connstr;
                                 42                 :                : 
 2806 noah@leadboat.com          43                 :             12 :         initPQExpBuffer(&connstr);
 1746 drowley@postgresql.o       44                 :             12 :         appendPQExpBufferStr(&connstr, "dbname=");
 2806 noah@leadboat.com          45                 :             12 :         appendConnStrVal(&connstr, old_db->db_name);
                                 46                 :             12 :         initPQExpBuffer(&escaped_connstr);
                                 47                 :             12 :         appendShellString(&escaped_connstr, connstr.data);
                                 48                 :             12 :         termPQExpBuffer(&connstr);
                                 49                 :                : 
 4146 bruce@momjian.us           50                 :             12 :         pg_log(PG_STATUS, "%s", old_db->db_name);
 4127                            51                 :             12 :         snprintf(sql_file_name, sizeof(sql_file_name), DB_DUMP_FILE_MASK, old_db->db_oid);
                                 52                 :             12 :         snprintf(log_file_name, sizeof(log_file_name), DB_DUMP_LOG_FILE_MASK, old_db->db_oid);
                                 53                 :                : 
 4127 bruce@momjian.us           54                 :UBC           0 :         parallel_exec_prog(log_file_name, NULL,
                                 55                 :                :                            "\"%s/pg_dump\" %s --schema-only --quote-all-identifiers "
                                 56                 :                :                            "--binary-upgrade --format=custom %s --file=\"%s/%s\" %s",
                                 57                 :                :                            new_cluster.bindir, cluster_conn_opts(&old_cluster),
 3993 tgl@sss.pgh.pa.us          58         [ -  + ]:CBC          12 :                            log_opts.verbose ? "--verbose" : "",
                                 59                 :                :                            log_opts.dumpdir,
                                 60                 :                :                            sql_file_name, escaped_connstr.data);
                                 61                 :                : 
 2806 noah@leadboat.com          62                 :             12 :         termPQExpBuffer(&escaped_connstr);
                                 63                 :                :     }
                                 64                 :                : 
                                 65                 :                :     /* reap all children */
 4127 bruce@momjian.us           66         [ -  + ]:              4 :     while (reap_child(true) == true)
                                 67                 :                :         ;
                                 68                 :                : 
 4153                            69                 :              4 :     end_progress_output();
                                 70                 :              4 :     check_ok();
 5086                            71                 :              4 : }
        

Generated by: LCOV version 2.1-beta2-3-g6141622