Skip to content

Conversation

@harshit-gangal
Copy link
Member

@harshit-gangal harshit-gangal commented Sep 9, 2024

Description

This PR uses the comment directive QUERY_TIMEOUT_MS, session variable query_timeout and VTGate's flag query-timeout to set the query timeout on the execute options sent to vttablet.

VTTablet will consider this as authoritative over VTTablet's default query timeout.
VTGate will set the execution context using the same timeout value.

QUERY_TIMEOUT_MS will override the session value if set. If nothing is set then no timeout value will be sent down to VTTablet.

Order of precedence: Query Comment > Session Value > VTGate flag.

If the query is executed inside a transaction then only the smaller value of query vs transaction timeout will be considered at VTTablet.

Related Issue(s)

Checklist

  • 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

@vitess-bot
Copy link
Contributor

vitess-bot bot commented Sep 9, 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 Sep 9, 2024
@harshit-gangal harshit-gangal removed the NeedsBackportReason If backport labels have been applied to a PR, a justification is required label Sep 9, 2024
@github-actions github-actions bot added this to the v21.0.0 milestone Sep 9, 2024
@codecov
Copy link

codecov bot commented Sep 9, 2024

Codecov Report

Attention: Patch coverage is 90.35088% with 11 lines in your changes missing coverage. Please review.

Project coverage is 68.93%. Comparing base (e0a5069) to head (a857a5e).
Report is 58 commits behind head on main.

Files with missing lines Patch % Lines
go/vt/vtgate/engine/dbddl.go 60.00% 4 Missing ⚠️
go/vt/vtgate/engine/insert_select.go 25.00% 3 Missing ⚠️
go/vt/vttablet/tabletserver/tabletserver.go 90.00% 2 Missing ⚠️
go/vt/sqlparser/comments.go 97.77% 1 Missing ⚠️
go/vt/vtgate/planbuilder/builder.go 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16735      +/-   ##
==========================================
- Coverage   68.94%   68.93%   -0.02%     
==========================================
  Files        1565     1565              
  Lines      201748   201764      +16     
==========================================
- Hits       139093   139083      -10     
- Misses      62655    62681      +26     

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

@harshit-gangal harshit-gangal added Type: Enhancement Logical improvement (somewhere between a bug and feature) Component: Query Serving 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 Sep 9, 2024
@harshit-gangal harshit-gangal changed the title feat: authoritative query timeout as query hint feat: authoritative query timeout for vttablet from vtgate Sep 10, 2024
Copy link
Contributor

@shlomi-noach shlomi-noach left a comment

Choose a reason for hiding this comment

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

Noting for self reference this usage sample:

select /*vt+ QUERY_TIMEOUT_MS=0 */ sleep(5) from dual

Still unsure about the relevance of the foreign key related changes.

@harshit-gangal
Copy link
Member Author

harshit-gangal commented Sep 10, 2024

Still unsure about the relevance of the foeign key related changes.

@shlomi-noach
Those are Query Hint related changes, brought all the extraction of query hints into a single struct.

Signed-off-by: Harshit Gangal <[email protected]>
@deepthi deepthi added the release notes (needs details) This PR needs to be listed in the release notes in a dedicated section (deprecation notice, etc...) label Sep 10, 2024
Signed-off-by: Harshit Gangal <[email protected]>
@systay systay removed the release notes (needs details) This PR needs to be listed in the release notes in a dedicated section (deprecation notice, etc...) label Sep 11, 2024

### <a id="query-timeout"/>Query Timeout Override
VTGate sends an authoritative query timeout to VTTablet when the `QUERY_TIMEOUT_MS` comment directive,
`query_timeout` session system variable, or `query-timeout` flag is set.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
`query_timeout` session system variable, or `query-timeout` flag is set.
`query_timeout` session system variable, or `query-timeout` flag are set.

Copy link
Member Author

Choose a reason for hiding this comment

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

even one of them set is enough.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think is is more apt here.

@harshit-gangal harshit-gangal merged commit e3d2e89 into vitessio:main Sep 11, 2024
@harshit-gangal harshit-gangal deleted the query-timeout branch September 11, 2024 08:23
@deepthi deepthi added the Benchmark me Add label to PR to run benchmarks label Oct 2, 2024
@vitess-bot
Copy link
Contributor

vitess-bot bot commented Oct 2, 2024

Hello! 👋

This Pull Request is now handled by arewefastyet. The current HEAD and future commits will be benchmarked.

You can find the performance comparison on the arewefastyet website.

@deepthi deepthi removed the Benchmark me Add label to PR to run benchmarks label Oct 2, 2024
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.

Feature Request: allow DDL statements to run for unlimited time

5 participants