Re: idle_in_transaction_timeout - Mailing list pgsql-hackers

From Robert Haas
Subject Re: idle_in_transaction_timeout
Date
Msg-id CA+Tgmob__pfjcPYjdsb+UZ1ufzr=qn9UY-Y1824p4nZbS2mPuw@mail.gmail.com
Whole thread Raw
In response to Re: idle_in_transaction_timeout  (Vik Fearing <vik.fearing@dalibo.com>)
Responses Re: idle_in_transaction_timeout  (Andres Freund <andres@2ndquadrant.com>)
Re: idle_in_transaction_timeout  (David G Johnston <david.g.johnston@gmail.com>)
Re: idle_in_transaction_timeout  (Vik Fearing <vik.fearing@dalibo.com>)
List pgsql-hackers
On Tue, Jun 24, 2014 at 9:18 AM, Vik Fearing <vik.fearing@dalibo.com> wrote:
> On 06/22/2014 05:11 PM, Kevin Grittner wrote:
>> I found one substantive issue that had been missed in discussion,
>> though.  The patch modifies the postgres_fdw extension to make it
>> automatically exempt from an attempt to set a limit like this on
>> the server to which it connects.  I'm not sure that's a good idea.
>> Why should this type of connection be allowed to sit indefinitely
>> with an idle open transaction?  I'm inclined to omit this part of
>> the patch
>
> My reasoning for doing it the way I did is that if a transaction touches
> a foreign table and then goes bumbling along with other things the
> transaction is active but the connection to the remote server remains
> idle in transaction.  If it hits the timeout, when the local transaction
> goes to commit it errors out and you lose all your work.
>
> If the local transaction is actually idle in transaction and the local
> server doesn't have a timeout, we're no worse off than before this patch.

I think we are.  First, the correct timeout is a matter of
remote-server-policy, not local-server-policy.  If the remote server
wants to boot people with long-running idle transactions, it's
entitled to do that, and postgres_fdw shouldn't assume that it's
"special".  The local server policy may be different, and may not even
have been configured by the same person.  Second, setting another GUC
at every session start adds overhead for all users of postgres_fdw.

Now, it might be that postgres_fdw should have a facility to allow
arbitrary options to be set on the foreign side at each connection
startup.  Then that could be used here if someone wants this behavior.
But I don't think we should hard-code it, because it could also be NOT
what someone wants.

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



pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: Extended Prefetching using Asynchronous IO - proposal and patch
Next
From: Andrew Dunstan
Date:
Subject: Re: [BUGS] BUG #10728: json_to_recordset with nested json objects NULLs columns