Skip to content

Commit 8ea9bca

Browse files
committed
remove duration variable as unrelated to this feature,
code cleanup.
1 parent 6f2d3f5 commit 8ea9bca

File tree

3 files changed

+4
-39
lines changed

3 files changed

+4
-39
lines changed

src/backup.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1992,8 +1992,6 @@ backup_files(void *arg)
19921992
if ((difftime(time(NULL), prev_time)) > 10)
19931993
{
19941994
prev_time = time(NULL);
1995-
elog(INFO, "write_backup_filelist N=%d, starttime %ld, time %ld",
1996-
n_backup_files_list, current.start_time, prev_time);
19971995

19981996
write_backup_filelist(&current, arguments->files_list, instance_config.pgdata,
19991997
arguments->external_dirs);

src/catalog.c

Lines changed: 3 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -91,31 +91,6 @@ write_backup_status(pgBackup *backup, BackupStatus status)
9191
pgBackupFree(tmp);
9292
}
9393

94-
/* update some fields of backup control file */
95-
void
96-
write_backup_control_on_the_fly(pgBackup *backup)
97-
{
98-
pgBackup *tmp;
99-
100-
tmp = read_backup(backup->start_time);
101-
if (!tmp)
102-
{
103-
/*
104-
* Silently exit the function, since read_backup already logged the
105-
* warning message.
106-
*/
107-
return;
108-
}
109-
110-
tmp->status = backup->status;
111-
tmp->data_bytes = backup->data_bytes;
112-
backup->duration = difftime(time(NULL), backup->start_time);
113-
tmp->duration = backup->duration;
114-
write_backup(tmp);
115-
116-
pgBackupFree(tmp);
117-
}
118-
11994
/*
12095
* Create exclusive lockfile in the backup's directory.
12196
*/
@@ -610,8 +585,6 @@ pgBackupWriteControl(FILE *out, pgBackup *backup)
610585
/* print external directories list */
611586
if (backup->external_dir_str)
612587
fio_fprintf(out, "external-dirs = '%s'\n", backup->external_dir_str);
613-
614-
fio_fprintf(out, "duration = " INT64_FORMAT "\n", backup->duration);
615588
}
616589

617590
/*
@@ -687,11 +660,10 @@ write_backup_filelist(pgBackup *backup, parray *files, const char *root,
687660

688661
i++;
689662

663+
/* if file is not backuped yet, do not add it to the list */
664+
/* TODO check that we correctly handle files which disappeared during backups */
690665
if (!file->backuped)
691-
{
692-
elog(WARNING, "file not backuped %s", file->rel_path);
693666
continue;
694-
}
695667

696668
if (S_ISDIR(file->mode))
697669
backup_size_on_disk += 4096;
@@ -778,7 +750,7 @@ write_backup_filelist(pgBackup *backup, parray *files, const char *root,
778750

779751
/* use extra variable to avoid reset of previous data_bytes value in case of error */
780752
backup->data_bytes = backup_size_on_disk;
781-
write_backup_control_on_the_fly(backup);
753+
write_backup(backup);
782754
}
783755

784756
/*
@@ -826,7 +798,6 @@ readBackupControlFile(const char *path)
826798
{'b', 0, "from-replica", &backup->from_replica, SOURCE_FILE_STRICT},
827799
{'s', 0, "primary-conninfo", &backup->primary_conninfo, SOURCE_FILE_STRICT},
828800
{'s', 0, "external-dirs", &backup->external_dir_str, SOURCE_FILE_STRICT},
829-
{'I', 0, "duration", &backup->duration, SOURCE_FILE_STRICT},
830801
{0}
831802
};
832803

@@ -1058,8 +1029,6 @@ pgBackupInit(pgBackup *backup)
10581029
backup->program_version[0] = '\0';
10591030
backup->server_version[0] = '\0';
10601031
backup->external_dir_str = NULL;
1061-
1062-
backup->duration = (time_t) 0;
10631032
}
10641033

10651034
/* free pgBackup object */

src/pg_probackup.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -310,8 +310,6 @@ struct pgBackup
310310
* in the format suitable for recovery.conf */
311311
char *external_dir_str; /* List of external directories,
312312
* separated by ':' */
313-
314-
int64 duration; /* TODO write better comment. time(NULL)-start_time */
315313
};
316314

317315
/* Recovery target for restore and validate subcommands */
@@ -549,7 +547,7 @@ extern int do_validate_all(void);
549547
extern pgBackup *read_backup(time_t timestamp);
550548
extern void write_backup(pgBackup *backup);
551549
extern void write_backup_status(pgBackup *backup, BackupStatus status);
552-
extern void write_backup_control_on_the_fly(pgBackup *backup);
550+
extern void write_backup_data_bytes(pgBackup *backup);
553551
extern bool lock_backup(pgBackup *backup);
554552

555553
extern const char *pgBackupGetBackupMode(pgBackup *backup);

0 commit comments

Comments
 (0)