我正在尝试使用 pglogical-9.6 进行 2 节点双向复制。当我设置 pglogical.conflict_resolution = 'last_update_wins' 时,我能够始终导致段错误。
我正在创建一个 BEFORE DELETE TRIGGER 以防止将某些值插入到复制表中。
CREATE TRIGGER TR_REP BEFORE DELETE
ON table_for_repl
FOR EACH ROW
EXECUTE PROCEDURE check_value();
CREATE OR REPLACE FUNCTION public.check_value()
RETURNS trigger AS
$BODY$
BEGIN
IF OLD."origin"::text = 'test' then
RETURN OLD;
ELSE
RETURN Null;
END IF;
END;
$BODY$
LANGUAGE plpgsq;
此触发器适用于正常的删除操作。当我打开它进行复制时(ALTER TABLE table_for_repl ENABLE REPLICA TRIGGER TR_REP;)并且我重现了触发器应该阻止插入的情况(即函数将返回 Null).. 我得到:
background worker "pglogical apply 16384:1892658794" (PID 4250) was terminated by signal 11: Segmentation fault.
terminating any other active server processes
recovered replication state of node 1 to 0/1764C38
database system was not properly shut down; automatic recovery in progress
在 pglogical-11 上重复错误