vitess icon indicating copy to clipboard operation
vitess copied to clipboard

vtgate does not implement COM_STATISTICS

Open aquarapid opened this issue 5 years ago • 11 comments

Pretty minor, but logging in case it comes up:

With the result that you don't get server uptime and anything in server stats when executing "\s" via the mysql client.

E.g.: via "real" MySQL you get something like this (note the uptime and stats at the end):

mysql> \s
--------------
.
.
Connection id:          56
Current database:
Current user:           root@localhost
SSL:                    Not in use
Current pager:          stdout
Using outfile:          ''
Using delimiter:        ;
Server version:         5.7.28-log MySQL Community Server (GPL)
Protocol version:       10
Connection:             Localhost via UNIX socket
Server characterset:    utf8
Db     characterset:    utf8
Client characterset:    latin1
Conn.  characterset:    latin1
UNIX socket:            mysql.sock
Uptime:                 3 min 18 sec

Threads: 25  Questions: 157  Slow queries: 0  Opens: 119  Flush tables: 1  Open tables: 113  Que792

Via vtgate (note no uptime and stats at the end):

mysql> \s
--------------
mysql  Ver 8.0.18 for Linux on x86_64 (Source distribution)

Connection id:          5
Current database:       vt_main
Current user:           vt_app@localhost
SSL:                    Not in use
Current pager:          stdout
Using outfile:          ''
Using delimiter:        ;
Server version:         5.5.10-Vitess MySQL Community Server (GPL)
Protocol version:       10
Connection:             34.70.126.210 via TCP/IP
Server characterset:    utf8
Db     characterset:    utf8
Client characterset:    utf8mb4
Conn.  characterset:    utf8mb4
TCP port:               3306
--------------

If you trace the network, you'll see we just respond with an 1047 error "command handling not implemented yet: 9" to the COM_STATISTICS command.

aquarapid avatar Dec 13 '19 19:12 aquarapid

when you select user(), it always comes out 'vt_app'. Does it mean we connect to mysqld from using vt_app but not the real client conn name?

lishinho avatar Mar 17 '20 09:03 lishinho

when you select user(), it always comes out 'vt_app'. Does it mean we connect to mysqld from using vt_app but not the real client conn name?

@lishinho I just saw this comment today; yes; since vttablet is doing connection pooling at the backend, the vtgate username/passwords are unrelated to the actual MySQL usernames/passwords vttablet are using.

aquarapid avatar Feb 01 '21 18:02 aquarapid

@harshit-gangal Could you please assign this to me. Would like to get started on this.

gsphanikumar avatar Jan 09 '22 08:01 gsphanikumar

@harshit-gangal Could you please assign this to me. Would like to get started on this.

Hi, have you made any progress on it? do you need information or help regarding progress? Or, have you dropped plan to support this?

harshit-gangal avatar Jun 21 '22 15:06 harshit-gangal

Hi @harshit-gangal I'm looking to contribute to Vitess. Can I pick this issue up? If so is there any other relevant info that would help?

Maniktherana avatar Dec 20 '23 13:12 Maniktherana

You can take this up. Best places would we to understand the request and response for this https://dev.mysql.com/doc/dev/mysql-server/latest/page_protocol_com_statistics.html

and look at other implementation in go/mysql/conn.go:handleNextCommand method

harshit-gangal avatar Dec 20 '23 16:12 harshit-gangal

If you trace the network, you'll see we just respond with an 1047 error "command handling not implemented yet: 9" to the COM_STATISTICS command.

@harshit-gangal just to confirm, shouldn't the command be 8? The MySQL docs you referred to state that the associated constant for this command is 0x08

Maniktherana avatar Jan 18 '24 10:01 Maniktherana

Yeah, you would need to add the constant to go/mysql/constants.go, something like:

	ComStatistics = 0x08

systay avatar Jan 19 '24 07:01 systay

@systay figured as much but wouldn't that mean that the unimplemented command in the network trace should be 8?

Specifically referring to the quote in my previous comment

Maniktherana avatar Jan 19 '24 07:01 Maniktherana

Hmm... good point. I misunderstood your question.

If I were you, I would reproduce @aquarapid 's experiment and use wireshark or something like it to see what is going on.

The mysql client does a lot of extra stuff behind the scenes. /s does might not be just sending COM_STATISTICS 🤷

systay avatar Jan 19 '24 08:01 systay

I agree with @systay, wireshark is best to understand the wire protocol

harshit-gangal avatar Jan 22 '24 14:01 harshit-gangal