Commit ba7d33a8 authored by Sachin's avatar Sachin

MDEV-18820 Assertion `lock_table_has(trx, index->table, LOCK_IX)' failed in...

MDEV-18820 Assertion `lock_table_has(trx, index->table, LOCK_IX)' failed in lock_rec_insert_check_and_lock upon INSERT into table with blob key

Don't Ignore Any error during index lookup, And throw duplicate key error
only if error is HA_ERR_FOUND_DUPP_KEY
parent afca4a3a
......@@ -239,3 +239,29 @@ CREATE TABLE t1 (a INT, UNIQUE USING HASH (a)) PARTITION BY HASH (a) PARTITIONS
INSERT INTO t1 VALUES (2);
REPLACE INTO t1 VALUES (2);
DROP TABLE t1;
set innodb_lock_wait_timeout= 10;
CREATE TABLE t1 (
id int primary key,
f INT unique
) ENGINE=InnoDB;
CREATE TABLE t2 (
id int primary key,
a blob unique
) ENGINE=InnoDB;
START TRANSACTION;
connect con1,localhost,root,,test;
connection con1;
set innodb_lock_wait_timeout= 10;
START TRANSACTION;
INSERT INTO t1 VALUES (1,1)/*1*/;
connection default;
INSERT INTO t2 VALUES (2, 1)/*2*/ ;
connection con1;
INSERT INTO t2 VALUES (3, 1)/*3*/;
connection default;
INSERT IGNORE INTO t1 VALUES (4, 1)/*4*/;
connection con1;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
disconnect con1;
connection default;
DROP TABLE t1, t2;
--source include/have_innodb.inc
--source include/have_partition.inc
#
# MDEV-18707 Server crash in my_hash_sort_bin, ASAN heap-use-after-free in Field::is_null, server hang, corrupted double-linked list
......@@ -269,8 +270,50 @@ drop table t1;
#
# MDEV-18904 Assertion `m_part_spec.start_part >= m_part_spec.end_part' failed in ha_partition::index_read_idx_map
#
--source include/have_partition.inc
CREATE TABLE t1 (a INT, UNIQUE USING HASH (a)) PARTITION BY HASH (a) PARTITIONS 2;
INSERT INTO t1 VALUES (2);
REPLACE INTO t1 VALUES (2);
DROP TABLE t1;
#
# MDEV-18820 Assertion `lock_table_has(trx, index->table, LOCK_IX)' failed in lock_rec_insert_check_and_lock upon INSERT into table with blob key'
#
--source include/have_innodb.inc
set innodb_lock_wait_timeout= 10;
CREATE TABLE t1 (
id int primary key,
f INT unique
) ENGINE=InnoDB;
CREATE TABLE t2 (
id int primary key,
a blob unique
) ENGINE=InnoDB;
START TRANSACTION;
--connect (con1,localhost,root,,test)
--connection con1
set innodb_lock_wait_timeout= 10;
START TRANSACTION;
INSERT INTO t1 VALUES (1,1)/*1*/;
--connection default
INSERT INTO t2 VALUES (2, 1)/*2*/ ;
--connection con1
--send
INSERT INTO t2 VALUES (3, 1)/*3*/;
--connection default
INSERT IGNORE INTO t1 VALUES (4, 1)/*4*/;
--connection con1
--error ER_LOCK_DEADLOCK
--reap
--disconnect con1
--connection default
DROP TABLE t1, t2;
......@@ -6590,10 +6590,10 @@ static int check_duplicate_long_entry_key(TABLE *table, handler *h,
error= HA_ERR_FOUND_DUPP_KEY;
goto exit;
}
if (result == HA_ERR_LOCK_WAIT_TIMEOUT)
error= HA_ERR_LOCK_WAIT_TIMEOUT;
if (result != HA_ERR_KEY_NOT_FOUND)
error= result;
exit:
if (error)
if (error == HA_ERR_FOUND_DUPP_KEY)
{
table->file->errkey= key_no;
if (h->ha_table_flags() & HA_DUPLICATE_POS)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment