Official tiup benchmark test fails to run, error: panic: failed to connect to database when loading data

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 官方 tiup 基准测试无法运行,报错:panic: failed to connect to database when loading data

| username: olaper

Bug Report
Following the official performance testing steps, no performance tests can be run on a server running the Ubuntu 20 operating system.
Reference documentation:

[TiDB Version]
6.5.0

[Impact of the Bug]
The official tiup benchmark test cannot run, error: panic: failed to connect to database when loading data

[Possible Steps to Reproduce the Issue]

# tiup bench tpcc -H 10.x.x.x -P 4000 -D tpcc --warehouses 1 --threads 1 prepare
tiup is checking updates for component bench ...
Starting component `bench`: /root/.tiup/components/bench/v1.12.0/tiup-bench tpcc -H 10.x.x.x -P 4000 -D tpcc --warehouses 1 --threads 1 prepare
panic: failed to connect to database when loading data

goroutine 1 [running]:
github.com/pingcap/go-tpc/tpcc.NewWorkloader(0x0?, 0xc0003dcfa0?)
	/home/runner/work/go-tpc/go-tpc/tpcc/workload.go:110 +0x93d
main.executeTpcc({0xa9ce83, 0x7})
	/home/runner/work/go-tpc/go-tpc/cmd/go-tpc/tpcc.go:64 +0x1ea
main.registerTpcc.func1(0xc000376dc0?, {0xa99807?, 0xa?, 0xa?})
	/home/runner/work/go-tpc/go-tpc/cmd/go-tpc/tpcc.go:94 +0x25
github.com/spf13/cobra.(*Command).execute(0xc000376dc0, {0xc0000d20a0, 0xa, 0xa})
	/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:846 +0x663
github.com/spf13/cobra.(*Command).ExecuteC(0xc000376580)
	/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:950 +0x39c
github.com/spf13/cobra.(*Command).Execute(...)
	/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:887
main.main()
	/home/runner/work/go-tpc/go-tpc/cmd/go-tpc/main.go:250 +0x7e5

[Observed Unexpected Behavior]

[Expected Behavior]
The test should run normally

[Related Components and Specific Versions]

# tiup bench
tiup is checking updates for component bench ...
Starting component `bench`: /root/.tiup/components/bench/v1.12.0/tiup-bench
Usage: tiup bench {ch/rawsql/tpcc/tpch/ycsb} [flags]

[Other Background Information or Screenshots]
Connection issues have been ruled out. The connection can be established using the MySQL client.

bogon:key xxx$ mysql -h 10.x.x.x -P 4000 -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 483
Server version: 5.7.25-TiDB-v6.5.0 TiDB Server (Apache License 2.0) Community Edition, MySQL 5.7 compatible

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

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

mysql>
| username: 裤衩儿飞上天 | Original post link

The username and password were not specified.

| username: olaper | Original post link

Thank you for the prompt reply.
Strangely, the same error occurs after adding the username & password.

# tiup bench tpcc -H 10.x.x.x -P 4000 --user demo --password 123456 -D tpcc --warehouses 1 --threads 1 prepare
tiup is checking updates for component bench ...
Starting component `bench`: /root/.tiup/components/bench/v1.12.0/tiup-bench tpcc -H 10.x.x.x -P 4000 --user demo --password 123456 -D tpcc --warehouses 1 --threads 1 prepare
panic: failed to connect to database when loading data

goroutine 1 [running]:
github.com/pingcap/go-tpc/tpcc.NewWorkloader(0x0?, 0xc0004a0140?)
	/home/runner/work/go-tpc/go-tpc/tpcc/workload.go:110 +0x93d
main.executeTpcc({0xa9ce83, 0x7})
	/home/runner/work/go-tpc/go-tpc/cmd/go-tpc/tpcc.go:64 +0x1ea
main.registerTpcc.func1(0xc0000feb00?, {0xa99807?, 0xe?, 0xe?})
	/home/runner/work/go-tpc/go-tpc/cmd/go-tpc/tpcc.go:94 +0x25
github.com/spf13/cobra.(*Command).execute(0xc0000feb00, {0xc0001982a0, 0xe, 0xe})
	/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:846 +0x663
github.com/spf13/cobra.(*Command).ExecuteC(0xc0000fe2c0)
	/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:950 +0x39c
github.com/spf13/cobra.(*Command).Execute(...)
	/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:887
main.main()
	/home/runner/work/go-tpc/go-tpc/cmd/go-tpc/main.go:250 +0x7e5

Using the MySQL client, I can connect normally.

bogon:key xxx$ mysql -h 10.x.x.x -P 4000 -u demo -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 487
Server version: 5.7.25-TiDB-v6.5.0 TiDB Server (Apache License 2.0) Community Edition, MySQL 5.7 compatible

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

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

mysql>
| username: 裤衩儿飞上天 | Original post link

  1. Is the username and password correct?
  2. Are the commands for executing tpcc and connecting to the database with the MySQL client executed on the same machine?
| username: olaper | Original post link

Sorry, your suggestion is correct, thank you :pray:.
I created the user using this method:

CREATE USER demo IDENTIFIED BY '123456';

I did not grant it permissions to create tables in the tpcc database.
As suggested, I kept thinking it was a connection issue :sob:.

After granting permissions, the test worked fine!

GRANT ALL ON tpcc* TO 'demo';
load to order_line in warehouse 1 district 10
begin to check warehouse 1 at condition 3.3.2.1
begin to check warehouse 1 at condition 3.3.2.2
begin to check warehouse 1 at condition 3.3.2.3
begin to check warehouse 1 at condition 3.3.2.6
begin to check warehouse 1 at condition 3.3.2.9
begin to check warehouse 1 at condition 3.3.2.11
begin to check warehouse 1 at condition 3.3.2.4
begin to check warehouse 1 at condition 3.3.2.5
begin to check warehouse 1 at condition 3.3.2.7
begin to check warehouse 1 at condition 3.3.2.8
begin to check warehouse 1 at condition 3.3.2.10
begin to check warehouse 1 at condition 3.3.2.12
Finished
| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.