Hi all,

I noticed that bloom indexes are not properly WAL-looged on unlogged tables
and attached is my attempt at fixing it

Since commit ccadf73163c
<https://github.com/postgres/postgres/commit/ccadf73163ca88bdaa74b8223d4dde05d17f550b>
(discussion:
https://www.postgresql.org/message-id/[email protected]),
`contrib/bloom` index AM's blbuildempty() wrote the metapage of the init
fork through generic WAL, which emits no WAL record for an unlogged
relation.

The init fork must be WAL-logged as it is used to recreate main fork of an
unlogged relation after a crash.

Without this fix, after a crash, an unlogged and bloom-indexed relation
gets a zero-ed out index meta page. As a result, insertions and index scans
fail with "Relation is not a bloom index" or "could not read blocks 0..0",
until an index rebuild.

Narek
--

Attachment: 0001-Add-tests-for-crash-recovery-with-unlogged-bloom-ind.patch
Description: Binary data

Attachment: 0002-Fix-init-fork-unlogged-table-WAL-logging-of-bloom-in.patch
Description: Binary data

Reply via email to