On Tue, 2009-09-22 at 12:53 +0300, Heikki Linnakangas wrote:
> It looks like the standby tries to remove XID 4323 from the
> known-assigned hash table, but it's not there because it was removed
> and set in pg_subtrans by an XLOG_XACT_ASSIGNMENT record earlier. I
> guess we should just not throw an error in that case, but is there a
> way we could catch that narrow case and still keep the check in
> KnownAssignedXidsRemove()? It seems like the check might help catch
> other bugs, so I'd rather keep it if possible.

Fix attached.

-- 
 Simon Riggs           www.2ndQuadrant.com
diff --git a/src/backend/storage/ipc/procarray.c b/src/backend/storage/ipc/procarray.c
index f6f50be..031a6a2 100644
--- a/src/backend/storage/ipc/procarray.c
+++ b/src/backend/storage/ipc/procarray.c
@@ -2561,8 +2561,15 @@ KnownAssignedXidsRemove(TransactionId xid, bool report_error)
 
 	if (!found && report_error)
 	{
-		KnownAssignedXidsDisplay(LOG);
-		elog(ERROR, "cannot remove KnownAssignedXid %u", xid);
+		/*
+		 * Check to see whether we have updated subtrans with this xid.
+		 * If we did, its OK that it is no longer present in KnownAssignedXids
+		 */
+		if (!TransactionIdIsValid(SubTransGetParent(xid)))
+		{
+			KnownAssignedXidsDisplay(LOG);
+			elog(ERROR, "cannot remove KnownAssignedXid %u", xid);
+		}
 	}
 }
 
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to