mirror of
https://github.com/MariaDB/server.git
synced 2025-12-06 05:42:06 +03:00
* MDEV-20225 BF aborting SP execution When stored procedure execution was chosen as victim for a BF abort, the old implemnetationn called for rollback immediately when execution was inside SP isntruction. Technically this happened in wsrep_after_statement() call, which identified the need for a rollback. The problem was that MariaDB does not accept rollback (nor commit) inside sub statement, there are several asserts about it, checking for THD::in_sub_stmt. This patch contains a fix, which skips calling wsrep_after_statement() for SP execution, which is marked as BF must abort. Instead, we return error code to upper level, where rollback will eventually happen, ouside of SP execution. Also, appending the affected trigger table (dropped or created) in the populated key set for the write set, which prevents parallel applying of other transactions working on the same table. * MDEV-20225 BF aborting SP execution, second patch First PR missed 4 commits, which are now squashed in this patch: - Added galera_sp_bf_abort test. A MTR test case which will reproduce BF-BF conflict if all keys corresponding to affected tables are not assigned for DROP TRIGGER. - Fixed incorrect use of sync pointsin MDEV-20225 - Added condition for SQLCOM_DROP_TRIGGER in wsrep_can_run_in_toi() to make it replicate. * MDEV-20225 BF aborting SP execution, third patch The galera_trigger.test caused a situation, where SP invocation caused a trigger to fire, and the trigger executed as sub statement SP, and was BF aborted by applier. because of wsrep_after_statement() was called for the sub-statement level, it ended up in exeuting rollback and asserted there. Thus fix will catch sub-statement level SP execution, and avoids calling wsrep_after_statement()
23 lines
847 B
Plaintext
23 lines
847 B
Plaintext
connection node_2;
|
|
connection node_1;
|
|
CREATE TABLE t1 (f1 INT NOT NULL PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
|
|
CREATE TABLE t2 (f1 INT NOT NULL PRIMARY KEY AUTO_INCREMENT, f2 INT) ENGINE=InnoDB;
|
|
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES (NULL, NEW.f1);
|
|
connection node_2;
|
|
SET SESSION wsrep_sync_wait = 0;
|
|
SET GLOBAL wsrep_slave_threads = 2;
|
|
SET GLOBAL debug_dbug = 'd,sync.mdev_20225';
|
|
DROP TRIGGER tr1;
|
|
connection node_2;
|
|
connection node_1;
|
|
INSERT INTO t1 VALUES (NULL);
|
|
connection node_2;
|
|
SET GLOBAL debug_dbug = 'RESET';
|
|
SET DEBUG_SYNC = 'now SIGNAL signal.mdev_20225_continue';
|
|
SET DEBUG_SYNC = 'RESET';
|
|
SET GLOBAL wsrep_slave_threads = 1;
|
|
SHOW TRIGGERS;
|
|
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
|
|
DROP TABLE t1;
|
|
DROP TABLE t2;
|