LCOV - differential code coverage report
Current view: top level - src/common - archive.c (source / functions) Coverage Total Hit UBC CBC
Current: Differential Code Coverage 16@8cea358b128 vs 17@8cea358b128 Lines: 100.0 % 9 9 9
Current Date: 2024-04-14 14:21:10 Functions: 100.0 % 1 1 1
Baseline: 16@8cea358b128 Branches: 50.0 % 4 2 2 2
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: 100.0 % 9 9 9
Function coverage date bins:
(240..) days: 100.0 % 1 1 1
Branch coverage date bins:
(240..) days: 50.0 % 4 2 2 2

 Age         Owner                    Branch data    TLA  Line data    Source code
                                  1                 :                : /*-------------------------------------------------------------------------
                                  2                 :                :  *
                                  3                 :                :  * archive.c
                                  4                 :                :  *    Common WAL archive routines
                                  5                 :                :  *
                                  6                 :                :  * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
                                  7                 :                :  * Portions Copyright (c) 1994, Regents of the University of California
                                  8                 :                :  *
                                  9                 :                :  *
                                 10                 :                :  * IDENTIFICATION
                                 11                 :                :  *    src/common/archive.c
                                 12                 :                :  *
                                 13                 :                :  *-------------------------------------------------------------------------
                                 14                 :                :  */
                                 15                 :                : 
                                 16                 :                : #ifndef FRONTEND
                                 17                 :                : #include "postgres.h"
                                 18                 :                : #else
                                 19                 :                : #include "postgres_fe.h"
                                 20                 :                : #endif
                                 21                 :                : 
                                 22                 :                : #include "common/archive.h"
                                 23                 :                : #include "common/percentrepl.h"
                                 24                 :                : 
                                 25                 :                : /*
                                 26                 :                :  * BuildRestoreCommand
                                 27                 :                :  *
                                 28                 :                :  * Builds a restore command to retrieve a file from WAL archives, replacing
                                 29                 :                :  * the supported aliases with values supplied by the caller as defined by
                                 30                 :                :  * the GUC parameter restore_command: xlogpath for %p, xlogfname for %f and
                                 31                 :                :  * lastRestartPointFname for %r.
                                 32                 :                :  *
                                 33                 :                :  * The result is a palloc'd string for the restore command built.  The
                                 34                 :                :  * caller is responsible for freeing it.  If any of the required arguments
                                 35                 :                :  * is NULL and that the corresponding alias is found in the command given
                                 36                 :                :  * by the caller, then an error is thrown.
                                 37                 :                :  */
                                 38                 :                : char *
  433 michael@paquier.xyz        39                 :CBC         308 : BuildRestoreCommand(const char *restoreCommand,
                                 40                 :                :                     const char *xlogpath,
                                 41                 :                :                     const char *xlogfname,
                                 42                 :                :                     const char *lastRestartPointFname)
                                 43                 :                : {
                                 44                 :            308 :     char       *nativePath = NULL;
                                 45                 :                :     char       *result;
                                 46                 :                : 
                                 47         [ +  - ]:            308 :     if (xlogpath)
                                 48                 :                :     {
                                 49                 :            308 :         nativePath = pstrdup(xlogpath);
                                 50                 :            308 :         make_native_path(nativePath);
                                 51                 :                :     }
                                 52                 :                : 
                                 53                 :            308 :     result = replace_percent_placeholders(restoreCommand, "restore_command", "frp",
                                 54                 :                :                                           xlogfname, lastRestartPointFname, nativePath);
                                 55                 :                : 
                                 56         [ +  - ]:            308 :     if (nativePath)
                                 57                 :            308 :         pfree(nativePath);
                                 58                 :                : 
                                 59                 :            308 :     return result;
                                 60                 :                : }
        

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