diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2008-02-20 17:44:26 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2008-02-20 17:44:26 +0000 |
commit | 63df2c788a25076b645176727d7a4a02061881f4 (patch) | |
tree | d508db21d14bf59b5466e850dc47e2b607dd9c82 /src | |
parent | e2429619b1093b536f4b8324b7fdc54382f04ba3 (diff) | |
download | postgresql-63df2c788a25076b645176727d7a4a02061881f4.tar.gz postgresql-63df2c788a25076b645176727d7a4a02061881f4.zip |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/catalog/catalog.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/backend/catalog/catalog.c b/src/backend/catalog/catalog.c index 69313ea86a2..f4908178122 100644 --- a/src/backend/catalog/catalog.c +++ b/src/backend/catalog/catalog.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/catalog/catalog.c,v 1.64 2005/10/15 02:49:12 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/catalog.c,v 1.64.2.1 2008/02/20 17:44:26 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -301,6 +301,8 @@ GetNewOidWithIndex(Relation relation, Relation indexrel) /* Generate new OIDs until we find one not in the table */ do { + CHECK_FOR_INTERRUPTS(); + newOid = GetNewObjectId(); ScanKeyInit(&key, @@ -349,6 +351,8 @@ GetNewRelFileNode(Oid reltablespace, bool relisshared, Relation pg_class) do { + CHECK_FOR_INTERRUPTS(); + /* Generate the OID */ if (pg_class) rnode.relNode = GetNewOid(pg_class); |