Debian Codegraph @

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

raw
1 ## Preamble
2 --let $xplugin_disable_ssl_for_x_at_client_side=1
3 --let $xplugin_cache_x_root=1
4 --source include/xplugin_preamble.inc
5 --source include/xplugin_create_user.inc
6 CREATE SCHEMA xtest;
7 CREATE TABLE xtest.xtable (value TEXT);
8 INSERT INTO xtest.xtable(value) VALUES("");
9
10 ## TEST STARTS HERE
11 --write_file $MYSQL_TMP_DIR/message_large_payload.xpl
12
13
14 ## Test case description:
15 #
16 -->echo
17 -->echo
18 -->echo ## I. Verify that sending an X Protocol message that generates
19 -->echo ## SQL larger than a certain limit (SQL > 1MB) doesn't
20 -->echo ## return ER_QUERY_INTERRUPTED.
21 -->echo #
22 -->echo # 1. Send StmtExecute with 1MB encoded literal.
23 -->echo # 2. Send CRUD-find with 1MB encoded literal.
24 -->echo # 3. Send CRUD-delete with 1MB encoded literal.
25 -->echo # 4. Send CRUD-insert with 1MB encoded literal.
26 -->echo # 5. Send CRUD-update with 1MB encoded literal.
27 -->echo # 6. Send CRUD-CreateView with 1MB encoded literal.
28 -->echo # 7. Send Mysqlx.Prepare.Prepare with 1MB encoded literal.
29 -->echo # 8. Send Mysqlx.Cursor.Open with 1MB encoded literal.
30 -->echo
31
32 -->echo
33 -->echo #
34 -->echo # I.1
35
36 # Generate value of size 1MB (1024 * 1024 = 1 048 576 bytes)
37 # and pack it into StmtExecute with SELECT.
38 -->vargen %LARGE_TEXT% . 1048577
39
40 -->quiet
41 -->echo ## Send large message
42 Mysqlx.Sql.StmtExecute {
43 stmt: "select '%LARGE_TEXT%' as result"
44 }
45 -->varsub %LARGE_TEXT%
46 -->recvresult
47
48
49 -->echo
50 -->echo #
51 -->echo # I.2
52
53 Mysqlx.Crud.Find {
54 collection { name: "xtable" schema: "xtest"}
55 data_model: TABLE
56 projection {
57 source { type: PLACEHOLDER position: 0 }
58 alias: "result"
59 }
60 args { type: V_OCTETS v_octets {value:"%LARGE_TEXT%"} }
61 }
62 -->varsub %LARGE_TEXT%
63 -->recvresult
64
65
66 -->echo
67 -->echo #
68 -->echo # I.3
69
70 -->varsub %LARGE_TEXT%
71 Mysqlx.Crud.Delete {
72 collection { name: "xtable" schema: "xtest"}
73 data_model: TABLE
74 args { type: V_OCTETS v_octets {value:"%LARGE_TEXT%"} }
75 criteria {
76 type: OPERATOR
77 operator {
78 name: "=="
79 param { type: IDENT identifier { name: "value" } }
80 param { type: PLACEHOLDER position: 0 }
81 }
82 }
83 }
84 -->recvresult
85
86
87 -->echo
88 -->echo #
89 -->echo # I.4
90
91 Mysqlx.Crud.Insert {
92 collection { name: "xtable" schema: "xtest"}
93 data_model: TABLE
94 projection {name: "value"}
95 row {
96 field {
97 type : LITERAL literal { type: V_OCTETS v_octets {value:"%LARGE_TEXT%"} }
98 }
99 }
100 }
101 -->expecterror ER_DATA_TOO_LONG
102 -->recvresult
103
104
105 -->echo
106 -->echo #
107 -->echo # I.5
108
109 Mysqlx.Crud.Update {
110 collection { name: "xtable" schema: "xtest"}
111 data_model: TABLE
112 operation {
113 source {
114 name: 'value'
115 }
116 operation: SET
117 value: {
118 type: LITERAL literal {type: V_OCTETS v_octets {value:"%LARGE_TEXT%"}}
119 }
120 }
121 }
122 -->expecterror ER_DATA_TOO_LONG
123 -->recvresult
124
125 -->echo
126 -->echo #
127 -->echo # I.6
128 Mysqlx.Crud.CreateView {
129 collection { name: "view" schema: "xtest" }
130 stmt: {
131 collection { name: "xtable" schema: "xtest" }
132 projection {
133 source { type: PLACEHOLDER position: 0 }
134 alias: "result"
135 }
136 args { type: V_OCTETS v_octets {value:"%LARGE_TEXT%"} }
137 data_model: DOCUMENT
138 }
139 }
140 -->recvok
141
142 -->echo
143 -->echo #
144 -->echo # I.7
145 Mysqlx.Prepare.Prepare {
146 stmt_id: 2
147 stmt: {
148 type: FIND
149 find: {
150 collection { name: "xtable" schema: "xtest"}
151 data_model: TABLE
152 projection {
153 source { type: PLACEHOLDER position: 0 }
154 alias: "result"
155 }
156 args { type: V_OCTETS v_octets {value:"%LARGE_TEXT%"} }
157 }
158 }
159 }
160 -->recvok
161
162 -->echo
163 -->echo #
164 -->echo # I.8
165 Mysqlx.Prepare.Prepare {
166 stmt_id: 3
167 stmt: {
168 type: FIND
169 find: {
170 collection { name: "xtable" schema: "xtest"}
171 data_model: TABLE
172 projection {
173 source { type: PLACEHOLDER position: 0 }
174 alias: "result"
175 }
176 }
177 }
178 }
179 -->recvok
180
181 Mysqlx.Cursor.Open {
182 cursor_id: 100
183 stmt {
184 type: PREPARE_EXECUTE
185 prepare_execute {
186 stmt_id: 3
187 args {
188 type: SCALAR scalar {
189 type: V_STRING v_string {
190 value: "%LARGE_TEXT%"
191 }
192 }
193 }
194 }
195 }
196 }
197 -->recvresult
198
199 EOF
200
201 # Set the X Protocol packet limit to 2MB (2 × 1024 × 1024 = 2097152 bytes)
202 SET GLOBAL mysqlx_max_allowed_packet = 2097152;
203
204 --exec $MYSQLXTEST -u x_root --file=$MYSQL_TMP_DIR/message_large_payload.xpl 2>&1
205
206 ## Cleanup
207 SET GLOBAL mysqlx_max_allowed_packet = DEFAULT;
208 --source ../include/xplugin_cleanup.inc