Debian Codegraph @

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