Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit dbbe146

Browse files
committed
Don't try to reset sync_standby_names if we never were in cluster.
Since for ALTER SYSTEM we reconnect to ourselves, we need the connstring and we have no connstring we have never been in cluster.
1 parent a41bc05 commit dbbe146

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

init.sql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,10 @@ BEGIN
316316
-- otherwise we will hang
317317
SET LOCAL synchronous_commit TO LOCAL;
318318
-- TODO: remove only shardman's standbys
319-
PERFORM shardman.set_sync_standbys('');
319+
-- If we never were in the cluster, we didn't touch sync_standby_names
320+
IF shardman.my_connstr() != NULL THEN
321+
PERFORM shardman.set_sync_standbys('');
322+
END IF;
320323
END IF;
321324

322325
PERFORM shardman.reset_node_id();

membership.sql

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,11 @@ BEGIN
9999
END
100100
$$ LANGUAGE plpgsql;
101101

102-
-- Get local node connstr. Throws an error, if node is not in cluster
102+
-- Get local node connstr. Returns NULL if node is not in cluster and never was
103+
-- in one.
103104
CREATE FUNCTION my_connstr() RETURNS text AS $$
104-
DECLARE
105-
connstr text := connstring FROM shardman.nodes WHERE id = shardman.my_id();
106105
BEGIN
107-
IF connstr IS NULL THEN
108-
RAISE EXCEPTION '[SHMN] Node not in cluster, can''t get its connstring';
109-
END IF;
110-
RETURN connstr;
106+
RETURN connstring FROM shardman.nodes WHERE id = shardman.my_id();
111107
END $$ LANGUAGE plpgsql;
112108

113109
-- Get connstr of worker node with id node_id. ERROR is raised if there isn't

0 commit comments

Comments
 (0)