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

VReplication: handle escaped identifiers in vschema when initializing sequence tables #16169

Merged
merged 11 commits into from
Jun 18, 2024

Conversation

mattlord
Copy link
Contributor

@mattlord mattlord commented Jun 13, 2024

Description

This work ensures that VReplication — when initializing sequence tables during a traffic switch — handles any escaped identifiers (by unescaping them) that may be in the vschema while continuing to ensure that they are escaped when using them in SQL queries.

This PR also moves more of the VReplication endtoend tests to vtctldclient as we now escape the backing sequence table customer_seq references in the test vschemas and the vtctlclient (wrangler) implementation remains unchanged as it's long deprecated and should be removed entirely in v21 or v22.

I think that this is worth back porting to the latest GA release (v20), for RC2 if we can.

Related Issue(s)

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

Signed-off-by: Matt Lord <mattalord@gmail.com>
Signed-off-by: Matt Lord <mattalord@gmail.com>
@mattlord mattlord added Type: Bug Component: VReplication Backport to: release-18.0 Needs to be back ported to release-18.0 Backport to: release-19.0 Needs to be back ported to release-19.0 Backport to: release-20.0 Needs to be backport to release-20.0 labels Jun 13, 2024
Copy link
Contributor

vitess-bot bot commented Jun 13, 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 Jun 13, 2024
@mattlord mattlord removed NeedsWebsiteDocsUpdate What it says NeedsIssue A linked issue is missing for this Pull Request labels Jun 13, 2024
@github-actions github-actions bot added this to the v21.0.0 milestone Jun 13, 2024
Copy link

codecov bot commented Jun 14, 2024

Codecov Report

Attention: Patch coverage is 49.36709% with 40 lines in your changes missing coverage. Please review.

Project coverage is 68.59%. Comparing base (13846e6) to head (990cc6a).
Report is 2 commits behind head on main.

Files Patch % Lines
go/vt/vtctl/workflow/traffic_switcher.go 50.00% 39 Missing ⚠️
go/vt/vttablet/tabletserver/schema/engine.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16169      +/-   ##
==========================================
+ Coverage   68.57%   68.59%   +0.01%     
==========================================
  Files        1544     1544              
  Lines      197863   197918      +55     
==========================================
+ Hits       135688   135757      +69     
+ Misses      62175    62161      -14     

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

Signed-off-by: Matt Lord <mattalord@gmail.com>
Signed-off-by: Matt Lord <mattalord@gmail.com>
@mattlord mattlord added Backport to: release-20.0-rc Needs to be backport to release-20.0-rc and removed Backport to: release-18.0 Needs to be back ported to release-18.0 Backport to: release-19.0 Needs to be back ported to release-19.0 NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsBackportReason If backport labels have been applied to a PR, a justification is required labels Jun 14, 2024
Signed-off-by: Matt Lord <mattalord@gmail.com>
@mattlord mattlord changed the title VReplication: handle escaped identifiers when initializing sequence tables VReplication: handle escaped identifiers in vschema when initializing sequence tables Jun 14, 2024
Signed-off-by: Matt Lord <mattalord@gmail.com>
I had previously extended the unit test timeout and in the
interim we had split the unit test race out so it had the
old timeout.

Signed-off-by: Matt Lord <mattalord@gmail.com>
@@ -54,7 +54,7 @@ for pkg in $flaky_tests; do
max_attempts=3
attempt=1
# Set a timeout because some tests may deadlock when they flake.
until go test -timeout 2m $VT_GO_PARALLEL $pkg -v -race -count=1; do
until go test -timeout 5m $VT_GO_PARALLEL $pkg -v -race -count=1; do
Copy link
Contributor Author

@mattlord mattlord Jun 14, 2024

Choose a reason for hiding this comment

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

The timeout was extended for unit tests in https://github.com/vitessio/vitess/pull/15797/files#diff-470746102447655f4af9e1e9c9756444906143d6b70e394d42eff2aa251fa05aR87 but the race one was not (it should have been — I think that change was made in parallel with them getting split).

Signed-off-by: Matt Lord <mattalord@gmail.com>
Signed-off-by: Matt Lord <mattalord@gmail.com>
@frouioui frouioui mentioned this pull request Jun 18, 2024
34 tasks
@shlomi-noach shlomi-noach merged commit ee01017 into vitessio:main Jun 18, 2024
93 checks passed
@shlomi-noach shlomi-noach deleted the init_seq_table_backticks branch June 18, 2024 18:10
vitess-bot pushed a commit that referenced this pull request Jun 18, 2024
… sequence tables (#16169)

Signed-off-by: Matt Lord <mattalord@gmail.com>
vitess-bot pushed a commit that referenced this pull request Jun 18, 2024
… sequence tables (#16169)

Signed-off-by: Matt Lord <mattalord@gmail.com>
shlomi-noach pushed a commit that referenced this pull request Jun 18, 2024
…en initializing sequence tables (#16169) (#16219)

Signed-off-by: Matt Lord <mattalord@gmail.com>
Co-authored-by: vitess-bot[bot] <108069721+vitess-bot[bot]@users.noreply.github.com>
shlomi-noach pushed a commit that referenced this pull request Jun 18, 2024
… when initializing sequence tables (#16169) (#16218)

Signed-off-by: Matt Lord <mattalord@gmail.com>
Co-authored-by: vitess-bot[bot] <108069721+vitess-bot[bot]@users.noreply.github.com>
systay pushed a commit that referenced this pull request Jul 22, 2024
…ma when initializing sequence tables (#5437)

* cherry pick of 16169

* resolved conflict

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>

---------

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Co-authored-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backport to: release-20.0-rc Needs to be backport to release-20.0-rc Backport to: release-20.0 Needs to be backport to release-20.0 Component: VReplication Type: Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

VReplication SwitchTraffic: backticks in sequence tables in vschema cause SwitchTraffic to error out
4 participants