@@ -662,12 +662,10 @@ $$ LANGUAGE sql;
662
662
663
663
-- Execute command at shardlord
664
664
CREATE FUNCTION redirect_to_shardlord (cmd text ) RETURNS bool AS $$
665
- DECLARE
666
- am_shardlord bool;
667
665
BEGIN
668
- SELECT setting::bool INTO am_shardlord FROM pg_settings WHERE name = ' shardman.shardlord ' ;
669
- IF NOT am_shardlord THEN
670
- PERFORM shardman .broadcast (format(' 0:SELECT %s;' , cmd));
666
+ IF NOT shardman .is_shardlord () THEN
667
+ RAISE NOTICE ' Redirect command "%" to shardlord ' ,cmd;
668
+ PERFORM shardman .broadcast (format(' 0:SELECT shardman. %s;' , cmd));
671
669
RETURN true;
672
670
ELSE
673
671
RETURN false;
@@ -772,10 +770,14 @@ CREATE FUNCTION pq_conninfo_parse(IN conninfo text, OUT keys text[], OUT vals te
772
770
CREATE FUNCTION shardlord_connection_string ()
773
771
RETURNS text AS ' pg_shardman' LANGUAGE C STRICT;
774
772
775
- -- Check from configuration parameters is synchronous replication mode was enabled
773
+ -- Check from configuration parameters if synchronous replication mode was enabled
776
774
CREATE FUNCTION synchronous_replication ()
777
775
RETURNS bool AS ' pg_shardman' LANGUAGE C STRICT;
778
776
777
+ -- Check from configuration parameters if node plays role of shardlord
778
+ CREATE FUNCTION is_shardlord ()
779
+ RETURNS bool AS ' pg_shardman' LANGUAGE C STRICT;
780
+
779
781
-- Wait completion of partition copy using LR
780
782
CREATE FUNCTION wait_copy_completion (src_node_id int , part_name text ) RETURNS void AS $$
781
783
DECLARE
0 commit comments