Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle backquote in USE command #857

Closed
olafz opened this issue Dec 29, 2016 · 5 comments
Closed

Handle backquote in USE command #857

olafz opened this issue Dec 29, 2016 · 5 comments

Comments

@olafz
Copy link

olafz commented Dec 29, 2016

This is a followup for #847. After we updated to the latest version (1.3.2) our Java client doesn't work anymore.

This was the behavior with 1.3.1:

java -jar ProxySQL-1.0-SNAPSHOT-all.jar "jdbc:mysql://127.0.0.1:6033/?rewriteBatchedStatements=true&useServerPrepStmts=true&useUnicode=true&characterEncoding=UTF-8&characterSetResults=UTF-8" "trojka_ro_d” “xxxx" "trojka_d"
databasechangelog
databasechangeloglock
documents

and

java -jar ProxySQL-1.0-SNAPSHOT-all.jar "jdbc:mysql://127.0.0.1:6033/?rewriteBatchedStatements=true&useServerPrepStmts=true&useUnicode=true&characterEncoding=UTF-8&characterSetResults=UTF-8" "trojka_ro_d” "xxxx" "presdb_TE1002"
SQL ERROR CODE: 1044, message: Access denied for user 'trojka_ro_d'@'10.120.%' to database 'presdb_te1002'

After upgrading to 1.3.2 (ProxySQL version 1.3.2-0-g5bbceb0, codename Trulswith) with the same configuration, the output now is empty, for all schema's:

java -jar ProxySQL-1.0-SNAPSHOT-all.jar "jdbc:mysql://127.0.0.1:6033/?rewriteBatchedStatements=true&useServerPrepStmts=true&useUnicode=true&characterEncoding=UTF-8&characterSetResults=UTF-8" "trojka_ro_d” “xxxx" "trojka_d"
<nothing>

and

java -jar ProxySQL-1.0-SNAPSHOT-all.jar "jdbc:mysql://127.0.0.1:6033/?rewriteBatchedStatements=true&useServerPrepStmts=true&useUnicode=true&characterEncoding=UTF-8&characterSetResults=UTF-8" "trojka_ro_d” "xxxx" "presdb_TE1002"
<nothing>

The CLI does still function.

@renecannao
Copy link
Contributor

@olafz : error 1044 is returned by the backend.
Can you please double check permission? If permissions are all ok, please send me some traffic collected with tcpdump as in the previous issue #847 .
Sorry for the inconvenience.

@olafz
Copy link
Author

olafz commented Dec 29, 2016

@renecannao The 1044 return was with 1.3.1. After the upgrade to 1.3.2, nothing is returned

@renecannao
Copy link
Contributor

What no output means in this context?
If I understand correctly the client, does it mean no tables?
I would be very happy if you could share some network traffic collected with tcpdump. Thank you

@olafz
Copy link
Author

olafz commented Dec 29, 2016

@renecannao Yes, it means the client sees no tables.

I e-mailed you two dumps from tcpdump. When I look at the tcpdump, it gets interesting. Now it seems that both seem to return 1044? But the client does not report that (like it did in version 1.3.1).

@renecannao renecannao changed the title Upgrade to 1.3.2 from 1.3.1 does not fix #847, makes matters worse Handle backquote in USE command Dec 29, 2016
@renecannao
Copy link
Contributor

Renamed the issue to reflect the proper issue.
From tcpdump provided by @olafz (thanks), client to proxy:

08:29:56.657589 IP 127.0.0.1.63805 > 127.0.0.1.6033: Flags [P.], seq 1073:1097, ack 1072, win 357, options [nop,nop,TS val 3022427846 ecr 3022427845], length 24
        0x0000:  4500 004c 2054 4000 4006 1c56 7f00 0001  E..L.T@.@..V....
        0x0010:  7f00 0001 f93d 1791 07e8 bafb c2e3 4546  .....=........EF
        0x0020:  8018 0165 fe40 0000 0101 080a b426 96c6  ...e.@.......&..
        0x0030:  b426 96c5 1400 0000 0355 5345 2060 7072  .&.......USE.`pr
        0x0040:  6573 6462 5f54 4531 3030 3260            esdb_TE1002`

proxy to db:

08:29:56.659976 IP 10.120.12.87.49176 > 10.120.8.2.3306: Flags [P.], seq 1148:1168, ack 1059, win 243, options [nop,nop,TS val 3022427847 ecr 3368573676], length 20
        0x0000:  4508 0048 e3b6 4000 4006 2da9 0a78 0c57  E..H..@.@.-..x.W
        0x0010:  0a78 0802 c018 0cea 88f7 797c c821 0604  .x........y|.!..
        0x0020:  8018 00f3 2983 0000 0101 080a b426 96c7  ....)........&..
        0x0030:  c8c8 5aec 1000 0000 0260 7072 6573 6462  ..Z......`presdb
        0x0040:  5f54 4531 3030 3260                      _TE1002`

The problem:
ProxySQL is not removing the backquote.

@renecannao renecannao added this to the v1.3.2 milestone Dec 29, 2016
renecannao added a commit that referenced this issue Dec 29, 2016
renecannao added a commit that referenced this issue Dec 29, 2016
Ported from 1.3.2

Conflicts:
	lib/MySQL_Session.cpp
minichate pushed a commit to minichate/proxysql that referenced this issue Mar 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants