Skip_Checkpoint_on_Promotion_20120618.patch

text/x-patch

Filename: Skip_Checkpoint_on_Promotion_20120618.patch
Type: text/x-patch
Part: 1
Message: Re: Skip checkpoint on promoting from streaming replication

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/xlog.c 11 3
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 70b4972..574ecfb 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -6914,9 +6914,17 @@ StartupXLOG(void)
 		 * allows some extra error checking in xlog_redo.
 		 */
 		if (bgwriterLaunched)
-			RequestCheckpoint(CHECKPOINT_END_OF_RECOVERY |
-							  CHECKPOINT_IMMEDIATE |
-							  CHECKPOINT_WAIT);
+		{
+			checkPointLoc = ControlFile->prevCheckPoint;
+			record = ReadCheckpointRecord(checkPointLoc, 2);
+			if (record != NULL)
+				ereport(LOG,
+						(errmsg("Checkpoint on recovery end was skipped")));
+			else
+				RequestCheckpoint(CHECKPOINT_END_OF_RECOVERY |
+								  CHECKPOINT_IMMEDIATE |
+								  CHECKPOINT_WAIT);
+		}
 		else
 			CreateCheckPoint(CHECKPOINT_END_OF_RECOVERY | CHECKPOINT_IMMEDIATE);