[MDEV-21833] Make slave_run_triggers_for_rbr enforce triggers to run on slave, even when there are triggers on the master Created: 2020-02-27  Updated: 2020-04-02  Due: 2020-03-10  Resolved: 2020-03-09

Status: Closed
Project: MariaDB Server
Component/s: Replication
Fix Version/s: 10.5.2

Type: Task Priority: Critical
Reporter: Ralf Gebhardt Assignee: Andrei Elkin
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
Sub-Tasks:
Key
Summary
Type
Status
Assignee
MDEV-22120 Add author to SHOW AUTHORS Technical task Closed Rasmus Johansson  

 Description   

When using slave_run_triggers_for_rbr on the slave, if there are triggers on the master table, any triggers on the slave will still not be executed. This is fine, given the assumption that the slave and master have the same schema and the triggers on the master has already executed and operations that would be executed by the triggers on the slave, thus avoiding the same operation being executed twice.
Although this makes sense in many cases, in other cases this is not so. In a situation when there are triggers on a table on both the master and the slave, but these are completely different triggers, by design, and you actually want both the triggers on the master and the slave to execute and the user knows hos to deal with this, you would want to enforce the trigger on the to execute, independent of the existance of a trigger on the master.
One use case for this is to allow for "asynchronous" triggers, so that triggers that takes has a rather high performance penalty can be executed on an asynchronous slave.
The suggested fix to this is not to break the existing restrictive mode, which in many cases makes sense, but to add a new mode to slave_run_triggers_for_rbr beyond, YES, NO and LOGGING. This could be called ENFORCE or something similar.

A suggested patch, based on MariaDB 10.4.8, is attached.



 Comments   
Comment by Ian Gilfillan [ 2020-03-16 ]

For reference, here is the commit: https://github.com/MariaDB/server/commit/980108ceebdca5c4f6c9e3a167e9ad40cb062ac8 - for some reason it's not being picked up in the commits on the right of the task (only server-clustrix, which leads to a 404).

Generated at Thu Feb 08 09:10:09 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.