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

Concurrent trigger creation causes errors and corrupts the trigger

    XMLWordPrintable

Details

    • Bug
    • Status: Confirmed (View Workflow)
    • Minor
    • Resolution: Unresolved
    • 5.5(EOL), 10.0(EOL), 10.1(EOL), 10.2(EOL), 10.3(EOL), 10.4(EOL), 10.5
    • 10.5
    • Triggers

    Description

      Very soon after startup the concurrent test reports the error

      CREATE TRIGGER tr AFTER INSERT ON t2 FOR EACH ROW SET @a=1 failed: 7 Error on rename of './test/tr.TRN~' to './test/tr.TRN' (Errcode: 2 - No such file or directory)
      

      Further attempt to deal with the trigger reveals problems. The trigger can be seen via SHOW TRIGGERS:

      MySQL [test]> show triggers;
      +---------+--------+-------+-----------+--------+---------+------------------------+----------------+----------------------+----------------------+--------------------+
      | Trigger | Event  | Table | Statement | Timing | Created | sql_mode               | Definer        | character_set_client | collation_connection | Database Collation |
      +---------+--------+-------+-----------+--------+---------+------------------------+----------------+----------------------+----------------------+--------------------+
      | tr      | INSERT | t1    | SET @a=1  | AFTER  | NULL    | NO_ENGINE_SUBSTITUTION | root@127.0.0.1 | latin1               | latin1_swedish_ci    | latin1_swedish_ci  |
      +---------+--------+-------+-----------+--------+---------+------------------------+----------------+----------------------+----------------------+--------------------+
      1 row in set (0.00 sec)
      

      but not via SHOW CREATE TRIGGER:

      MySQL [test]> show create trigger tr;
      ERROR 1360 (HY000): Trigger does not exist
      

      It can't be dropped, either.

      All that because the trigger information went out of sync.
      The {[TRN}} file says the trigger belongs to t2:

      $ cat tr.TRN 
      TYPE=TRIGGERNAME
      trigger_table=t2
      

      but the TRG file belongs to t1:

      $ ls -l *.TRG
      -rw-rw---- 1 elenst elenst 255 Sep 30 19:02 t1.TRG
      

      Grammar

      query_init:
          CREATE TABLE IF NOT EXISTS t1 (i INT); CREATE TABLE t2 LIKE t1;
          
      my_table:
          t1 | t2 ;
          
      query:
            CREATE TRIGGER tr AFTER INSERT ON my_table FOR EACH ROW SET @a=1
          | DROP TRIGGER tr
      ;
      

      Command line

      perl ./runall-new.pl --grammar=1.yy --threads=2 --skip-gendata --duration=200 --queries=100M --basedir=<basedir> --vardir=<vardir>
      

      Attachments

        Issue Links

          Activity

            People

              Elkin Andrei Elkin
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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