sjmudd / ps-top

ps-top - a top-like program for MySQL
BSD 2-Clause "Simplified" License
205 stars 31 forks source link

performance_schema should be specified in lowercase #7

Closed samitani closed 7 years ago

samitani commented 7 years ago

ps-top is cool. but, i found a trouble. i try to fix it.

Failed with show_compatibility_56.

-bash-4.1$ /home/<MASKED>/go/bin/ps-top --socket /var/lib/mysql/mysql.sock -user root --password password

panic: runtime error: invalid memory address or nil pointer dereference
        panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x4c86c6]

goroutine 1 [running]:
panic(0x62a220, 0xc4200120b0)
        /usr/local/go/src/runtime/panic.go:500 +0x1a1
database/sql.(*Rows).Close(0x0, 0x6197a0, 0xc420012220)
        /usr/local/go/src/database/sql/sql.go:1864 +0x26
panic(0x62a220, 0xc4200120b0)
        /usr/local/go/src/runtime/panic.go:458 +0x243
database/sql.(*Rows).Next(0x0, 0x6892e0)
        /usr/local/go/src/database/sql/sql.go:1752 +0x26
github.com/sjmudd/ps-top/global.(*Variables).selectAll(0xc420012140)
        /home/<MASKED>/go/src/github.com/sjmudd/ps-top/global/variables.go:72 +0x35a
github.com/sjmudd/ps-top/global.NewVariables(0xc4200d0000, 0xc420028008)
        /home/<MASKED>/go/src/github.com/sjmudd/ps-top/global/variables.go:30 +0x62
github.com/sjmudd/ps-top/app.NewApp(0x0, 0xc42006b1d0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x765e40, 0xc420076b40, 0xc420049e90)
        /home/<MASKED>/go/src/github.com/sjmudd/ps-top/app/app.go:96 +0x180
main.main()
        /home/<MASKED>/go/src/github.com/sjmudd/ps-top/cmd/ps-top/ps-top.go:103 +0x492

refer manual https://dev.mysql.com/doc/refman/5.5/en/performance-schema-quick-start.html, we should specify performance_schema in lower case.

The name of the performance_schema database is lowercase, as are the names of tables within it. 
Queries should specify the names in lowercase.
mysql>  SELECT * FROM PERFORMANCE_SCHEMA.GLOBAL_VARIABLES LIMIT 1;
ERROR 1146 (42S02): Table 'PERFORMANCE_SCHEMA.GLOBAL_VARIABLES' doesn't exist

mysql>  SELECT * FROM performance_schema.global_variables LIMIT 1;
+---------------------+----------------+
| VARIABLE_NAME       | VARIABLE_VALUE |
+---------------------+----------------+
| auto_generate_certs | ON             |
+---------------------+----------------+
1 row in set (0.00 sec)

note: I_S could be specified in both upper/lower case.