| 1 |
# Checks decompression context consistency |
| 2 |
# |
| 3 |
# This test confirms even if some X Protocol messages are skipped/failed |
| 4 |
# by Expectation blocks, still those messages are decompressed which |
| 5 |
# ensure that client and server have the compression context in the same |
| 6 |
# state. |
| 7 |
# |
| 8 |
# The usage of compression context depends on which algorithm was selected by the user: |
| 9 |
# |
| 10 |
# * DEFLATE_STREAM - in this case the context is always the same, created |
| 11 |
# after connection authentication |
| 12 |
# * LZ4_MESSAGE - in this case the context is alive only for time of creation |
| 13 |
# of "Mysqlx.Connection.Compression" message. Each compression |
| 14 |
# message is going to have different context. |
| 15 |
# |
| 16 |
# |
| 17 |
--source include/xplugin_preamble.inc |
| 18 |
--source include/xplugin_create_user.inc |
| 19 |
|
| 20 |
## Test starts here |
| 21 |
--write_file $MYSQL_TMP_DIR/resultset.xpl |
| 22 |
-->import assert_status_variable.macro |
| 23 |
|
| 24 |
-->echo |
| 25 |
-->echo |
| 26 |
-->echo ## I. Compression and Open expectation block with no-error condition |
| 27 |
-->echo # |
| 28 |
-->echo # 1. Fail the expectation block and check that each message that |
| 29 |
-->echo # was compressed is replied with error without executing it |
| 30 |
-->echo # 2. Close expectation block and check that compressed messages |
| 31 |
-->echo # are correctly decompressed (context in sync) and executed |
| 32 |
|
| 33 |
-->macro Execute_compressed_queries %ERROR% |
| 34 |
-->begin_compress %BLOCK_COMPRESSION% |
| 35 |
Mysqlx.Sql.StmtExecute{ |
| 36 |
stmt: "SELECT 'First query'" |
| 37 |
} |
| 38 |
|
| 39 |
Mysqlx.Sql.StmtExecute{ |
| 40 |
stmt: "SELECT 'Second query'" |
| 41 |
} |
| 42 |
|
| 43 |
Mysqlx.Sql.StmtExecute{ |
| 44 |
stmt: "SELECT 'Last query'" |
| 45 |
} |
| 46 |
-->end_compress |
| 47 |
|
| 48 |
-->expecterror %ERROR% |
| 49 |
-->recvresult |
| 50 |
-->expecterror %ERROR% |
| 51 |
-->recvresult |
| 52 |
-->expecterror %ERROR% |
| 53 |
-->recvresult |
| 54 |
-->endmacro |
| 55 |
|
| 56 |
-->echo |
| 57 |
-->echo # |
| 58 |
-->echo # I.1 |
| 59 |
# Open no-error block |
| 60 |
Mysqlx.Expect.Open { |
| 61 |
cond { |
| 62 |
condition_key: 1 |
| 63 |
} |
| 64 |
} |
| 65 |
-->recvok |
| 66 |
|
| 67 |
# Following error will force all requestes to be rejected |
| 68 |
expecterror ER_PARSE_ERROR; |
| 69 |
SELECT invalid_syntax(-); |
| 70 |
|
| 71 |
# Try to execute SQL from a compressed packet |
| 72 |
callmacro Execute_compressed_queries ER_X_EXPECT_NO_ERROR_FAILED; |
| 73 |
|
| 74 |
|
| 75 |
-->echo |
| 76 |
-->echo # |
| 77 |
-->echo # I.2 |
| 78 |
Mysqlx.Expect.Close { |
| 79 |
} |
| 80 |
recverror ER_X_EXPECT_NO_ERROR_FAILED; |
| 81 |
callmacro Execute_compressed_queries 0; |
| 82 |
|
| 83 |
EOF |
| 84 |
|
| 85 |
|
| 86 |
--echo |
| 87 |
--echo ## A. Execute the test using zlib/single |
| 88 |
--echo # |
| 89 |
|
| 90 |
exec $MYSQLXTEST |
| 91 |
-ux_root --password='' |
| 92 |
--compression-mode=required |
| 93 |
--compression-algorithm=deflate_stream |
| 94 |
-v%BLOCK_COMPRESSION%=SINGLE |
| 95 |
--file=$MYSQL_TMP_DIR/resultset.xpl 2>&1; |
| 96 |
|
| 97 |
|
| 98 |
--echo |
| 99 |
--echo ## B. Execute the test using lz4/single |
| 100 |
--echo # |
| 101 |
|
| 102 |
exec $MYSQLXTEST |
| 103 |
-ux_root --password='' |
| 104 |
--compression-mode=required |
| 105 |
--compression-algorithm=lz4_message |
| 106 |
-v%BLOCK_COMPRESSION%=SINGLE |
| 107 |
--file=$MYSQL_TMP_DIR/resultset.xpl 2>&1; |
| 108 |
|
| 109 |
|
| 110 |
--echo |
| 111 |
--echo ## C. Execute the test using zlib/multiple |
| 112 |
--echo # |
| 113 |
|
| 114 |
exec $MYSQLXTEST |
| 115 |
-ux_root --password='' |
| 116 |
--compression-mode=required |
| 117 |
--compression-algorithm=deflate_stream |
| 118 |
-v%BLOCK_COMPRESSION%=MULTIPLE |
| 119 |
--file=$MYSQL_TMP_DIR/resultset.xpl 2>&1; |
| 120 |
|
| 121 |
|
| 122 |
--echo |
| 123 |
--echo ## D. Execute the test using lz4/multiple |
| 124 |
--echo # |
| 125 |
|
| 126 |
exec $MYSQLXTEST |
| 127 |
-ux_root --password='' |
| 128 |
--compression-mode=required |
| 129 |
--compression-algorithm=lz4_message |
| 130 |
-v%BLOCK_COMPRESSION%=MULTIPLE |
| 131 |
--file=$MYSQL_TMP_DIR/resultset.xpl 2>&1; |
| 132 |
|
| 133 |
|
| 134 |
--echo |
| 135 |
--echo ## E. Execute the test using zlib/group |
| 136 |
--echo # |
| 137 |
|
| 138 |
exec $MYSQLXTEST |
| 139 |
-ux_root --password='' |
| 140 |
--compression-mode=required |
| 141 |
--compression-algorithm=deflate_stream |
| 142 |
-v%BLOCK_COMPRESSION%=GROUP |
| 143 |
--file=$MYSQL_TMP_DIR/resultset.xpl 2>&1; |
| 144 |
|
| 145 |
|
| 146 |
--echo |
| 147 |
--echo ## F. Execute the test using lz4/group |
| 148 |
--echo # |
| 149 |
|
| 150 |
exec $MYSQLXTEST |
| 151 |
-ux_root --password='' |
| 152 |
--compression-mode=required |
| 153 |
--compression-algorithm=lz4_message |
| 154 |
-v%BLOCK_COMPRESSION%=GROUP |
| 155 |
--file=$MYSQL_TMP_DIR/resultset.xpl 2>&1; |
| 156 |
|
| 157 |
--echo |
| 158 |
--echo ## G. Execute the test using zstd/single |
| 159 |
--echo # |
| 160 |
|
| 161 |
exec $MYSQLXTEST |
| 162 |
-ux_root --password='' |
| 163 |
--compression-mode=required |
| 164 |
--compression-algorithm=zstd_stream |
| 165 |
-v%BLOCK_COMPRESSION%=SINGLE |
| 166 |
--file=$MYSQL_TMP_DIR/resultset.xpl 2>&1; |
| 167 |
|
| 168 |
--echo |
| 169 |
--echo ## H. Execute the test using zstd/multiple |
| 170 |
--echo # |
| 171 |
|
| 172 |
exec $MYSQLXTEST |
| 173 |
-ux_root --password='' |
| 174 |
--compression-mode=required |
| 175 |
--compression-algorithm=zstd_stream |
| 176 |
-v%BLOCK_COMPRESSION%=MULTIPLE |
| 177 |
--file=$MYSQL_TMP_DIR/resultset.xpl 2>&1; |
| 178 |
|
| 179 |
--echo |
| 180 |
--echo ## I. Execute the test using zstd/group |
| 181 |
--echo # |
| 182 |
|
| 183 |
exec $MYSQLXTEST |
| 184 |
-ux_root --password='' |
| 185 |
--compression-mode=required |
| 186 |
--compression-algorithm=zstd_stream |
| 187 |
-v%BLOCK_COMPRESSION%=GROUP |
| 188 |
--file=$MYSQL_TMP_DIR/resultset.xpl 2>&1; |
| 189 |
|
| 190 |
## Cleanup |
| 191 |
|
| 192 |
--source ../include/xplugin_cleanup.inc |