I'm just experimenting a bit with GIN, and it is occasionally getting
stuck looping in findParents() during WAL replay.

The attached patch seems to fix it. I also had to set ptr->off as
advertised in the comment above the function to avoid triggering
assertions.

GIN isn't fully transparent to me yet, so it is quite likely that I am
missing something...

regards,
andreas

Index: ginbtree.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/access/gin/ginbtree.c,v
retrieving revision 1.1
diff -c -r1.1 ginbtree.c
*** ginbtree.c  2 May 2006 11:28:54 -0000       1.1
--- ginbtree.c  25 May 2006 18:12:13 -0000
***************
*** 202,208 ****
        for(;;) {
                buffer = ReadBuffer(btree->index, blkno);
                LockBuffer(buffer, GIN_EXCLUSIVE);
!               page = BufferGetPage(root->buffer);
                if ( GinPageIsLeaf(page) )
                        elog(ERROR, "Lost path");
  
--- 202,208 ----
        for(;;) {
                buffer = ReadBuffer(btree->index, blkno);
                LockBuffer(buffer, GIN_EXCLUSIVE);
!               page = BufferGetPage(buffer);
                if ( GinPageIsLeaf(page) )
                        elog(ERROR, "Lost path");
  
***************
*** 224,229 ****
--- 224,230 ----
                        ptr->blkno = blkno;
                        ptr->buffer = buffer;
                        ptr->parent = root; /* it's may be wrong, but in next 
call we will correct */
+                       ptr->off = offset;
                        stack->parent = ptr;
                        return;
                }

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

               http://archives.postgresql.org

Reply via email to