pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jeff Davis <pgsql@j-davis.com>
To: Thomas Munro <thomas.munro@gmail.com>
To: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: Noah Misch <noah@leadboat.com>
Cc: Jeff Davis <jdavis@postgresql.org>
Cc: Postgres hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: pgsql: Add contrib/pg_walinspect.
Date: Wed, 27 Apr 2022 20:11:37 -0700
Message-ID: <e1daec9ffebb441773bb10b54f3d3170d54f16a5.camel@j-davis.com> (raw)
In-Reply-To: <CA+hUKG+VXatd-_ykFdnQoGrBb9NuNz8-YMGiWMMtNEPp9rU3Vw@mail.gmail.com>
References: <E1ncj1z-000rJo-Kh@gemulon.postgresql.org>
	<Ymd/e5eeZMNAkrXo@paquier.xyz>
	<171769.1650950714@sss.pgh.pa.us>
	<YmeExX6ACB/Et9Ww@paquier.xyz>
	<CA+hUKGLtswFk9ZO3WMOqnDkGs6dK5kCdQK9gxJm0N8gip5cpiA@mail.gmail.com>
	<287795.1651019129@sss.pgh.pa.us>
	<CA+hUKG+H_VEBdtK4CVb7uRLaAKbufNOMy-djUsptcqhLxONMmA@mail.gmail.com>
	<295868.1651024073@sss.pgh.pa.us>
	<CA+hUKG+By4isKdbDkCaLkPq4V4ECWW=d+RhcLjQXTQ3KAJLobg@mail.gmail.com>
	<CA+hUKGJAULJ_NtszwEdnSgrpRiQiRjsf62DG9_1B9x0Vzoex5g@mail.gmail.com>
	<298689.1651025716@sss.pgh.pa.us>
	<304865.1651029340@sss.pgh.pa.us>
	<CALj2ACVDYTeiWF8pKv9iz1kbTajunS96pWwLtyaRq_rxwAHrKg@mail.gmail.com>
	<CALj2ACW7_d2RZzq-K8ZLv+uWqrstpW9omo2Lc-jbD2K5XoFMGQ@mail.gmail.com>
	<CALj2ACWLV+g=a7ojcLo-R52HeAUZtGdG6XPG6nTFoo7S7e17fw@mail.gmail.com>
	<CA+hUKG+VXatd-_ykFdnQoGrBb9NuNz8-YMGiWMMtNEPp9rU3Vw@mail.gmail.com>

On Thu, 2022-04-28 at 12:11 +1200, Thomas Munro wrote:
> 
> Another option might be to abandon this whole no-wait concept and
> revert 2258e76f's changes to xlogutils.c.  pg_walinspect already does
> preliminary checks that LSNs are in range, so you can't enter a value
> that will wait indefinitely, and it's interruptible (it's a 1ms
> sleep/check loop, not my favourite programming pattern but that's
> pre-existing code).  If you're unlucky enough to hit the case where
> the LSN is judged to be valid but is in the middle of a record that
> hasn't been totally flushed yet, it'll just be a bit slower to return
> as we wait for the inevitable later flush(es) to happen.  The rest of
> your record will *surely* be flushed pretty soon (or the flushing
> backend panics the whole system and time ends).  I don't imagine this
> is performance critical work, so maybe that'd be acceptable?

I'm inclined toward this option. I was a bit iffy on those xlogutils.c
changes to begin with, and they are causing a problem now, so I'd like
to avoid layering on more workarounds.

The time when we need to wait is very narrow, only in this case where
it's earlier than the flush pointer, and the flush pointer is in the
middle of a record that's not fully flushed. And as you say, we won't
be waiting very long in that case, because once we start to write a WAL
record it better finish soon.

Bharath, thoughts? When you originally introduced the nowait behavior,
I believe that was to solve the case where someone specifies an LSN
range well in the future, but we can still catch that and throw an
error if we see that it's beyond the flush pointer. Do you see a
problem with just doing that and getting rid of the nowait changes?

Regards,
	Jeff Davis







view thread (22+ messages)  latest in thread

Message-ID: <e1daec9ffebb441773bb10b54f3d3170d54f16a5.camel@j-davis.com>
Permalink:  ../e1daec9ffebb441773bb10b54f3d3170d54f16a5.camel@j-davis.com/
Also on:    postgresql.org/message-id/e1daec9ffebb441773bb10b54f3d3170d54f16a5.camel@j-davis.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: pgsql@j-davis.com, thomas.munro@gmail.com, bharath.rupireddyforpostgres@gmail.com, tgl@sss.pgh.pa.us, michael@paquier.xyz, noah@leadboat.com, jdavis@postgresql.org, pgsql-hackers@lists.postgresql.org
  Subject: Re: pgsql: Add contrib/pg_walinspect.
  In-Reply-To: <e1daec9ffebb441773bb10b54f3d3170d54f16a5.camel@j-davis.com>
  References: <E1ncj1z-000rJo-Kh@gemulon.postgresql.org> <Ymd/e5eeZMNAkrXo@paquier.xyz> <171769.1650950714@sss.pgh.pa.us> <YmeExX6ACB/Et9Ww@paquier.xyz> <CA+hUKGLtswFk9ZO3WMOqnDkGs6dK5kCdQK9gxJm0N8gip5cpiA@mail.gmail.com> <287795.1651019129@sss.pgh.pa.us> <CA+hUKG+H_VEBdtK4CVb7uRLaAKbufNOMy-djUsptcqhLxONMmA@mail.gmail.com> <295868.1651024073@sss.pgh.pa.us> <CA+hUKG+By4isKdbDkCaLkPq4V4ECWW=d+RhcLjQXTQ3KAJLobg@mail.gmail.com> <CA+hUKGJAULJ_NtszwEdnSgrpRiQiRjsf62DG9_1B9x0Vzoex5g@mail.gmail.com> <298689.1651025716@sss.pgh.pa.us> <304865.1651029340@sss.pgh.pa.us> <CALj2ACVDYTeiWF8pKv9iz1kbTajunS96pWwLtyaRq_rxwAHrKg@mail.gmail.com> <CALj2ACW7_d2RZzq-K8ZLv+uWqrstpW9omo2Lc-jbD2K5XoFMGQ@mail.gmail.com> <CALj2ACWLV+g=a7ojcLo-R52HeAUZtGdG6XPG6nTFoo7S7e17fw@mail.gmail.com> <CA+hUKG+VXatd-_ykFdnQoGrBb9NuNz8-YMGiWMMtNEPp9rU3Vw@mail.gmail.com> <e1daec9ffebb441773bb10b54f3d3170d54f16a5.camel@j-davis.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox