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

Fix accepting bind variables in time related function calls. #14763

Merged
merged 8 commits into from
Dec 13, 2023

Conversation

GuptaManan100
Copy link
Member

Description

As part of the PR #12742 we changed curtime function expressions to only accept literal values instead of taking in bind variables. This however caused the problem described in #14740 where-in, the vtgates from v16 are still normalizing the query and sending bind-variables, but the v17 vttablets aren't accepting them.

This PR addresses this issue, by making v17 vttablets to continue to parse the bind-variables and it also fixes the normalizer to continue to not normalize the curtime function expressions.

Tests for all the changes have been added. Moreover, I have added running the misc package of vtgate queries in upgrade-downgrade tests.

Related Issue(s)

Checklist

  • "Backport to:" labels have been added if this change should be back-ported
  • Tests were added or are not required
  • Did the new or modified tests pass consistently locally and on the CI
  • Documentation was added or is not required

Deployment Notes

Copy link
Contributor

vitess-bot bot commented Dec 13, 2023

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 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 Dec 13, 2023
@github-actions github-actions bot added this to the v17.0.5 milestone Dec 13, 2023
@GuptaManan100 GuptaManan100 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 Dec 13, 2023
@harshit-gangal
Copy link
Member

harshit-gangal commented Dec 13, 2023

Looks like a genuine failure here due to changes

2023-12-13T07:59:56.7049644Z === RUN   TestSetUDV/17-set_@foo_=_now(),_@bar_=_now(),_@dd_=_date('2020-10-20'),_@tt_=_time('10:15')
2023-12-13T07:59:56.7050937Z     udv_test.go:112: 
2023-12-13T07:59:56.7052334Z         	Error Trace:	/home/runner/work/vitess/vitess/go/test/endtoend/vtgate/reservedconn/utils.go:150
2023-12-13T07:59:56.7054893Z         	            				/home/runner/work/vitess/vitess/go/test/endtoend/vtgate/reservedconn/udv_test.go:112
2023-12-13T07:59:56.7056196Z         	Error:      	Received unexpected error:
2023-12-13T07:59:56.7059396Z         	            	Bind variables not supported for CurTimeFuncExpr (errno 1105) (sqlstate HY000) during query: set @foo = now(), @bar = now(), @dd = date('2020-10-20'), @tt = time('10:15')
2023-12-13T07:59:56.7061843Z         	Test:       	TestSetUDV/17-set_@foo_=_now(),_@bar_=_now(),_@dd_=_date('2020-10-20'),_@tt_=_time('10:15')
2023-12-13T07:59:56.7063698Z         	Messages:   	for query: set @foo = now(), @bar = now(), @dd = date('2020-10-20'), @tt = time('10:15')
2023-12-13T07:59:56.7064835Z === RUN   TestSetUDV/18-select_@foo_=_@bar,_@dd,_@tt
2023-12-13T07:59:56.7065617Z     udv_test.go:118:   string(
2023-12-13T07:59:56.7066535Z         - 	`[[INT64(1) DATE("2020-10-20") TIME("10:15:00")]]`,
2023-12-13T07:59:56.7067292Z         + 	"[[INT64(0) NULL NULL]]",
2023-12-13T07:59:56.7067855Z           )
2023-12-13T07:59:56.7068217Z         
2023-12-13T07:59:56.7068778Z         for query: select @foo = @bar, @dd, @tt
2023-12-13T07:59:56.7069468Z --- FAIL: TestSetUDV (0.03s)

@GuptaManan100
Copy link
Member Author

Okay, yes. I found the failure and fixed it 👍

@harshit-gangal harshit-gangal merged commit 8316759 into vitessio:release-17.0 Dec 13, 2023
112 checks passed
@harshit-gangal harshit-gangal deleted the fix-now-bindvar branch December 13, 2023 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants