Skip site navigation (1) Skip section navigation (2)

pgsql: Make the overflow guards in ExecChooseHashTableSize be more

From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Make the overflow guards in ExecChooseHashTableSize be more
Date: 2009-10-30 20:58:45
Message-ID: 20091030205845.C4C1B753FB7@cvs.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-committers
Log Message:
-----------
Make the overflow guards in ExecChooseHashTableSize be more protective.
The original coding ensured nbuckets and nbatch didn't exceed INT_MAX,
which while not insane on its own terms did nothing to protect subsequent
code like "palloc(nbatch * sizeof(BufFile *))".  Since enormous join size
estimates might well be planner error rather than reality, it seems best
to constrain the initial sizes to be not more than work_mem/sizeof(pointer),
thus ensuring the allocated arrays don't exceed work_mem.  We will allow
nbatch to get bigger than that during subsequent ExecHashIncreaseNumBatches
calls, but we should still guard against integer overflow in those palloc
requests.  Per bug #5145 from Bernt Marius Johnsen.

Although the given test case only seems to fail back to 8.2, previous
releases have variants of this issue, so patch all supported branches.

Modified Files:
--------------
    pgsql/src/backend/executor:
        nodeHash.c (r1.122 -> r1.123)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/executor/nodeHash.c?r1=1.122&r2=1.123)

pgsql-committers by date

Next:From: Tom LaneDate: 2009-10-30 20:58:51
Subject: pgsql: Make the overflow guards in ExecChooseHashTableSize be more
Previous:From: Peter EisentrautDate: 2009-10-29 21:57:17
Subject: pgsql: Remove some leftovers of split tarball support

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group