From debcec7dc31a992703911a9953e299c8d730c778 Mon Sep 17 00:00:00 2001 From: Robert Haas Date: Fri, 13 Aug 2010 20:10:54 +0000 Subject: Include the backend ID in the relpath of temporary relations. This allows us to reliably remove all leftover temporary relation files on cluster startup without reference to system catalogs or WAL; therefore, we no longer include temporary relations in XLOG_XACT_COMMIT and XLOG_XACT_ABORT WAL records. Since these changes require including a backend ID in each SharedInvalSmgrMsg, the size of the SharedInvalidationMessage.id field has been reduced from two bytes to one, and the maximum number of connections has been reduced from INT_MAX / 4 to 2^23-1. It would be possible to remove these restrictions by increasing the size of SharedInvalidationMessage by 4 bytes, but right now that doesn't seem like a good trade-off. Review by Jaime Casanova and Tom Lane. --- src/backend/access/transam/twophase.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/backend/access/transam/twophase.c') diff --git a/src/backend/access/transam/twophase.c b/src/backend/access/transam/twophase.c index d6dca97bce..e3c3bc8dbc 100644 --- a/src/backend/access/transam/twophase.c +++ b/src/backend/access/transam/twophase.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/transam/twophase.c,v 1.62 2010/07/06 19:18:55 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/access/transam/twophase.c,v 1.63 2010/08/13 20:10:50 rhaas Exp $ * * NOTES * Each global transaction is associated with a global transaction @@ -865,8 +865,8 @@ StartPrepare(GlobalTransaction gxact) hdr.prepared_at = gxact->prepared_at; hdr.owner = gxact->owner; hdr.nsubxacts = xactGetCommittedChildren(&children); - hdr.ncommitrels = smgrGetPendingDeletes(true, &commitrels, NULL); - hdr.nabortrels = smgrGetPendingDeletes(false, &abortrels, NULL); + hdr.ncommitrels = smgrGetPendingDeletes(true, &commitrels); + hdr.nabortrels = smgrGetPendingDeletes(false, &abortrels); hdr.ninvalmsgs = xactGetCommittedInvalidationMessages(&invalmsgs, &hdr.initfileinval); StrNCpy(hdr.gid, gxact->gid, GIDSIZE); @@ -1320,13 +1320,13 @@ FinishPreparedTransaction(const char *gid, bool isCommit) } for (i = 0; i < ndelrels; i++) { - SMgrRelation srel = smgropen(delrels[i]); + SMgrRelation srel = smgropen(delrels[i], InvalidBackendId); ForkNumber fork; for (fork = 0; fork <= MAX_FORKNUM; fork++) { if (smgrexists(srel, fork)) - smgrdounlink(srel, fork, false, false); + smgrdounlink(srel, fork, false); } smgrclose(srel); } -- cgit v1.2.1