| 1 |
# ==== Purpose ==== |
| 2 |
# |
| 3 |
# This test will generate a random workload in the server and will perform |
| 4 |
# many SHOW BINLOG EVENTS pointing to the positions the transactions start |
| 5 |
# in the encrypted binary log file. |
| 6 |
# |
| 7 |
# The server shall be able to display the requested events properly, by doing |
| 8 |
# random access to the encrypted binary log file. |
| 9 |
# |
| 10 |
# ==== Related Bugs and Worklogs ==== |
| 11 |
# |
| 12 |
# WL#10957: Binary log encryption at rest |
| 13 |
# |
| 14 |
|
| 15 |
--source include/have_log_bin.inc |
| 16 |
|
| 17 |
# Suppression of error messages |
| 18 |
CALL mtr.add_suppression('Unsafe statement written to the binary log using statement format'); |
| 19 |
--let $binlog_file=query_get_value(SHOW MASTER STATUS, File, 1) |
| 20 |
|
| 21 |
CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 TEXT, pos INT); |
| 22 |
|
| 23 |
--let $max_trx=100 |
| 24 |
--echo # Inserting $max_trx random transaction |
| 25 |
--let $trx=$max_trx |
| 26 |
--disable_query_log |
| 27 |
--disable_warnings |
| 28 |
while ($trx) |
| 29 |
{ |
| 30 |
--let $pos=query_get_value(SHOW MASTER STATUS, Position, 1) |
| 31 |
BEGIN; |
| 32 |
--eval INSERT INTO t1 (c1, c2, pos) VALUES ($trx, REPEAT('a', RAND() * 8192), $pos) |
| 33 |
COMMIT; |
| 34 |
--dec $trx |
| 35 |
} |
| 36 |
--enable_query_log |
| 37 |
--enable_warnings |
| 38 |
|
| 39 |
--let $trx=$max_trx |
| 40 |
--echo # Asserting we can show binlog events from each transaction |
| 41 |
--disable_query_log |
| 42 |
while ($trx) |
| 43 |
{ |
| 44 |
--let $pos=`SELECT pos FROM t1 WHERE c1 = $trx` |
| 45 |
--let $command=SHOW BINLOG EVENTS IN '$binlog_file' FROM $pos LIMIT 1 |
| 46 |
--let $showed_pos=query_get_value($command, Pos, 1) |
| 47 |
if ($showed_pos != $pos) |
| 48 |
{ |
| 49 |
--enable_query_log |
| 50 |
--echo requested_pos=$pos |
| 51 |
--eval $command |
| 52 |
--die requested_pos shall be equal to Pos |
| 53 |
} |
| 54 |
--dec $trx |
| 55 |
} |
| 56 |
--enable_query_log |
| 57 |
|
| 58 |
# Cleanup |
| 59 |
DROP TABLE t1; |