BUG #17055: Logical replication worker crashes when applying update of row that dose not exist in target partiti - Mailing list pgsql-bugs

From PG Bug reporting form
Subject BUG #17055: Logical replication worker crashes when applying update of row that dose not exist in target partiti
Date
Msg-id 17055-9ba800ec8522668b@postgresql.org
Whole thread Raw
Responses Re: BUG #17055: Logical replication worker crashes when applying update of row that dose not exist in target partiti
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      17055
Logged by:          Sergey Bernikov
Email address:      sbernikov@gmail.com
PostgreSQL version: 13.3
Operating system:   Ubuntu 18.04.4
Description:

This error happens when logical replication target is partitioned table.

Steps to reproduce:
1. in source DB: create table and add to publication
    create table test_replication (
      id int not null,
      value varchar(100),
      primary key (id)
    );
create publication test_publication for table test_replication;

2. in target DB: create partitioned table and start replication
    create table test_replication (
      id int not null,
      value varchar(100),
      primary key (id)
    ) partition by range (id);
    create table test_replication_p_1 partition of test_replication
       for values from (0) to (10);
    create table test_replication_p_2 partition of test_replication
       for values from (10) to (20);
 
    create subscription test_subscription CONNECTION '...' publication
test_publication;
 
3. in source DB: insert data
    insert into test_replication(id, value) values (1, 'a1');

4. in target DB: delete data
    delete from test_replication where id = 1;

5. in source DB: update data
    update test_replication set value = 'a2' where id = 1;

Result: logical replication worker on target server crashes with different
error message:

Fragment of log output:
2021-06-07 19:51:13.480 +06 [82800] DEBUG:  logical replication did not find
row for update in replication target relation "test_replication_p_1"
2021-06-07 19:51:13.491 +06 [82800] ERROR:  could not access status of
transaction 1226709024
2021-06-07 19:51:13.491 +06 [82800] DETAIL:  Could not open file
"pg_subtrans/491E": No such file or directory.
2021-06-07 19:51:13.493 +06 [82797] DEBUG:  starting logical replication
worker for subscription "test_subscription"
2021-06-07 19:51:13.493 +06 [80587] DEBUG:  registering background worker
"logical replication worker for subscription 781420"
2021-06-07 19:51:13.493 +06 [80587] DEBUG:  starting background worker
process "logical replication worker for subscription 781420"
2021-06-07 19:51:13.501 +06 [28356] LOG:  logical replication apply worker
for subscription "test_subscription" has started
2021-06-07 19:51:13.501 +06 [28356] DEBUG:  connecting to publisher using
connection string "....."
2021-06-07 19:51:13.508 +06 [80587] DEBUG:  unregistering background worker
"logical replication worker for subscription 781420"
2021-06-07 19:51:13.508 +06 [80587] LOG:  background worker "logical
replication worker" (PID 82800) exited with exit code 1
2021-06-07 19:51:13.563 +06 [28356] DEBUG:  logical replication did not find
row for update in replication target relation "test_replication_p_1"
2021-06-07 19:52:31.575 +06 [80587] LOG:  background worker "logical
replication worker" (PID 28356) was terminated by signal 11: Segmentation
fault
2021-06-07 19:52:31.575 +06 [80587] LOG:  terminating any other active
server processes


pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #17054: Memory corruption in logical replication worker when replicating into partitioned table
Next
From: "David G. Johnston"
Date:
Subject: Re: pg_table_size errors "invalid name syntax" for table names containing spaces