Skip to content

Commit 9de692c

Browse files
committed
Remove dead code in do_pg_backup_start().
As of commit 39969e2, no caller of do_pg_backup_start() passes NULL for labelfile or tblspcmapfile, nor is it plausible that any would do so in the future. Remove the code that coped with that case, as (a) it's dead and (b) it causes Coverity to bleat about possibly leaked storage. While here, do some janitorial work on the function's header comment.
1 parent 5e70d8b commit 9de692c

File tree

1 file changed

+13
-17
lines changed
  • src/backend/access/transam

1 file changed

+13
-17
lines changed

src/backend/access/transam/xlog.c

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8037,23 +8037,26 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli)
80378037
* function. It creates the necessary starting checkpoint and constructs the
80388038
* backup label and tablespace map.
80398039
*
8040-
* The backup label and tablespace map contents are returned in *labelfile and
8040+
* Input parameters are "backupidstr" (the backup label string) and "fast"
8041+
* (if true, we do the checkpoint in immediate mode to make it faster).
8042+
*
8043+
* The backup label and tablespace map contents are appended to *labelfile and
80418044
* *tblspcmapfile, and the caller is responsible for including them in the
8042-
* backup archive as 'backup_label' and 'tablespace_map'. There can be many
8043-
* backups active at the same time.
8045+
* backup archive as 'backup_label' and 'tablespace_map'.
8046+
* tblspcmapfile is required mainly for tar format in windows as native windows
8047+
* utilities are not able to create symlinks while extracting files from tar.
8048+
* However for consistency and platform-independence, we do it the same way
8049+
* everywhere.
80448050
*
80458051
* If "tablespaces" isn't NULL, it receives a list of tablespaceinfo structs
80468052
* describing the cluster's tablespaces.
80478053
*
8048-
* tblspcmapfile is required mainly for tar format in windows as native windows
8049-
* utilities are not able to create symlinks while extracting files from tar.
8050-
* However for consistency, the same is used for all platforms.
8051-
*
80528054
* Returns the minimum WAL location that must be present to restore from this
80538055
* backup, and the corresponding timeline ID in *starttli_p.
80548056
*
80558057
* Every successfully started backup must be stopped by calling
8056-
* do_pg_backup_stop() or do_pg_abort_backup().
8058+
* do_pg_backup_stop() or do_pg_abort_backup(). There can be many
8059+
* backups active at the same time.
80578060
*
80588061
* It is the responsibility of the caller of this function to verify the
80598062
* permissions of the calling user!
@@ -8244,12 +8247,8 @@ do_pg_backup_start(const char *backupidstr, bool fast, TimeLineID *starttli_p,
82448247
XLogFileName(xlogfilename, starttli, _logSegNo, wal_segment_size);
82458248

82468249
/*
8247-
* Construct tablespace_map file. If caller isn't interested in this,
8248-
* we make a local StringInfo.
8250+
* Construct tablespace_map file.
82498251
*/
8250-
if (tblspcmapfile == NULL)
8251-
tblspcmapfile = makeStringInfo();
8252-
82538252
datadirpathlen = strlen(DataDir);
82548253

82558254
/* Collect information about all tablespaces */
@@ -8350,11 +8349,8 @@ do_pg_backup_start(const char *backupidstr, bool fast, TimeLineID *starttli_p,
83508349
FreeDir(tblspcdir);
83518350

83528351
/*
8353-
* Construct backup label file. If caller isn't interested in this,
8354-
* we make a local StringInfo.
8352+
* Construct backup label file.
83558353
*/
8356-
if (labelfile == NULL)
8357-
labelfile = makeStringInfo();
83588354

83598355
/* Use the log timezone here, not the session timezone */
83608356
stamp_time = (pg_time_t) time(NULL);

0 commit comments

Comments
 (0)