For an aborted transaction, there is today a gap between the
AtEOXact_LogicalCtl call and the XID being cleared. If an
effective_wal_level change occurs during that gap, the change will be
missed. That means the next transaction on that session will not be
logically decoded.
Attaching a reproducer bash script that demonstrates the missing decoded change.
Attaching a fix that moves the AtEOXact_LogicalCtl call later, closing the gap.
The issue was observed on master (b69356cd789) and REL_19_STABLE
(67c01b84788). It seems it was introduced in 67c20979ce7.
repro.sh output without patch:
> rows committed:
> 1
> 2
> 3
>
> changes decoded from slot s:
> table public.t: INSERT: a[integer]:1
> table public.t: INSERT: a[integer]:3
repro.sh output with patch:
> rows committed:
> 1
> 2
> 3
>
> changes decoded from slot s:
> table public.t: INSERT: a[integer]:1
> table public.t: INSERT: a[integer]:2
> table public.t: INSERT: a[integer]:3
Best regards,
Sergei