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

VStream API: validate that last PK has fields defined #16478

Merged
merged 2 commits into from
Jul 26, 2024

Conversation

rohit-nayak-ps
Copy link
Contributor

@rohit-nayak-ps rohit-nayak-ps commented Jul 25, 2024

Description

The vstream API currently doesn't validate that the Fields for a specified TableLastPK are defined. This results in a panics:

2024-07-16 18:28:49.897	runtime/panic.go:113 (0x436d5e)
2024-07-16 18:28:49.897	vitess.io/vitess/go/sqltypes/result.go:288 (0xcc1fda)
2024-07-16 18:28:49.897	vitess.io/vitess/go/sqltypes/proto3.go:92 (0xcc1e96)
2024-07-16 18:28:49.897	vitess.io/vitess/go/sqltypes/proto3.go:123 (0xcc2210)
2024-07-16 18:28:49.897	vitess.io/vitess/go/vt/vttablet/tabletserver/vstreamer/copy.go:183 (0x15269b2)
2024-07-16 18:28:49.897	vitess.io/vitess/go/vt/vttablet/tabletserver/vstreamer/copy.go:211 (0x1526b97)
2024-07-16 18:28:49.897	vitess.io/vitess/go/vt/vttablet/tabletserver/vstreamer/copy.go:60 (0x152558c)
2024-07-16 18:28:49.897	vitess.io/vitess/go/vt/vttablet/tabletserver/vstreamer/copy.go:39 (0x1525327)
2024-07-16 18:28:49.897	vitess.io/vitess/go/vt/vttablet/tabletserver/vstreamer/uvstreamer.go:418 (0x15390b5)
2024-07-16 18:28:49.897	vitess.io/vitess/go/vt/vttablet/tabletserver/vstreamer/engine.go:236 (0x152969c)
2024-07-16 18:28:49.897	vitess.io/vitess/go/vt/vttablet/tabletserver/tabletserver.go:1138 (0x15fc07a)
2024-07-16 18:28:49.897	vitess.io/vitess/go/vt/vttablet/grpcqueryservice/server.go:336 (0x17f6a47)
2024-07-16 18:28:49.897	vitess.io/vitess/go/vt/proto/queryservice/queryservice_grpc.pb.go:1170 (0x17e9ad2)
2024-07-16 18:28:49.897	google.golang.org/grpc@v1.59.0/server.go:1637 (0xa2a2e3)
2024-07-16 18:28:49.897	google.golang.org/grpc@v1.59.0/server.go:1741 (0xa2bd6f)
2024-07-16 18:28:49.897	google.golang.org/grpc@v1.59.0/server.go:986 (0xa2452b)
2024-07-16 18:28:49.897	runtime/asm_amd64.s:1598 (0x470b60)

This happens because the downstream code converts a query.QueryResult to a sqltypes.Result for which it requires Field type information to be specified.

Since this can crash vttablets we should backport it to all supported versions.

Related Issue(s)

#16479

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

Signed-off-by: Rohit Nayak <rohit@planetscale.com>
Copy link
Contributor

vitess-bot bot commented Jul 25, 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 Jul 25, 2024
@github-actions github-actions bot added this to the v21.0.0 milestone Jul 25, 2024
@rohit-nayak-ps rohit-nayak-ps added Type: Bug Component: VReplication and 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 labels Jul 25, 2024
Copy link

codecov bot commented Jul 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 68.62%. Comparing base (f481a77) to head (844ed61).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16478      +/-   ##
==========================================
- Coverage   68.65%   68.62%   -0.03%     
==========================================
  Files        1551     1551              
  Lines      199468   199473       +5     
==========================================
- Hits       136935   136885      -50     
- Misses      62533    62588      +55     

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

Signed-off-by: Rohit Nayak <rohit@planetscale.com>
@rohit-nayak-ps rohit-nayak-ps marked this pull request as ready for review July 26, 2024 02:21
@rohit-nayak-ps rohit-nayak-ps added 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 and removed NeedsBackportReason If backport labels have been applied to a PR, a justification is required labels Jul 26, 2024
@rohit-nayak-ps rohit-nayak-ps requested review from deepthi, mattlord and a team July 26, 2024 03:42
Copy link
Member

@GuptaManan100 GuptaManan100 left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@rohit-nayak-ps rohit-nayak-ps merged commit 9aa9ab5 into vitessio:main Jul 26, 2024
133 checks passed
@rohit-nayak-ps rohit-nayak-ps deleted the rohit/vstream-panic branch July 26, 2024 17:12
vitess-bot pushed a commit that referenced this pull request Jul 26, 2024
Signed-off-by: Rohit Nayak <rohit@planetscale.com>
rohit-nayak-ps pushed a commit that referenced this pull request Jul 30, 2024
…16478) (#16487)

Signed-off-by: Rohit Nayak <rohit@planetscale.com>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Co-authored-by: vitess-bot[bot] <108069721+vitess-bot[bot]@users.noreply.github.com>
Co-authored-by: Florent Poinsard <florent.poinsard@outlook.fr>
rohit-nayak-ps added a commit that referenced this pull request Aug 28, 2024
…16478) (#16485)

Signed-off-by: Rohit Nayak <rohit@planetscale.com>
Co-authored-by: vitess-bot[bot] <108069721+vitess-bot[bot]@users.noreply.github.com>
Co-authored-by: Rohit Nayak <rohit@planetscale.com>
rohit-nayak-ps added a commit that referenced this pull request Aug 28, 2024
…16478) (#16486)

Signed-off-by: Rohit Nayak <rohit@planetscale.com>
Co-authored-by: vitess-bot[bot] <108069721+vitess-bot[bot]@users.noreply.github.com>
Co-authored-by: Rohit Nayak <rohit@planetscale.com>
venkatraju pushed a commit to slackhq/vitess that referenced this pull request Aug 29, 2024
Signed-off-by: Rohit Nayak <rohit@planetscale.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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 Component: VReplication Type: Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants