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

ttl: use static expression context to calculate the TTL expire time #53104

Merged
merged 1 commit into from May 13, 2024

Conversation

lcwangchao
Copy link
Collaborator

@lcwangchao lcwangchao commented May 8, 2024

What problem does this PR solve?

Issue Number: close #53103

Problem Summary:

After we introduced StaticExprContext, we can build and evaluate an expression more simply without relying on the session. So, we can make it simple to evalute a TTL expire time.

What changed and how does it work?

  • introduce a new function EvalExpireTime to compute the TTL expire time. It only requires the current time and the expression info as the input argument. So it is more simple, the new function is:
func EvalExpireTime(now time.Time, interval string, unit ast.TimeUnitType) (time.Time, error) {
    // ...
}
  • DDL use EvalExpireTime to check whether a expire expression is legal.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

@ti-chi-bot ti-chi-bot bot added release-note-none size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels May 8, 2024
Copy link

tiprow bot commented May 8, 2024

Hi @lcwangchao. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Copy link

codecov bot commented May 8, 2024

Codecov Report

Attention: Patch coverage is 70.00000% with 12 lines in your changes are missing coverage. Please review.

Project coverage is 74.3393%. Comparing base (516977e) to head (c2854a7).
Report is 58 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #53104        +/-   ##
================================================
+ Coverage   72.0377%   74.3393%   +2.3016%     
================================================
  Files          1499       1509        +10     
  Lines        431246     441470     +10224     
================================================
+ Hits         310660     328186     +17526     
+ Misses       101286      93079      -8207     
- Partials      19300      20205       +905     
Flag Coverage Δ
integration 49.1760% <47.5000%> (?)
unit 71.2465% <70.0000%> (-0.0080%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 53.9957% <ø> (ø)
parser ∅ <ø> (∅)
br 46.3661% <ø> (+8.0140%) ⬆️

@lcwangchao
Copy link
Collaborator Author

/retest

Copy link

tiprow bot commented May 8, 2024

@lcwangchao: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Copy link
Member

@YangKeao YangKeao left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

ti-chi-bot bot commented May 13, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: tangenta, YangKeao

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link

ti-chi-bot bot commented May 13, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-05-08 09:20:12.922830816 +0000 UTC m=+1040166.679966389: ☑️ agreed by YangKeao.
  • 2024-05-13 06:17:28.351022893 +0000 UTC m=+1461202.108158466: ☑️ agreed by tangenta.

@ti-chi-bot ti-chi-bot bot merged commit 8ef6667 into pingcap:master May 13, 2024
23 checks passed
@lcwangchao lcwangchao deleted the eval_expire_time branch May 13, 2024 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm release-note-none size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

use static expression context to caculate the ttl expire time
3 participants