File tree Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -316,7 +316,10 @@ BEGIN
316
316
-- otherwise we will hang
317
317
SET LOCAL synchronous_commit TO LOCAL;
318
318
-- 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;
320
323
END IF;
321
324
322
325
PERFORM shardman .reset_node_id ();
Original file line number Diff line number Diff line change @@ -99,15 +99,11 @@ BEGIN
99
99
END
100
100
$$ LANGUAGE plpgsql;
101
101
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.
103
104
CREATE FUNCTION my_connstr () RETURNS text AS $$
104
- DECLARE
105
- connstr text := connstring FROM shardman .nodes WHERE id = shardman .my_id ();
106
105
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 ();
111
107
END $$ LANGUAGE plpgsql;
112
108
113
109
-- Get connstr of worker node with id node_id. ERROR is raised if there isn't
You can’t perform that action at this time.
0 commit comments