pingcap / go-tpc

A toolbox to benchmark TPC workloads in Go
Apache License 2.0
178 stars 94 forks source link

The error message is not user-friendly enough - panic: failed to connect to database when loading data #169

Open Yui-Song opened 1 year ago

Yui-Song commented 1 year ago

The error message is misleading and not user-friendly enough to show why the program gets panic.

# go-tpc tpcc --host xxx.xxx.xxx.xxx -P4000 --warehouses 1000 run -D tpcc -T 200 --time 10m0s --ignore-error --conn-params="kv_read_timeout=1000"
panic: failed to connect to database when loading data

goroutine 1 [running]:
github.com/pingcap/go-tpc/tpcc.NewWorkloader(0x0, 0x10b08e0, 0x1b, 0x1b, 0x1a, 0xc000104380)
        /go/src/github.com/pingcap/go-tpc/tpcc/workload.go:105 +0xbb3
main.executeTpcc(0xac5e7a, 0x3)
        /go/src/github.com/pingcap/go-tpc/cmd/go-tpc/tpcc.go:56 +0x36c
main.registerTpcc.func2(0xc000456dc0, 0xc00022fa00, 0x0, 0xd)
        /go/src/github.com/pingcap/go-tpc/cmd/go-tpc/tpcc.go:102 +0x36
github.com/spf13/cobra.(*Command).execute(0xc000456dc0, 0xc00022f930, 0xd, 0xd, 0xc000456dc0, 0xc00022f930)
        /go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:846 +0x2c2
github.com/spf13/cobra.(*Command).ExecuteC(0xc0004562c0, 0xb0cdb0, 0xc000400720, 0xc000418760)
        /go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:950 +0x375
github.com/spf13/cobra.(*Command).Execute(...)
        /go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:887
main.main()
        /go/src/github.com/pingcap/go-tpc/cmd/go-tpc/main.go:153 +0x9db

The root cause of the panic:

# mysql -h xxx.xxx.xxx.xxx -P4000
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MySQL connection id is 687
Server version: 5.7.25-TiDB-v6.5.0 TiDB Server (Apache License 2.0) Community Edition, MySQL 5.7 compatible

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MySQL [(none)]> set @@kv_read_timeout=1000;
ERROR 1193 (HY000): Unknown system variable 'kv_read_timeout'

Another example: https://asktug.com/t/topic/1000741