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

UNIQUE KEY USING HASH accepting duplicate records

    XMLWordPrintable

Details

    • Can result in unexpected behaviour
    • UNIQUE constraint that was USING HASH or WITHOUT OVERLAPS could be violated under heavy load in READ COMMITTED transaction isolation mode. This is now fixed for INSERT [IGNORE] and UPDATE, and disallowed in UPDATE IGNORE.

    Description

      Test case from debarun:

      --source include/have_innodb.inc
      --source include/have_debug_sync.inc
      create table t1 (
        col1 int primary key,
        col2 varchar(3000),
        unique (col2) using hash) engine=innodb;
      --echo # Keep a Read View open to prevent purge
      start transaction;
      select * from t1;
      --connect con1,localhost,root
      --echo # Create delete marked secondary index Record ('a', 10)
      insert into t1 values(10, 'a');
      delete from t1;
      --echo # Insert secondary index key ('a', 15) in the GAP between ('a', 10) and Supremum
      set transaction isolation level read committed;
      set debug_sync="innodb_row_ins_step_enter SIGNAL checked_duplicate WAIT_FOR do_insert";
      --send insert into t1 values(15, 'a')
      --connect con2,localhost,root
      set debug_sync="now WAIT_FOR checked_duplicate";
      --echo # Insert secondary index key ('a', 5) in the GAP between Infimum and ('a', 10)
      set session innodb_lock_wait_timeout = 1;
      set transaction isolation level read committed;
      insert into t1 values(5, 'a');
      set debug_sync="now SIGNAL do_insert";
      --connection con1
      --reap
      --connection default
      select * from t1;
      commit;
      select * from t1;
      --disconnect con1
      --disconnect con2
      set debug_sync='RESET';
      drop table t1;
      

      Attachments

        Issue Links

          Activity

            People

              serg Sergei Golubchik
              serg Sergei Golubchik
              Votes:
              0 Vote for this issue
              Watchers:
              5 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.