Обсуждение: Seek for helper documents to implement WAL with an FDW

Поиск
Список
Период
Сортировка

Seek for helper documents to implement WAL with an FDW

От
Komal Habura
Дата:
Hi all,
        I have written an FDW, which is similar to the file_fdw. I need the support of WAL to perform logical and stream replication. I have knowledge about custom WAL but do not have clarity about implementing WAL(writing, redo, desc, identify, etc..) and cases where WAL can be applied.

kindly share some documents, and links regarding WAL implementation.


--------
Komal Habura



Re: Seek for helper documents to implement WAL with an FDW

От
Bharath Rupireddy
Дата:
On Tue, Feb 21, 2023 at 3:01 PM Komal Habura <komalhabura2@gmail.com> wrote:
>
> Hi all,
>         I have written an FDW, which is similar to the file_fdw. I need the support of WAL to perform logical and
streamreplication. I have knowledge about custom WAL but do not have clarity about implementing WAL(writing, redo,
desc,identify, etc..) and cases where WAL can be applied. 
>
> kindly share some documents, and links regarding WAL implementation.
>
> Reference of Custom WAL: - https://www.postgresql.org/docs/current/custom-rmgr.html

You can look at a sample extension called test_custom_rmgrs that
implements custom WAL rmgr -

https://git.postgresql.org/gitweb/?p=postgresql.git;a=tree;f=src/test/modules/test_custom_rmgrs;h=2144037578b01e56cbc8bf80af4fbdaa94c07c17;hb=HEAD.
Basically, custom WAL rmgrs allow one to write WAL records of their
own choice and define what to do when the server is in recovery i.e.
replaying those WAL records or when the server is decoding (for
logical replication) those WAL records.

Coming to whether you need to write WAL at all in your FDW, it depends
on what the FDW does.

--
Bharath Rupireddy
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com



Re: Seek for helper documents to implement WAL with an FDW

От
Peter Eisentraut
Дата:
On 20.02.23 10:53, Komal Habura wrote:
>          I have written an FDW, which is similar to the file_fdw. I need 
> the support of WAL to perform logical and stream replication. I have 
> knowledge about custom WAL but do not have clarity about implementing 
> WAL(writing, redo, desc, identify, etc..) and cases where WAL can be 
> applied.

A foreign-data wrapper manages *foreign* data, which almost by 
definition means that it does not participate in the transaction 
management of the local PostgreSQL instance, including in the WAL.  If 
you want to build a custom storage format that does participate in the 
local transaction management, you should probably look at building 
either a table access method or a storage manager.