Skip to content

Comments

PanicOnWarnings option to detect SQL warnings and fail the copy process#1

Closed
grodowski wants to merge 15 commits intomasterfrom
grodowski/raise_on_warnings
Closed

PanicOnWarnings option to detect SQL warnings and fail the copy process#1
grodowski wants to merge 15 commits intomasterfrom
grodowski/raise_on_warnings

Conversation

@grodowski
Copy link
Member

A Pull Request should be associated with an Issue.

We wish to have discussions in Issues. A single issue may be targeted by multiple PRs.
If you're offering a new feature or fixing anything, we'd like to know beforehand in Issues,
and potentially we'll be able to point development in a particular direction.

Related issue: https://github.com/github/gh-ost/issues/0123456789

Further notes in https://github.com/github/gh-ost/blob/master/.github/CONTRIBUTING.md
Thank you! We are open to PRs, but please understand if for technical reasons we are unable to accept each and any PR

Description

This PR [briefly explain what it does]

In case this PR introduced Go code changes:

  • contributed code is using same conventions as original code
  • script/cibuild returns with no formatting errors, build errors or unit test errors.

@grodowski grodowski force-pushed the grodowski/raise_on_warnings branch from a4a4354 to e78c3a7 Compare February 13, 2025 10:48
@grodowski grodowski force-pushed the grodowski/raise_on_warnings branch 2 times, most recently from d426b4c to 69d8158 Compare February 27, 2025 14:40
continue
}
pkDuplicateSuffix := fmt.Sprintf("for key '%s.PRIMARY'", this.migrationContext.GetGhostTableName())
if strings.HasPrefix(message, "Duplicate entry") && strings.HasSuffix(message, pkDuplicateSuffix) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Possible to test this with localtests reliably?

%s.%s
where
%s and %s
with /* gh-ost %s.%s %s */ key_range as (
Copy link
Member Author

@grodowski grodowski Feb 28, 2025

Choose a reason for hiding this comment

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

CTEs not supported in mySQL 5 is the reason for the partly broken build. We could unwrap the CTE, I believe it would be equivalent perf-wise, but the duplication doesn't make me happy.

@grodowski grodowski changed the title First pass at raise_on_warnings PanicOnWarnings option to detect SQL warnings and fail the copy process Feb 28, 2025
@grodowski grodowski force-pushed the grodowski/raise_on_warnings branch from 673576d to 067dbdf Compare February 28, 2025 09:14
where
%s and %s
%s,
(select count(*) from (

Choose a reason for hiding this comment

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

I'd be curious what kind of performance impact the changed query has. 🤔

I mainly asking because bad to slow people's migrations down if they don't intend to use the new flag.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, that's a good point. Intuitively, I think there shouldn't be much overhead on the count given how the old query looks. Do you think running explains on a reasonably-sized test table will be a good way to prove it?

Choose a reason for hiding this comment

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

I was hoping they have some benchmarking setup, but doesn't look like it. Yeah, explain analyze on a big table would be a good place to start.

@grodowski grodowski force-pushed the grodowski/raise_on_warnings branch from 067dbdf to 7681d1c Compare February 28, 2025 11:04
@grodowski grodowski force-pushed the grodowski/raise_on_warnings branch from 36eaf27 to 1487b5c Compare March 24, 2025 16:02
…s when renaming unique keys

Error message formats are different across mysql distributions and versions
@grodowski grodowski force-pushed the grodowski/raise_on_warnings branch from fe68db4 to 71a63c4 Compare March 25, 2025 10:18
@grodowski
Copy link
Member Author

This is done: eedac87 and will be part of the next gh-ost release

@grodowski grodowski closed this Mar 26, 2025
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