From 622983ea6964fc55f1ad3063d3d7b8f5de8e8816 Mon Sep 17 00:00:00 2001
From: Heikki Linnakangas <heikki.linnakangas@iki.fi>
Date: Fri, 21 Nov 2014 15:13:15 +0200
Subject: [PATCH] No need to call XLogEnsureRecordSpace when the relation is
 unlogged.

Amit Kapila
---
 src/backend/access/gin/ginfast.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/backend/access/gin/ginfast.c b/src/backend/access/gin/ginfast.c
index fd81d675570..f559a2f3d80 100644
--- a/src/backend/access/gin/ginfast.c
+++ b/src/backend/access/gin/ginfast.c
@@ -552,7 +552,8 @@ shiftList(Relation index, Buffer metabuffer, BlockNumber newHead,
 		 * prepare the XLogInsert machinery for that before entering the
 		 * critical section.
 		 */
-		XLogEnsureRecordSpace(data.ndeleted, 0);
+		if (RelationNeedsWAL(index))
+			XLogEnsureRecordSpace(data.ndeleted, 0);
 
 		START_CRIT_SECTION();
 
-- 
GitLab