From: Tom Lane <tgl@sss.pgh.pa.us> Date: Fri, 25 Nov 2011 18:58:59 +0000 (-0500) Subject: Fix erroneous replay of GIN_UPDATE_META_PAGE WAL records. X-Git-Tag: REL9_0_6~14 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=80cbf3401c6cab7e00628b9cf5ca204c0726b9cc;p=postgresql Fix erroneous replay of GIN_UPDATE_META_PAGE WAL records. A simple thinko in ginRedoUpdateMetapage, namely failing to increment a loop counter, led to inserting records into the last pending-list page in the wrong order (the opposite of that intended). So far as I can tell, this would not upset the code that eventually flushes pending items into the main part of the GIN index. But it did break the code that searched the pending list for matches, resulting in transient failure to find matching entries during index lookups, as illustrated in bug #6307 from Maksym Boguk. Back-patch to 8.4 where the incorrect code was introduced. --- diff --git a/src/backend/access/gin/ginxlog.c b/src/backend/access/gin/ginxlog.c index f9ed583ec0..fc078b1959 100644 --- a/src/backend/access/gin/ginxlog.c +++ b/src/backend/access/gin/ginxlog.c @@ -528,6 +528,8 @@ ginRedoUpdateMetapage(XLogRecPtr lsn, XLogRecord *record) elog(ERROR, "failed to add item to index page"); tuples = (IndexTuple) (((char *) tuples) + tupsize); + + off++; } /*