aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2008-02-20 17:44:14 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2008-02-20 17:44:14 +0000
commit636fa3b4a7684fdef1a9f9b0d22030200cf62f7a (patch)
treeacc732502993c58f822f533715f28e89bf2c7fef
parentf134132abc94e1a300a5aa53d29dea8a9be009fa (diff)
downloadpostgresql-636fa3b4a7684fdef1a9f9b0d22030200cf62f7a.tar.gz
postgresql-636fa3b4a7684fdef1a9f9b0d22030200cf62f7a.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.
-rw-r--r--src/backend/catalog/catalog.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/backend/catalog/catalog.c b/src/backend/catalog/catalog.c
index bc94a5ca2aa..7947170e479 100644
--- a/src/backend/catalog/catalog.c
+++ b/src/backend/catalog/catalog.c
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/catalog.c,v 1.72 2008/01/01 19:45:48 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/catalog.c,v 1.72.2.1 2008/02/20 17:44:14 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -374,6 +374,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,
@@ -423,6 +425,8 @@ GetNewRelFileNode(Oid reltablespace, bool relisshared, Relation pg_class)
do
{
+ CHECK_FOR_INTERRUPTS();
+
/* Generate the OID */
if (pg_class)
rnode.relNode = GetNewOid(pg_class);