File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -593,25 +593,34 @@ DECLARE
593
593
poll text ;
594
594
response text ;
595
595
BEGIN
596
+ IF shardman .redirect_to_shardlord (' ensure_redundancy()' )
597
+ THEN
598
+ RETURN;
599
+ END IF;
600
+
601
+ -- Wait until all subscritpion switch to ready state
596
602
LOOP
597
- poll := ' '
603
+ poll := ' ' ;
598
604
FOR src_node_id IN SELECT id FROM shardman .nodes
599
- LOOP
605
+ LOOP
600
606
FOR dst_node_id IN SELECT id FROM shardman .nodes WHERE id<> src_node_id
601
- LOOP
607
+ LOOP
602
608
sub_name := format(' sub_%s_%s' , dst_node_id, src_node_id);
603
609
poll := format(' %s%s:SELECT shardman.is_subscription_ready(%L);' ,
604
610
poll, dst_node_id, sub_name);
605
611
END LOOP;
606
612
END LOOP;
607
-
613
+
614
+ -- Poll subsciption statuses at all nodes
608
615
response := shardman .broadcast (poll);
616
+
617
+ -- Check if all are ready
609
618
EXIT WHEN POSITION(' f' IN response)= 0 ;
610
619
611
620
PERFORM pg_sleep(timeout_sec);
612
621
END LOOP;
613
622
END
614
- $$ LANGUAGE plpgsql;
623
+ $$ LANGUAGE plpgsql;
615
624
616
625
617
626
-- Remove table from all nodes.
You can’t perform that action at this time.
0 commit comments