Logical insert/update/delete WAL records for custom table AMs - Mailing list pgsql-hackers

From Jeff Davis
Subject Logical insert/update/delete WAL records for custom table AMs
Date
Msg-id 20ee0b0ae6958804a88fe9580157587720faf664.camel@j-davis.com
Whole thread Raw
Responses Re: Logical insert/update/delete WAL records for custom table AMs  (Amit Kapila <amit.kapila16@gmail.com>)
Re: Logical insert/update/delete WAL records for custom table AMs  (Simon Riggs <simon.riggs@enterprisedb.com>)
List pgsql-hackers
Attached is a WIP patch to add new WAL records to represent a logical
insert, update, or delete. These records do not do anything at REDO
time, they are only processed during logical decoding/replication.

These are intended to be used by a custom table AM, like my columnar
compression extension[0], which currently supports physical replication
but can't support logical decoding/replication because decoding is not
extensible. Using these new logical records would be redundant, making
inserts/updates/deletes less efficient, but at least logical decoding
would work (the lack of which is columnar's biggest weakness).

Alternatively, we could support extensible WAL with extensible
decoding. I also like this approach, but it takes more work for an AM
like columnar to get that right -- it needs to keep additional state in
the walsender to track and assemble the compressed columns stored
across many blocks. It also requires a lot of care, because mistakes
can get you into serious trouble.

This proposal, for new logical records without WAL extensibility,
provides a more shallow ramp to get a table AM working (including
logical replication/decoding) without the need to invest in the WAL
design. Later, of course I'd like the option for extensible WAL as well
(to be more efficient), but right now I'd prefer it just worked
(inefficiently).

The patch is still very rough, but I tried in simple insert cases in my
columnar[0] extension (which only supports insert, not update/delete).
I'm looking for some review on the approach and structure before I
polish and test it. Note that my main test case is columnar, which
doesn't support update/delete. Also note that the patch is against v14
(for now).

Regards,
    Jeff Davis

[0] https://github.com/citusdata/citus/tree/master/src/backend/columnar

Attachment

pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: Feature request for adoptive indexes
Next
From: Tom Lane
Date:
Subject: Re: Add additional information to src/test/ssl/README