0001-Prevent-checkpointer-from-writing-to-older-timeline.patch
text/x-patch
Filename: 0001-Prevent-checkpointer-from-writing-to-older-timeline.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: format-patch
Series: patch 0001
Subject: Prevent checkpointer from writing to older timeline
| File | + | − |
|---|---|---|
| src/backend/access/transam/twophase.c | 10 | 0 |
From dbf5a9f6899bedf28b482fc03a4a2b0571e92e9b Mon Sep 17 00:00:00 2001
From: Soumyadeep Chakraborty <soumyadeep2007@gmail.com>
Date: Tue, 2 Mar 2021 17:41:20 -0800
Subject: [PATCH 1/1] Prevent checkpointer from writing to older timeline
Co-authored-by: Kevin Yeap <kyeap@vmware.com>
---
src/backend/access/transam/twophase.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/backend/access/transam/twophase.c b/src/backend/access/transam/twophase.c
index 80d2d20d6cc..081aee6217e 100644
--- a/src/backend/access/transam/twophase.c
+++ b/src/backend/access/transam/twophase.c
@@ -1740,6 +1740,16 @@ CheckPointTwoPhase(XLogRecPtr redo_horizon)
}
LWLockRelease(TwoPhaseStateLock);
+ if (serialized_xacts > 0)
+ {
+ /*
+ * In order to ensure that we write the checkpoint record to the latest
+ * timeline, refresh ThisTimeLineID. This is necessary if we had read
+ * two phase data from an earlier timeline, above.
+ */
+ InitXLOGAccess();
+ }
+
/*
* Flush unconditionally the parent directory to make any information
* durable on disk. Two-phase files could have been removed and those
--
2.25.1