Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 428745d

Browse files
committed
Drop trigger prohibiting writes for promted node
1 parent 781fd65 commit 428745d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

shard.sql

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,12 +305,17 @@ BEGIN
305305
-- Drop sub for old channel src -> next
306306
PERFORM shardman.eliminate_sub(src_next_lname);
307307
PERFORM update shardman.partitions set prv=OLD.prv where owner=me and part_name=OLD.part_name;
308-
END IF;
308+
-- This replica is promoted to primary node, so drop trigger disabling writes to the table
309+
PERFORM readonly_replica_off(part_name);
310+
-- and replace FDW with local partition
311+
PERFORM shardman.replace_usual_part_with_foreign(new_primary);
312+
END IF;
309313

310314
-- If primary was moved
311315
IF OLD.prv IS NULL THEN
312316
-- And update fdw almost everywhere
313317
PERFORM shardman.update_fdw_server(new_primary);
318+
PERFORM shardman.replace_foreign_part_with_usual(NEW);
314319
END IF;
315320

316321
RETURN NULL;

0 commit comments

Comments
 (0)