pgsql: Ensure mark_dummy_rel doesn't create dangling pointers in RelOpt

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Ensure mark_dummy_rel doesn't create dangling pointers in RelOpt
Date: 2011-04-13 22:57:29
Message-ID: E1QA905-000478-Dp@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Ensure mark_dummy_rel doesn't create dangling pointers in RelOptInfos.

When we are doing GEQO join planning, the current memory context is a
short-lived context that will be reset at the end of geqo_eval(). However,
the RelOptInfos for base relations are set up before that and then re-used
across many GEQO cycles. Hence, any code that modifies a baserel during
join planning has to be careful not to put pointers to the short-lived
context into the baserel struct. mark_dummy_rel got this wrong, leading to
easy-to-reproduce-once-you-know-how crashes in 8.4, as reported off-list by
Leo Carson of SDSC. Some improvements made in 9.0 make it difficult to
demonstrate the crash in 9.0 or HEAD; but there's no doubt that there's
still a risk factor here, so patch all branches that have the function.
(Note: 8.3 has a similar function, but it's only applied to joinrels and
thus is not a hazard.)

Branch
------
REL8_4_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/1de8584fb1b71c98138b1f23808a4f01ab7566cd

Modified Files
--------------
src/backend/optimizer/path/joinrels.c | 26 +++++++++++++++++++++++++-
1 files changed, 25 insertions(+), 1 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2011-04-14 01:18:17 pgsql: Fix toast table creation.
Previous Message User Karl 2011-04-13 22:20:05 pgtcl - libpgtcl: Reference tclsh8.5 rather than 8.4.