public inbox for [email protected]
help / color / mirror / Atom feedFrom: Andres Freund <[email protected]>
To: Amit Khandekar <[email protected]>
Cc: tushar <[email protected]>
Cc: Petr Jelinek <[email protected]>
Cc: Robert Haas <[email protected]>
Cc: Craig Ringer <[email protected]>
Cc: Petr Jelinek <[email protected]>
Cc: pgsql-hackers <[email protected]>
Subject: Re: Minimal logical decoding on standbys
Date: Mon, 27 May 2019 06:56:02 -0700
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAJ3gD9d3uyK2iaO+PD=64HvOBerZPz3JyaPc6qF=kVZ_jGvgeQ@mail.gmail.com>
References: <[email protected]>
<CAJ3gD9fNuB9hTBMmQ=k9Be0LmPVEPwb8nv-5jc=fbgxUn=82Vw@mail.gmail.com>
<[email protected]>
<CAJ3gD9c9EP6CGB+hGoDJKeVYQG67mtWcgVRhOAhVhh44hOBkmw@mail.gmail.com>
<[email protected]>
<CAJ3gD9dKw8OEDjwbTmQ6e3-VGY64keNRxycHF4roJpsqhtssuw@mail.gmail.com>
<[email protected]>
<CAJ3gD9dv60f-QE21OQkZh3Wc1MCXrkVg=Yz5oPLzAmj-DQAeBw@mail.gmail.com>
<CAJ3gD9fJdB6yZ5SL_h7GvVZxCLA7kXVpNzwjvggPge7kHZ1Bsw@mail.gmail.com>
<CAJ3gD9d3uyK2iaO+PD=64HvOBerZPz3JyaPc6qF=kVZ_jGvgeQ@mail.gmail.com>
On 2019-05-27 17:04:44 +0530, Amit Khandekar wrote:
> On Fri, 24 May 2019 at 21:00, Amit Khandekar <[email protected]> wrote:
> >
> > On Fri, 24 May 2019 at 19:26, Amit Khandekar <[email protected]> wrote:
> > > Working on the patch now ....
> >
> > Attached is an incremental WIP patch
> > handle_wal_level_changes_WIP.patch to be applied over the earlier main
> > patch logical-decoding-on-standby_v4_rebased.patch.
>
> I found an issue with these changes : When we change master wal_level
> from logical to hot_standby, and again back to logical, and then
> create a logical replication slot on slave, it gets created; but when
> I do pg_logical_slot_get_changes() with that slot, it seems to read
> records *before* I created the logical slot, so it encounters
> parameter-change(logical=>hot_standby) record, so returns an error as
> per the patch, because now in DecodeXLogOp() I error out when
> XLOG_PARAMETER_CHANGE is found :
> @@ -190,11 +190,23 @@ DecodeXLogOp(LogicalDecodingContext *ctx,
> XLogRecordBuffer *buf)
> * can restart from there.
> */
> break;
> + case XLOG_PARAMETER_CHANGE:
> + {
> + xl_parameter_change *xlrec =
> + (xl_parameter_change *) XLogRecGetData(buf->record);
> +
> + /* Cannot proceed if master itself does not have logical data */
> + if (xlrec->wal_level < WAL_LEVEL_LOGICAL)
> + ereport(ERROR,
> + (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
> + errmsg("logical decoding on standby requires "
> + "wal_level >= logical on master")));
> + break;
> + }
>
> I thought it won't read records *before* the slot was created. Am I
> missing something ?
That's why I had mentioned that you'd need to adapt
ReplicationSlotReserveWal(), to use the replay LSN or such.
Greetings,
Andres Freund
view thread (196+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: Minimal logical decoding on standbys
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox