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

« back to all changes in this revision

Viewing changes to src/backend/executor/nodeHash.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:
365
365
 
366
366
        /*
367
367
         * Set up for skew optimization, if possible and there's a need for more
368
 
         * than one batch.      (In a one-batch join, there's no point in it.)
 
368
         * than one batch.  (In a one-batch join, there's no point in it.)
369
369
         */
370
370
        if (nbatch > 1)
371
371
                ExecHashBuildSkewHash(hashtable, node, num_skew_mcvs);
407
407
 
408
408
        /*
409
409
         * Estimate tupsize based on footprint of tuple in hashtable... note this
410
 
         * does not allow for any palloc overhead.      The manipulations of spaceUsed
 
410
         * does not allow for any palloc overhead.  The manipulations of spaceUsed
411
411
         * don't count palloc overhead either.
412
412
         */
413
413
        tupsize = HJTUPLE_OVERHEAD +
459
459
        /*
460
460
         * Set nbuckets to achieve an average bucket load of NTUP_PER_BUCKET when
461
461
         * memory is filled.  Set nbatch to the smallest power of 2 that appears
462
 
         * sufficient.  The Min() steps limit the results so that the pointer
 
462
         * sufficient.  The Min() steps limit the results so that the pointer
463
463
         * arrays we'll try to allocate do not exceed work_mem.
464
464
         */
465
465
        max_pointers = (work_mem * 1024L) / sizeof(void *);
498
498
 
499
499
        /*
500
500
         * Both nbuckets and nbatch must be powers of 2 to make
501
 
         * ExecHashGetBucketAndBatch fast.      We already fixed nbatch; now inflate
502
 
         * nbuckets to the next larger power of 2.      We also force nbuckets to not
 
501
         * ExecHashGetBucketAndBatch fast.  We already fixed nbatch; now inflate
 
502
         * nbuckets to the next larger power of 2.  We also force nbuckets to not
503
503
         * be real small, by starting the search at 2^10.  (Note: above we made
504
504
         * sure that nbuckets is not more than INT_MAX / 2, so this loop cannot
505
505
         * overflow, nor can the final shift to recalculate nbuckets.)
817
817
                 * the hash support function as strict even if the operator is not.
818
818
                 *
819
819
                 * Note: currently, all hashjoinable operators must be strict since
820
 
                 * the hash index AM assumes that.      However, it takes so little extra
 
820
                 * the hash index AM assumes that.  However, it takes so little extra
821
821
                 * code here to allow non-strict that we may as well do it.
822
822
                 */
823
823
                if (isNull)
1237
1237
                        /*
1238
1238
                         * While we have not hit a hole in the hashtable and have not hit
1239
1239
                         * the desired bucket, we have collided with some previous hash
1240
 
                         * value, so try the next bucket location.      NB: this code must
 
1240
                         * value, so try the next bucket location.  NB: this code must
1241
1241
                         * match ExecHashGetSkewBucket.
1242
1242
                         */
1243
1243
                        bucket = hashvalue & (nbuckets - 1);
1435
1435
         * NOTE: this is not nearly as simple as it looks on the surface, because
1436
1436
         * of the possibility of collisions in the hashtable.  Suppose that hash
1437
1437
         * values A and B collide at a particular hashtable entry, and that A was
1438
 
         * entered first so B gets shifted to a different table entry.  If we were
 
1438
         * entered first so B gets shifted to a different table entry.  If we were
1439
1439
         * to remove A first then ExecHashGetSkewBucket would mistakenly start
1440
1440
         * reporting that B is not in the hashtable, because it would hit the NULL
1441
1441
         * before finding B.  However, we always remove entries in the reverse