Re: 回复: Why is XLOG_FPI_FOR_HINT always need backups?

From: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
To: 757634191(at)qq(dot)com
Cc: japinli(at)hotmail(dot)com, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: 回复: Why is XLOG_FPI_FOR_HINT always need backups?
Date: 2021-07-07 07:11:25
Message-ID: 20210707.161125.1190797247155264523.horikyota.ntt@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello.

At Tue, 6 Jul 2021 20:42:23 +0800, "zwj" <757634191(at)qq(dot)com> wrote in
> But I wonder whether it is necessary or not while my file system can protect the blocks of database to be torn. And I read a comment in function&nbsp;MarkBufferDirtyHint:
>
> /*
> * If we need to protect hint bit updates from torn writes, WAL-log a
> * full page image of the page. This full page image is only necessary
> * if the hint bit update is the first change to the page since the
> * last checkpoint.
> *
> * We don't check full_page_writes here because that logic is included
> * when we call XLogInsert() since the value changes dynamically.
> */
>
> However, the code tell me it has nothing to do with full_page_writes. I can't figure it out.

The doc of wal_log_hints says that "*even* for non-critical
modifications of so-called hint bits", which seems to me implies it is
following full_page_writes (and I think it is nonsense otherwise, as
you suspect).

XLogSaveBufferForHint sets REGBUF_FORCE_IMAGE since 2c03216d83116 when
the symbol was introduced. As my understanding XLogInsert did not have
an ability to enforce FPIs before the commit. The code comment above
is older than that commit. So it seems to me a thinko that
XLogSaveBufferForHint sets REGBUF_FORCE_IMAGE.

I think the attached fixes that thinko.

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

Attachment Content-Type Size
0001-Make-FPI_FOR_HINT-follow-standard-FPI-emitting-polic.patch text/x-patch 1.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2021-07-07 07:12:49 Re: ExecRTCheckPerms() and many prunable partitions
Previous Message Tatsuo Ishii 2021-07-07 07:11:23 Re: [HACKERS] WIP aPatch: Pgbench Serialization and deadlock errors