-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[docs] Add syntax documentation for logical replication #23270
Changes from 1 commit
b7f4a3d
0bd5e06
4ba778d
0d70b3e
6b351ed
4169886
8172bae
963b494
9a147e9
328cfa5
6a01bc1
073deb5
08ac907
929c2da
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 |
---|---|---|
|
@@ -38,18 +38,36 @@ The log sequence number from where to start the streaming from. | |
|
||
The name of an option passed to the slot's logical decoding plugin. | ||
|
||
The applicable options accepted by the command depends on the output plugin of the replication slot. They can be viewed in the respective documentation of the output plugin itself. | ||
|
||
For `pgoutput` and `yboutput`, check the section [53.5.1. Logical Streaming Replication Parameters](https://www.postgresql.org/docs/11/protocol-logical-replication.html) in the PG documentation. | ||
|
||
For `wal2json`, refer to the [plugin documentation](https://github.com/eulerto/wal2json/tree/master?tab=readme-ov-file#parameters). | ||
|
||
### *start_replication_option_value* | ||
|
||
Optional value, in the form of a string constant, associated with the specified option. | ||
|
||
## Example | ||
|
||
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. Add brief summary - "Start replication from Replication Slot test_slot using LSN 0/2 and something something" (explain what is going on) 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. Added 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. But what is 'pub'? 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. Do we need to document these options too https://www.postgresql.org/docs/current/protocol-logical-replication.html ? 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. In this example, we probably need a full example? So creating a table, a publication, and then starting replication. 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.
So these parameters depend on the output plugin chosen. These parameters are specific to
Good point. I've added one. We can't show the output of the start_replication as it streams data via copy protocol. The command doesn't output anything on the shell. |
||
Assume that you have already created a replication slot `test_slot` with output plugin `pgoutput` or `yboutput`. | ||
We need to follow a few steps before we can start streaming from a replication slot. Assume that a table with name `users` already exists in the database. | ||
|
||
Create a publication `mypublication` which includes the table `users`. | ||
|
||
```sql | ||
yugabyte=# CREATE PUBLICATION mypublication FOR TABLE users; | ||
``` | ||
|
||
Create a replication slot with name `test_slot` and output plugin `pgoutput`. | ||
|
||
```sql | ||
yugabyte=# CREATE_REPLICATION_SLOT test_slot LOGICAL pgoutput; | ||
``` | ||
|
||
Start replication from the `test_slot` replication slot starting from LSN `0/2`. We also pass the `publication_names` parameter to the output plugin. `publication_names` is an output plugin parameter that is accepted by both `pgoutput` and `yboutput` to determine the tables to stream the data from. | ||
Start replication from the `test_slot` replication slot starting from LSN `0/2`. We also pass the `publication_names` parameter with value `mypublication` to the output plugin. `publication_names` is an output plugin parameter that is accepted by both `pgoutput` and `yboutput` to determine the tables to stream the data from. | ||
|
||
```sql | ||
yugabyte=# START_REPLICATION test_slot LOGICAL 0/2 publication_names 'pub'; | ||
yugabyte=# START_REPLICATION test_slot LOGICAL 0/2 publication_names 'mypublication'; | ||
ddorian marked this conversation as resolved.
Show resolved
Hide resolved
|
||
``` | ||
|
||
## See also | ||
|
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.
Do we need to document somehow
yboutput
? Or say how/if it differes frompgoutput
?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.
Yes but not in the syntax section. cc: @asrinivasanyb