LCOV - differential code coverage report
Current view: top level - src/bin/pg_upgrade - dump.c (source / functions) Coverage Total Hit UBC CBC
Current: 0e5ff9b9b45a657aea12440478dc002e9b01f138 vs 0123ce131fca454009439dfa3b2266d1d40737d7 Lines: 96.6 % 29 28 1 28
Current Date: 2026-03-14 14:10:32 -0400 Functions: 100.0 % 1 1 1
Baseline: lcov-20260315-024220-baseline Branches: 62.5 % 16 10 6 10
Baseline Date: 2026-03-14 15:27:56 +0100 Line coverage date bins:
Legend: Lines:     hit not hit
Branches: + taken - not taken # not executed
(7,30] days: 66.7 % 3 2 1 2
(30,360] days: 100.0 % 2 2 2
(360..) days: 100.0 % 24 24 24
Function coverage date bins:
(360..) days: 100.0 % 1 1 1
Branch coverage date bins:
(7,30] days: 50.0 % 2 1 1 1
(30,360] days: 75.0 % 4 3 1 3
(360..) days: 60.0 % 10 6 4 6

 Age         Owner                    Branch data    TLA  Line data    Source code
                                  1                 :                : /*
                                  2                 :                :  *  dump.c
                                  3                 :                :  *
                                  4                 :                :  *  dump functions
                                  5                 :                :  *
                                  6                 :                :  *  Copyright (c) 2010-2026, 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
 5626 bruce@momjian.us           16                 :CBC          11 : generate_old_dump(void)
                                 17                 :                : {
                                 18                 :                :     int         dbnum;
                                 19                 :                : 
 4853                            20                 :             11 :     prep_status("Creating dump of global objects");
                                 21                 :                : 
                                 22                 :                :     /* run new pg_dumpall binary for globals */
 2988                            23         [ +  - ]:             22 :     exec_prog(UTILITY_LOG_FILE, NULL, true, true,
                                 24                 :                :               "\"%s/pg_dumpall\" %s%s --globals-only --quote-all-identifiers "
                                 25                 :                :               "--binary-upgrade %s --no-sync -f \"%s/%s\"",
                                 26                 :                :               new_cluster.bindir, cluster_conn_opts(&old_cluster),
   19 jchampion@postgresql       27                 :             11 :               protocol_negotiation_supported(&old_cluster) ? "" : " -d \"max_protocol_version=3.0\"",
 5116 bruce@momjian.us           28         [ -  + ]:             11 :               log_opts.verbose ? "--verbose" : "",
                                 29                 :                :               log_opts.dumpdir,
                                 30                 :                :               GLOBALS_DUMP_FILE);
 4853                            31                 :             11 :     check_ok();
                                 32                 :                : 
 1483 andres@anarazel.de         33                 :             11 :     prep_status_progress("Creating dump of database schemas");
                                 34                 :                : 
                                 35                 :                :     /* create per-db dump files */
 4853 bruce@momjian.us           36         [ +  + ]:             47 :     for (dbnum = 0; dbnum < old_cluster.dbarr.ndbs; dbnum++)
                                 37                 :                :     {
                                 38                 :                :         char        sql_file_name[MAXPGPATH],
                                 39                 :                :                     log_file_name[MAXPGPATH];
 4693 tgl@sss.pgh.pa.us          40                 :             36 :         DbInfo     *old_db = &old_cluster.dbarr.dbs[dbnum];
                                 41                 :                :         PQExpBufferData connstr,
                                 42                 :                :                     escaped_connstr;
                                 43                 :                : 
 3506 noah@leadboat.com          44                 :             36 :         initPQExpBuffer(&connstr);
 2446 drowley@postgresql.o       45                 :             36 :         appendPQExpBufferStr(&connstr, "dbname=");
 3506 noah@leadboat.com          46                 :             36 :         appendConnStrVal(&connstr, old_db->db_name);
   19 jchampion@postgresql       47         [ -  + ]:             36 :         if (!protocol_negotiation_supported(&old_cluster))
   19 jchampion@postgresql       48                 :UBC           0 :             appendPQExpBufferStr(&connstr, " max_protocol_version=3.0");
                                 49                 :                : 
 3506 noah@leadboat.com          50                 :CBC          36 :         initPQExpBuffer(&escaped_connstr);
                                 51                 :             36 :         appendShellString(&escaped_connstr, connstr.data);
                                 52                 :             36 :         termPQExpBuffer(&connstr);
                                 53                 :                : 
 4846 bruce@momjian.us           54                 :             36 :         pg_log(PG_STATUS, "%s", old_db->db_name);
 4827                            55                 :             36 :         snprintf(sql_file_name, sizeof(sql_file_name), DB_DUMP_FILE_MASK, old_db->db_oid);
                                 56                 :             36 :         snprintf(log_file_name, sizeof(log_file_name), DB_DUMP_LOG_FILE_MASK, old_db->db_oid);
                                 57                 :                : 
                                 58                 :            108 :         parallel_exec_prog(log_file_name, NULL,
                                 59                 :                :                            "\"%s/pg_dump\" %s --no-data %s %s --quote-all-identifiers "
                                 60                 :                :                            "--binary-upgrade --format=custom %s --no-sync --file=\"%s/%s\" %s",
                                 61                 :                :                            new_cluster.bindir, cluster_conn_opts(&old_cluster),
  355 nathan@postgresql.or       62         [ +  + ]:             36 :                            (user_opts.transfer_mode == TRANSFER_MODE_SWAP) ?
                                 63                 :                :                            "" : "--sequence-data",
 4693 tgl@sss.pgh.pa.us          64         [ -  + ]:             36 :                            log_opts.verbose ? "--verbose" : "",
  225 jdavis@postgresql.or       65         [ +  - ]:             36 :                            user_opts.do_statistics ? "--statistics" : "--no-statistics",
                                 66                 :                :                            log_opts.dumpdir,
                                 67                 :                :                            sql_file_name, escaped_connstr.data);
                                 68                 :                : 
 3506 noah@leadboat.com          69                 :             36 :         termPQExpBuffer(&escaped_connstr);
                                 70                 :                :     }
                                 71                 :                : 
                                 72                 :                :     /* reap all children */
 4827 bruce@momjian.us           73         [ -  + ]:             11 :     while (reap_child(true) == true)
                                 74                 :                :         ;
                                 75                 :                : 
 4853                            76                 :             11 :     end_progress_output();
                                 77                 :             11 :     check_ok();
 5786                            78                 :             11 : }
        

Generated by: LCOV version 2.4-beta