Re: [HACKERS] WAL logging problem in 9.4.3?

From: Noah Misch <noah(at)leadboat(dot)com>
To: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
Cc: 9erthalion6(at)gmail(dot)com, andrew(dot)dunstan(at)2ndquadrant(dot)com, hlinnaka(at)iki(dot)fi, robertmhaas(at)gmail(dot)com, michael(at)paquier(dot)xyz, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] WAL logging problem in 9.4.3?
Date: 2019-03-21 05:48:35
Message-ID: 20190321054835.GB3842129@rfd.leadboat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Mar 20, 2019 at 05:17:54PM +0900, Kyotaro HORIGUCHI wrote:
> At Sun, 10 Mar 2019 19:27:08 -0700, Noah Misch <noah(at)leadboat(dot)com> wrote in <20190311022708(dot)GA2189728(at)rfd(dot)leadboat(dot)com>
> > On Mon, Mar 04, 2019 at 12:24:48PM +0900, Kyotaro HORIGUCHI wrote:
> > > +/*
> > > + * Sync to disk any relations that we skipped WAL-logging for earlier.
> > > + */
> > > +void
> > > +smgrDoPendingSyncs(bool isCommit)
> > > +{
> > > + if (!pendingSyncs)
> > > + return;
> > > +
> > > + if (isCommit)
> > > + {
> > > + HASH_SEQ_STATUS status;
> > > + PendingRelSync *pending;
> > > +
> > > + hash_seq_init(&status, pendingSyncs);
> > > +
> > > + while ((pending = hash_seq_search(&status)) != NULL)
> > > + {
> > > + if (pending->sync_above != InvalidBlockNumber)
> >
> > I'm mildly unhappy that pendingSyncs entries with "pending->sync_above ==
> > InvalidBlockNumber" are not sync requests at all. Those just record the fact
> > of a RelationTruncate() happening. If you can think of a way to improve that,
> > please do so. If not, it's okay.
>
> After a truncation, required WAL records are emitted for the
> truncated pages, so no need to sync. Does this make sense for
> you? (Maybe commit is needed there)

Yes, the behavior makes sense. I wasn't saying the quoted code had the wrong
behavior. I was saying that the data structure called "pendingSyncs" is
actually "pending syncs and past truncates". It's not ideal that the variable
name differs from the variable purpose in this way. However, it's okay if you
don't find a way to improve that.

> I don't have enough time for now so the new version will be
> posted early next week.

I'll wait for that version.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andreas Karlsson 2019-03-21 06:04:25 Re: PostgreSQL pollutes the file system
Previous Message Haribabu Kommi 2019-03-21 05:17:34 Re: Pluggable Storage - Andres's take