From 8bd4b89e240cc6488f5e1523202cc2d27e9970c0 Mon Sep 17 00:00:00 2001
From: Robert Haas <rhaas@postgresql.org>
Date: Fri, 17 Dec 2010 11:32:02 -0500
Subject: [PATCH] Try to save a kernel call in
 ResolveRecoveryConflictWithVirtualXIDs.

If there's no work to be done, just exit quickly, before initialization.
---
 src/backend/storage/ipc/standby.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/backend/storage/ipc/standby.c b/src/backend/storage/ipc/standby.c
index 4f209eab688..b659c320585 100644
--- a/src/backend/storage/ipc/standby.c
+++ b/src/backend/storage/ipc/standby.c
@@ -193,6 +193,10 @@ ResolveRecoveryConflictWithVirtualXIDs(VirtualTransactionId *waitlist,
 	TimestampTz waitStart;
 	char	   *new_status;
 
+	/* Fast exit, to avoid a kernel call if there's no work to be done. */
+	if (!VirtualTransactionIdIsValid(*waitlist))
+		return;
+
 	waitStart = GetCurrentTimestamp();
 	new_status = NULL;		/* we haven't changed the ps display */
 
-- 
GitLab