Skip to content
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

Update docs for LDR v25.1 #19353

Merged
merged 4 commits into from
Feb 21, 2025
Merged

Update docs for LDR v25.1 #19353

merged 4 commits into from
Feb 21, 2025

Conversation

kathancox
Copy link
Contributor

@kathancox kathancox commented Feb 6, 2025

Fixes DOC-11948, DOC-12060

This PR adds the new LDR syntax CREATE LOGICALLY REPLICATED. We're keeping the original syntax from 24.2 in place as well, which has resulted in restructuring the Set Up Logical Data Replication tutorial. Both the new syntaxes, plus unidirectional/bidirectional intersect, so the updates are intended to pave a logical way through the tutorial no matter if the user setting up unidirectional or bidirectional.

Rendered Previews

Setup Guide
New SQL Page

Copy link

github-actions bot commented Feb 6, 2025

Files changed:

Copy link

netlify bot commented Feb 6, 2025

Deploy Preview for cockroachdb-interactivetutorials-docs canceled.

Name Link
🔨 Latest commit bb79370
🔍 Latest deploy log https://app.netlify.com/sites/cockroachdb-interactivetutorials-docs/deploys/67b8a401896779000866d48b

Copy link

netlify bot commented Feb 6, 2025

Deploy Preview for cockroachdb-api-docs canceled.

Name Link
🔨 Latest commit bb79370
🔍 Latest deploy log https://app.netlify.com/sites/cockroachdb-api-docs/deploys/67b8a401d5d7b000081cad1a

Copy link

netlify bot commented Feb 6, 2025

Netlify Preview

Name Link
🔨 Latest commit bb79370
🔍 Latest deploy log https://app.netlify.com/sites/cockroachdb-docs/deploys/67b8a4017f53b60008c37166
😎 Deploy Preview https://deploy-preview-19353--cockroachdb-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@kathancox kathancox force-pushed the ldr-syntax-bidirectional branch 2 times, most recently from f2364da to 366c902 Compare February 7, 2025 21:15
@@ -36,12 +42,6 @@ You'll need:
- All nodes in each cluster will need access to the Certificate Authority for the other cluster. Refer to [Step 2. Connect from the destination to the source](#step-2-connect-from-the-destination-to-the-source).
- LDR replicates at the table level, which means clusters can contain other tables that are not part of the LDR job. If both clusters are empty, create the tables that you need to replicate with **identical** schema definitions (excluding indexes) on both clusters. If one cluster already has an existing table that you'll replicate, ensure the other cluster's table definition matches. For more details on the supported schemas, refer to [Schema Validation](#schema-validation).
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@msbutler @alicia-l2 Am I right in thinking that the main point of this prerequisite bullet applies only to CREATE LOGICAL REPLICATION STREAM?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

create the tables that you need to replicate with identical schema definitions (excluding indexes) on both clusters.

correct, this only applies to the original syntax.

{{site.data.alerts.end}}{% endcomment %}

To create bidirectional LDR, you can complete the [optional step](#step-4-optional-set-up-bidirectional-ldr) to start the second LDR job that sends writes from the table on cluster B to the table on cluster A.

### Schema validation
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about Schema validation? Is this just the old syntax since the new syntax will create the table?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

both flavors undergo schema validation. In fact, the CREATE LOGICALLY REPLICATED is slightly more restricive. Unlike with the og syntax, a replicating table with the new syntax cannot have:

  • UDTs
  • foreign keys

@kathancox kathancox force-pushed the ldr-syntax-bidirectional branch from 366c902 to 2e3493f Compare February 10, 2025 15:04
@kathancox kathancox marked this pull request as ready for review February 10, 2025 16:48
Copy link

@alicia-l2 alicia-l2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, have some comments

@@ -0,0 +1 @@
If your table does not contain any user-defined types or [foregin key]({% link {{ page.version.version }}/foreign-key.md %}) dependencies, use the [`CREATE LOGICALLY REPLICATED`]({% link {{ page.version.version }}/create-logically-replicated.md %}) syntax to start the stream for a fast, offline initial scan and automatic destination table setup.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@msbutler Can you fact check that those are the only two limitations for the ofline initial scan?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, i believe these are the only ones.

{{site.data.alerts.callout_info}}
{% include feature-phases/preview.md %}

Logical data replication is only supported in CockroachDB {{ site.data.products.core }} clusters.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*currently only supported

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should avoid potential "forward-looking" language, and remain with what is factually available right now.

Copy link

@msbutler msbutler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Left mostly nits

@@ -0,0 +1 @@
If your table does not contain any user-defined types or [foregin key]({% link {{ page.version.version }}/foreign-key.md %}) dependencies, use the [`CREATE LOGICALLY REPLICATED`]({% link {{ page.version.version }}/create-logically-replicated.md %}) syntax to start the stream for a fast, offline initial scan and automatic destination table setup.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, i believe these are the only ones.


- [Column families]({% link {{ page.version.version }}/column-families.md %})
- [Partial indexes]({% link {{ page.version.version }}/partial-indexes.md %}) and [hash-sharded indexes]({% link {{ page.version.version }}/hash-sharded-indexes.md %})
- Indexes with a [virtual computed column]({% link {{ page.version.version }}/computed-columns.md %})
- Composite types in the [primary key]({% link {{ page.version.version }}/primary-key.md %})

Additionally, for the `CREATE LOGICALLY REPLCATED` syntax, you cannot use LDR on a table with a schema that contains:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i find it a bit confusing that we have this list of limitations as well as a separate list of known limitations. LDR, with both syntaxes, currently do not support UDFs, Sequences etc. IMHO, it would be clearer to have just one list.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this, I've created myself an issue that I'll tackle as a follow-up. I want to take a look at the KL sections across LDR and this Schema validation section to evaluate the best approach: https://cockroachlabs.atlassian.net/browse/DOC-12331


You can use the `cockroach encode-uri` command to generate a connection string containing a cluster's certificate.

1. On the **source** cluster in a new terminal window, generate a connection string, by passing the replication user, node IP, and port, along with the directory to the source cluster's CA certificate:
1. On the **source** cluster in a new terminal window, generate a connection string, by passing the user, node IP, and port, along with the directory to the source cluster's CA certificate:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be good to clarify that the user in the external conn requires the REPLICATION priv.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added this back in, not sure why I took that out while testing 🤔

Copy link

@msbutler msbutler Feb 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you your user was root, then you had these privs automatically


## Step 4. (Optional) Set up bidirectional LDR
{% include_cached copy-clipboard.html %}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just realized I did something bad: I should have added a release note to this SHOW LOGICAL REPLICATION JOBS change I made for 25.1, which means we'll need to update the examples in the docs. Should I open a separate docs issue?

This is another SHOW LDR JOBS change that should have had a release note as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries! I've updated both of these column name changes and added the release notes to the 25.1 testing releases they released with.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you!

@kathancox
Copy link
Contributor Author

I think I've addressed the comments / opened an issue to take care of the KLs in a follow-up. PTAL when you have a chance, @msbutler @alicia-l2

@kathancox kathancox requested a review from rmloveland February 18, 2025 13:44
Copy link
Contributor

@rmloveland rmloveland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, had non-blocking questions/comments to take or leave as you desire

@kathancox kathancox force-pushed the ldr-syntax-bidirectional branch from 5d3eee9 to bb79370 Compare February 21, 2025 16:04
@kathancox kathancox merged commit c0b88c3 into main Feb 21, 2025
6 checks passed
@kathancox kathancox deleted the ldr-syntax-bidirectional branch February 21, 2025 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants