From 16fd9fdf7fa74847e0fa8eec9f7e1d4f7baa9f89 Mon Sep 17 00:00:00 2001
From: Osumi Takamichi <osumi.takamichi@fujitsu.com>
Date: Thu, 26 Nov 2020 03:57:40 +0000
Subject: [PATCH v01] Safeguard for archive recovery not to miss data

This disables the server to start up when it
detects WAL generated with wal_level=minimal during archive recovery.
The motivation of this patch is to protect user ends up with getting replica
that could miss data and getting the server to miss data in targeted recovery mode.

Author: Takamichi Osumi <osumi.takamichi@fujitsu.com>
---
 src/backend/access/transam/xlog.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 13f1d8c..da4cc77 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -6257,7 +6257,7 @@ CheckRequiredParameterValues(void)
 	 */
 	if (ArchiveRecoveryRequested && ControlFile->wal_level == WAL_LEVEL_MINIMAL)
 	{
-		ereport(WARNING,
+		ereport(FATAL,
 				(errmsg("WAL was generated with wal_level=minimal, data may be missing"),
 				 errhint("This happens if you temporarily set wal_level=minimal without taking a new base backup.")));
 	}
-- 
1.8.3.1

