Skip to content

Commit 5d0eb1a

Browse files
committed
Reorder subscription creation steps in add_node workflow for SUB_DISABLE mode
- Moved creation of downstream subscriptions (N3 → N1/N2) to the near-end of the workflow. - Ensures that N3 completes its initial sync before establishing outbound replication paths. - Set synchronize_structure and synchronize_data to false on these subscriptions to avoid resending data to nodes that originally provided it. Creating these subscriptions before N3 completes its initial sync may cause data to replicate back to N1/N2, potentially resulting in conflicts — which should not happen, as N3 has just synced from N1/N2.
1 parent 6766336 commit 5d0eb1a

File tree

1 file changed

+42
-56
lines changed

1 file changed

+42
-56
lines changed

spockctrl/workflows/add_node.json

Lines changed: 42 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -18,62 +18,6 @@
1818
"on_failure": {}
1919
}
2020
},
21-
{
22-
"spock": {
23-
"node": "n1",
24-
"command": "CREATE SUBSCRIPTION",
25-
"description": "Create a subscription (sub_n3_n1) on (n1) for n3->n1",
26-
"sleep": 0,
27-
"args": [
28-
"--sub_name=sub_n3_n1",
29-
"--provider_dsn=host=127.0.0.1 dbname=pgedge port=5433 user=pgedge password=spockpass",
30-
"--replication_sets=ARRAY['default', 'default_insert_only', 'ddl_sql']",
31-
"--synchronize_structure=true",
32-
"--synchronize_data=true",
33-
"--forward_origins='{}'::text[]",
34-
"--apply_delay='0'::interval",
35-
"--force_text_transfer=false",
36-
"--enabled=true"
37-
],
38-
"on_success": {},
39-
"on_failure": {}
40-
}
41-
},
42-
{
43-
"spock": {
44-
"node": "n2",
45-
"command": "CREATE SUBSCRIPTION",
46-
"description": "Create a subscription (sub_n3_n2) on (n2) for n3->n2",
47-
"sleep": 0,
48-
"args": [
49-
"--sub_name=sub_n3_n2",
50-
"--provider_dsn=host=127.0.0.1 dbname=pgedge port=5433 user=pgedge password=spockpass",
51-
"--replication_sets=ARRAY['default', 'default_insert_only', 'ddl_sql']",
52-
"--synchronize_structure=false",
53-
"--synchronize_data=true",
54-
"--forward_origins='{}'::text[]",
55-
"--apply_delay='0'::interval",
56-
"--force_text_transfer=false",
57-
"--enabled=true"
58-
],
59-
"on_success": {},
60-
"on_failure": {}
61-
}
62-
},
63-
{
64-
"sql": {
65-
"node": "n2",
66-
"ignore_errors": false,
67-
"command": "SQL",
68-
"description": "Wait for apply worker on n2 subscription",
69-
"sleep": 0,
70-
"args": [
71-
"--sql=SELECT spock.wait_for_apply_worker($n2.sub_create, 1000);"
72-
],
73-
"on_success": {},
74-
"on_failure": {}
75-
}
76-
},
7721
{
7822
"spock": {
7923
"node": "n3",
@@ -227,6 +171,48 @@
227171
"on_failure": {}
228172
}
229173
},
174+
{
175+
"spock": {
176+
"node": "n1",
177+
"command": "CREATE SUBSCRIPTION",
178+
"description": "Create a subscription (sub_n3_n1) on (n1) for n3->n1",
179+
"sleep": 0,
180+
"args": [
181+
"--sub_name=sub_n3_n1",
182+
"--provider_dsn=host=127.0.0.1 dbname=pgedge port=5433 user=pgedge password=spockpass",
183+
"--replication_sets=ARRAY['default', 'default_insert_only', 'ddl_sql']",
184+
"--synchronize_structure=false",
185+
"--synchronize_data=false",
186+
"--forward_origins='{}'::text[]",
187+
"--apply_delay='0'::interval",
188+
"--force_text_transfer=false",
189+
"--enabled=true"
190+
],
191+
"on_success": {},
192+
"on_failure": {}
193+
}
194+
},
195+
{
196+
"spock": {
197+
"node": "n2",
198+
"command": "CREATE SUBSCRIPTION",
199+
"description": "Create a subscription (sub_n3_n2) on (n2) for n3->n2",
200+
"sleep": 0,
201+
"args": [
202+
"--sub_name=sub_n3_n2",
203+
"--provider_dsn=host=127.0.0.1 dbname=pgedge port=5433 user=pgedge password=spockpass",
204+
"--replication_sets=ARRAY['default', 'default_insert_only', 'ddl_sql']",
205+
"--synchronize_structure=false",
206+
"--synchronize_data=false",
207+
"--forward_origins='{}'::text[]",
208+
"--apply_delay='0'::interval",
209+
"--force_text_transfer=false",
210+
"--enabled=true"
211+
],
212+
"on_success": {},
213+
"on_failure": {}
214+
}
215+
},
230216
{
231217
"sql": {
232218
"node": "n3",

0 commit comments

Comments
 (0)