2ndQuadrant / pglogical

Logical Replication extension for PostgreSQL 17, 16, 15, 14, 13, 12, 11, 10, 9.6, 9.5, 9.4 (Postgres), providing much faster replication than Slony, Bucardo or Londiste, as well as cross-version upgrades.
http://2ndquadrant.com/en/resources/pglogical/
Other
1.01k stars 153 forks source link

FATAL: CONFLICT: remote DELETE on relation .. replica identity index .. (tuple not found). Resolution: skip. #296

Open gilesmca opened 3 years ago

gilesmca commented 3 years ago

1 provider, 1 subscriber - postgresql 13 on both pglogical 2.3.3

I keep getting this on the subscriber, after which the subscription shows as down. It happens on several tables. I managed to reproduce the error in a minimal two commands: insert into myschema.mytable(id1,id2,description,code) values (2,'AE04E','TIMING','ABC'); (this replicates fine) delete from myschema.mytable where id2 = 'AE04E'; This results in the FATAL error.

Both the provider and subscriber servers have only recently been built (Centos 8) from the same set of repositories so should be identical in terms of collations etc. Also the schema was copied, before starting replication, from the provider using pgdump.

Provider node + set is created as follows:

SELECT pglogical.create_node(
    node_name := 'provider1',
    dsn := 'host=myhost port=5432 dbname=main'
);
select pglogical.create_replication_set('myschema', true, true, true, true );
SELECT pglogical.replication_set_add_all_tables('myschema', '{myschema}'::text[]);

Subscriber subscription as:

SELECT pglogical.create_node(
    node_name := 'subscriber1',
    dsn := 'host=myhost port=5432 dbname=main user=replication password=apassword'
);
SELECT pglogical.create_subscription(
    subscription_name := 'myschema',
    provider_dsn := 'host=myhost port=5432 dbname=main user=replication password=apassword',
    replication_sets := '{myschema}'::text[],
    synchronize_data := false 
);

Any ideas how I might resolve this as, thus far, I have failed to get any reliable replication working in postgresql and it is rather essential to our setup?

Thanks.

gilesmca commented 3 years ago

One clue - in the case of the above row (there are others causing the same problem) it does not seem to like that "E04" in the id2 string (it does look a bit like a character code) - if I change id2 to 'AB04E' in both statements the delete works okay.