| 1 |
## Test to verifies maximum number of messages for compression |
| 2 |
# |
| 3 |
|
| 4 |
# |
| 5 |
# Server gives user a possibility to configure maximum number |
| 6 |
# of messages that server can compress into signle Mysqlx.Connection.Compression |
| 7 |
# message: |
| 8 |
# |
| 9 |
# client<-server: Compressed(MaxNoOfMsg * X Protocol frame) |
| 10 |
# |
| 11 |
# The configuration in done thought following capability: |
| 12 |
# |
| 13 |
# * server_max_combine_messages |
| 14 |
# |
| 15 |
# and it doesn't have any influence on compressed messages send from client. |
| 16 |
# |
| 17 |
# The test checks if the server encapsulated correct number of messages into |
| 18 |
# single compressed message. |
| 19 |
# |
| 20 |
# |
| 21 |
|
| 22 |
--source include/xplugin_preamble.inc |
| 23 |
--source include/xplugin_create_user.inc |
| 24 |
|
| 25 |
CREATE TABLE test_table(data TEXT); |
| 26 |
INSERT INTO test_table(data) VALUES |
| 27 |
("my first row"), |
| 28 |
("my second row"), |
| 29 |
("my third row"), |
| 30 |
("my fourth row"), |
| 31 |
("my fifth row"), |
| 32 |
("my sixth row"), |
| 33 |
("my seventh row"), |
| 34 |
("my eighth row"), |
| 35 |
("my ninth row"), |
| 36 |
( "my tenth row"); |
| 37 |
|
| 38 |
## Test starts here |
| 39 |
--write_file $MYSQL_TMP_DIR/resultset.xpl |
| 40 |
-->import connection.macro |
| 41 |
-->import assert_messages.macro |
| 42 |
-->import assert_notices.macro |
| 43 |
|
| 44 |
-->macro New_session_with_compression %SESSION% %MAX_MSG% |
| 45 |
newsession %SESSION% -; |
| 46 |
-->quiet |
| 47 |
callmacro Verify_its_xprotocol_connection; |
| 48 |
Mysqlx.Connection.CapabilitiesSet { |
| 49 |
capabilities { |
| 50 |
capabilities { |
| 51 |
name: "compression" |
| 52 |
value { |
| 53 |
type: OBJECT |
| 54 |
obj { |
| 55 |
fld { |
| 56 |
key: "algorithm" |
| 57 |
value { |
| 58 |
type: SCALAR |
| 59 |
scalar { |
| 60 |
type: V_STRING |
| 61 |
v_string { |
| 62 |
value: "%OPTION_COMPRESSION_ALGORITHM%" |
| 63 |
} |
| 64 |
} |
| 65 |
} |
| 66 |
} |
| 67 |
fld { |
| 68 |
key: "server_max_combine_messages" |
| 69 |
value { |
| 70 |
type: SCALAR |
| 71 |
scalar { |
| 72 |
type: V_SINT |
| 73 |
v_signed_int: %MAX_MSG% |
| 74 |
} |
| 75 |
} |
| 76 |
} |
| 77 |
} |
| 78 |
} |
| 79 |
} |
| 80 |
} |
| 81 |
} |
| 82 |
recvok; |
| 83 |
enable_compression %OPTION_COMPRESSION_ALGORITHM%; |
| 84 |
login; |
| 85 |
-->noquiet |
| 86 |
-->endmacro |
| 87 |
|
| 88 |
-->echo |
| 89 |
-->echo |
| 90 |
-->echo ## Execute same query two times, which should return resultset of 10 rows |
| 91 |
-->echo # 1. Observe that the resultset if its correctly uncompressed |
| 92 |
-->echo # 2. Observe that the resultset if its correctly encapsulated |
| 93 |
-->echo # into compression messages |
| 94 |
|
| 95 |
|
| 96 |
callmacro New_session_with_compression SomeSession %MAX_MSGS_PER_COMPRESSION%; |
| 97 |
-->echo |
| 98 |
-->echo # |
| 99 |
-->echo # 1 |
| 100 |
|
| 101 |
stmtsql SELECT * FROM test.test_table; |
| 102 |
callmacro Assert_metadata BYTES "data"; |
| 103 |
callmacro Assert_rows 10; |
| 104 |
callmacro Assert_message Mysqlx.Resultset.FetchDone; |
| 105 |
callmacro Assert_notice_session_state ROWS_AFFECTED v_unsigned_int:0; |
| 106 |
callmacro Assert_message Mysqlx.Sql.StmtExecuteOk; |
| 107 |
|
| 108 |
|
| 109 |
-->echo |
| 110 |
-->echo # |
| 111 |
-->echo # 2 |
| 112 |
stmtsql SELECT * FROM test.test_table; |
| 113 |
repeat %NUM_OF_COMPRESSION_MSGS%; |
| 114 |
callmacro Assert_frame COMPRESSION; |
| 115 |
endrepeat; |
| 116 |
callmacro Assert_message Mysqlx.Sql.StmtExecuteOk; |
| 117 |
|
| 118 |
EOF |
| 119 |
|
| 120 |
|
| 121 |
let $iteration=3; |
| 122 |
while ($iteration) |
| 123 |
{ |
| 124 |
let $algo=`select json_unquote(JSON_EXTRACT('["NONE","DEFLATE_STREAM","LZ4_MESSAGE","ZSTD_STREAM"]', '$[$iteration]'))`; |
| 125 |
--echo |
| 126 |
--echo ## I. Execute the test using: $algo + max_combine=1 |
| 127 |
--echo # |
| 128 |
exec $MYSQLXTEST |
| 129 |
--schema test |
| 130 |
-ux_root --password='' |
| 131 |
--compression-mode=required |
| 132 |
--compression-algorithm=$algo |
| 133 |
-v %MAX_MSGS_PER_COMPRESSION%=1 |
| 134 |
-v %NUM_OF_COMPRESSION_MSGS%=13 |
| 135 |
--file=$MYSQL_TMP_DIR/resultset.xpl 2>&1; |
| 136 |
|
| 137 |
--echo |
| 138 |
--echo ## II. Execute the test using: $algo + max_combine=2 |
| 139 |
--echo # |
| 140 |
exec $MYSQLXTEST |
| 141 |
--schema test |
| 142 |
-ux_root --password='' |
| 143 |
--compression-mode=required |
| 144 |
--compression-algorithm=$algo |
| 145 |
-v %MAX_MSGS_PER_COMPRESSION%=2 |
| 146 |
-v %NUM_OF_COMPRESSION_MSGS%=7 |
| 147 |
--file=$MYSQL_TMP_DIR/resultset.xpl 2>&1; |
| 148 |
|
| 149 |
|
| 150 |
--echo |
| 151 |
--echo ## III. Execute the test using: $algo + max_combine=3 |
| 152 |
--echo # |
| 153 |
exec $MYSQLXTEST |
| 154 |
--schema test |
| 155 |
-ux_root --password='' |
| 156 |
--compression-mode=required |
| 157 |
--compression-algorithm=$algo |
| 158 |
-v %MAX_MSGS_PER_COMPRESSION%=3 |
| 159 |
-v %NUM_OF_COMPRESSION_MSGS%=5 |
| 160 |
--file=$MYSQL_TMP_DIR/resultset.xpl 2>&1; |
| 161 |
|
| 162 |
--echo |
| 163 |
--echo ## IV. Execute the test using: $algo + max_combine=6 |
| 164 |
--echo # |
| 165 |
exec $MYSQLXTEST |
| 166 |
--schema test |
| 167 |
-ux_root --password='' |
| 168 |
--compression-mode=required |
| 169 |
--compression-algorithm=$algo |
| 170 |
-v %MAX_MSGS_PER_COMPRESSION%=6 |
| 171 |
-v %NUM_OF_COMPRESSION_MSGS%=3 |
| 172 |
--file=$MYSQL_TMP_DIR/resultset.xpl 2>&1; |
| 173 |
|
| 174 |
--echo |
| 175 |
--echo ## V. Execute the test using: $algo + max_combine=1000000 |
| 176 |
--echo # |
| 177 |
exec $MYSQLXTEST |
| 178 |
--schema test |
| 179 |
-ux_root --password='' |
| 180 |
--compression-mode=required |
| 181 |
--compression-algorithm=$algo |
| 182 |
-v %MAX_MSGS_PER_COMPRESSION%=1000000 |
| 183 |
-v %NUM_OF_COMPRESSION_MSGS%=1 |
| 184 |
--file=$MYSQL_TMP_DIR/resultset.xpl 2>&1; |
| 185 |
|
| 186 |
--echo |
| 187 |
--echo ## VI. Execute the test using: $algo + max_combine=9223372036854775807 |
| 188 |
--echo # |
| 189 |
exec $MYSQLXTEST |
| 190 |
--schema test |
| 191 |
-ux_root --password='' |
| 192 |
--compression-mode=required |
| 193 |
--compression-algorithm=$algo |
| 194 |
-v %MAX_MSGS_PER_COMPRESSION%=9223372036854775807 |
| 195 |
-v %NUM_OF_COMPRESSION_MSGS%=1 |
| 196 |
--file=$MYSQL_TMP_DIR/resultset.xpl 2>&1; |
| 197 |
|
| 198 |
dec $iteration; |
| 199 |
} |
| 200 |
|
| 201 |
## Cleanup |
| 202 |
DROP TABLE test_table; |
| 203 |
|
| 204 |
--source ../include/xplugin_cleanup.inc |