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

FK actions are ignored after tc_purge and COMMIT

    XMLWordPrintable

    Details

      Description

      To reproduce, please specify

      --mariadbd=--innodb_evict_tables_on_commit_debug

      --source include/have_debug_sync.inc
      --source include/have_innodb.inc
       
      create table t1 (a int, key(a), b int) engine=innodb;
      create table t2 (a int key references t1(a), b int) engine=innodb;
      insert t1 values (1, 1);
      insert t2 values (1, 1);
      set autocommit =0;
       
       
      --connect purge, localhost, root
      BACKUP STAGE start;
      --connection default
       
      begin;
      update t1 set b = b + 1;
      # Commenting this makes the test pass
      update t2 set b = b + 1;
       
      --connect bug, localhost, root
      set debug_sync="open_tables_after_open_and_process_table signal open wait_for go";
      send
      update t1 set a = a + 1;
       
      --connection purge
      BACKUP STAGE block_commit;
       
      BACKUP STAGE END;
       
      --connection default
      set debug_sync="now wait_for open";
      commit;
      set debug_sync="now signal go";
      --connection bug
      --error ER_ROW_IS_REFERENCED_2
      reap;
      --connection default
       
       
      # Cleanup
      set debug_sync= reset;
      drop table t2, t1;
      

      Actual result, rev. 505da21e3

      mysqltest: At line 36: query 'reap' succeeded - should have failed with error ER_ROW_IS_REFERENCED_2 (1451)...
      

      Another suitable alternative to BACKUP STAGE can be FLUSH TABLES.

      The table affected by a transaction is removed on COMMIT in lock_release().
      Then it is removed from all {{referenced_set}}s in dict_sys_t::remove().
      The trick is to make t2 reference count = 0, and leave t1 reference count != 0.
      So t1 was opened for write, but t2 is going to be opened soon by prelocking,
      so sync point is added right after t1 was opened.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              nikitamalyavin Nikita Malyavin
              Reporter:
              nikitamalyavin Nikita Malyavin
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.