Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3f2e29d

Browse files
committed
minor fix
1 parent a9f0460 commit 3f2e29d

File tree

2 files changed

+14
-20
lines changed

2 files changed

+14
-20
lines changed

src/backup.c

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1237,17 +1237,12 @@ wait_wal_lsn(const char *wal_segment_dir, XLogRecPtr target_lsn, bool is_start_l
12371237
int timeout_elevel, bool in_stream_dir)
12381238
{
12391239
XLogSegNo targetSegNo;
1240-
char wal_segment_path[MAXPGPATH],
1241-
// wal_segment_subdir[MAXPGPATH], // used only to check file existence, not actual parsing
1240+
char wal_segment_path[MAXPGPATH], /* used only for reporting */
12421241
wal_segment[MAXFNAMELEN];
12431242
uint32 try_count = 0,
12441243
timeout;
12451244
char *wal_delivery_str = in_stream_dir ? "streamed":"archived";
12461245

1247-
//#ifdef HAVE_LIBZ
1248-
// char gz_wal_segment_path[MAXPGPATH];
1249-
//#endif
1250-
12511246
/* Compute the name of the WAL file containing requested LSN */
12521247
GetXLogSegNo(target_lsn, targetSegNo, instance_config.xlog_seg_size);
12531248
if (in_prev_segment)
@@ -1256,12 +1251,15 @@ wait_wal_lsn(const char *wal_segment_dir, XLogRecPtr target_lsn, bool is_start_l
12561251
instance_config.xlog_seg_size);
12571252

12581253
// obtain WAL archive subdir for ARCHIVE backup
1259-
// if (in_stream_dir)
1260-
// strcpy(wal_segment_subdir, wal_segment_dir);
1261-
// else
1262-
// get_archive_subdir(wal_segment_subdir, wal_segment_dir, wal_segment, SEGMENT);
1263-
//
1264-
// join_path_components(wal_segment_path, wal_segment_subdir, wal_segment);
1254+
if (in_stream_dir)
1255+
join_path_components(wal_segment_path, wal_segment_dir, wal_segment);
1256+
else
1257+
{
1258+
char wal_segment_subdir[MAXPGPATH];
1259+
get_archive_subdir(wal_segment_subdir, wal_segment_dir, wal_segment, SEGMENT);
1260+
join_path_components(wal_segment_path, wal_segment_subdir, wal_segment);
1261+
}
1262+
12651263
/*
12661264
* In pg_start_backup we wait for 'target_lsn' in 'pg_wal' directory if it is
12671265
* stream and non-page backup. Page backup needs archived WAL files, so we
@@ -1282,11 +1280,6 @@ wait_wal_lsn(const char *wal_segment_dir, XLogRecPtr target_lsn, bool is_start_l
12821280
elog(LOG, "Looking for LSN %X/%X in segment: %s",
12831281
(uint32) (target_lsn >> 32), (uint32) target_lsn, wal_segment);
12841282

1285-
//#ifdef HAVE_LIBZ
1286-
// snprintf(gz_wal_segment_path, sizeof(gz_wal_segment_path), "%s.gz",
1287-
// wal_segment_path);
1288-
//#endif
1289-
12901283
/* Wait until target LSN is archived or streamed */
12911284
while (true)
12921285
{

src/parsexlog.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2051,7 +2051,8 @@ static XLogReaderState* WalReaderAllocate(uint32 wal_seg_size, XLogReaderData *r
20512051

20522052
/*
20532053
* Is WAL file exists in archive directory
2054-
* first check subdirectory, then fallback to archive directory
2054+
* for stream backup check uncompressed segment in wal_root_dir
2055+
* for archive backup first check subdirectory, then fallback to archive directory
20552056
*/
20562057
bool IsWalFileExists(const char *wal_segment_name, const char *wal_root_dir, bool in_stream_dir)
20572058
{
@@ -2098,11 +2099,11 @@ bool IsWalFileExists(const char *wal_segment_name, const char *wal_root_dir, boo
20982099
goto not_found;
20992100

21002101
found_compressed_file:
2101-
elog(LOG, "Found WAL segment: %s", wal_file_fullpath);
2102+
elog(LOG, "Found compressed WAL segment: %s", wal_file_fullpath);
21022103
return true;
21032104

21042105
found_uncompressed_file:
2105-
elog(LOG, "Found compressed WAL segment: %s", wal_file_fullpath_gz);
2106+
elog(LOG, "Found WAL segment: %s", wal_file_fullpath_gz);
21062107
return true;
21072108

21082109
not_found:

0 commit comments

Comments
 (0)