Re: Map WAL segment files on PMEM as WAL buffers

From: Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>
To: Takashi Menjo <takashi(dot)menjo(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, tsunakawa(dot)takay(at)fujitsu(dot)com, "Deng, Gang" <gang(dot)deng(at)intel(dot)com>, Takashi Menjo <takashi(dot)menjou(dot)vg(at)hco(dot)ntt(dot)co(dot)jp>
Subject: Re: Map WAL segment files on PMEM as WAL buffers
Date: 2021-10-07 22:46:17
Message-ID: CAEze2WgqpS86RqDsQK7fRk1mEJsV+hVQEt7qa-AkdEFsm-XjMQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 30 Jun 2021 at 06:53, Takashi Menjo <takashi(dot)menjo(at)gmail(dot)com> wrote:
>
> Rebased.

Thanks for these patches!

I recently took a dive into the WAL subsystem, and got to this
patchset through the previous ones linked from [0]. This patchset
seems straightforward to understand, so thanks!

I've looked over the patches and added some comments below. I haven't
yet tested this though; finding out how to get PMEM on WSL without
actual PMEM is probably going to be difficult.

> [ v3-0002-Add-wal_pmem_map-to-GUC.patch ]
> +extern bool wal_pmem_map;

A lot of the new code in these patches is gated behind this one flag,
but the flag should never be true on !pmem systems. Could you instead
replace it with something like the following?

+#ifdef USE_LIBPMEM
+extern bool wal_pmem_map;
+#else
+#define wal_pmem_map false
+#endif

A good compiler would then eliminate all the dead code from being
generated on non-pmem builds (instead of the compiler needing to keep
that code around just in case some extension decides to set
wal_pmem_map to true on !pmem systems because it has access to that
variable).

> [ v3-0004-Map-WAL-segment-files-on-PMEM-as-WAL-buffers.patch ]
> + if ((uintptr_t) addr & ~PG_DAX_HUGEPAGE_MASK)
> + elog(WARNING,
> + "file not mapped on DAX hugepage boundary: path \"%s\" addr %p",
> + path, addr);

I'm not sure that we should want to log this every time we detect the
issue; It's likely that once it happens it will happen for the next
file as well. Maybe add a timeout, or do we generally not deduplicate
such messages?

Kind regards,

Matthias

[0] https://wiki.postgresql.org/wiki/Persistent_Memory_for_WAL#Basic_performance

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2021-10-08 00:17:28 Re: Time to upgrade buildfarm coverage for some EOL'd OSes?
Previous Message Justin Pryzby 2021-10-07 22:45:43 Re: extended stats on partitioned tables