This patch will ensure that the hash table iteration performed by
authorBruce Momjian <[email protected]>
Wed, 11 May 2005 18:05:37 +0000 (18:05 +0000)
committerBruce Momjian <[email protected]>
Wed, 11 May 2005 18:05:37 +0000 (18:05 +0000)
AtCommit_Portals is restarted when a portal is deleted. This is
necessary since the deletion of a portal may cause the deletion of
another which on rare occations may cause the iterator to return a
deleted portal an thus a renewed attempt delete.

Thomas Hallgren

src/backend/utils/mmgr/portalmem.c

index 12fee76f330a885bddc663ae06bf265f5079608e..3d2d2fadd128770198f8aee158ff7077516e0c53 100644 (file)
@@ -475,12 +475,6 @@ CommitHoldablePortals(void)
  *
  * Remove all non-holdable portals created in this transaction.
  * Portals remaining from prior transactions should be left untouched.
- *
- * XXX This assumes that portals can be deleted in a random order, ie,
- * no portal has a reference to any other (at least not one that will be
- * exercised during deletion). I think this is okay at the moment, but
- * we've had bugs of that ilk in the past.  Keep a close eye on cursor
- * references...
  */
 void
 AtCommit_Portals(void)
@@ -516,6 +510,9 @@ AtCommit_Portals(void)
 
                /* Zap all non-holdable portals */
                PortalDrop(portal, true);
+
+               /* Restart the iteration */
+               hash_seq_init(&status, PortalHashTable);
        }
 }