~ubuntu-branches/ubuntu/natty/postgresql-8.4/natty-security

« back to all changes in this revision

Viewing changes to src/backend/commands/indexcmds.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2009-07-01 17:41:41 UTC
  • mfrom: (1.1.4 upstream)
  • mto: This revision was merged to the branch mainline in revision 6.
  • Revision ID: james.westby@ubuntu.com-20090701174141-jfmn9tt8e69m950x
Tags: 8.4.0-1
* Final 8.4.0 release. Major enhancements:
  - Windowing Functions
  - Common Table Expressions and Recursive Queries
  - Default and variadic parameters for functions
  - Parallel Restore
  - Column Permissions
  - Per-database locale settings
  - Improved hash indexes
  - Improved join performance for EXISTS and NOT EXISTS queries
  - Easier-to-use Warm Standby
  - Automatic sizing of the Free Space Map
  - Visibility Map (greatly reduces vacuum overhead for slowly-changing
    tables)
  - Version-aware psql (backslash commands work against older servers)
  - Support SSL certificates for user authentication
  - Per-function runtime statistics
  - Easy editing of functions in psql
  - New contrib modules: pg_stat_statements, auto_explain, citext,
    btree_gin 
  Upload to unstable, 8.4 is the new default. 
* debian/control: Build the versionless metapackages and have them point to
  8.4.

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
 *
9
9
 *
10
10
 * IDENTIFICATION
11
 
 *        $PostgreSQL: pgsql/src/backend/commands/indexcmds.c,v 1.184 2009/04/04 17:40:36 tgl Exp $
 
11
 *        $PostgreSQL: pgsql/src/backend/commands/indexcmds.c,v 1.185 2009/06/11 14:48:55 momjian Exp $
12
12
 *
13
13
 *-------------------------------------------------------------------------
14
14
 */
639
639
         * We can exclude any running transactions that have xmin > the xmin of
640
640
         * our reference snapshot; their oldest snapshot must be newer than ours.
641
641
         * We can also exclude any transactions that have xmin = zero, since they
642
 
         * evidently have no live snapshot at all (and any one they might be
643
 
         * in process of taking is certainly newer than ours).  Transactions in
644
 
         * other DBs can be ignored too, since they'll never even be able to see
645
 
         * this index.
 
642
         * evidently have no live snapshot at all (and any one they might be in
 
643
         * process of taking is certainly newer than ours).  Transactions in other
 
644
         * DBs can be ignored too, since they'll never even be able to see this
 
645
         * index.
646
646
         *
647
647
         * We can also exclude autovacuum processes and processes running manual
648
648
         * lazy VACUUMs, because they won't be fazed by missing index entries
649
 
         * either.  (Manual ANALYZEs, however, can't be excluded because they
 
649
         * either.      (Manual ANALYZEs, however, can't be excluded because they
650
650
         * might be within transactions that are going to do arbitrary operations
651
651
         * later.)
652
652
         *
653
653
         * Also, GetCurrentVirtualXIDs never reports our own vxid, so we need not
654
654
         * check for that.
655
655
         *
656
 
         * If a process goes idle-in-transaction with xmin zero, we do not need
657
 
         * to wait for it anymore, per the above argument.  We do not have the
658
 
         * infrastructure right now to stop waiting if that happens, but we can
659
 
         * at least avoid the folly of waiting when it is idle at the time we
660
 
         * would begin to wait.  We do this by repeatedly rechecking the output of
 
656
         * If a process goes idle-in-transaction with xmin zero, we do not need to
 
657
         * wait for it anymore, per the above argument.  We do not have the
 
658
         * infrastructure right now to stop waiting if that happens, but we can at
 
659
         * least avoid the folly of waiting when it is idle at the time we would
 
660
         * begin to wait.  We do this by repeatedly rechecking the output of
661
661
         * GetCurrentVirtualXIDs.  If, during any iteration, a particular vxid
662
662
         * doesn't show up in the output, we know we can forget about it.
663
663
         */
680
680
 
681
681
                        newer_snapshots = GetCurrentVirtualXIDs(snapshot->xmin,
682
682
                                                                                                        true, false,
683
 
                                                                                  PROC_IS_AUTOVACUUM | PROC_IN_VACUUM,
 
683
                                                                                 PROC_IS_AUTOVACUUM | PROC_IN_VACUUM,
684
684
                                                                                                        &n_newer_snapshots);
685
685
                        for (j = i; j < n_old_snapshots; j++)
686
686
                        {
687
687
                                if (!VirtualTransactionIdIsValid(old_snapshots[j]))
688
 
                                        continue;               /* found uninteresting in previous cycle */
 
688
                                        continue;       /* found uninteresting in previous cycle */
689
689
                                for (k = 0; k < n_newer_snapshots; k++)
690
690
                                {
691
691
                                        if (VirtualTransactionIdEquals(old_snapshots[j],
1058
1058
        ScanKeyData skey[1];
1059
1059
        SysScanDesc scan;
1060
1060
        HeapTuple       tup;
1061
 
        TYPCATEGORY     tcategory;
 
1061
        TYPCATEGORY tcategory;
1062
1062
 
1063
1063
        /* If it's a domain, look at the base type instead */
1064
1064
        type_id = getBaseType(type_id);