Re: [RFC] Should smgrtruncate() avoid sending sinval message for temp relations

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: MauMau <maumau307(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [RFC] Should smgrtruncate() avoid sending sinval message for temp relations
Date: 2014-07-26 18:20:05
Message-ID: 20140726182005.GJ17793@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2014-07-26 13:58:38 -0400, Tom Lane wrote:

> Andres Freund <andres(at)2ndquadrant(dot)com> writes:
> > That'd require either renegging on SA_RESTART or
> > using WaitLatchOrSocket() and nonblocking send/recv.
>
> Yeah, I was wondering about using WaitLatchOrSocket for client I/O too.
> We already have a hook that lets us do the actual recv even when using
> OpenSSL, and in principle that function could do interrupt-service-like
> functions if it got kicked off the recv().

I've started playing with this. Looks clearly worthwile.

I think if we do it right we pretty much can get rid of the whole
prepare_for_client_read() machinery and handle everything via
ProcessInterrupts(). EnableCatchupInterrupt() et al don't really fill me
with joy.

I'm not yet entirely sure where the interrupt processing should happen,
but I guess that'll fall out of the work at some point. The important
bit imo is to *not* not do anything but return with BIO_set_retry_*()
from my_sock_read/write(). That then allows us to implement stuff like
the idle transaction timeout with much fewer problems.

I probably won't finish doing this before leaving on holidays, so nobody
should hesitate to look themselves if interested. If not, I plan to pick
this up again. I think it's a prerequisite to getting rid of the FATAL
for recovery conflict interrupts which I really would like to do.

> Anything in this line is going to be a bigger change than I'd want to
> back-patch, though.

Agreed. I don't think it will, but it very well could have performance
implications. Besides the obvious risk of bugs...

> Are we OK with not fixing the problem in the back
> branches? Given the shortage of field complaints, that might be all
> right.

I'm not really comfortable with that. How about simply flagging a couple
contexts to not do the SyncRepWaitForLsn() dance? Possibly just by doing
something ugly like
SetConfigOption('synchronous_commit', 'off', PGC_INTERNAL,
PGC_S_OVERRIDE, GUC_ACTION_LOCAL, true, ERROR)?
during startup, inval and similar transaction commands? Not pretty, but
it looks simple enough to be backpatchable.

Greetings,

Andres Freund

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2014-07-26 18:22:20 Re: PL/PgSQL: EXIT USING ROLLBACK
Previous Message Tom Lane 2014-07-26 18:14:15 Re: building pdfs