-
Notifications
You must be signed in to change notification settings - Fork 119
livesync-pg: Refactor steps and add instructions to view replication lag #4235
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: latest
Are you sure you want to change the base?
Conversation
Signed-off-by: Arunprasad Rajkumar <[email protected]>
Allow 10 minutes from last push for the staging site to build. If the link doesn't work, try using incognito mode instead. For internal reviewers, check web-documentation repo actions for staging build status. Link to build for this PR: http://docs-dev.timescale.com/docs-arajkumar-refator-lm-instr |
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.
Nice doc, couple of things to achieve total awesomeness.
@@ -127,6 +127,48 @@ EOF | |||
</Procedure> | |||
|
|||
|
|||
## Specify the tables to synchronize | |||
|
|||
After the schema is migrated, you [`CREATE PUBLICATION`][create-publication] on the SOURCE database to |
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.
After the schema is migrated, you [`CREATE PUBLICATION`][create-publication] on the SOURCE database to | |
After the schema is migrated, you [`CREATE PUBLICATION`][create-publication] on the source database that |
## Specify the tables to synchronize | ||
|
||
After the schema is migrated, you [`CREATE PUBLICATION`][create-publication] on the SOURCE database to | ||
specify the list of tables which you intend to synchronize. |
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.
specify the list of tables which you intend to synchronize. | |
specifies the tables to synchronize. |
After the schema is migrated, you [`CREATE PUBLICATION`][create-publication] on the SOURCE database to | ||
specify the list of tables which you intend to synchronize. | ||
|
||
For example: |
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.
Remove
|
||
<Procedure> | ||
|
||
1. **Create a publication named `analytics` which publishes `metrics` and `tags` tables** |
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.
1. **Create a publication named `analytics` which publishes `metrics` and `tags` tables** | |
1. **Create a publication that specifies the table to synchronize** |
|
||
1. **Create a publication named `analytics` which publishes `metrics` and `tags` tables** | ||
|
||
`PUBLICATION` enables you to add all the tables in the schema or even all the tables in the database. However, it |
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.
`PUBLICATION` enables you to add all the tables in the schema or even all the tables in the database. However, it | |
A `PUBLICATION` enables you to synchronize some or all the tables in the schema or database. |
For example, to synchronize both `analytics` and `iot` publications: | ||
|
||
```shell | ||
docker run -d --rm --name livesync timescale/live-sync:v0.1.16 run --publication analytics --publication iot --subscription livesync --source $SOURCE --target $TARGET |
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.
Remove
1. **View the tables being synchronized** | ||
1. **View the progress of tables being synchronized** | ||
|
||
List the tables being synchronized by $LIVESYNC using the `_ts_live_sync.subscription_rel` table in the target $SERVICE_LONG: | ||
|
||
```bash | ||
psql $TARGET -c "SELECT * FROM _ts_live_sync.subscription_rel" | ||
|
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.
```
You see something like the following:
If you could turn the table into a markdown table, that would be great.
`rows_copied` indicates rows copied so far during the initial sync. | ||
|
||
`approximate_rows` indicates the approximate number of rows in the table. | ||
|
||
`bytes_copied` indicates the number of bytes copied so far during the initial sync. | ||
|
||
`approximate_size` indicates the approximate size of the table in bytes. |
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.
I would not bother with these as the table titles are clear enough. Possibly a one liner saying all values are from the start of the sync.
`approximate_size` indicates the approximate size of the table in bytes. | ||
|
||
|
||
To see the replication lag, run the following against the SOURCE database: |
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.
Can you check your indenting please.
psql $SOURCE -c "SELECT slot_name, pg_size_pretty(pg_current_wal_flush_lsn() - confirmed_flush_lsn) AS lag FROM pg_replication_slots WHERE slot_name LIKE 'live_sync_%' AND slot_type = 'logical'" | ||
``` | ||
|
||
1. **Add or remove tables from the publication** |
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.
I like this, can you do the same for the add and drop tables from the publication earlier to be consistent please.
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.
some minor copy suggestions, otherwise LGTM
@@ -127,6 +127,48 @@ EOF | |||
</Procedure> | |||
|
|||
|
|||
## Specify the tables to synchronize | |||
|
|||
After the schema is migrated, you [`CREATE PUBLICATION`][create-publication] on the SOURCE database to |
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.
After the schema is migrated, you [`CREATE PUBLICATION`][create-publication] on the SOURCE database to | |
After the schema is migrated, you use [`CREATE PUBLICATION`][create-publication] on the SOURCE database to |
|
||
1. **Create a publication named `analytics` which publishes `metrics` and `tags` tables** | ||
|
||
`PUBLICATION` enables you to add all the tables in the schema or even all the tables in the database. However, it |
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.
`PUBLICATION` enables you to add all the tables in the schema or even all the tables in the database. However, it | |
You can use `CREATE PUBLICATION` to add all the tables in a schema or all the tables in the database. However, it |
CREATE PUBLICATION analytics FOR TABLE metrics, tags; | ||
``` | ||
|
||
1. **Add tables after to an existing publication with a call to [ALTER PUBLICATION][alter-publication]** |
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.
1. **Add tables after to an existing publication with a call to [ALTER PUBLICATION][alter-publication]** | |
1. **Add tables to an existing publication with a call to [ALTER PUBLICATION][alter-publication]** |
Description
[Short summary of why you created this PR]
Links
Fixes #[insert issue link, if any]
Writing help
For information about style and word usage, see the Contribution guide
Review checklists
Reviewers: use this section to ensure you have checked everything before approving this PR:
Subject matter expert (SME) review checklist
Documentation team review checklist
and have they been implemented?