go-ycsb icon indicating copy to clipboard operation
go-ycsb copied to clipboard

Panic on a given property file

Open zhangysh1995 opened this issue 5 years ago • 1 comments

I followed the original property file to write a one for MySQL:

mysql.properties

mysql.host = 127.0.0.1
mysql.port = 5000
mysql.user = root                

This file should be correct (?), it follows the style of Postgres property file here. However, the tool has a panic:

zhangys@xxx:~/go/src/github.com/pingcap/go-ycsb$ ./bin/go-ycsb run mysql -P workloads/workloada -p mysql.properties 
panic: runtime error: index out of range [1] with length 1

goroutine 1 [running]:
main.initialGlobal(0x7ffc348eb1dd, 0x5, 0xc00063fc20)
        /home/zhangys/go/src/github.com/pingcap/go-ycsb/cmd/go-ycsb/main.go:94 +0x7e5
main.runClientCommandFunc(0xc0001ccf00, 0xc0002000a0, 0x1, 0x5, 0x1)
        /home/zhangys/go/src/github.com/pingcap/go-ycsb/cmd/go-ycsb/client.go:30 +0xc5
main.runTransCommandFunc(0xc0001ccf00, 0xc0002000a0, 0x1, 0x5)
        /home/zhangys/go/src/github.com/pingcap/go-ycsb/cmd/go-ycsb/client.go:66 +0x4e
github.com/spf13/cobra.(*Command).execute(0xc0001ccf00, 0xc000200050, 0x5, 0x5, 0xc0001ccf00, 0xc000200050)
        /home/zhangys/go/pkg/mod/github.com/spf13/[email protected]/command.go:766 +0x2c2
github.com/spf13/cobra.(*Command).ExecuteC(0xc0001cc500, 0xc00063ff20, 0x3, 0x3)
        /home/zhangys/go/pkg/mod/github.com/spf13/[email protected]/command.go:852 +0x2fe
github.com/spf13/cobra.(*Command).Execute(...)
        /home/zhangys/go/pkg/mod/github.com/spf13/[email protected]/command.go:800
main.main()
        /home/zhangys/go/src/github.com/pingcap/go-ycsb/cmd/go-ycsb/main.go:172 +0x27a

I know one workaround should be changing the source code, but it not very easy to do if I want to change the test database frequently.

zhangysh1995 avatar Sep 26 '20 08:09 zhangysh1995

I found that I used the wrong command with -p, the config should be also put into the file passed with -P. I think it would better to improve the error message.

zhangysh1995 avatar Sep 28 '20 08:09 zhangysh1995