Debian Codegraph @

mysql-test/suite/x/t/message_not_parsed_data.test

raw
1 ## Preamble
2 --source include/xplugin_preamble.inc
3 --source include/xplugin_create_user.inc
4
5 ## TEST STARTS HERE
6 --write_file $MYSQL_TMP_DIR/validate_not_parsed_data.xpl
7 -->import wait_until_disconnect.macro
8
9 #
10 # Binary form of message StmtExecute(SELECT 1) message:
11 -->varlet %MSG_LENGTH% \x0b\x00\x00\x00
12 -->varlet %MSG_TYPE% \x0c
13 -->varlet %MSG_BODY% \x0a\x08SELECT\x201
14
15
16 #
17 # Silent varification of %MSG_LENGTH% %MSG_TYPE% %MSG_BODY%
18 -->binparse %MSG% Mysqlx.Sql.StmtExecute {
19 stmt: "SELECT 1"
20 }
21
22 # Verification of correctness binary form of message
23 -->assert_eq %MSG% %MSG_LENGTH%%MSG_TYPE%%MSG_BODY%
24
25 ## Test case description:
26 -->echo
27 -->echo
28 -->echo ## I. Handling of unparsable
29 -->echo #
30 -->echo # 1. Send message with not-parsable data and verify that parsable part was properly handled
31 -->echo # 2. Send message normal query to verify that data from previous call was properly discarded
32
33
34 -->echo
35 -->echo #
36 -->echo # I.1
37
38 -->varlet %MSG_LENGTH_FIVE_BYTES_LONGER% \x10\x00\x00\x00
39
40 ## Additional description:
41 echo # Protobuf uses tags to mark its message fields,;
42 echo # in general \x00 is not a valid tag, still in this test its;
43 echo # used as end-of-message tag:;
44 echo #;
45 echo # ===================PROPER MESSAGE================>EOM==>not-parsed=>;
46 echo # MSG_LENGTH_FIVE_BYTES_LONGER MSG_TYPE MSG_BODY \x00 MSG_LENGTH;
47 echo #;
48 echo # Where last MSG_LENGTH is not parsed garbage.;
49 echo;
50 echo # Sending message with not-parsable data, and receive an error:;
51 -->binsend %MSG_LENGTH_FIVE_BYTES_LONGER%%MSG_TYPE%%MSG_BODY%\x00%MSG_LENGTH%
52 -->recverror ER_X_BAD_MESSAGE
53 echo # Wait until server disconnects because of the error;
54 -->callmacro Wait_until_disconnect
55 EOF
56
57 # Set the timeout for connection to 300 seconds
58 # which is must be greater than the peerdisc/timeout
59 SET GLOBAL mysqlx_connect_timeout = 300;
60 SET GLOBAL mysqlx_wait_timeout = 300;
61
62 --exec $MYSQLXTEST -u x_root --file=$MYSQL_TMP_DIR/validate_not_parsed_data.xpl 2>&1
63
64 --let $wait_condition= SELECT variable_value = 1 FROM performance_schema.global_status WHERE variable_name LIKE 'Mysqlx_sessions_fatal_error'
65 --source include/wait_condition_or_abort.inc
66
67 ## Cleanup
68 SET GLOBAL mysqlx_connect_timeout= DEFAULT;
69 SET GLOBAL mysqlx_wait_timeout = DEFAULT;
70 --source ../include/xplugin_cleanup.inc