Re: Fix assert failure when decoding XLOG_PARAMETER_CHANGE on primary

2025-02-24 Thread Masahiko Sawada
On Mon, Feb 24, 2025 at 11:39 AM Masahiko Sawada wrote: > > On Mon, Feb 24, 2025 at 7:13 AM Bertrand Drouvot > wrote: > > > > Hi, > > > > On Mon, Feb 24, 2025 at 05:01:30PM +0530, Amit Kapila wrote: > > > On Wed, Feb 12, 2025 at 5:22 PM Amit Kapila > > > wrote: > > > > > > > > On Wed, Feb 12, 2

Re: Fix assert failure when decoding XLOG_PARAMETER_CHANGE on primary

2025-02-24 Thread Masahiko Sawada
On Mon, Feb 24, 2025 at 7:13 AM Bertrand Drouvot wrote: > > Hi, > > On Mon, Feb 24, 2025 at 05:01:30PM +0530, Amit Kapila wrote: > > On Wed, Feb 12, 2025 at 5:22 PM Amit Kapila wrote: > > > > > > On Wed, Feb 12, 2025 at 1:16 AM Masahiko Sawada > > > wrote: > > > > > > > > > > > > Agreed, I'm fi

Re: Fix assert failure when decoding XLOG_PARAMETER_CHANGE on primary

2025-02-24 Thread Bertrand Drouvot
Hi, On Mon, Feb 24, 2025 at 05:01:30PM +0530, Amit Kapila wrote: > On Wed, Feb 12, 2025 at 5:22 PM Amit Kapila wrote: > > > > On Wed, Feb 12, 2025 at 1:16 AM Masahiko Sawada > > wrote: > > > > > > > > > Agreed, I'm fine with leaving InRecovery in this condition. I think > > > the point is wheth

Re: Fix assert failure when decoding XLOG_PARAMETER_CHANGE on primary

2025-02-24 Thread Amit Kapila
On Wed, Feb 12, 2025 at 5:22 PM Amit Kapila wrote: > > On Wed, Feb 12, 2025 at 1:16 AM Masahiko Sawada wrote: > > > > > > Agreed, I'm fine with leaving InRecovery in this condition. I think > > the point is whether we should add StandbyMode to the condition or > > not. I think if we do that, we w

Re: Fix assert failure when decoding XLOG_PARAMETER_CHANGE on primary

2025-02-12 Thread Amit Kapila
On Wed, Feb 12, 2025 at 1:16 AM Masahiko Sawada wrote: > > On Mon, Feb 10, 2025 at 4:11 AM Amit Kapila wrote: > > > > On Fri, Feb 7, 2025 at 11:30 PM Masahiko Sawada > > wrote: > > > > > > On Thu, Feb 6, 2025 at 9:30 PM Amit Kapila > > > wrote: > > > > > > > > True but it sounds like there is

Re: Fix assert failure when decoding XLOG_PARAMETER_CHANGE on primary

2025-02-11 Thread Masahiko Sawada
On Mon, Feb 10, 2025 at 4:11 AM Amit Kapila wrote: > > On Fri, Feb 7, 2025 at 11:30 PM Masahiko Sawada wrote: > > > > On Thu, Feb 6, 2025 at 9:30 PM Amit Kapila wrote: > > > > > > True but it sounds like there is more harm than benefit. It seems > > > reasonable to do this on HEAD. Shall we thin

Re: Fix assert failure when decoding XLOG_PARAMETER_CHANGE on primary

2025-02-10 Thread Amit Kapila
On Fri, Feb 7, 2025 at 11:30 PM Masahiko Sawada wrote: > > On Thu, Feb 6, 2025 at 9:30 PM Amit Kapila wrote: > > > > True but it sounds like there is more harm than benefit. It seems > > reasonable to do this on HEAD. Shall we think of doing it differently > > in HEAD and back-branches or let's r

Re: Fix assert failure when decoding XLOG_PARAMETER_CHANGE on primary

2025-02-07 Thread Masahiko Sawada
On Thu, Feb 6, 2025 at 9:30 PM Amit Kapila wrote: > > On Fri, Feb 7, 2025 at 12:11 AM Masahiko Sawada wrote: > > > > On Wed, Feb 5, 2025 at 10:17 PM Amit Kapila wrote: > > > > > > On Thu, Feb 6, 2025 at 12:30 AM Masahiko Sawada > > > wrote: > > > > > > > > I've updated the patch accordingly. >

Re: Fix assert failure when decoding XLOG_PARAMETER_CHANGE on primary

