~ubuntu-branches/ubuntu/hardy/postgresql-8.4/hardy-backports

« back to all changes in this revision

Viewing changes to src/backend/access/transam/xact.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2011-01-03 08:57:10 UTC
  • mfrom: (5.3.10 sid)
  • Revision ID: james.westby@ubuntu.com-20110103085710-v9u121v7u7oq8qca
Tags: 8.4.6-1~hardy1
Automated backport upload; no source changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
 *
11
11
 *
12
12
 * IDENTIFICATION
13
 
 *        $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.274.2.3 2010/01/24 21:49:31 tgl Exp $
 
13
 *        $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.274.2.4 2010/07/23 00:43:17 rhaas Exp $
14
14
 *
15
15
 *-------------------------------------------------------------------------
16
16
 */
399
399
 
400
400
        /*
401
401
         * Ensure parent(s) have XIDs, so that a child always has an XID later
402
 
         * than its parent.
 
402
         * than its parent.  Musn't recurse here, or we might get a stack overflow
 
403
         * if we're at the bottom of a huge stack of subtransactions none of which
 
404
         * have XIDs yet.
403
405
         */
404
406
        if (isSubXact && !TransactionIdIsValid(s->parent->transactionId))
405
 
                AssignTransactionId(s->parent);
 
407
        {
 
408
                TransactionState        p = s->parent;
 
409
                TransactionState   *parents;
 
410
                size_t  parentOffset = 0;
 
411
 
 
412
                parents = palloc(sizeof(TransactionState) *  s->nestingLevel);
 
413
                while (p != NULL && !TransactionIdIsValid(p->transactionId))
 
414
                {
 
415
                        parents[parentOffset++] = p;
 
416
                        p = p->parent;
 
417
                }
 
418
 
 
419
                /*
 
420
                 * This is technically a recursive call, but the recursion will
 
421
                 * never be more than one layer deep.
 
422
                 */
 
423
                while (parentOffset != 0)
 
424
                        AssignTransactionId(parents[--parentOffset]);
 
425
 
 
426
                pfree(parents);
 
427
        }
406
428
 
407
429
        /*
408
430
         * Generate a new Xid and record it in PG_PROC and pg_subtrans.