vitess
vitess copied to clipboard
VReplication: Move ENUM and SET mappings from vplayer to vstreamer
Description
This addresses the issues noted https://github.com/vitessio/vitess/issues/15750. You can see how to perform a manual test there as well.
It does this by removing the existing ENUM
and SET
field integer to string value mapping from the vplayer
(consumer — where it was relying on OnlineDDL specific code that I think can be at least partially removed after this) and moving this work to the vstreamer
(producer) so that Vitess provides uniform and intuitive vstream vevent behavior for ENUM
and SET
fields regardless of what phase the stream or workflow may be in.
In discussing this issue with the Debezium Vitess connector community they had asked if we could add something to the stream which would indicate that they do NOT need to do the string mappings in order to make it easier for them to transition from <= v19 to v20+ of Vitess. To support this I added a new flag to the FieldEvent
type which will indicate when the ENUM
and SET
values are already strings. We always set that in FieldEvent
s during the copy phase as 1) we've always provided those values as strings in the copy phase and 2) we have one field event per row event batch (vstream_packet) so that extra byte is negligible and is cheaper than always searching the columns to see if there are any SET
or ENUM
columns. During the running phase, however, we know when we're managing the string mappings for a table and we only set this field when the table we're streaming events for contains a SET
or ENUM
column.
This PR also fixes https://github.com/vitessio/vitess/issues/15598 after the evalengine portion of it was fixed in https://github.com/vitessio/vitess/pull/15783.
Related Issue(s)
- Fixes: https://github.com/vitessio/vitess/issues/15750
- Fixes: https://github.com/vitessio/vitess/issues/15598
Checklist
- [x] "Backport to:" labels have been added if this change should be back-ported to release branches
- [x] If this change is to be back-ported to previous releases, a justification is included in the PR description
- [x] Tests were added or are not required
- [x] Did the new or modified tests pass consistently locally and on CI?
- [x] Documentation was added or is not required
Review Checklist
Hello reviewers! :wave: 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 asrequired
. - [ ] 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 andawk
-able.
Cross reference for convenience: Online DDL/VReplication test suite: support ENUM as part of PRIMARY KEY
Codecov Report
Attention: Patch coverage is 75.64103%
with 19 lines
in your changes are missing coverage. Please review.
Project coverage is 68.42%. Comparing base (
4c2df48
) to head (1584903
). Report is 52 commits behind head on main.
Files | Patch % | Lines |
---|---|---|
go/vt/vttablet/tabletserver/vstreamer/vstreamer.go | 73.23% | 19 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## main #15723 +/- ##
==========================================
- Coverage 68.44% 68.42% -0.02%
==========================================
Files 1558 1559 +1
Lines 195822 196825 +1003
==========================================
+ Hits 134025 134685 +660
- Misses 61797 62140 +343
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
@mattlord: TestSchemaChange/revertible/expanded:_enum
is failing
@mattlord: TestSchemaChange/revertible/expanded:_enum is failing
consistent on my dev env. Let me quickly see if that's due to my own commit (unlikely because my commit removes unused code).
@mattlord:
TestSchemaChange/revertible/expanded:_enum
is failing
It was never failing before others pushed commits 🙂
Yes, it does look to have been https://github.com/vitessio/vitess/pull/15723/commits/d2bfdaed62c264cd49a6629aa564e73181b781f1 ! I reverted and pushed.
Thank you for the reviews, @shlomi-noach and @rohit-nayak-ps ! I believe that I have addressed all of your comments now.