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

Remove ALGORITHM=COPY from Online DDL in MySQL >= 8.0.32 #15376

Merged
merged 8 commits into from
Mar 6, 2024

Conversation

shlomi-noach
Copy link
Contributor

@shlomi-noach shlomi-noach commented Feb 28, 2024

Description

Solves #15375

We added ALGORITHM=COPY in #12436 and in #12521 to overcome a MySQL 8.0.29 vs Xtrabackup issue. Those we merged in release-16.0.

The problem was resolved as of MySQL 8.0.32.

This PR no longer adds ALGORITHM=COPY for Online DDL operations on 8.0.32 and above. This solves #15375.

Initial commit: adding tests that validate #15375

The main change in this PR conditionally undoes #12521.

Related Issue(s)

Fixes: #15375

Checklist

  • "Backport to:" labels have been added if this change should be back-ported to release branches
  • If this change is to be back-ported to previous releases, a justification is included in the PR description
  • Tests were added or are not required
  • Did the new or modified tests pass consistently locally and on CI?
  • Documentation was added or is not required

Deployment Notes

@shlomi-noach shlomi-noach added Type: Bug Component: Online DDL Online DDL (vitess/native/gh-ost/pt-osc) labels Feb 28, 2024
Copy link
Contributor

vitess-bot bot commented Feb 28, 2024

Review Checklist

Hello reviewers! 👋 Please follow this checklist when reviewing this Pull Request.

General

  • Ensure that the Pull Request has a descriptive title.
  • Ensure there is a link to an issue (except for internal cleanup and flaky test fixes), new features should have an RFC that documents use cases and test cases.

Tests

  • Bug fixes should have at least one unit or end-to-end test, enhancement and new features should have a sufficient number of tests.

Documentation

  • Apply the release notes (needs details) label if users need to know about this change.
  • New features should be documented.
  • There should be some code comments as to why things are implemented the way they are.
  • There should be a comment at the top of each new or modified test to explain what the test does.

New flags

  • Is this flag really necessary?
  • Flag names must be clear and intuitive, use dashes (-), and have a clear help text.

If a workflow is added or modified:

  • Each item in Jobs should be named in order to mark it as required.
  • If the workflow needs to be marked as required, the maintainer team must be notified.

Backward compatibility

  • Protobuf changes should be wire-compatible.
  • Changes to _vt tables and RPCs need to be backward compatible.
  • RPC changes should be compatible with vitess-operator
  • If a flag is removed, then it should also be removed from vitess-operator and arewefastyet, if used there.
  • vtctl command output order should be stable and awk-able.

@vitess-bot vitess-bot bot added NeedsBackportReason If backport labels have been applied to a PR, a justification is required NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsIssue A linked issue is missing for this Pull Request NeedsWebsiteDocsUpdate What it says labels Feb 28, 2024
@github-actions github-actions bot added this to the v20.0.0 milestone Feb 28, 2024
Copy link

codecov bot commented Feb 28, 2024

Codecov Report

Attention: Patch coverage is 60.00000% with 6 lines in your changes are missing coverage. Please review.

Project coverage is 65.43%. Comparing base (236f84c) to head (0bf8de5).
Report is 1 commits behind head on main.

Files Patch % Lines
go/vt/vttablet/onlineddl/executor.go 53.84% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #15376      +/-   ##
==========================================
+ Coverage   65.42%   65.43%   +0.01%     
==========================================
  Files        1561     1562       +1     
  Lines      193630   193670      +40     
==========================================
+ Hits       126674   126723      +49     
+ Misses      66956    66947       -9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Shlomi Noach <[email protected]>
Signed-off-by: Shlomi Noach <[email protected]>
Signed-off-by: Shlomi Noach <[email protected]>
{
// NOT NULL vs NULL should be fine
schema: "create table t10(id int primary key, pid int not null, key (pid)); create table t11 (id int primary key, pid int null, key ix(pid), constraint f10 foreign key (pid) references t10(pid))",
},
Copy link
Contributor Author

@shlomi-noach shlomi-noach Feb 28, 2024

Choose a reason for hiding this comment

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

The changes here merely validate that as far as schemadiff is concerned, modifying NULL to NOT NULL and vice versa is OK. It's related is essence to the bugfix of this PR, but isn't in any way affected by changes in this PR. These tests would have passed even before this PR. They're here for completeness.

@shlomi-noach shlomi-noach removed NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsWebsiteDocsUpdate What it says NeedsIssue A linked issue is missing for this Pull Request NeedsBackportReason If backport labels have been applied to a PR, a justification is required labels Feb 28, 2024
@shlomi-noach
Copy link
Contributor Author

The new go/test/endtoend/onlineddl/vrepl_suite/testdata/fk-child-modify-not-null/create.sql test in this PR cannot be tested on vanilla MySQL, and it is skipped. This means this PR in this repo does not actually validate this test. I did, however, validate it on the PlanetScale public MySQL fork.

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 introduce this flag file because vanilla MySQL, used by this test, cannot run foreign-key Online DDLs.

@shlomi-noach shlomi-noach marked this pull request as ready for review February 28, 2024 09:57
@shlomi-noach shlomi-noach requested a review from a team February 28, 2024 14:29
Copy link
Contributor

@mattlord mattlord left a comment

Choose a reason for hiding this comment

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

LGTM. I only had one minor question -- will leave that for you to decide.

Should we add this to the Related Issue(s) section in the description?

  - Fixes: https://github.com/vitessio/vitess/issues/15375

Comment on lines +186 to +191
if _, exists := readTestFile(t, testName, "require_rename_table_preserve_foreign_key"); exists {
if !fkOnlineDDLPossible {
t.Skipf("Skipping test due to require_rename_table_preserve_foreign_key")
return
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we instead use mysqlctl.GetVersionString() here and check for the PS fork indicator in the string?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's what https://github.com/vitessio/vitess/pull/15376/files#diff-5b2f7e26e6a031b4098461528dca98e5ff630e70e1986f35efaab59f3fa5bd76R137-R156 does (not using version() but using variables). The intent of the flag file is to point out that this specific test should only run where preserve_foreign_key is supported. We can't automatically associate a specific test with this specific restriction.

Choose a reason for hiding this comment

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

Run it

@shlomi-noach
Copy link
Contributor Author

shlomi-noach commented Feb 28, 2024

Should we add this to the Related Issue(s) section in the description?

Done.

@shlomi-noach shlomi-noach merged commit 6db8860 into vitessio:main Mar 6, 2024
102 checks passed
@shlomi-noach shlomi-noach deleted the schemadiff-fk-modify-null branch March 6, 2024 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Online DDL Online DDL (vitess/native/gh-ost/pt-osc) Type: Bug
Projects
None yet
4 participants