Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-5513

Row-based triggers: Trigger is applied to the rows after first one

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 10.0.9
    • Component/s: None
    • Labels:
      None

      Description

      The test case below creates one trigger (after insert) on the master and another trigger (before insert) on the slave.
      The master trigger writes into a different table. The slave trigger modifies the values on its own table (sets 2nd column := 1st column).

      Here is the result of the test case on slave:

      a	b
      1	10
      2	2
      3	3

      That is, the first row is not updated, while the other two are.

      Test case:

      --source include/master-slave.inc
      --source include/have_binlog_format_row.inc
       
      --connection master
       
      create table t1 (a int, b int);
      create table tlog (a int);
       
      set sql_log_bin=0;
      create trigger tr1 after insert on t1 for each row insert into tlog values (1);
      set sql_log_bin=1;
       
      --connection slave
       
      set @slave_run_triggers_for_rbr.saved = @@slave_run_triggers_for_rbr;
      set global slave_run_triggers_for_rbr=1;
      create trigger tr2 before insert on t1 for each row set new.b = new.a;
       
      --connection master
       
      insert into t1 values (1,10),(2,20),(3,30);
       
      --sync_slave_with_master
       
      select * from t1;
       
      # Cleanup 
       
      set global slave_run_triggers_for_rbr = @slave_run_triggers_for_rbr.saved;
       
      --connection master
       
      drop table t1, tlog;
       
      --source include/rpl_end.inc

      revision-id: sanja@askmonty.org-20140108131630-9am80xd8lbr9witb
      revno: 3916
      branch-nick: 10.0-mdev5095-sanja
      BUILD/compile-pentium-debug-max-no-ndb

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              sanja Oleksandr Byelkin
              Reporter:
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.