mirror of
https://github.com/postgrespro/pg_probackup.git
synced 2024-12-04 10:44:46 +02:00
Added pgBackupGetPath2()
This commit is contained in:
parent
d10b05bd91
commit
635a4a53ed
4
backup.c
4
backup.c
@ -1676,13 +1676,13 @@ StreamLog(void *arg)
|
||||
ctl.synchronous = false;
|
||||
ctl.mark_done = false;
|
||||
if(ReceiveXlogStream(conn, &ctl) == false)
|
||||
elog(ERROR, "Problem in recivexlog");
|
||||
elog(ERROR, "Problem in receivexlog");
|
||||
}
|
||||
#else
|
||||
if(ReceiveXlogStream(conn, startpos, starttli, NULL, basedir,
|
||||
stop_streaming, standby_message_timeout, NULL,
|
||||
false, false) == false)
|
||||
elog(ERROR, "Problem in recivexlog");
|
||||
elog(ERROR, "Problem in receivexlog");
|
||||
#endif
|
||||
|
||||
PQfinish(conn);
|
||||
|
24
catalog.c
24
catalog.c
@ -613,14 +613,32 @@ pgBackupCompareIdDesc(const void *l, const void *r)
|
||||
*/
|
||||
void
|
||||
pgBackupGetPath(const pgBackup *backup, char *path, size_t len, const char *subdir)
|
||||
{
|
||||
pgBackupGetPath2(backup, path, len, subdir, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Construct absolute path of the backup directory.
|
||||
* Append "subdir1" and "subdir2" to the backup directory.
|
||||
*/
|
||||
void
|
||||
pgBackupGetPath2(const pgBackup *backup, char *path, size_t len,
|
||||
const char *subdir1, const char *subdir2)
|
||||
{
|
||||
char *datetime;
|
||||
|
||||
datetime = base36enc(backup->start_time);
|
||||
if (subdir)
|
||||
snprintf(path, len, "%s/%s/%s", backup_instance_path, datetime, subdir);
|
||||
|
||||
/* If "subdir1" is NULL do not check "subdir2" */
|
||||
if (!subdir1)
|
||||
snprintf(path, len, "%s/%s/%s", backup_path, BACKUPS_DIR, datetime);
|
||||
else if (!subdir2)
|
||||
snprintf(path, len, "%s/%s/%s/%s", backup_path, BACKUPS_DIR, datetime, subdir1);
|
||||
/* "subdir1" and "subdir2" is not NULL */
|
||||
else
|
||||
snprintf(path, len, "%s/%s", backup_instance_path, datetime);
|
||||
snprintf(path, len, "%s/%s/%s/%s/%s", backup_path, BACKUPS_DIR,
|
||||
datetime, subdir1, subdir2);
|
||||
|
||||
free(datetime);
|
||||
|
||||
make_native_path(path);
|
||||
|
@ -338,6 +338,8 @@ extern void catalog_lock(void);
|
||||
extern void pgBackupWriteControl(FILE *out, pgBackup *backup);
|
||||
extern void pgBackupWriteBackupControlFile(pgBackup *backup);
|
||||
extern void pgBackupGetPath(const pgBackup *backup, char *path, size_t len, const char *subdir);
|
||||
extern void pgBackupGetPath2(const pgBackup *backup, char *path, size_t len,
|
||||
const char *subdir1, const char *subdir2);
|
||||
extern int pgBackupCreateDir(pgBackup *backup);
|
||||
extern void pgBackupFree(void *backup);
|
||||
extern int pgBackupCompareId(const void *f1, const void *f2);
|
||||
|
@ -373,11 +373,9 @@ remove_deleted_files(pgBackup *backup)
|
||||
{
|
||||
parray *files;
|
||||
parray *files_restored;
|
||||
char database_path[MAXPGPATH];
|
||||
char filelist_path[MAXPGPATH];
|
||||
int i;
|
||||
|
||||
pgBackupGetPath(backup, database_path, lengthof(database_path), DATABASE_DIR);
|
||||
pgBackupGetPath(backup, filelist_path, lengthof(filelist_path), DATABASE_FILE_LIST);
|
||||
/* Read backup's filelist using target database path as base path */
|
||||
files = dir_read_file_list(pgdata, filelist_path);
|
||||
|
Loading…
Reference in New Issue
Block a user