Debian Codegraph @

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

raw
1 ##
2 ## There are three levels on which the feature is verified:
3 ##
4 ## * on X Protocol layer (without decompressing)
5 ## * confirming that resultset flow is correct
6 ## * confirming that resultset contains correct data
7 ##
8 ## Test that verifies generation of `Mysqlx.Connection.Compression` message that
9 ## encapsulates several X Protocol messages in place of concrete resultset parts,
10 ## the resultset is verified without decompression (bullet point 1).
11 ##
12
13 #
14 # This tests doesn't verfies the content of compressed messages, its done in other tests like:
15 # * flow_compression_resultset_*.test
16 #
17
18 ##
19 ## Please take a note that this test (and others) use following terms:
20 ## SINGLE, MULTIPLE, GROUP
21 ##
22 ## Those correspond to concrete setting of compression capabilities:
23 ## server_combine_mixed_messages, server_max_combine_messages and
24 ## describe only compressed messages generated by the server.
25 ##
26 ## * SINGLE - it corresponds to
27 ## server_combine_mixed_messages=TRUE|FALSE,
28 ## server_max_combine_messages=1
29 ## In this configuration exact one X Protocol message is
30 ## encapsulated in one Mysqlx.Connection.Compression
31 ##
32 ## * MULTIPLE - it corresponds to
33 ## server_combine_mixed_messages=FALSE,
34 ## server_max_combine_messages=UNSET|0
35 ## In this configuration multiple X Protocol messages
36 ## of the same type are encapsulated in one
37 ## Mysqlx.Connection.Compression
38 ##
39 ## * GROUP - it corresponds to
40 ## server_combine_mixed_messages=TRUE,
41 ## server_max_combine_messages=UNSET|0
42 ## In this configuration multiple X Protocol messages
43 ## of different types are encapsulated in one
44 ## Mysqlx.Connection.Compression
45 ##
46 ## Cases where "server_max_combine_message" has values grater than 1
47 ## are in separate test file: compression_limit_message_count.test
48 ##
49
50 ## Preamble
51 --source include/xplugin_preamble.inc
52 --source include/xplugin_create_user.inc
53 ## Test starts here
54
55 --write_file $MYSQL_TMP_DIR/resultset.xpl
56 -->import assert_messages.macro
57 -->import assert_notices.macro
58 -->import crud_insert.macro
59
60 -->echo
61 -->echo
62 -->echo ## Test setup
63
64 ##
65 ## Execution of SQL through X Protocol can generate flow
66 ## described by following UML flow (GRAPH 1):
67 ##
68 ## ...
69 ## loop has more resultsets or not at end of fetch
70 ## group resultset
71 ## loop has more columns
72 ## server --> client: ColumnMetaData
73 ## end
74 ## loop has more rows
75 ## server --> client: Row
76 ## end
77 ## end
78 ## alt has more resultsets
79 ## server --> client: FetchDoneMoreResultsets
80 ## end
81 ## end
82 ## loop has more OUT-paramsets or not at end of fetch
83 ## server --> client: FetchDoneMoreOutParams
84 ## group resultset
85 ## loop has more columns
86 ## server --> client: ColumnMetaData
87 ## end
88 ## loop has more rows
89 ## server --> client: Row
90 ## end
91 ## end
92 ## end
93 ## alt at end of all resultsets
94 ## server --> client: FetchDone
95 ## else cursor is opened
96 ## server --> client: FetchSuspended
97 ## end
98 ## ...
99 ##
100 ## After compression is enabled the flows stays the same, still
101 ## all messages are wrapped inside `Mysqlx.Connection.Compression` message.
102 ## Thus on message-frame level its going to look in following way (GRAPH 2):
103 ##
104 ## ...
105 ## server --> client: Compression([Resultset1[, Resultset2,....]][,OutResultset])
106 ## ...
107
108 ## Test case description:
109 -->echo
110 -->echo
111 -->echo ## I. Validate that X Plugin sends compressed messages in StmtExecute resultset (GRAPH 2)
112 -->echo #
113 -->echo # 1. Assert SELECTs empty resultset
114 -->echo # 2. Assert SELECTs resultset with one column and one row
115 -->echo # 3. Assert SELECTs resultset with one column and multiple rows
116 -->echo # 4. Assert SELECTs resultset with multiple columns and multiple rows
117 -->echo # 5. Assert SQL that returns multiple resultsets
118 -->echo #
119 -->echo ## II. Validate that X Plugin sends compressed messages in Crud.Insert resultset (GRAPH 2)
120 -->echo #
121 -->echo # 1. Assert Crud.Insert resultset for single row insert
122 -->echo # 2. Assert Crud.Insert resultset for multiple rows insert
123 -->echo #
124 -->echo ## III. Validate that X Plugin sends compressed messages in Crud.Find resultset (GRAPH 2)
125 -->echo #
126 -->echo # 1. Assert Crud.Find empty resultset
127 -->echo # 2. Assert Crud.Find resultset with multiple rows
128 -->echo #
129 -->echo ## IV. Validate that X Plugin sends compressed messages in Crud.Update resultset (GRAPH 2)
130 -->echo #
131 -->echo # 1. Assert Crud.Update resultset with no hits
132 -->echo # 2. Assert Crud.Update resultset with multiple updated rows
133 -->echo #
134 -->echo ## V. Validate that X Plugin sends compressed messages in Crud.Delete resultset (GRAPH 2)
135 -->echo #
136 -->echo # 1. Assert Crud.Delete resultset with no hits
137 -->echo # 2. Assert Crud.Delete resultset with multiple deleted rows
138 -->echo #
139 -->echo ## VI. Validate that X Plugin sends compressed messages in PrepStmt resultset (GRAPH 2)
140 -->echo #
141 -->echo # 1. Assert PrepStmt resultset with out-params
142 -->echo # 2. Assert Cursor resultset that was suspended
143 -->echo
144
145 -->import sample_tables.macro
146 -->callmacro Create_table_xtbl_with_phrase_and_prio
147 -->callmacro Create_collection_coll_with_phrase_and_prio
148
149 -->echo
150 -->echo #
151 -->echo # I.1
152 stmtsql SELECT phrase FROM xtbl WHERE prio < 0;
153 # Compressed ColumnMetadata, Notice, FetchDone
154 callmacro Assert_frame COMPRESSION;
155 callmacro Assert_message Mysqlx.Sql.StmtExecuteOk;
156
157
158 -->echo
159 -->echo #
160 -->echo # I.2
161 stmtsql SELECT phrase FROM xtbl LIMIT 1;
162 # Compressed ColumnMetadata, Row, Notice, FetchDone
163 callmacro Assert_frame COMPRESSION;
164 callmacro Assert_message Mysqlx.Sql.StmtExecuteOk;
165
166
167 -->echo
168 -->echo #
169 -->echo # I.3
170 stmtsql SELECT phrase FROM xtbl LIMIT 4;
171 # Compressed ColumnMetadata, 4xRow, Notice, FetchDone
172 callmacro Assert_frame COMPRESSION;
173 callmacro Assert_message Mysqlx.Sql.StmtExecuteOk;
174
175
176 -->echo
177 -->echo #
178 -->echo # I.4
179 stmtsql SELECT phrase, prio FROM xtbl LIMIT 4;
180 # Compressed 2xColumnMetadata, 4xRow, Notice, FetchDone
181 callmacro Assert_frame COMPRESSION;
182 callmacro Assert_message Mysqlx.Sql.StmtExecuteOk;
183
184 -->echo
185 -->echo #
186 -->echo # I.5
187 stmtsql CALL two_resultsets();
188 # Compressed ColumnMetadata, Row, Notice, FetchMoreResultsets, ColumnMentadata, Row, Notice, FetchDone
189 callmacro Assert_frame COMPRESSION;
190 callmacro Assert_message Mysqlx.Sql.StmtExecuteOk;
191
192
193 -->echo
194 -->echo #
195 -->echo # II.1
196 Mysqlx.Crud.Insert {
197 collection {
198 name: "coll"
199 schema: "xtest"
200 }
201 data_model: DOCUMENT
202 row {
203 field {
204 type: LITERAL
205 literal {
206 type: V_STRING
207 v_string {
208 value: "{\"some_field\":\"ok\"}"
209 }
210 }}
211 }
212 }
213 # Compressed Notices
214 callmacro Assert_frame COMPRESSION;
215 callmacro Assert_message Mysqlx.Sql.StmtExecuteOk;
216
217
218 -->echo
219 -->echo #
220 -->echo # II.2
221 Mysqlx.Crud.Insert {
222 collection {
223 name: "coll"
224 schema: "xtest"
225 }
226 data_model: DOCUMENT
227 row {
228 field {
229 type: LITERAL
230 literal {
231 type: V_STRING
232 v_string {
233 value: "{\"ints\":1}"
234 }
235 }}
236 }
237 row {
238 field {
239 type: LITERAL
240 literal {
241 type: V_STRING
242 v_string {
243 value: "{\"ints\":2}"
244 }
245 }}
246 }
247 row {
248 field {
249 type: LITERAL
250 literal {
251 type: V_STRING
252 v_string {
253 value: "{\"ints\":3}"
254 }
255 }}
256 }
257 row {
258 field {
259 type: LITERAL
260 literal {
261 type: V_STRING
262 v_string {
263 value: "{\"ints\":4}"
264 }
265 }}
266 }
267 }
268 # Compressed Notices
269 callmacro Assert_frame COMPRESSION;
270 callmacro Assert_message Mysqlx.Sql.StmtExecuteOk;
271
272
273 -->echo
274 -->echo #
275 -->echo # III.1
276 Mysqlx.Crud.Find {
277 collection {
278 name: "coll"
279 schema: "xtest"
280 }
281 data_model: DOCUMENT
282 criteria {
283 type: OPERATOR
284 operator {
285 name: "=="
286 param {
287 type: IDENT
288 identifier {
289 document_path{type:MEMBER value:"not_existing_member"}
290 }
291 }
292 param {
293 type: LITERAL
294 literal {
295 type: V_OCTETS
296 v_octets {value: "non-existing-value"}
297 }
298 }
299 }
300 }
301 }
302 # Compressed ColumnMetaData(doc), FetchDone
303 callmacro Assert_frame COMPRESSION;
304 callmacro Assert_message Mysqlx.Sql.StmtExecuteOk;
305
306
307 -->echo
308 -->echo #
309 -->echo # III.2
310 Mysqlx.Crud.Find {
311 collection {
312 name: "coll"
313 schema: "xtest"
314 }
315 data_model: DOCUMENT
316 limit { row_count:4 }
317 }
318 # Compressed ColumnMetaData(doc), Row, FetchDone
319 callmacro Assert_frame COMPRESSION;
320 callmacro Assert_message Mysqlx.Sql.StmtExecuteOk;
321
322
323 -->echo
324 -->echo #
325 -->echo # IV.1
326 Mysqlx.Crud.Update {
327 collection {
328 name: "coll"
329 schema: "xtest"
330 }
331 data_model: DOCUMENT
332 criteria {
333 type: OPERATOR
334 operator {
335 name: "=="
336 param {
337 type: IDENT
338 identifier {
339 document_path{type:MEMBER value:"not_existing_member"}
340 }
341 }
342 param {
343 type: LITERAL
344 literal {
345 type: V_OCTETS
346 v_octets {value: "non-existing-value"}
347 }
348 }
349 }
350 }
351 operation{
352 operation:ITEM_SET
353 source{document_path { type: MEMBER value: 'foo' }}
354 value{
355 type: LITERAL
356 literal{ type: V_NULL }
357 }
358 }
359 }
360 # Compressed Notice
361 callmacro Assert_frame COMPRESSION;
362 callmacro Assert_message Mysqlx.Sql.StmtExecuteOk;
363
364
365 -->echo
366 -->echo #
367 -->echo # IV.2
368 Mysqlx.Crud.Update {
369 collection {
370 name: "coll"
371 schema: "xtest"
372 }
373 data_model: DOCUMENT
374
375 operation{
376 operation:ITEM_SET
377 source{document_path { type: MEMBER value: 'foo2' }}
378 value{
379 type: LITERAL
380 literal{ type: V_NULL }
381 }
382 }
383 }
384 # Compressed Notice
385 callmacro Assert_frame COMPRESSION;
386 callmacro Assert_message Mysqlx.Sql.StmtExecuteOk;
387
388
389 -->echo
390 -->echo #
391 -->echo # V.1
392 Mysqlx.Crud.Delete {
393 collection {
394 name: "coll"
395 schema: "xtest"
396 }
397 data_model: DOCUMENT
398
399 criteria {
400 type: OPERATOR
401 operator {
402 name: "=="
403 param {
404 type: IDENT
405 identifier {
406 document_path{type:MEMBER value:"not_existing_member"}
407 }
408 }
409 param {
410 type: LITERAL
411 literal {
412 type: V_OCTETS
413 v_octets {value: "non-existing-value"}
414 }
415 }
416 }
417 }
418 }
419 # Compressed Notice
420 callmacro Assert_frame COMPRESSION;
421 callmacro Assert_message Mysqlx.Sql.StmtExecuteOk;
422
423
424 -->echo
425 -->echo #
426 -->echo # V.2
427 Mysqlx.Crud.Delete {
428 collection {
429 name: "coll"
430 schema: "xtest"
431 }
432 data_model: DOCUMENT
433
434 criteria {
435 type: OPERATOR
436 operator {
437 name: "=="
438 param {
439 type: IDENT
440 identifier {
441 document_path{type:MEMBER value:"prio"}
442 }
443 }
444 param {
445 type: LITERAL
446 literal {
447 type: V_SINT
448 v_signed_int: 1
449 }
450 }
451 }
452 }
453 }
454 # Compressed Notice
455 callmacro Assert_frame COMPRESSION;
456 callmacro Assert_message Mysqlx.Sql.StmtExecuteOk;
457
458
459 -->echo
460 -->echo #
461 -->echo # VI.2
462 Mysqlx.Prepare.Prepare {
463 stmt_id: 1
464 stmt: {
465 type: STMT
466 stmt_execute: {
467 stmt: "call out_param_no_select(10, ?)"
468 }
469 }
470 }
471 recvok;
472 Mysqlx.Prepare.Execute {
473 stmt_id: 1
474 args {
475 type: SCALAR scalar {
476 type: V_STRING v_string {
477 value: "@my_var"
478 }
479 }
480 }
481 }
482 # Compressed FetchMoreOutParams, ColumnMetaData, Row, FetchDone, Notice
483 callmacro Assert_frame COMPRESSION;
484 callmacro Assert_message Mysqlx.Sql.StmtExecuteOk;
485
486
487 -->echo
488 -->echo #
489 -->echo # VI.2
490 Mysqlx.Prepare.Prepare {
491 stmt_id: 2
492 stmt: {
493 type: STMT
494 stmt_execute: {
495 stmt: "SELECT phrase FROM xtbl"
496 }
497 }
498 }
499 recvok;
500 Mysqlx.Cursor.Open {
501 cursor_id: 2
502 stmt {
503 type: PREPARE_EXECUTE
504 prepare_execute {
505 stmt_id: 2
506 }
507 }
508 fetch_rows:1
509 }
510 # Compressed ColumnMentaData, Row, FetchSuspended
511 callmacro Assert_frame COMPRESSION;
512 callmacro Assert_message Mysqlx.Sql.StmtExecuteOk;
513
514 EOF
515
516 --let $STORED_PROC_DB_NAME=xtest
517 --source ../include/stored_procedures.inc
518
519
520 --echo
521 --echo ## A. Execute the test using zlib compression
522 --echo #
523
524 exec $MYSQLXTEST
525 -ux_root --password=''
526 --schema=xtest
527 --compression-mode=required
528 --compression-algorithm=deflate_stream
529 --compression-combine-mixed-messages=1
530 --compression-max-combine-messages=0
531 --file=$MYSQL_TMP_DIR/resultset.xpl 2>&1;
532
533
534 --echo
535 --echo ## B. Execute the test using lz4 compression
536 --echo #
537
538 exec $MYSQLXTEST
539 -ux_root --password=''
540 --schema=xtest
541 --compression-mode=required
542 --compression-algorithm=lz4_message
543 --compression-combine-mixed-messages=1
544 --compression-max-combine-messages=0
545 --file=$MYSQL_TMP_DIR/resultset.xpl 2>&1;
546
547
548 --echo
549 --echo ## C. Execute the test using zstd compression
550 --echo #
551
552 exec $MYSQLXTEST
553 -ux_root --password=''
554 --schema=xtest
555 --compression-mode=required
556 --compression-algorithm=zstd_stream
557 --compression-combine-mixed-messages=1
558 --compression-max-combine-messages=0
559 --file=$MYSQL_TMP_DIR/resultset.xpl 2>&1;
560
561
562 ## Cleanup
563 --source ../include/xplugin_cleanup.inc