pglogical:REPLICA TRIGGER before delete 导致数据库损坏
pglogical: REPLICA TRIGGER before delete causes database corruption
我正在试验使用 pglogical-9.6 的 2 节点双向复制。当我设置 pglogical.conflict_resolution = 'last_update_wins'.
时,我能够始终导致段错误
我正在创建一个 BEFORE DELETE TRIGGER 以防止将一些值插入到已复制的 table。
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;)并且我重现了触发器应该阻止插入的情况(即函数将 return无效的)..
我得到:
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 上重复出现错误
除非是由硬件问题或数据损坏引起的,否则分段错误始终是错误。
您应该向 2ndQuadrant 提交错误;这是他们的软件。
确保在错误报告中包含复制器。
我正在试验使用 pglogical-9.6 的 2 节点双向复制。当我设置 pglogical.conflict_resolution = 'last_update_wins'.
时,我能够始终导致段错误我正在创建一个 BEFORE DELETE TRIGGER 以防止将一些值插入到已复制的 table。
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;)并且我重现了触发器应该阻止插入的情况(即函数将 return无效的).. 我得到:
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 上重复出现错误
除非是由硬件问题或数据损坏引起的,否则分段错误始终是错误。
您应该向 2ndQuadrant 提交错误;这是他们的软件。
确保在错误报告中包含复制器。