Re: BUG #17055: Logical replication worker crashes when applying update of row that dose not exist in target partiti

Amit Langote <amitlangote09@gmail.com>

From: Amit Langote <amitlangote09@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: sbernikov@gmail.com, PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Date: 2021-06-11T05:56:58Z
Lists: pgsql-bugs

Attachments

On Fri, Jun 11, 2021 at 9:17 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> PG Bug reporting form <noreply@postgresql.org> writes:
> > This error happens when logical replication target is partitioned table.
>
> Thanks for the report!  This one reproduces on HEAD as well as v13.

+1, confirmed here too.

> Also, people should be aware that this one causes the logrep worker
> to crash repeatedly, which will fill your disk with core files
> quite quickly.

Thanks for this tip.

The problem is that apply_handle_tuple_routing() marches on as if it
could go ahead and update a tuple that it was just told doesn't exist.

Attached fixes the problem for me.  Not sure if adding a test case makes sense.

-- 
Amit Langote
EDB: http://www.enterprisedb.com

Commits

  1. Improve log pattern detection in recently-added TAP tests

  2. Fix multiple crasher bugs in partitioned-table replication logic.