Re: pgsql: Check interrupts during logical decoding more frequently. - Mailing list pgsql-committers

From Andres Freund
Subject Re: pgsql: Check interrupts during logical decoding more frequently.
Date
Msg-id 20140630152300.GO26930@awork2.anarazel.de
Whole thread Raw
In response to Re: pgsql: Check interrupts during logical decoding more frequently.  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-committers
On 2014-06-30 10:10:24 -0400, Tom Lane wrote:
> Andres Freund <andres@anarazel.de> writes:
> > Check interrupts during logical decoding more frequently.
>
> FWIW, I think it's usually better style to put CHECK_FOR_INTERRUPTS
> at the tops of loops rather than the bottoms.  If you put it at the
> bottom, it's easily bypassed unintentionally by a "continue" somewhere
> in the middle of the loop body.  (I suppose there could be cases where
> that's actually what you want, but if so some comments would be
> appropriate, because it's fragile coding.)

Ok. Will do so from now on.

I wanted to put it after the expensive/slow operation which makes the
check necessary - obviously putting it at the loop begin essentially has
the same effect, but that seemed clearer to me.

Greetings,

Andres Freund

--
 Andres Freund                       http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: Re: pgsql: Check interrupts during logical decoding more frequently.
Next
From: Noah Misch
Date:
Subject: pgsql: Don't prematurely free the BufferAccessStrategy in pgstat_heap()