Skip to content

[SS-97] Small refactor to prep for MySQL parallel snapshot changes#37692

Merged
peterdukelarsen merged 1 commit into
MaterializeInc:mainfrom
peterdukelarsen:pl/mysql-snapshot-refactor
Jul 16, 2026
Merged

[SS-97] Small refactor to prep for MySQL parallel snapshot changes#37692
peterdukelarsen merged 1 commit into
MaterializeInc:mainfrom
peterdukelarsen:pl/mysql-snapshot-refactor

Conversation

@peterdukelarsen

@peterdukelarsen peterdukelarsen commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Motivation

This is a subcomponent of the larger MySQL parallel snapshotting feature: #37642.

We're working on parallelizing mysql snapshotting. Trying to shrink the overall diff by a bit in the upcoming PR by extracting re-usable bits into methods.

Description

Pull the SET lock_wait_timeout / LOCK TABLES / read @@gtid_executed sequence out of render() into lock_tables_and_read_gtid_set(), returning the raw GTID set string (definite TableDropped error on a vanished table).

@peterdukelarsen
peterdukelarsen force-pushed the pl/mysql-snapshot-refactor branch 2 times, most recently from 26beebc to 1e8f86d Compare July 16, 2026 19:06
Behavior-preserving refactor of the MySQL snapshot reader: pull the
SET lock_wait_timeout / LOCK TABLES / read @@gtid_executed sequence out of
render() into lock_tables_and_read_gtid_set(), returning the raw GTID set
string (definite TableDropped error on a vanished table). The parallel-snapshot
work builds on this so its leader path reuses the same helper.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@peterdukelarsen
peterdukelarsen force-pushed the pl/mysql-snapshot-refactor branch from 1e8f86d to bf3441f Compare July 16, 2026 19:33
@peterdukelarsen
peterdukelarsen marked this pull request as ready for review July 16, 2026 19:36
@peterdukelarsen
peterdukelarsen requested a review from a team as a code owner July 16, 2026 19:36

@patrickwwbutler patrickwwbutler left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Overall looks good! minor suggestion on the error enum but i don't think it's terribly important

Ok(total)
}

enum SnapshotSetupError {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

IMO it's reasonable to just reuse the ReplicationError enum that already exists with the same two variants, as this eum is effectively duplicated code, but it's not terribly important. If you want to maintain a separate name for clarity of purpose/origin of the error, you could use something like type SnapshotSetupError = ReplicationError to just alias it

@peterdukelarsen peterdukelarsen Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The one hiccup with this is that the ReplicationError wraps the underlying errors with Rc so it makes the code a good bit uglier to re-use that type. I'm leaning towards leaving it as is with the targeted type & conversions.

@peterdukelarsen
peterdukelarsen merged commit e440289 into MaterializeInc:main Jul 16, 2026
127 checks passed
@peterdukelarsen
peterdukelarsen deleted the pl/mysql-snapshot-refactor branch July 16, 2026 20:23
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.

2 participants