-
Notifications
You must be signed in to change notification settings - Fork 47
Documentation review changes #460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
691674d
e50b928
2fafb3a
bfa3e5a
d9185dd
8d101ae
4b3ff35
d7ae8e7
8568090
7d567dd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -154,15 +154,15 @@ FROM dblink( | |
| 'host=127.0.0.1 dbname=inventory port=5432 user=pgedge password=1safepassword', | ||
| 'SELECT extversion FROM pg_extension WHERE extname = ''spock''' | ||
| ) AS t(version text); | ||
| -- Expected: 5.0.4 | ||
| -- Expected: matches the version installed on every node in the cluster | ||
|
|
||
| -- Check new node version | ||
| SELECT version | ||
| FROM dblink( | ||
| 'host=127.0.0.1 dbname=inventory port=5435 user=pgedge password=1safepassword', | ||
| 'SELECT extversion FROM pg_extension WHERE extname = ''spock''' | ||
| ) AS t(version text); | ||
| -- Expected: 5.0.4 | ||
| -- Expected: matches the version installed on every node in the cluster | ||
|
|
||
| -- Check all existing cluster nodes (n2, n3) | ||
| SELECT node_name, version | ||
|
|
@@ -173,12 +173,12 @@ FROM dblink( | |
| FROM spock.node n' | ||
| ) AS t(node_name text, version text); | ||
|
|
||
| -- Expected output: | ||
| -- node_name | version | ||
| -- -----------+-------------- | ||
| -- n1 | 5.0.4 | ||
| -- n2 | 5.0.4 | ||
| -- n3 | 5.0.4 | ||
| -- Expected output: every node reports the same Spock version, e.g. | ||
| -- node_name | version | ||
| -- -----------+---------- | ||
| -- n1 | 5.0.6 | ||
| -- n2 | 5.0.6 | ||
| -- n3 | 5.0.6 | ||
| ``` | ||
|
|
||
| ### Validate Prerequisites | ||
|
|
@@ -597,8 +597,8 @@ FROM dblink( | |
| SELECT * | ||
| FROM dblink( | ||
| 'host=127.0.0.1 dbname=inventory port=5432 user=alice password=1safepassword', | ||
| 'CALL spock.wait_for_sync_event(true, ''n2'', ''0/1C9F400''::pg_lsn, 1200000)' | ||
| ) AS t(result text); | ||
| 'CALL spock.wait_for_sync_event(true, ''n2'', ''0/1C9F400''::pg_lsn, 1200)' | ||
| ) AS t(result bool); | ||
| ``` | ||
|
|
||
| #### Sync n3 to n1 | ||
|
|
@@ -623,8 +623,8 @@ FROM dblink( | |
| SELECT * | ||
| FROM dblink( | ||
| 'host=127.0.0.1 dbname=inventory port=5432 user=alice password=1safepassword', | ||
| 'CALL spock.wait_for_sync_event(true, ''n3'', ''0/1D0E510''::pg_lsn, 1200000)' | ||
| ) AS t(result text); | ||
| 'CALL spock.wait_for_sync_event(true, ''n3'', ''0/1D0E510''::pg_lsn, 1200)' | ||
| ) AS t(result bool); | ||
| ``` | ||
|
|
||
| ### Copy the Source to New Subscription | ||
|
|
@@ -752,7 +752,7 @@ FROM dblink( | |
| On n4, wait for the sync marker that matches the returned LSN (0/1E1F620) | ||
| to arrive and be processed. This is a blocking call; the call will not | ||
| return until the n4 subscription from n1 has replicated up to this LSN. | ||
| The timeout (1200000 milliseconds = 20 minutes) prevents waiting forever | ||
| The timeout (1200 seconds = 20 minutes) prevents waiting forever | ||
| if something goes wrong. | ||
|
|
||
| In the following example, the command waits for the sync event on n4: | ||
|
|
@@ -761,8 +761,8 @@ In the following example, the command waits for the sync event on n4: | |
| SELECT * | ||
| FROM dblink( | ||
| 'host=127.0.0.1 dbname=inventory port=5435 user=alice password=1safepassword', | ||
| 'CALL spock.wait_for_sync_event(true, ''n1'', ''0/1E1F620''::pg_lsn, 1200000)' | ||
| ) AS t(result text); | ||
| 'CALL spock.wait_for_sync_event(true, ''n1'', ''0/1E1F620''::pg_lsn, 1200)' | ||
| ) AS t(result bool); | ||
| ``` | ||
|
|
||
|
|
||
|
|
@@ -844,7 +844,7 @@ FROM dblink( | |
| ) | ||
| SELECT pg_replication_slot_advance(''spk_inventory_n2_sub_n2_n4'', lsn) | ||
| FROM lsn_cte' | ||
| ) AS t(result text); | ||
| ) AS t(result bool); | ||
| ``` | ||
|
Comment on lines
+847
to
848
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🌐 Web query:
💡 Result: The exact return signature of pg_replication_slot_advance(slot_name name, upto_lsn pg_lsn) is a record with fields (slot_name name, end_lsn pg_lsn). This is consistent across PostgreSQL v17 [1] and v18 [2] official documentation, as well as secondary sources like pgPedia [3] and source code [4]. The function advances the confirmed position of the named replication slot to the specified LSN (or as far as possible without going backwards or beyond the current WAL insert location) and returns the slot name and the actual end LSN achieved [1][2]. Citations:
Proposed doc fix-) AS t(result bool);
+) AS t(slot_name text, end_lsn pg_lsn);Also applies to: lines 878-879 🤖 Prompt for AI Agents |
||
|
|
||
| #### Repeat for n3 to n4 | ||
|
|
@@ -875,7 +875,7 @@ FROM dblink( | |
| ) | ||
| SELECT pg_replication_slot_advance(''spk_inventory_n3_sub_n3_n4'', lsn) | ||
| FROM lsn_cte' | ||
| ) AS t(result text); | ||
| ) AS t(result bool); | ||
| ``` | ||
|
|
||
|
|
||
|
|
@@ -925,7 +925,7 @@ FROM dblink( | |
| subscription_name := ''sub_n2_n4'', | ||
| immediate := true | ||
| )' | ||
| ) AS t(result text); | ||
| ) AS t(result bool); | ||
| ``` | ||
|
|
||
| #### Wait for Stored Sync Event from n2 | ||
|
|
@@ -948,8 +948,8 @@ SELECT sync_lsn FROM temp_sync_lsns WHERE origin_node = 'n2'; | |
| SELECT * | ||
| FROM dblink( | ||
| 'host=127.0.0.1 dbname=inventory port=5435 user=alice password=1safepassword', | ||
| 'CALL spock.wait_for_sync_event(true, ''n2'', ''0/1A7D1E0''::pg_lsn, 1200000)' | ||
| ) AS t(result text); | ||
| 'CALL spock.wait_for_sync_event(true, ''n2'', ''0/1A7D1E0''::pg_lsn, 1200)' | ||
| ) AS t(result bool); | ||
| ``` | ||
|
|
||
| #### Verify the Subscription is Replicating | ||
|
|
@@ -991,7 +991,7 @@ FROM dblink( | |
| subscription_name := ''sub_n3_n4'', | ||
| immediate := true | ||
| )' | ||
| ) AS t(result text); | ||
| ) AS t(result bool); | ||
|
|
||
| -- Retrieve stored LSN | ||
| SELECT sync_lsn FROM temp_sync_lsns WHERE origin_node = 'n3'; | ||
|
|
@@ -1001,8 +1001,8 @@ SELECT sync_lsn FROM temp_sync_lsns WHERE origin_node = 'n3'; | |
| SELECT * | ||
| FROM dblink( | ||
| 'host=127.0.0.1 dbname=inventory port=5435 user=alice password=1safepassword', | ||
| 'CALL spock.wait_for_sync_event(true, ''n3'', ''0/1B8E2F0''::pg_lsn, 1200000)' | ||
| ) AS t(result text); | ||
| 'CALL spock.wait_for_sync_event(true, ''n3'', ''0/1B8E2F0''::pg_lsn, 1200)' | ||
| ) AS t(result bool); | ||
|
|
||
| -- Verify status | ||
| SELECT subscription_name, status, provider_node | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,7 +24,13 @@ Invoked on the provider node, this function returns the current `pg_lsn` | |
| value, representing a point-in-time value for your replication scenario. The | ||
| syntax of `spock.sync_event` is: | ||
|
|
||
| `spock.sync_event() RETURNS pg_lsn` | ||
| `spock.sync_event(transactional boolean DEFAULT false) RETURNS pg_lsn` | ||
|
|
||
| When `transactional` is `false` (the default), the sync event marker is | ||
| emitted into the WAL stream immediately, independent of the calling | ||
| transaction. When `transactional` is `true`, the marker is bound to the | ||
| calling transaction and is only visible to subscribers if the transaction | ||
| commits. | ||
|
|
||
| Invoked on a subscriber node, `spock.wait_for_sync_event` is available in two | ||
| flavors - the first uses the origin_id (an `oid`) as an identifier for the | ||
|
|
@@ -62,6 +68,11 @@ On a provider node: | |
|
|
||
| On a subscriber node: | ||
|
|
||
| `CALL spock.wait_for_sync_event(OUT result, 'provider_node', '0/16342B0', 10);` | ||
| `-- result: true (if applied within 10s), false otherwise` | ||
| ```sql | ||
| CALL spock.wait_for_sync_event(NULL, 'provider_node', '0/16342B0', 10); | ||
| -- result: true (if applied within 10s), false otherwise | ||
| ``` | ||
|
|
||
| The first parameter is the OUT `result` placeholder; pass `NULL` for it in | ||
| the `CALL` statement and read the OUT value from the procedure result. | ||
|
|
||
|
Comment on lines
+71
to
78
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Clarify the earlier This updated example is correct, but the earlier inline 🤖 Prompt for AI Agents |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Timeout value is inconsistent with the earlier prerequisite note.
This section says 1200 seconds, but the earlier warning still says ZODAN uses an internal 180-second timeout. Please reconcile or explicitly explain the difference to avoid operator confusion.
🤖 Prompt for AI Agents