From: | Andres Freund <andres(at)2ndquadrant(dot)com> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org, Kevin Grittner <kgrittn(at)mail(dot)com> |
Subject: | matviews do not lock relations during refresh |
Date: | 2013-10-22 23:28:22 |
Message-ID: | 20131022232822.GB823737@alap2.anarazel.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
In an postgres build that has added instrumentation to detect cases
where indexes are index_open()ed without any locks on the underlying
relation, the matview code started to cry during the regression tests.
The problem seems to be that refresh_matview_datafill() uses
QueryRewrite() without previously using AcquireRewriteLocks() but as
QueryRewrite states:
* ...
* NOTE: the parsetree must either have come straight from the parser,
* or have been scanned by AcquireRewriteLocks to acquire suitable locks.
*/
I think the missed locks could lead to postgres crashing under
concurrent DDL.
I've attached a quick patch that fixes the issue for me in HEAD, but I
am not 100% sure I understand the details of refresh_matview_datafill().
This probably needs to go into 9.3 in an adapted form.
Greetings,
Andres Freund
--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
Attachment | Content-Type | Size |
---|---|---|
0001-Acquire-appropriate-locks-when-rewriting-during-REFR.patch | text/x-patch | 1.4 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Noah Misch | 2013-10-23 01:05:33 | Re: Why the asprintf patch is still breaking the buildfarm |
Previous Message | Alvaro Herrera | 2013-10-22 22:16:00 | tracking commit timestamps |