saved_ThisTimeLineID.patch
text/x-patch
Filename: saved_ThisTimeLineID.patch
Type: text/x-patch
Part: 1
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: unified
| File | + | − |
|---|---|---|
| src/backend/access/transam/xlogutils.c | 8 | 0 |
diff --git a/src/backend/access/transam/xlogutils.c b/src/backend/access/transam/xlogutils.c
index d17d660f460..9064fa19837 100644
--- a/src/backend/access/transam/xlogutils.c
+++ b/src/backend/access/transam/xlogutils.c
@@ -831,6 +831,7 @@ read_local_xlog_page(XLogReaderState *state, XLogRecPtr targetPagePtr,
XLogRecPtr read_upto,
loc;
TimeLineID tli;
+ TimeLineID saved_ThisTimeLineID = ThisTimeLineID;
int count;
WALReadError errinfo;
@@ -915,6 +916,13 @@ read_local_xlog_page(XLogReaderState *state, XLogRecPtr targetPagePtr,
}
}
+ /*
+ * We want subsequent writes to go to the latest timeline. Thus, resync
+ * ThisTimeLineID, which may now be pointing to an older timeline, if we are
+ * currently in recovery.
+ */
+ ThisTimeLineID = saved_ThisTimeLineID;
+
if (targetPagePtr + XLOG_BLCKSZ <= read_upto)
{
/*