We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6defc76 commit 9453cf0Copy full SHA for 9453cf0
src/pg_probackup.h
@@ -649,6 +649,9 @@ typedef struct BackupPageHeader2
649
strcmp((fname) + XLOG_FNAME_LEN, ".gz") == 0)
650
651
#if PG_VERSION_NUM >= 110000
652
+
653
+#define WalSegmentOffset(xlogptr, wal_segsz_bytes) \
654
+ XLogSegmentOffset(xlogptr, wal_segsz_bytes)
655
#define GetXLogSegNo(xlrp, logSegNo, wal_segsz_bytes) \
656
XLByteToSeg(xlrp, logSegNo, wal_segsz_bytes)
657
#define GetXLogRecPtr(segno, offset, wal_segsz_bytes, dest) \
@@ -668,6 +671,8 @@ typedef struct BackupPageHeader2
668
671
#define GetXLogFromFileName(fname, tli, logSegNo, wal_segsz_bytes) \
669
672
XLogFromFileName(fname, tli, logSegNo, wal_segsz_bytes)
670
673
#else
674
675
+ XLogSegmentOffset(xlogptr)
676
677
XLByteToSeg(xlrp, logSegNo)
678
src/stream.c
@@ -290,8 +290,13 @@ stop_streaming(XLogRecPtr xlogpos, uint32 timeline, bool segment_finished)
290
291
GetXLogSegNo(xlogpos, xlog_segno, instance_config.xlog_seg_size);
292
293
- /* xlogpos points to the current segment, and we need the finished - previous one */
294
- xlog_segno--;
+ /*
+ * xlogpos points to the current segment, and we need the finished - previous one
295
+ * inless xlogpos points to not 0 offset in segment
296
+ */
297
+ if (WalSegmentOffset(xlogpos, instance_config.xlog_seg_size) == 0)
298
+ xlog_segno--;
299
300
GetXLogFileName(wal_segment_name, timeline, xlog_segno,
301
instance_config.xlog_seg_size);
302
0 commit comments