Skip to content

Comments

[sql_server] Create all *Source related types, support CREATE CONNECTION ... TO SQL SERVER#32087

Merged
ParkMyCar merged 6 commits intoMaterializeInc:mainfrom
ParkMyCar:sql_server/create-connection
Apr 9, 2025
Merged

[sql_server] Create all *Source related types, support CREATE CONNECTION ... TO SQL SERVER#32087
ParkMyCar merged 6 commits intoMaterializeInc:mainfrom
ParkMyCar:sql_server/create-connection

Conversation

@ParkMyCar
Copy link
Contributor

@ParkMyCar ParkMyCar commented Apr 3, 2025

This PR adds all of the various SQL Server 'Source' and 'Connection' types, and leaves the implementations of Purification and Source Rendering as TODOs. Given the number of new types required, and files that need to be touched, I figured it was easier to make this into its own PR.

The two main types this PR adds are:

  1. SqlServerSource (analogous to PostgresSourceConnection)
    • Implements the SourceConnection, AlterCompatible, and SourceRender traits.
  2. SqlServerConnectionDetails (analogous to PostgresConnection)
    • Implements IntoInlineConnection and AlterCompatible.

Note: I slightly differed from the naming convention here because to me PostgresSourceConnection and PostgresConnection were similar enough that I kept getting the two confused.

We also add several types related to these two:

  1. SqlServerSource
    • SqlServerSourceExtras - like the MySQL source, this type is empty but include to conform with other sources.
    • SqlServerSourceExportDetails - details of the specific upstream tables we'll be replicating.
    • GenericSourceConnection::SqlServer variant - enum wrapper around all SOURCE types.
  2. SqlServerConnectionDetails
    • Connection::SqlServer variant - enum wrapper around all CONNECTION types.

Feature Changes

Everything in this PR is still gated behind the enable_sql_server_source flag. When this flag is enabled, the only feature related change is CREATE CONNECTION ... TO SQL SERVER is now supported!

Otherwise purification in the Adapter and implementation of the SourceRender trait are left as a TODO which I will include in a follow-up PR.

Testing

This PR also adds two tests to exercise the new connection behavior, and will eventually be used to exercise CDC:

  1. tests/sql-server-cdc - testdrive based mzcompose workflows, asserts creating and validating a CONNECTION is successful
  2. tests/platform-checks - a new SqlServerCdc check is added to ensure creating and dropping connections works across restarts and upgrades

Motivation

Related to https://github.com/MaterializeInc/database-issues/issues/9198
Progress towards https://github.com/MaterializeInc/database-issues/issues/8762

Tips for reviewer

Overall a lot of this is just plumbing and cargo culting what already exists for Postgres and MySql. I would focus on the changes in the storage-types crate, that's where the most net new code is.

Checklist

  • This PR has adequate test coverage / QA involvement has been duly considered. (trigger-ci for additional test/nightly runs)
  • This PR has an associated up-to-date design doc, is a design doc (template), or is sufficiently small to not require a design.
  • If this PR evolves an existing $T ⇔ Proto$T mapping (possibly in a backwards-incompatible way), then it is tagged with a T-proto label.
  • If this PR will require changes to cloud orchestration or tests, there is a companion cloud PR to account for those changes that is tagged with the release-blocker label (example).
  • If this PR includes major user-facing behavior changes, I have pinged the relevant PM to schedule a changelog post.

@ParkMyCar ParkMyCar force-pushed the sql_server/create-connection branch 2 times, most recently from 8a961cf to d50d51d Compare April 3, 2025 20:47
@ParkMyCar ParkMyCar marked this pull request as ready for review April 3, 2025 20:48
@ParkMyCar ParkMyCar requested review from a team as code owners April 3, 2025 20:48
@ParkMyCar ParkMyCar force-pushed the sql_server/create-connection branch 3 times, most recently from 7d050e4 to cfed48d Compare April 7, 2025 20:35
timeout_in_minutes: 30
parallelism: 1
depends_on: build-x86_64
timeout_in_minutes: 10
Copy link
Contributor

Choose a reason for hiding this comment

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

10 minutes is probably not enough.

Copy link
Contributor

Choose a reason for hiding this comment

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

Pushed with 30 min and worked.

Copy link
Contributor

@martykulma martykulma left a comment

Choose a reason for hiding this comment

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

wow, that is a significant amount of stuff, thanks for putting it into a separate PR!

aside from the copy-paste, it all makes sense to me!

for (compatible, field) in compatibility_checks {
if !compatible {
tracing::warn!(
"MySqlConnection incompatible at {field}:\nself:\n{:#?}\n\nother\n{:#?}",
Copy link
Contributor

Choose a reason for hiding this comment

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

s/MySqlConnection/SqlServerConnection/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

eagle eyed!

ParkMyCar and others added 6 commits April 8, 2025 16:21
…ONNECTION

* Creates all of the various 'Source' and 'Connection' related types with their purification and SourceRender implementations stubbed out
* Adds support for CREATE CONNECTION ... TO SQL SERVER
@ParkMyCar ParkMyCar force-pushed the sql_server/create-connection branch from 6aa48fb to b4739dc Compare April 8, 2025 20:21
@ParkMyCar ParkMyCar merged commit cabd31b into MaterializeInc:main Apr 9, 2025
85 checks passed
@ParkMyCar ParkMyCar deleted the sql_server/create-connection branch April 12, 2025 15:50
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.

3 participants