Skip to content

ttl: get uint64 value fails because passing uint64(math.MaxInt32) #7980

Closed
@HuSharp

Description

Bug Report

What did you do?

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

What did you expect to see?

parse value success

What did you see instead?

[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 get default value

Error Stack

json unmarshal will convert number(such as 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 {

will transfer fmt.Sprint(math.MaxInt32) to 2.147483647e+09 which will meet error

[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"]

What version of PD are you using (pd-server -V)?

master

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions