Skip to content

Commit 71e6895

Browse files
VictorSpirinfunny-falcon
authored andcommitted
[PBCKP-270] Updated wait_wal_lsn function for begin backup without wal file for streaming WAL.
1 parent 8b46c8a commit 71e6895

File tree

4 files changed

+18
-0
lines changed

4 files changed

+18
-0
lines changed

src/backup.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1327,6 +1327,16 @@ wait_wal_lsn(const char *wal_segment_dir, XLogRecPtr target_lsn, bool is_start_l
13271327
}
13281328
else
13291329
elog(LOG, "Found WAL segment: %s", wal_segment_path);
1330+
1331+
1332+
/* Check current file for stream. It may be not exist in S3 */
1333+
if (!file_exists && segment_only && is_start_lsn && in_stream_dir && try_count > 1)
1334+
{
1335+
if( isStreamProccessed(wal_segment))
1336+
return InvalidXLogRecPtr;
1337+
1338+
}
1339+
13301340
}
13311341

13321342
if (file_exists)

src/compatibility/receivelog.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1222,3 +1222,9 @@ CalculateCopyStreamSleeptime(TimestampTz now, int standby_message_timeout,
12221222

12231223
return sleeptime;
12241224
}
1225+
1226+
1227+
bool isStreamProccessed(char *seg_filename)
1228+
{
1229+
return still_sending && !strcmp(current_walfile_name, seg_filename);
1230+
}

src/compatibility/walmethods.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ struct WalWriteMethod
8585

8686
/* Return a text for the last error in this Walfile */
8787
const char *(*getlasterror) (void);
88+
8889
};
8990

9091
/*

src/pg_probackup.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,6 +1221,7 @@ extern XLogRecPtr wait_wal_lsn(const char *wal_segment_dir, XLogRecPtr lsn, bool
12211221
extern void wait_wal_and_calculate_stop_lsn(const char *xlog_path, XLogRecPtr stop_lsn, pgBackup *backup);
12221222
extern int64 calculate_datasize_of_filelist(parray *filelist);
12231223

1224+
extern bool isStreamProccessed(char *seg_filename); /* Checks, that this file is stream processing. File name without path. */
12241225

12251226
/*
12261227
* Slices and arrays for C strings

0 commit comments

Comments
 (0)