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

Commit3347226

Browse files
committed
[Issue#177] treat files with '.gz.partial', '.part' and '.gz.part' siffixes as WAL segments
1 parentaa27b53 commit3347226

File tree

3 files changed

+49
-8
lines changed

3 files changed

+49
-8
lines changed

‎src/catalog.c‎

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,8 @@ pgBackupCreateDir(pgBackup *backup)
853853
}
854854

855855
/*
856-
* Create list of timelines
856+
* Create list of timelines.
857+
* TODO: '.partial' and '.part' segno information should be added to tlinfo.
857858
*/
858859
parray*
859860
catalog_get_timelines(InstanceConfig*instance)
@@ -933,7 +934,8 @@ catalog_get_timelines(InstanceConfig *instance)
933934
continue;
934935
}
935936
/* partial WAL segment */
936-
elseif (IsPartialXLogFileName(file->name))
937+
elseif (IsPartialXLogFileName(file->name)||
938+
IsPartialCompressXLogFileName(file->name))
937939
{
938940
elog(VERBOSE,"partial WAL file \"%s\"",file->name);
939941

@@ -952,6 +954,27 @@ catalog_get_timelines(InstanceConfig *instance)
952954
parray_append(tlinfo->xlog_filelist,wal_file);
953955
continue;
954956
}
957+
/* temp WAL segment */
958+
elseif (IsTempXLogFileName(file->name)||
959+
IsTempCompressXLogFileName(file->name))
960+
{
961+
elog(VERBOSE,"temp WAL file \"%s\"",file->name);
962+
963+
if (!tlinfo||tlinfo->tli!=tli)
964+
{
965+
tlinfo=timelineInfoNew(tli);
966+
parray_append(timelineinfos,tlinfo);
967+
}
968+
969+
/* append file to xlog file list */
970+
wal_file=palloc(sizeof(xlogFile));
971+
wal_file->file=*file;
972+
wal_file->segno=segno;
973+
wal_file->type=TEMP_SEGMENT;
974+
wal_file->keep= false;
975+
parray_append(tlinfo->xlog_filelist,wal_file);
976+
continue;
977+
}
955978
/* we only expect compressed wal files with .gz suffix */
956979
elseif (strcmp(suffix,"gz")!=0)
957980
{

‎src/delete.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -942,6 +942,8 @@ delete_walfiles_in_tli(XLogRecPtr keep_lsn, timelineInfo *tlinfo,
942942
{
943943
if (wal_file->type==SEGMENT)
944944
elog(VERBOSE,"Removed WAL segment \"%s\"",wal_file->file.path);
945+
elseif (wal_file->type==TEMP_SEGMENT)
946+
elog(VERBOSE,"Removed temp WAL segment \"%s\"",wal_file->file.path);
945947
elseif (wal_file->type==PARTIAL_SEGMENT)
946948
elog(VERBOSE,"Removed partial WAL segment \"%s\"",wal_file->file.path);
947949
elseif (wal_file->type==BACKUP_HISTORY_FILE)

‎src/pg_probackup.h‎

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ extern const char *PROGRAM_URL;
4646
externconstchar*PROGRAM_EMAIL;
4747

4848
/* Directory/File names */
49-
#defineDATABASE_DIR"database"
49+
#defineDATABASE_DIR"database"
5050
#defineBACKUPS_DIR"backups"
5151
#ifPG_VERSION_NUM >=100000
5252
#definePG_XLOG_DIR"pg_wal"
@@ -90,6 +90,7 @@ extern const char *PROGRAM_EMAIL;
9090
/* retry attempts */
9191
#definePAGE_READ_ATTEMPTS 100
9292

93+
/* max size of note, that can be added to backup */
9394
#defineMAX_NOTE_SIZE 1024
9495

9596
/* Check if an XLogRecPtr value is pointed to 0 offset */
@@ -514,18 +515,18 @@ typedef struct lsnInterval
514515
typedefenumxlogFileType
515516
{
516517
SEGMENT,
518+
TEMP_SEGMENT,
517519
PARTIAL_SEGMENT,
518520
BACKUP_HISTORY_FILE
519521
}xlogFileType;
520522

521523
typedefstructxlogFile
522524
{
523-
pgFilefile;
524-
XLogSegNosegno;
525+
pgFilefile;
526+
XLogSegNosegno;
525527
xlogFileTypetype;
526-
boolkeep;/* Used to prevent removal of WAL segments
527-
* required by ARCHIVE backups.
528-
*/
528+
boolkeep;/* Used to prevent removal of WAL segments
529+
* required by ARCHIVE backups. */
529530
}xlogFile;
530531

531532

@@ -607,6 +608,21 @@ typedef struct BackupPageHeader
607608
XLogFromFileName(fname, tli, logSegNo)
608609
#endif
609610

611+
#defineIsPartialCompressXLogFileName(fname)\
612+
(strlen(fname) == XLOG_FNAME_LEN + strlen(".gz.partial") && \
613+
strspn(fname, "0123456789ABCDEF") == XLOG_FNAME_LEN &&\
614+
strcmp((fname) + XLOG_FNAME_LEN, ".gz.partial") == 0)
615+
616+
#defineIsTempXLogFileName(fname)\
617+
(strlen(fname) == XLOG_FNAME_LEN + strlen(".part") &&\
618+
strspn(fname, "0123456789ABCDEF") == XLOG_FNAME_LEN &&\
619+
strcmp((fname) + XLOG_FNAME_LEN, ".part") == 0)
620+
621+
#defineIsTempCompressXLogFileName(fname)\
622+
(strlen(fname) == XLOG_FNAME_LEN + strlen(".gz.part") && \
623+
strspn(fname, "0123456789ABCDEF") == XLOG_FNAME_LEN &&\
624+
strcmp((fname) + XLOG_FNAME_LEN, ".gz.part") == 0)
625+
610626
#defineIsSshProtocol() (instance_config.remote.host && strcmp(instance_config.remote.proto, "ssh") == 0)
611627

612628
/* directory options */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp