| 1 |
# |
| 2 |
# MDEV-35281 - SR transaction crashes with innodb_snapshot_isolation |
| 3 |
# |
| 4 |
# Test outline: a simple SR transaction fails to remove |
| 5 |
# its fragments from streaming_log table, with error |
| 6 |
# HA_ERR_RECORD_CHANGED. |
| 7 |
# This happens with the following sequence of events: |
| 8 |
# 1. Start a streaming replication transaction |
| 9 |
# 2. The transaction creates a read view in InnoDB |
| 10 |
# (this must happen before a fragment is replicated) |
| 11 |
# 3. The transaction replicates a fragment. |
| 12 |
# Internally, a new transaction is created to INSERT |
| 13 |
# a row representing the fragment into the streaming_log |
| 14 |
# table and is committed immediately. |
| 15 |
# 4. The streaming replication transaction COMMITs. |
| 16 |
# Before committing, the transaction replicates |
| 17 |
# a commit fragment and DELETEs its fragments that |
| 18 |
# were created in the streaming_log table. |
| 19 |
# If bug is present, fragment removal from the |
| 20 |
# streaming_log table violates snapshot isolation, |
| 21 |
# thus the operation fails with HA_ERR_RECORD_CHANGED. |
| 22 |
# (One or more records from the streaming_log table |
| 23 |
# are removed, while these were not visible to |
| 24 |
# the transaction). |
| 25 |
|
| 26 |
--source include/galera_cluster.inc |
| 27 |
|
| 28 |
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY); |
| 29 |
|
| 30 |
SET SESSION wsrep_trx_fragment_size=1; |
| 31 |
SET SESSION innodb_snapshot_isolation=ON; |
| 32 |
|
| 33 |
START TRANSACTION WITH CONSISTENT SNAPSHOT; |
| 34 |
INSERT INTO t1 VALUES (1); |
| 35 |
COMMIT; |
| 36 |
|
| 37 |
DROP TABLE t1; |