Re: New Event Trigger: table_rewrite - Mailing list pgsql-hackers

From Robert Haas
Subject Re: New Event Trigger: table_rewrite
Date
Msg-id CA+TgmoZ7HxOdR4_VKYvQvD1bJO1UXw+XaDVhr=x6fZjZ1zM6GA@mail.gmail.com
Whole thread Raw
In response to Re: New Event Trigger: table_rewrite  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-hackers
On Tue, Nov 18, 2014 at 5:34 PM, Alvaro Herrera
<alvherre@2ndquadrant.com> wrote:
> Almost the whole of that function is conditions to bail out clustering
> the relation if things have changed since the relation list was
> collected.  It seems wrong to invoke the event trigger in all those
> cases; it's going to fire spuriously.  I think you should move the
> invocation of the event trigger at the end, just before rebuild_relation
> is called.  Not sure where relative to the predicate lock stuff therein;
> probably before, so that we avoid doing that dance if the event trigger
> function decides to jump ship.

I can see two problems with that:

1. What if the conditions aren't true any more after the event trigger
has run?  Then it's unsafe.

2. If we do it that way, then we'll unnecessarily wait for a lock on
the relation even if the event trigger is just going to bail out.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: New Event Trigger: table_rewrite
Next
From: Heikki Linnakangas
Date:
Subject: Re: Increasing test coverage of WAL redo functions