-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
VReplication/OnlineDDL: reordering enum values #15103
VReplication/OnlineDDL: reordering enum values #15103
Conversation
Signed-off-by: Shlomi Noach <[email protected]>
Signed-off-by: Shlomi Noach <[email protected]>
Signed-off-by: Shlomi Noach <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #15103 +/- ##
==========================================
+ Coverage 65.39% 65.42% +0.02%
==========================================
Files 1561 1561
Lines 193524 193526 +2
==========================================
+ Hits 126563 126609 +46
+ Misses 66961 66917 -44 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Shlomi Noach <[email protected]>
Here is the expected test failure: https://github.com/vitessio/vitess/actions/runs/7736886979/job/21094946752?pr=15103 |
Signed-off-by: Shlomi Noach <[email protected]>
…to text or remains an ENUM Signed-off-by: Shlomi Noach <[email protected]>
Signed-off-by: Shlomi Noach <[email protected]>
Signed-off-by: Shlomi Noach <[email protected]>
@@ -133,3 +133,248 @@ func TestGetSharedColumns(t *testing.T) { | |||
}) | |||
} | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This added test is mostly irrelevant to the changes in this PR, but while writing the PR I noticed how this was missing.
@@ -120,8 +120,8 @@ const ( | |||
) | |||
|
|||
const ( | |||
EnumReorderStrategyReject int = iota | |||
EnumReorderStrategyAllow | |||
EnumReorderStrategyAllow int = iota |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Subsequently to the main change in this PR, it's now fine to reorder enum values, and the default schemadiff
hints enum-reordering strategy is now EnumReorderStrategyAllow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, great that tracking the schema is already solved. That makes this much easier!
I believe we should backport this to all supported versions, as this is a bugfix in OnlineDDL/VReplication. |
Signed-off-by: Shlomi Noach <[email protected]>
#15352) Signed-off-by: Shlomi Noach <[email protected]> Co-authored-by: vitess-bot[bot] <108069721+vitess-bot[bot]@users.noreply.github.com>
#15350) Signed-off-by: Shlomi Noach <[email protected]> Co-authored-by: vitess-bot[bot] <108069721+vitess-bot[bot]@users.noreply.github.com> Co-authored-by: Shlomi Noach <[email protected]>
#15351) Signed-off-by: Shlomi Noach <[email protected]> Co-authored-by: vitess-bot[bot] <108069721+vitess-bot[bot]@users.noreply.github.com> Co-authored-by: Shlomi Noach <[email protected]>
Description
Fixes #15349
This PR builds a test case where an
enum
's values are reordered, from('red', 'green', 'blue')
to('blue', 'green', 'red')
, and observes howvreplication
(in this case via OnlineDDL) handles it.The behavior before this PR (see test output) is that
vcopier
will copy enum values by text, andvplayer
by ordinal value.As of this PR, and solved specifically for Online DDL (the problem is irrelevant for other
vreplication
workflows),vplayer
appliesenum
column changes by writing the logical (string representation, e.g.'blue'
) of the column.The change is actually quite small. A prior work on converting
enum
s to textual columns has already laid the necessary foundation: makingvplayer
aware of the enum's schema. This is already supported by settingvreplication
'sFilter.Rule.ConvertEnumToText
map. Previously, we only populated it, as mentioned, when convertingenum
to text. The only change needed in this PR was to populate it also when anenum
remains anenum
. Whether theenum
's schema is change or not, this ensures applying binlog events from the original table to the target table by enum textual value.Backport
As this is a corruption bugfix, I believe this should be backported to all supported versions.
Related Issue(s)
vcopier
&vplayer
when copying shuffled enum values #15349schemadiff
strategy forenum
/set
value ordinal change #15105schemadiff
:EnumReorderStrategy
, checking if enum or set values change ordinal #15106Checklist
Deployment Notes