2025-02-07 Thread Bertrand Drouvot
Hi, On Wed, Feb 05, 2025 at 10:59:22AM -0800, Masahiko Sawada wrote: > On Tue, Feb 4, 2025 at 11:48 PM Bertrand Drouvot > wrote: > > + if (SlotIsLogical(s) && !EnableHotStandby) > > + ereport(FATAL, > > + (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), > > + e

Re: Fix assert failure when decoding XLOG_PARAMETER_CHANGE on primary

2025-02-06 Thread Bertrand Drouvot
Hi, On Fri, Feb 07, 2025 at 11:00:39AM +0530, Amit Kapila wrote: > On Fri, Feb 7, 2025 at 12:11 AM Masahiko Sawada wrote: > > > > On Wed, Feb 5, 2025 at 10:17 PM Amit Kapila wrote: > > > > > > On Thu, Feb 6, 2025 at 12:30 AM Masahiko Sawada > > > wrote: > > > > > > > > I've updated the patch a

Re: Fix assert failure when decoding XLOG_PARAMETER_CHANGE on primary

2025-02-06 Thread Amit Kapila
On Fri, Feb 7, 2025 at 12:11 AM Masahiko Sawada wrote: > > On Wed, Feb 5, 2025 at 10:17 PM Amit Kapila wrote: > > > > On Thu, Feb 6, 2025 at 12:30 AM Masahiko Sawada > > wrote: > > > > > > I've updated the patch accordingly. > > > > > > > Today, again thinking about the proposed fix, I was wond

Re: Fix assert failure when decoding XLOG_PARAMETER_CHANGE on primary

2025-02-06 Thread Masahiko Sawada
On Wed, Feb 5, 2025 at 10:17 PM Amit Kapila wrote: > > On Thu, Feb 6, 2025 at 12:30 AM Masahiko Sawada wrote: > > > > I've updated the patch accordingly. > > > > Today, again thinking about the proposed fix, I was wondering about > the following case. Say, on hot_standby, the user created a logic

Re: Fix assert failure when decoding XLOG_PARAMETER_CHANGE on primary

2025-02-05 Thread Amit Kapila
On Thu, Feb 6, 2025 at 12:30 AM Masahiko Sawada wrote: > > I've updated the patch accordingly. > Today, again thinking about the proposed fix, I was wondering about the following case. Say, on hot_standby, the user created a logical slot, then shut down hot_standby, turn off the hot_standby flag,

Re: Fix assert failure when decoding XLOG_PARAMETER_CHANGE on primary

2025-02-05 Thread Masahiko Sawada
On Tue, Feb 4, 2025 at 11:48 PM Bertrand Drouvot wrote: > > Hi, > > On Wed, Feb 05, 2025 at 12:08:26PM +0530, Amit Kapila wrote: > > On Wed, Feb 5, 2025 at 2:06 AM Masahiko Sawada > > wrote: > > > > > > I've attached the updated patch. The fix needs to be back-patched to > > > v16 where logical

Re: Fix assert failure when decoding XLOG_PARAMETER_CHANGE on primary

2025-02-04 Thread Bertrand Drouvot
Hi, On Wed, Feb 05, 2025 at 12:08:26PM +0530, Amit Kapila wrote: > On Wed, Feb 5, 2025 at 2:06 AM Masahiko Sawada wrote: > > > > I've attached the updated patch. The fix needs to be back-patched to > > v16 where logical decoding on standby was introduced. Nice catch and thanks for the patch! I a

Re: Fix assert failure when decoding XLOG_PARAMETER_CHANGE on primary

2025-02-04 Thread Amit Kapila
On Wed, Feb 5, 2025 at 2:06 AM Masahiko Sawada wrote: > > I've attached the updated patch. The fix needs to be back-patched to > v16 where logical decoding on standby was introduced. > Isn't it better to give the new ERROR near the below code? RestoreSlotFromDisk() { ... if (cp.slotdata.database

Re: Fix assert failure when decoding XLOG_PARAMETER_CHANGE on primary

2025-02-04 Thread Masahiko Sawada
On Tue, Feb 4, 2025 at 10:20 AM Masahiko Sawada wrote: > > On Tue, Feb 4, 2025 at 12:59 AM Masahiko Sawada wrote: > > > > On Sun, Feb 2, 2025 at 8:11 PM Amit Kapila wrote: > > > > > > On Fri, Jan 24, 2025 at 4:05 AM Masahiko Sawada > > > wrote: > > > > > > > > When a standby replays a XLOG_PAR

Re: Fix assert failure when decoding XLOG_PARAMETER_CHANGE on primary

2025-02-04 Thread Masahiko Sawada
On Tue, Feb 4, 2025 at 12:59 AM Masahiko Sawada wrote: > > On Sun, Feb 2, 2025 at 8:11 PM Amit Kapila wrote: > > > > On Fri, Jan 24, 2025 at 4:05 AM Masahiko Sawada > > wrote: > > > > > > When a standby replays a XLOG_PARAMETER_CHANGE record that lowers > > > wal_level from logical, we invalida

Re: Fix assert failure when decoding XLOG_PARAMETER_CHANGE on primary

2025-02-04 Thread Masahiko Sawada
On Sun, Feb 2, 2025 at 8:11 PM Amit Kapila wrote: > > On Fri, Jan 24, 2025 at 4:05 AM Masahiko Sawada wrote: > > > > When a standby replays a XLOG_PARAMETER_CHANGE record that lowers > > wal_level from logical, we invalidate all logical slots only when the > > standby is in hot standby mode: > >

Re: Fix assert failure when decoding XLOG_PARAMETER_CHANGE on primary

2025-02-02 Thread Amit Kapila
On Fri, Jan 24, 2025 at 4:05 AM Masahiko Sawada wrote: > > When a standby replays a XLOG_PARAMETER_CHANGE record that lowers > wal_level from logical, we invalidate all logical slots only when the > standby is in hot standby mode: > > if (InRecovery && InHotStandby && > xlrec.wal_level < WAL_L

Fix assert failure when decoding XLOG_PARAMETER_CHANGE on primary

2025-01-23 Thread Masahiko Sawada
Hi all, When a standby replays a XLOG_PARAMETER_CHANGE record that lowers wal_level from logical, we invalidate all logical slots only when the standby is in hot standby mode: if (InRecovery && InHotStandby && xlrec.wal_level < WAL_LEVEL_LOGICAL && wal_level >= WAL_LEVEL_LOGICAL) Inva