-
Notifications
You must be signed in to change notification settings - Fork 1k
Replying to client’s queries SELECT @@AUTOCOMMIT without need of backend #4888
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
base: v3.0
Are you sure you want to change the base?
Conversation
…end. Returning from session object. 2. Added tap test.
Can one of the admins verify this patch? |
Please ignore first commit message. As incorrectly I have mention SELECT @@Version instead of SELECT @@autocommit |
add to whitelist |
Initial requirement: Reply to client’s queries |
const char* expected[] = {"1", "0", "1"}; | ||
int expected_idx = 0; | ||
|
||
for (int i = 0; i < 5; ++i) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can avoid hardcoding the number of queries, but consider the size of states[]
Same thing applies for plan()
: it can be computed based on the content of states[]
.
The above consideration is related to the fact that:
- autocommit is changed from 1 (implicit) to 0 and then to 1 (explicitly), but never changed back to 0 (and eventually back to 1) to test multiple changes
- queries all have
SELECT
uppercase andautocommit
lowercase : no combination of uppercase and lowercase are tested - values
0
and1
are used , whileON
/OFF
/true
/FaLsE
/etc are not tested
The test doesn't verify that no backend was used, neither that multiplexing was not disabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was going to propose to reuse other test for this purpose. All the feedback from the previous comment can be taken into modifying a test like reg_test_3549-autocommit_tracking-t.cpp
which performs more complex queries, and already tracks autocommit, so should be a matter of doing an (extra) consistency check between the present tracking and SELECT @@autocommit
. For addressing the part of the feedback about multiplexing disabling, the utility function check_multiplexing_disabled
from test_keep_multiplexing_variables-t.cpp
can also be moved to utils.cpp
and reused.
return exit_status(); | ||
} | ||
|
||
MYSQL_QUERY(mysql, "USE test"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am curious: why this?
If used to add come entropy, we could run after every SET/SELECT
myds->DSS=STATE_QUERY_SENT_DS; | ||
int sid=1; | ||
myprot->generate_pkt_column_count(true,NULL,NULL,sid,1); sid++; | ||
myprot->generate_pkt_field(true,NULL,NULL,sid,(char *)"",(char *)"",(char *)"",buf2,(char *)"",63,31,MYSQL_TYPE_LONGLONG,161,0,false,0,NULL); sid++; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on a response from MySQL 5.7.44-log
:
Packet Length: 34
Packet Number: 2
Catalog
Catalog: def
Database
Database:
Table
Table:
Original table
Original table:
Name
Name: @@autocommit
Original name
Original name:
Charset number: binary COLLATE binary (63)
Length: 1
Type: FIELD_TYPE_LONGLONG (8)
Flags: 0x0080
.... .... .... ...0 = Not null: Not set
.... .... .... ..0. = Primary key: Not set
.... .... .... .0.. = Unique key: Not set
.... .... .... 0... = Multiple key: Not set
.... .... ...0 .... = Blob: Not set
.... .... ..0. .... = Unsigned: Not set
.... .... .0.. .... = Zero fill: Not set
.... ...0 .... .... = Enum: Not set
.... ..0. .... .... = Auto increment: Not set
.... .0.. .... .... = Timestamp: Not set
.... 0... .... .... = Set: Not set
Decimals: 0
MySQL Protocol - row packet
Packet Length: 2
Packet Number: 3
text
text: 1
- Size for the field of
1
instead of31
. Most probably this won't be an issue, yet this could be confusing from client side. - Flags should be 0x80 (binary_flag), instead of (0xa1).
const char* expected[] = {"1", "0", "1"}; | ||
int expected_idx = 0; | ||
|
||
for (int i = 0; i < 5; ++i) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was going to propose to reuse other test for this purpose. All the feedback from the previous comment can be taken into modifying a test like reg_test_3549-autocommit_tracking-t.cpp
which performs more complex queries, and already tracks autocommit, so should be a matter of doing an (extra) consistency check between the present tracking and SELECT @@autocommit
. For addressing the part of the feedback about multiplexing disabling, the utility function check_multiplexing_disabled
from test_keep_multiplexing_variables-t.cpp
can also be moved to utils.cpp
and reused.
Replying to client’s queries SELECT @@autocommit without need of backend
The query should also not disabling multiplexing.
For details Please see:
https://github.com/ProxySQL/proxysql_3p_testing/issues/13