Last active
April 1, 2018 11:39
-
-
Save marcocitus/64c445d73733a773939c968087806da0 to your computer and use it in GitHub Desktop.
Repair all shard placements in shardstate 3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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