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

variable: set max duration of gc interval/lifetime to 365 days #25396

Merged
merged 4 commits into from
Jun 15, 2021

Conversation

morgo
Copy link
Contributor

@morgo morgo commented Jun 14, 2021

What problem does this PR solve?

Problem Summary:

In pingcap/docs#5752 I am working through a PR to document min/max, scope etc of system variables by generating it from the TiDB server source. This has revealed that the max values for gc interval/lifetime are quite large (292 years).

It is a very minor issue, but in this PR I propose we change it to 365 days. It is inspired by similar "time based" values in MySQL such as https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_lock_wait_timeout (1 year). The rationale for the change is that Golang doesn't print 292 years in a user-friendly way.

What is changed and how it works?

What's Changed:

The maximum duration for gc interval/lifetime changes from 292 years to 365 days. This is not expected to cause issues for users, since the typical range is specified in minutes to hours.

Related changes

  • PR to update pingcap/docs/pingcap/docs-cn:
  • Need to cherry-pick to the release branch

Check List

Tests

  • Unit test (covered by existing tests)

Side effects

  • None

Release note

  • The maximum duration for gc interval/lifetime changes from 292 years to 365 days. This is not expected to cause issues for users, since the typical range is specified in minutes to hours.

@morgo morgo requested review from dveeden and MyonKeminta June 14, 2021 20:37
@ti-chi-bot ti-chi-bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Jun 14, 2021
Copy link
Contributor

@dveeden dveeden left a comment

Choose a reason for hiding this comment

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

5.7.25-TiDB-v5.2.0-alpha-14-g75388187f 127.0.0.1:4000  SQL  set global tidb_gc_life_time='9m';
ERROR: 1232 (42000): Incorrect argument type to variable 'tidb_gc_life_time'

Not that this should be part of this PR, but this error is both unhelpful and wrong.

  • The type is not wrong, the value is.
  • Would be nice to have it report the range.

Just and idea:

5.7.25-TiDB-v5.2.0-alpha-14-g75388187f 127.0.0.1:4000  SQL  set global tidb_gc_life_time='9m';
ERROR: 1232 (42000): Out of range value for variable 'tidb_gc_life_time'. Allowed range: 10m0s - 1y

sessionctx/variable/sysvar.go Show resolved Hide resolved
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Jun 14, 2021
@morgo
Copy link
Contributor Author

morgo commented Jun 14, 2021

5.7.25-TiDB-v5.2.0-alpha-14-g75388187f 127.0.0.1:4000  SQL  set global tidb_gc_life_time='9m';
ERROR: 1232 (42000): Incorrect argument type to variable 'tidb_gc_life_time'

Not that this should be part of this PR, but this error is both unhelpful and wrong.

  • The type is not wrong, the value is.
  • Would be nice to have it report the range.

Just and idea:

5.7.25-TiDB-v5.2.0-alpha-14-g75388187f 127.0.0.1:4000  SQL  set global tidb_gc_life_time='9m';
ERROR: 1232 (42000): Out of range value for variable 'tidb_gc_life_time'. Allowed range: 10m0s - 1y

This is easy to fix:

if int64(d) < sv.MinValue {
return value, ErrWrongTypeForVar.GenWithStackByArgs(sv.Name)
}
if uint64(d) > sv.MaxValue {
return value, ErrWrongTypeForVar.GenWithStackByArgs(sv.Name)
}

I don't think it will break many tests to fix this case, but the functions that validate integer values also return 'wrong type'. Fixing these might break a fair amount of tests.

@ti-chi-bot
Copy link
Member

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • dveeden
  • xhebox

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

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

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Jun 15, 2021
@xhebox
Copy link
Contributor

xhebox commented Jun 15, 2021

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: f1fd49d

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Jun 15, 2021
@ti-chi-bot
Copy link
Member

@morgo: Your PR was out of date, I have automatically updated it for you.

At the same time I will also trigger all tests for you:

/run-all-tests

If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

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 ti-community-infra/tichi repository.

@ti-chi-bot ti-chi-bot merged commit 49cbbc4 into pingcap:master Jun 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/sql-infra SIG: SQL Infra size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants