~ubuntu-branches/ubuntu/trusty/postgresql-9.3/trusty-proposed

« back to all changes in this revision

Viewing changes to src/backend/utils/time/snapmgr.c

  • Committer: Package Import Robot
  • Author(s): Martin Pitt
  • Date: 2014-07-24 16:13:59 UTC
  • mfrom: (1.1.8)
  • Revision ID: package-import@ubuntu.com-20140724161359-uk325qfv03euxuuh
Tags: 9.3.5-0ubuntu0.14.04.1
* New upstream bug fix release: (LP: #1348176)
  - pg_upgrade: Users who upgraded to version 9.3 using pg_upgrade may have
    an issue with transaction information which causes VACUUM to eventually
    fail. These users should run the script provided in the release notes to
    determine if their installation is affected, and then take the remedy
    steps outlined there.
  - Various data integrity and other bug fixes.
  - Secure Unix-domain sockets of temporary postmasters started during make
    check.
    Any local user able to access the socket file could connect as the
    server's bootstrap superuser, then proceed to execute arbitrary code as
    the operating-system user running the test, as we previously noted in
    CVE-2014-0067. This change defends against that risk by placing the
    server's socket in a temporary, mode 0700 subdirectory of /tmp.
  - See release notes for details:
    http://www.postgresql.org/about/news/1534/
* Remove pg_regress patches to support --host=/path, obsolete with above
  upstream changes and not applicable any more.
* Drop tcl8.6 patch, applied upstream.
* Add missing logrotate test dependency.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 * regd_count and count it in RegisteredSnapshots, but this reference is not
12
12
 * tracked by a resource owner. We used to use the TopTransactionResourceOwner
13
13
 * to track this snapshot reference, but that introduces logical circularity
14
 
 * and thus makes it impossible to clean up in a sane fashion.  It's better to
 
14
 * and thus makes it impossible to clean up in a sane fashion.  It's better to
15
15
 * handle this reference as an internally-tracked registration, so that this
16
16
 * module is entirely lower-level than ResourceOwners.
17
17
 *
20
20
 * tracked by any resource owner.
21
21
 *
22
22
 * These arrangements let us reset MyPgXact->xmin when there are no snapshots
23
 
 * referenced by this transaction.      (One possible improvement would be to be
 
23
 * referenced by this transaction.  (One possible improvement would be to be
24
24
 * able to advance Xmin when the snapshot with the earliest Xmin is no longer
25
 
 * referenced.  That's a bit harder though, it requires more locking, and
 
25
 * referenced.  That's a bit harder though, it requires more locking, and
26
26
 * anyway it should be rather uncommon to keep temporary snapshots referenced
27
27
 * for too long.)
28
28
 *
57
57
 * CurrentSnapshot points to the only snapshot taken in transaction-snapshot
58
58
 * mode, and to the latest one taken in a read-committed transaction.
59
59
 * SecondarySnapshot is a snapshot that's always up-to-date as of the current
60
 
 * instant, even in transaction-snapshot mode.  It should only be used for
 
60
 * instant, even in transaction-snapshot mode.  It should only be used for
61
61
 * special-purpose code (say, RI checking.)
62
62
 *
63
63
 * These SnapshotData structs are static to simplify memory allocation
76
76
 * mode, we don't want it to say that BootstrapTransactionId is in progress.
77
77
 *
78
78
 * RecentGlobalXmin is initialized to InvalidTransactionId, to ensure that no
79
 
 * one tries to use a stale value.      Readers should ensure that it has been set
 
79
 * one tries to use a stale value.  Readers should ensure that it has been set
80
80
 * to something else before using it.
81
81
 */
82
82
TransactionId TransactionXmin = FirstNormalTransactionId;
114
114
bool            FirstSnapshotSet = false;
115
115
 
116
116
/*
117
 
 * Remember the serializable transaction snapshot, if any.      We cannot trust
 
117
 * Remember the serializable transaction snapshot, if any.  We cannot trust
118
118
 * FirstSnapshotSet in combination with IsolationUsesXactSnapshot(), because
119
119
 * GUC may be reset before us, changing the value of IsolationUsesXactSnapshot.
120
120
 */
286
286
 
287
287
        /*
288
288
         * In transaction-snapshot mode, the first snapshot must live until end of
289
 
         * xact, so we must make a copy of it.  Furthermore, if we're running in
 
289
         * xact, so we must make a copy of it.  Furthermore, if we're running in
290
290
         * serializable mode, predicate.c needs to do its own processing.
291
291
         */
292
292
        if (IsolationUsesXactSnapshot())
382
382
 *
383
383
 * If the passed snapshot is a statically-allocated one, or it is possibly
384
384
 * subject to a future command counter update, create a new long-lived copy
385
 
 * with active refcount=1.      Otherwise, only increment the refcount.
 
385
 * with active refcount=1.  Otherwise, only increment the refcount.
386
386
 */
387
387
void
388
388
PushActiveSnapshot(Snapshot snap)
751
751
         * However, we haven't got enough information to do that, since we don't
752
752
         * know if we're at top level or not.  For example, we could be inside a
753
753
         * plpgsql function that is going to fire off other transactions via
754
 
         * dblink.      Rather than disallow perfectly legitimate usages, don't make a
 
754
         * dblink.  Rather than disallow perfectly legitimate usages, don't make a
755
755
         * check.
756
756
         *
757
757
         * Also note that we don't make any restriction on the transaction's
964
964
 
965
965
/*
966
966
 * ImportSnapshot
967
 
 *              Import a previously exported snapshot.  The argument should be a
 
967
 *              Import a previously exported snapshot.  The argument should be a
968
968
 *              filename in SNAPSHOT_EXPORT_DIR.  Load the snapshot from that file.
969
969
 *              This is called by "SET TRANSACTION SNAPSHOT 'foo'".
970
970
 */