Re: logical replication seems broken

Erik Rijkers <er@xs4all.nl>

From: er@xs4all.nl
To: Amit Kapila <amit.kapila16@gmail.com>
Cc: "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2021-02-12T16:30:31Z
Lists: pgsql-hackers

Attachments

> On 02/12/2021 1:51 PM Amit Kapila <amit.kapila16@gmail.com> wrote:
> 
>  
> On Fri, Feb 12, 2021 at 6:04 PM Erik Rijkers <er@xs4all.nl> wrote:
> >
> > Hello,
> >
> > I am seeing errors in replication in a test program that I've been running for years with very little change (since 2017, really [1]).

Hi,

Here is a test program.  Careful, it deletes stuff.  And it will need some changes:

I compile postgres server versions into directories like:
     $HOME/pg_stuff/pg_installations/pgsql.$project    where project is a name

The attached script (logrep_cascade_bug.sh)  assumes that two such compiled versions are present (on my machine they are called HEAD and head0):
     $HOME/pg_stuff/pg_installations/pgsql.HEAD   --> git master as of today - friday 12 febr 2021
     $HOME/pg_stuff/pg_installations/pgsql.head0  --> 3063eb17593c  so that's from 11 febr, before the replication changes

In the test script, bash variables 'project' (and 'BIN') reflect my set up - so should probably be changed.

The instance from today 12 february ('HEAD') has the bug:
  it keeps endlessly waiting/looping with 'NOK' (=Not OK).
  'Not OK' means: primary not identical to all replicas (replica1 seems ok, but replica2 remains empty)

The instance from yesterday 11 february ('head0') is ok:
  it finishes in 20 s after waiting/looping just 2 or 3 times
  'ok' means: all replicas are identical to primary (as proven by the md5s).

That's all I have for now - I have no deeper idea about what exactly goes wrong.

I hope that helps, let me know when you cannot reproduce the problem.

Erik Rijkers

Commits

  1. Remove the unnecessary PrepareWrite in pgoutput.

  2. Allow multiple xacts during table sync in logical replication.

  3. Stop demanding that top xact must be seen before subxact in decoding.