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

« back to all changes in this revision

Viewing changes to src/backend/access/hash/hashpage.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:
49
49
 * of the locking rules).  However, we can skip taking lmgr locks when the
50
50
 * index is local to the current backend (ie, either temp or new in the
51
51
 * current transaction).  No one else can see it, so there's no reason to
52
 
 * take locks.  We still take buffer-level locks, but not lmgr locks.
 
52
 * take locks.  We still take buffer-level locks, but not lmgr locks.
53
53
 */
54
54
#define USELOCKING(rel)         (!RELATION_IS_LOCAL(rel))
55
55
 
136
136
 *
137
137
 *              This must be used only to fetch pages that are known to be before
138
138
 *              the index's filesystem EOF, but are to be filled from scratch.
139
 
 *              _hash_pageinit() is applied automatically.      Otherwise it has
 
139
 *              _hash_pageinit() is applied automatically.  Otherwise it has
140
140
 *              effects similar to _hash_getbuf() with access = HASH_WRITE.
141
141
 *
142
142
 *              When this routine returns, a write lock is set on the
344
344
        /*
345
345
         * Determine the target fill factor (in tuples per bucket) for this index.
346
346
         * The idea is to make the fill factor correspond to pages about as full
347
 
         * as the user-settable fillfactor parameter says.      We can compute it
 
347
         * as the user-settable fillfactor parameter says.  We can compute it
348
348
         * exactly since the index datatype (i.e. uint32 hash key) is fixed-width.
349
349
         */
350
350
        data_width = sizeof(uint32);
377
377
        /*
378
378
         * We initialize the metapage, the first N bucket pages, and the first
379
379
         * bitmap page in sequence, using _hash_getnewbuf to cause smgrextend()
380
 
         * calls to occur.      This ensures that the smgr level has the right idea of
 
380
         * calls to occur.  This ensures that the smgr level has the right idea of
381
381
         * the physical index length.
382
382
         */
383
383
        metabuf = _hash_getnewbuf(rel, HASH_METAPAGE, forkNum);
545
545
 
546
546
        /*
547
547
         * Determine which bucket is to be split, and attempt to lock the old
548
 
         * bucket.      If we can't get the lock, give up.
 
548
         * bucket.  If we can't get the lock, give up.
549
549
         *
550
550
         * The lock protects us against other backends, but not against our own
551
551
         * backend.  Must check for active scans separately.
603
603
        }
604
604
 
605
605
        /*
606
 
         * Okay to proceed with split.  Update the metapage bucket mapping info.
 
606
         * Okay to proceed with split.  Update the metapage bucket mapping info.
607
607
         *
608
608
         * Since we are scribbling on the metapage data right in the shared
609
609
         * buffer, any failure in this next little bit leaves us with a big
641
641
         * Copy bucket mapping info now; this saves re-accessing the meta page
642
642
         * inside _hash_splitbucket's inner loop.  Note that once we drop the
643
643
         * split lock, other splits could begin, so these values might be out of
644
 
         * date before _hash_splitbucket finishes.      That's okay, since all it
 
644
         * date before _hash_splitbucket finishes.  That's okay, since all it
645
645
         * needs is to tell which of these two buckets to map hashkeys into.
646
646
         */
647
647
        maxbucket = metap->hashm_maxbucket;
876
876
 
877
877
        /*
878
878
         * We're at the end of the old bucket chain, so we're done partitioning
879
 
         * the tuples.  Before quitting, call _hash_squeezebucket to ensure the
 
879
         * the tuples.  Before quitting, call _hash_squeezebucket to ensure the
880
880
         * tuples remaining in the old bucket (including the overflow pages) are
881
881
         * packed as tightly as possible.  The new bucket is already tight.
882
882
         */