| 1 |
# ==== Purpose ==== |
| 2 |
# |
| 3 |
# The purpose of this test is to validate that the replication process is |
| 4 |
# tolerant to the failure when allocating required space for a row event - |
| 5 |
# IO_CACHE failure due to temporary directory disc partition being full, for |
| 6 |
# instance. |
| 7 |
# |
| 8 |
# ==== Requirements ==== |
| 9 |
# |
| 10 |
# R1. The `HA_ERR_OUT_OF_MEM` must be triggered whenever |
| 11 |
# `binlog_prepare_pending_rows_event` fails to return a reference to the |
| 12 |
# pending rows event. |
| 13 |
# |
| 14 |
# ==== Implementation ==== |
| 15 |
# |
| 16 |
# 1. Create a normal table and a table with partitions. |
| 17 |
# 2. Activate the `simulate_null_pending_rows_event` DBUG point. |
| 18 |
# 3. Insert, update and delete records and expect failure. |
| 19 |
# 4. Deactivate the `simulate_null_pending_rows_event` DBUG point. |
| 20 |
# 5. Insert, update and delete records and expect success. |
| 21 |
# 6. Ensure that both tables have the same data. |
| 22 |
# |
| 23 |
# ==== References ==== |
| 24 |
# |
| 25 |
# BUG#29848931 UPDATE ON PARTITIONED TABLE CRASHES THE SERVER WHEN PARTITION |
| 26 |
# COUNT IS MORE |
| 27 |
# |
| 28 |
--source include/have_debug.inc |
| 29 |
|
| 30 |
--write_file $MYSQLTEST_VARDIR/tmp/execute_operation.inc PROCEDURE |
| 31 |
if ($error_number == '') |
| 32 |
{ |
| 33 |
--die !!!ERROR IN TEST: you must set $error_number |
| 34 |
} |
| 35 |
if ($statement == '') |
| 36 |
{ |
| 37 |
--die !!!ERROR IN TEST: you must set $statement |
| 38 |
} |
| 39 |
if ($error_number != 0) |
| 40 |
{ |
| 41 |
SET DEBUG = '+d, simulate_null_pending_rows_event'; |
| 42 |
} |
| 43 |
--let $t = 2 |
| 44 |
while($t != 0) |
| 45 |
{ |
| 46 |
if ($statement == INSERT) |
| 47 |
{ |
| 48 |
--error $error_number |
| 49 |
--eval INSERT INTO t$t VALUES (1, 1), (2, 2), (3, 3) |
| 50 |
} |
| 51 |
if ($statement == UPDATE) |
| 52 |
{ |
| 53 |
--error $error_number |
| 54 |
--eval UPDATE t$t SET p = 4 WHERE id = 2 |
| 55 |
} |
| 56 |
if ($statement == DELETE) |
| 57 |
{ |
| 58 |
--error $error_number |
| 59 |
--eval DELETE FROM t$t WHERE id = 2 |
| 60 |
} |
| 61 |
--dec $t |
| 62 |
} |
| 63 |
if ($error_number != 0) |
| 64 |
{ |
| 65 |
SET DEBUG = '-d, simulate_null_pending_rows_event'; |
| 66 |
} |
| 67 |
#END OF |
| 68 |
PROCEDURE |
| 69 |
|
| 70 |
--source include/not_group_replication_plugin.inc |
| 71 |
--source include/have_binlog_format_row.inc |
| 72 |
--source include/master-slave.inc |
| 73 |
|
| 74 |
CREATE TABLE t1 (id INT, p INT); |
| 75 |
CREATE TABLE t2 (id INT, p INT); |
| 76 |
CREATE INDEX i ON t2 (id); |
| 77 |
ALTER TABLE t2 PARTITION BY KEY (id) PARTITIONS 100; |
| 78 |
|
| 79 |
--source include/sync_slave_sql_with_master.inc |
| 80 |
--source include/rpl_connection_master.inc |
| 81 |
|
| 82 |
--let $statement = INSERT |
| 83 |
--let $error_number = ER_BINLOG_ROW_LOGGING_FAILED |
| 84 |
--source $MYSQLTEST_VARDIR/tmp/execute_operation.inc |
| 85 |
--let $error_number = 0 |
| 86 |
--source $MYSQLTEST_VARDIR/tmp/execute_operation.inc |
| 87 |
|
| 88 |
--let $statement = UPDATE |
| 89 |
--let $error_number = ER_BINLOG_ROW_LOGGING_FAILED |
| 90 |
--source $MYSQLTEST_VARDIR/tmp/execute_operation.inc |
| 91 |
--let $error_number = 0 |
| 92 |
--source $MYSQLTEST_VARDIR/tmp/execute_operation.inc |
| 93 |
|
| 94 |
--let $statement = DELETE |
| 95 |
--let $error_number = ER_BINLOG_ROW_LOGGING_FAILED |
| 96 |
--source $MYSQLTEST_VARDIR/tmp/execute_operation.inc |
| 97 |
--let $error_number = 0 |
| 98 |
--source $MYSQLTEST_VARDIR/tmp/execute_operation.inc |
| 99 |
|
| 100 |
--let $assert_cond= "[SELECT COUNT(*) FROM t1]" = "2" |
| 101 |
--let $assert_text= There are 2 records in t1 |
| 102 |
--source include/assert.inc |
| 103 |
--let $assert_cond= "[SELECT COUNT(*) FROM t2]" = "2" |
| 104 |
--let $assert_text= There are 2 records in t2 |
| 105 |
--source include/assert.inc |
| 106 |
|
| 107 |
--source include/sync_slave_sql_with_master.inc |
| 108 |
|
| 109 |
--let $diff_tables= master:t1, slave:t1 |
| 110 |
--source include/diff_tables.inc |
| 111 |
--let $diff_tables= master:t2, slave:t2 |
| 112 |
--source include/diff_tables.inc |
| 113 |
|
| 114 |
--source include/rpl_connection_master.inc |
| 115 |
DROP TABLE t1; |
| 116 |
DROP TABLE t2; |
| 117 |
--remove_file $MYSQLTEST_VARDIR/tmp/execute_operation.inc |
| 118 |
--source include/rpl_end.inc |