| 1 |
# |
| 2 |
# MDEV-32051 : Failed to insert streaming client |
| 3 |
# |
| 4 |
# Test outline: |
| 5 |
# To reproduce we need a autocommit INSERT with streaming enabled, |
| 6 |
# and a conflicting TRUNCATE. |
| 7 |
# The INSERT is BF aborted by TRUNCATE during replication of the commit |
| 8 |
# fragment, so that the INSERT must be rolled back replayed. During |
| 9 |
# replay it fails certification, finally the statement is retried and |
| 10 |
# succeeds. If bug is present, the streaming client for the INSERT does |
| 11 |
# not get deleted after replay, causing the warning (or assert in debug builds) |
| 12 |
# when retrying attempts to create the same streaming client with the same id. |
| 13 |
# |
| 14 |
|
| 15 |
--source include/galera_cluster.inc |
| 16 |
--source include/have_innodb.inc |
| 17 |
--source include/have_debug_sync.inc |
| 18 |
--source include/galera_have_debug_sync.inc |
| 19 |
|
| 20 |
--connection node_1 |
| 21 |
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; |
| 22 |
INSERT INTO t1 VALUES(1); |
| 23 |
|
| 24 |
# |
| 25 |
# Issue an INSERT and block it right before certification |
| 26 |
# of the commit fragment. This is needed to setup for |
| 27 |
# before_replicate_sync in galera, to make sure we catch |
| 28 |
# the commit fragment. |
| 29 |
# |
| 30 |
--connection node_1 |
| 31 |
SET SESSION wsrep_trx_fragment_size=1; |
| 32 |
SET DEBUG_SYNC='wsrep_before_certification SIGNAL before_fragment WAIT_FOR continue'; |
| 33 |
--send INSERT INTO t1 VALUES (2) |
| 34 |
|
| 35 |
--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 |
| 36 |
--connection node_1a |
| 37 |
SET SESSION wsrep_sync_wait=0; |
| 38 |
SET DEBUG_SYNC='now WAIT_FOR before_fragment'; |
| 39 |
--let galera_sync_point = before_replicate_sync |
| 40 |
--source include/galera_set_sync_point.inc |
| 41 |
SET DEBUG_SYNC='now SIGNAL continue'; |
| 42 |
--source include/galera_wait_sync_point.inc |
| 43 |
SET DEBUG_SYNC='RESET'; |
| 44 |
|
| 45 |
# |
| 46 |
# Commit fragment of INSERT is now parked in galera side |
| 47 |
# before replication. Issue the conflicting DDL |
| 48 |
# |
| 49 |
--connection node_2 |
| 50 |
TRUNCATE TABLE t1; |
| 51 |
|
| 52 |
--connection node_1a |
| 53 |
--source include/galera_signal_sync_point.inc |
| 54 |
--source include/galera_clear_sync_point.inc |
| 55 |
|
| 56 |
# INSERT is first aborted, but ultimately succeeds because of wsrep_autocommit_retry |
| 57 |
# If bug is present: |
| 58 |
# [Warning] WSREP: Failed to insert streaming client |
| 59 |
# server_state.cpp:1152: void wsrep::server_state::start_streaming_client(wsrep::client_state*): Assertion `0' failed. |
| 60 |
--connection node_1 |
| 61 |
--reap |
| 62 |
|
| 63 |
SELECT * FROM t1; |
| 64 |
SELECT COUNT(*) FROM mysql.wsrep_streaming_log; |
| 65 |
|
| 66 |
--connection node_2 |
| 67 |
|
| 68 |
SELECT * FROM t1; |
| 69 |
SELECT COUNT(*) FROM mysql.wsrep_streaming_log; |
| 70 |
|
| 71 |
|
| 72 |
DROP TABLE t1; |