redpanda-data / redpanda

Redpanda is a streaming data platform for developers. Kafka API compatible. 10x faster. No ZooKeeper. No JVM!
https://redpanda.com
9.43k stars 580 forks source link

rpk: core's uint64 max value isn't correctly handled #16723

Open daisukebe opened 6 months ago

daisukebe commented 6 months ago

Version & Environment

Redpanda version: (use rpk version): dev (89731b250c405a)

What went wrong?

In Redpanda core, max_concurrent_producer_ids is set to uint64 max 18446744073709551615 by default. Here's a snip from a startup log.

INFO  2024-02-27 14:41:56,186 [shard 0:main] main - application.cc:760 - redpanda.max_concurrent_producer_ids:18446744073709551615- Max number of the active sessions (producers). When the threshold is passed Redpanda terminates old sessions. When an idle producer corresponding to the terminated session wakes up and produces - it leads to its batches being rejected with out of order sequence error.

However, rpk cluster config get max_concurrent_producer_ids returns -9223372036854775808 as this conversion doesn't work correctly.

                // currentConfig is the result of json.Unmarshal into a
                // map[string]interface{}. Due to json rules, all numbers
                // are float64. We do not want to print floats, especially
                // for large numbers.
                if f64, ok := val.(float64); ok {
                    val = int64(f64)
                }

What should have happened instead?

The command should return 18446744073709551615

How to reproduce the issue?

  1. Start a new cluster
  2. Run rpk cluster config get max_concurrent_producer_ids

JIRA Link: CORE-1812

daisukebe commented 6 months ago

I see converting from float64 to uint64 doesn't work in a reliable way in Go. So, converting to string is the way to go as export.go does?

            case float64:
                scalarVal = strconv.FormatFloat(x, 'f', -1, 64)