Re: [HACKERS] Why forcing Hot_standby_feedback to be enabled when creating a logical decoding slot on standby

From: sanyam jain <sanyamjain22(at)live(dot)in>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] Why forcing Hot_standby_feedback to be enabled when creating a logical decoding slot on standby
Date: 2018-01-31 12:51:57
Message-ID: MA1PR0101MB1320E62683D5A56435946731C0FB0@MA1PR0101MB1320.INDPRD01.PROD.OUTLOOK.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,
I am trying to create logical decoding slot on a standby.
Enabling Hot_standby_feedback on standby is one of the requirement ; which will delay vacuuming of stale data on Master server.
I am working on a hack to avoid Hot_standby_feedback so that Standby doesn't have any dependency on Master (except receiving WAL).

Hot_standby_feedback restricts Master to do early vacuuming of catalog relation which will be in decoding WAL record using "time travelling snapshot" on a Standby.

The other way to prevent early vacuuming on Standby can be by pausing recovery on Standby when a vacuum record belonging to catalog relation is encountered.
And when walsender process belonging to logical slot on Standby reaches this record it will resume the recovery by executing SetRecoveryPause(false).

To check whether VACUUM record belongs to a catalog relation i simply check if relationID < 10000.

This hack will only work for a single logical slot on standby.
Pausing recovery will increase the size of pg_xlog directory as walreceiver will continue receiving WAL.
Querying standby might result in wrong output.

Thanks,
Sanyam Jain

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Verite 2018-01-31 12:58:45 Re: csv format for psql
Previous Message Amit Kapila 2018-01-31 12:44:51 Re: Re: BUG #15039: some question about hash index code