@@ -679,12 +679,10 @@ $$ LANGUAGE sql;
679
679
680
680
-- Execute command at shardlord
681
681
CREATE FUNCTION redirect_to_shardlord (cmd text ) RETURNS bool AS $$
682
- DECLARE
683
- am_shardlord bool;
684
682
BEGIN
685
- SELECT setting::bool INTO am_shardlord FROM pg_settings WHERE name = ' shardman.shardlord ' ;
686
- IF NOT am_shardlord THEN
687
- PERFORM shardman .broadcast (format(' 0:SELECT %s;' , cmd));
683
+ IF NOT shardman .is_shardlord () THEN
684
+ RAISE NOTICE ' Redirect command "%" to shardlord ' ,cmd;
685
+ PERFORM shardman .broadcast (format(' 0:SELECT shardman. %s;' , cmd));
688
686
RETURN true;
689
687
ELSE
690
688
RETURN false;
@@ -793,10 +791,14 @@ CREATE FUNCTION pq_conninfo_parse(IN conninfo text, OUT keys text[], OUT vals te
793
791
CREATE FUNCTION shardlord_connection_string ()
794
792
RETURNS text AS ' pg_shardman' LANGUAGE C STRICT;
795
793
796
- -- Check from configuration parameters is synchronous replication mode was enabled
794
+ -- Check from configuration parameters if synchronous replication mode was enabled
797
795
CREATE FUNCTION synchronous_replication ()
798
796
RETURNS bool AS ' pg_shardman' LANGUAGE C STRICT;
799
797
798
+ -- Check from configuration parameters if node plays role of shardlord
799
+ CREATE FUNCTION is_shardlord ()
800
+ RETURNS bool AS ' pg_shardman' LANGUAGE C STRICT;
801
+
800
802
-- Wait completion of partition copy using LR
801
803
CREATE FUNCTION wait_copy_completion (src_node_id int , part_name text ) RETURNS void AS $$
802
804
DECLARE
0 commit comments