Skip to content

Commit 5ce6829

Browse files
committed
Put a CHECK_FOR_INTERRUPTS call into the loops that try to find a unique new
OID or new relfilenode. If the existing OIDs are sufficiently densely populated, this could take a long time (perhaps even be an infinite loop), so it seems wise to allow the system to respond to a cancel interrupt here. Per a gripe from Jacky Leng. Backpatch as far as 8.1. Older versions just fail on OID collision, instead of looping.
1 parent f78611b commit 5ce6829

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/backend/catalog/catalog.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/backend/catalog/catalog.c,v 1.72 2008/01/01 19:45:48 momjian Exp $
13+
* $PostgreSQL: pgsql/src/backend/catalog/catalog.c,v 1.73 2008/02/20 17:44:09 tgl Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -374,6 +374,8 @@ GetNewOidWithIndex(Relation relation, Relation indexrel)
374374
/* Generate new OIDs until we find one not in the table */
375375
do
376376
{
377+
CHECK_FOR_INTERRUPTS();
378+
377379
newOid = GetNewObjectId();
378380

379381
ScanKeyInit(&key,
@@ -423,6 +425,8 @@ GetNewRelFileNode(Oid reltablespace, bool relisshared, Relation pg_class)
423425

424426
do
425427
{
428+
CHECK_FOR_INTERRUPTS();
429+
426430
/* Generate the OID */
427431
if (pg_class)
428432
rnode.relNode = GetNewOid(pg_class);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy