Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Repair all shard placements in shardstate 3
CREATE OR REPLACE FUNCTION public.repair_all()
RETURNS void
LANGUAGE plpgsql
AS $function$
BEGIN
PERFORM
master_copy_shard_placement(shardid, h.nodename, h.nodeport, u.nodename, u.nodeport)
FROM
(SELECT shardid, nodename, nodeport FROM pg_dist_shard_placement WHERE shardstate = 3) u
JOIN
(SELECT DISTINCT (shardid) shardid, nodename, nodeport FROM pg_dist_shard_placement WHERE shardstate = 1) h
USING
(shardid);
END;
$function$;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.