Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit635a4a5

Browse files
committed
Added pgBackupGetPath2()
1 parentd10b05b commit635a4a5

File tree

4 files changed

+25
-7
lines changed

4 files changed

+25
-7
lines changed

‎backup.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1676,13 +1676,13 @@ StreamLog(void *arg)
16761676
ctl.synchronous= false;
16771677
ctl.mark_done= false;
16781678
if(ReceiveXlogStream(conn,&ctl)== false)
1679-
elog(ERROR,"Problem inrecivexlog");
1679+
elog(ERROR,"Problem inreceivexlog");
16801680
}
16811681
#else
16821682
if(ReceiveXlogStream(conn,startpos,starttli,NULL,basedir,
16831683
stop_streaming,standby_message_timeout,NULL,
16841684
false, false)== false)
1685-
elog(ERROR,"Problem inrecivexlog");
1685+
elog(ERROR,"Problem inreceivexlog");
16861686
#endif
16871687

16881688
PQfinish(conn);

‎catalog.c

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -613,14 +613,32 @@ pgBackupCompareIdDesc(const void *l, const void *r)
613613
*/
614614
void
615615
pgBackupGetPath(constpgBackup*backup,char*path,size_tlen,constchar*subdir)
616+
{
617+
pgBackupGetPath2(backup,path,len,subdir,NULL);
618+
}
619+
620+
/*
621+
* Construct absolute path of the backup directory.
622+
* Append "subdir1" and "subdir2" to the backup directory.
623+
*/
624+
void
625+
pgBackupGetPath2(constpgBackup*backup,char*path,size_tlen,
626+
constchar*subdir1,constchar*subdir2)
616627
{
617628
char*datetime;
618629

619630
datetime=base36enc(backup->start_time);
620-
if (subdir)
621-
snprintf(path,len,"%s/%s/%s",backup_instance_path,datetime,subdir);
631+
632+
/* If "subdir1" is NULL do not check "subdir2" */
633+
if (!subdir1)
634+
snprintf(path,len,"%s/%s/%s",backup_path,BACKUPS_DIR,datetime);
635+
elseif (!subdir2)
636+
snprintf(path,len,"%s/%s/%s/%s",backup_path,BACKUPS_DIR,datetime,subdir1);
637+
/* "subdir1" and "subdir2" is not NULL */
622638
else
623-
snprintf(path,len,"%s/%s",backup_instance_path,datetime);
639+
snprintf(path,len,"%s/%s/%s/%s/%s",backup_path,BACKUPS_DIR,
640+
datetime,subdir1,subdir2);
641+
624642
free(datetime);
625643

626644
make_native_path(path);

‎pg_probackup.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,8 @@ extern void catalog_lock(void);
338338
externvoidpgBackupWriteControl(FILE*out,pgBackup*backup);
339339
externvoidpgBackupWriteBackupControlFile(pgBackup*backup);
340340
externvoidpgBackupGetPath(constpgBackup*backup,char*path,size_tlen,constchar*subdir);
341+
externvoidpgBackupGetPath2(constpgBackup*backup,char*path,size_tlen,
342+
constchar*subdir1,constchar*subdir2);
341343
externintpgBackupCreateDir(pgBackup*backup);
342344
externvoidpgBackupFree(void*backup);
343345
externintpgBackupCompareId(constvoid*f1,constvoid*f2);

‎restore.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,11 +373,9 @@ remove_deleted_files(pgBackup *backup)
373373
{
374374
parray*files;
375375
parray*files_restored;
376-
chardatabase_path[MAXPGPATH];
377376
charfilelist_path[MAXPGPATH];
378377
inti;
379378

380-
pgBackupGetPath(backup,database_path,lengthof(database_path),DATABASE_DIR);
381379
pgBackupGetPath(backup,filelist_path,lengthof(filelist_path),DATABASE_FILE_LIST);
382380
/* Read backup's filelist using target database path as base path */
383381
files=dir_read_file_list(pgdata,filelist_path);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp