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: Trying to get float64 after get uint64 fails. #7979

Merged
merged 2 commits into from
Mar 27, 2024

Conversation

HuSharp
Copy link
Member

@HuSharp HuSharp commented Mar 26, 2024

What problem does this PR solve?

Issue Number: Close #7980

What is changed and how does it work?

when set schedule.max-pending-peer-count as uint64(math.MaxInt32)

json unmarshal will convert number(uint64(math.MaxInt32)) to float64

and then set float64 into TTL config

if err := s.persistOptions.SetTTLData(s.ctx, s.client, k, fmt.Sprint(v), ttl); err != nil {

and then fmt.Sprint(float(math.MaxInt32)) will transfer float(math.MaxInt32) to 2.147483647e+09 which will meet error when try to get TTL config

[2024/03/25 06:55:50.799 +00:00] [WARN] [persist_options.go:887] ["failed to parse schedule.max-pending-peer-count from PersistOptions's ttl storage"] [error="strconv.ParseUint: parsing \"2.147483647e+09\": invalid syntax"]

and then get default value 64 which is not equal math.MaxInt32

How does this pr work?

try to parse float64 when meet parse uint64 failed

Check List

Tests

  • Integration test

Release note

None.

Copy link
Contributor

ti-chi-bot bot commented Mar 26, 2024

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • CabinfeverB
  • lhy1024

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 bot added do-not-merge/needs-linked-issue release-note-none Denotes a PR that doesn't merit a release note. labels Mar 26, 2024
@ti-chi-bot ti-chi-bot bot requested review from disksing and JmPotato March 26, 2024 03:31
@ti-chi-bot ti-chi-bot bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Mar 26, 2024
@HuSharp HuSharp requested review from lhy1024 and removed request for disksing March 26, 2024 03:43
Copy link

codecov bot commented Mar 26, 2024

Codecov Report

Merging #7979 (296c811) into master (5a24dc0) will increase coverage by 0.02%.
The diff coverage is 89.47%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7979      +/-   ##
==========================================
+ Coverage   73.53%   73.56%   +0.02%     
==========================================
  Files         436      436              
  Lines       48467    48472       +5     
==========================================
+ Hits        35641    35659      +18     
+ Misses       9760     9749      -11     
+ Partials     3066     3064       -2     
Flag Coverage Δ
unittests 73.56% <89.47%> (+0.02%) ⬆️

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

@ti-chi-bot ti-chi-bot bot added the status/LGT1 Indicates that a PR has LGTM 1. label Mar 26, 2024
@@ -876,7 +876,16 @@ func (o *PersistOptions) getTTLUint(key string) (uint64, bool, error) {
return 0, false, nil
}
r, err := strconv.ParseUint(stringForm, 10, 64)
return r, true, err
if err == nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe we need to provide a util about it

Copy link
Member Author

Choose a reason for hiding this comment

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

transfer function name getTTLUint to getTTLNumber and add more comment

@ti-chi-bot ti-chi-bot bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Mar 26, 2024
@HuSharp HuSharp force-pushed the fix_ttl_set branch 2 times, most recently from c6d2588 to 953623d Compare March 26, 2024 07:17
@ti-chi-bot ti-chi-bot bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Mar 27, 2024
@HuSharp HuSharp requested a review from lhy1024 March 27, 2024 07:19
@HuSharp
Copy link
Member Author

HuSharp commented Mar 27, 2024

/merge

Copy link
Contributor

ti-chi-bot bot commented Mar 27, 2024

@HuSharp: It seems you want to merge this PR, I will help you trigger all the tests:

/run-all-tests

You only need to trigger /merge once, and 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.

If you have any questions about the PR merge process, please refer to pr process.

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.

Copy link
Contributor

ti-chi-bot bot commented Mar 27, 2024

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

Commit hash: 296c811

@ti-chi-bot ti-chi-bot bot added the status/can-merge Indicates a PR has been approved by a committer. label Mar 27, 2024
@ti-chi-bot ti-chi-bot bot merged commit bc92c13 into tikv:master Mar 27, 2024
24 of 26 checks passed
@HuSharp HuSharp deleted the fix_ttl_set branch March 27, 2024 07:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 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.

ttl: get uint64 value fails because passing uint64(math.MaxInt32)
3 participants