Skip to content

Unsharded support for CREATE PROCEDURE and DROP PROCEDURE statement #17946

Merged
GuptaManan100 merged 33 commits intovitessio:mainfrom
planetscale:create-procedure
Apr 1, 2025
Merged

Unsharded support for CREATE PROCEDURE and DROP PROCEDURE statement #17946
GuptaManan100 merged 33 commits intovitessio:mainfrom
planetscale:create-procedure

Conversation

@GuptaManan100
Copy link
Contributor

@GuptaManan100 GuptaManan100 commented Mar 11, 2025

Description

This PR adds the ability to vtgate to run basic CREATE PROCEDURE and DROP PROCEDURE statements. The following changes needed to be made for this support -

  1. Augment the parser for allowing CREATE PROCEDURE and DROP PROCEDURE statements.
  2. Add planning for the statements, while only allowing them for an unsharded keyspace.
  3. Augment SplitStatementsToPieces to split create procedure statements properly. This requiring us to also parse the statement since create procedure statements can have multiple ; tokens in them, and just splitting on ; is no longer enough.

This PR also changes the e2e test for procedures to create them using 2 methods, one through the ApplySchema call, and the other through the vtgate connection.

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

Deployment Notes

Signed-off-by: Manan Gupta <manan@planetscale.com>
Signed-off-by: Manan Gupta <manan@planetscale.com>
Signed-off-by: Manan Gupta <manan@planetscale.com>
Signed-off-by: Manan Gupta <manan@planetscale.com>
@vitess-bot
Copy link
Contributor

vitess-bot bot commented Mar 11, 2025

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 Mar 11, 2025
@github-actions github-actions bot added this to the v22.0.0 milestone Mar 11, 2025
Signed-off-by: Manan Gupta <manan@planetscale.com>
Signed-off-by: Manan Gupta <manan@planetscale.com>
Signed-off-by: Manan Gupta <manan@planetscale.com>
Signed-off-by: Manan Gupta <manan@planetscale.com>
Signed-off-by: Manan Gupta <manan@planetscale.com>
Signed-off-by: Manan Gupta <manan@planetscale.com>
Signed-off-by: Manan Gupta <manan@planetscale.com>
Signed-off-by: Manan Gupta <manan@planetscale.com>
Signed-off-by: Manan Gupta <manan@planetscale.com>
Signed-off-by: Manan Gupta <manan@planetscale.com>
…nd use that to implement ParseMultiple and remove parse next

Signed-off-by: Manan Gupta <manan@planetscale.com>
…est expectations

Signed-off-by: Manan Gupta <manan@planetscale.com>
…atement is incomplete

Signed-off-by: Manan Gupta <manan@planetscale.com>
Signed-off-by: Manan Gupta <manan@planetscale.com>
Signed-off-by: Manan Gupta <manan@planetscale.com>
Signed-off-by: Manan Gupta <manan@planetscale.com>
…ng for create procedure statements

Signed-off-by: Manan Gupta <manan@planetscale.com>
Signed-off-by: Manan Gupta <manan@planetscale.com>
Signed-off-by: Manan Gupta <manan@planetscale.com>
@codecov
Copy link

codecov bot commented Mar 26, 2025

Codecov Report

Attention: Patch coverage is 34.13174% with 330 lines in your changes missing coverage. Please review.

Project coverage is 67.54%. Comparing base (8f48378) to head (cc2b1f7).
Report is 26 commits behind head on main.

Files with missing lines Patch % Lines
go/vt/sqlparser/ast_path.go 3.47% 139 Missing ⚠️
go/vt/sqlparser/ast_format.go 3.09% 94 Missing ⚠️
go/vt/sqlparser/ast.go 28.73% 62 Missing ⚠️
go/vt/sqlparser/ast_funcs.go 40.00% 30 Missing ⚠️
go/vt/vtgate/planbuilder/ddl.go 81.81% 4 Missing ⚠️
go/vt/vttablet/tabletserver/planbuilder/plan.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #17946      +/-   ##
==========================================
- Coverage   67.58%   67.54%   -0.04%     
==========================================
  Files        1598     1600       +2     
  Lines      260323   261288     +965     
==========================================
+ Hits       175930   176482     +552     
- Misses      84393    84806     +413     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

…ruct

Signed-off-by: Manan Gupta <manan@planetscale.com>
Copy link
Member

@harshit-gangal harshit-gangal left a comment

Choose a reason for hiding this comment

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

do we support drop procedure? If not, I believe we need to add that support as well

Signed-off-by: Manan Gupta <manan@planetscale.com>
Signed-off-by: Manan Gupta <manan@planetscale.com>
Signed-off-by: Manan Gupta <manan@planetscale.com>
@GuptaManan100 GuptaManan100 changed the title Parsing support for CREATE PROCEDURE statement Unsharded support for CREATE PROCEDURE and DROP PROCEDURE statement Mar 31, 2025
Signed-off-by: Manan Gupta <manan@planetscale.com>
Signed-off-by: Manan Gupta <manan@planetscale.com>
@GuptaManan100 GuptaManan100 merged commit eca7922 into vitessio:main Apr 1, 2025
103 checks passed
@GuptaManan100 GuptaManan100 deleted the create-procedure branch April 1, 2025 12:32
@versecafe
Copy link

@GuptaManan100 Are there any plans to add FUNCTION support for unsharded keyspaces to go along with PROCEDURE being added?

@GuptaManan100
Copy link
Contributor Author

No not at the moment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component: Query Serving Type: Enhancement Logical improvement (somewhere between a bug and feature)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants