mariadb/mysql-test/main/long_unique_innodb.test
Sergei Golubchik 062f8eb37d cleanup: key algorithm vs key flags
the information about index algorithm was stored in two
places inconsistently split between both.

BTREE index could have key->algorithm == HA_KEY_ALG_BTREE, if the user
explicitly specified USING BTREE or HA_KEY_ALG_UNDEF, if not.

RTREE index had key->algorithm == HA_KEY_ALG_RTREE
and always had key->flags & HA_SPATIAL

FULLTEXT index had  key->algorithm == HA_KEY_ALG_FULLTEXT
and always had key->flags & HA_FULLTEXT

HASH index had key->algorithm == HA_KEY_ALG_HASH or HA_KEY_ALG_UNDEF

long unique index always had key->algorithm == HA_KEY_ALG_LONG_HASH

In this commit:

All indexes except BTREE and HASH always have key->algorithm
set, HA_SPATIAL and HA_FULLTEXT flags are not used anymore (except
for storage to keep frms backward compatible).

As a side effect ALTER TABLE now detects FULLTEXT index renames correctly
2024-11-05 14:00:47 -08:00

146 lines
3.2 KiB
Text

--source include/have_innodb.inc
#
# MDEV-371 Unique indexes for blobs
#
create table t1(a blob unique) engine= InnoDB;
insert into t1 values('RUC');
--error ER_DUP_ENTRY
insert into t1 values ('RUC');
show keys from t1;
drop table t1;
create table t1 (a blob unique , c int unique) engine=innodb;
show create table t1;
drop table t1;
--echo #test for concurrent insert of long unique in innodb
create table t1(a blob unique) engine= InnoDB;
show create table t1;
connect ('con1', localhost, root,,);
connect ('con2', localhost, root,,);
--connection con1
set innodb_lock_wait_timeout= 2;
set transaction isolation level READ UNCOMMITTED;
start transaction;
insert into t1 values('RUC');
--connection con2
set innodb_lock_wait_timeout= 2;
set transaction isolation level READ UNCOMMITTED;
start transaction;
--error ER_LOCK_WAIT_TIMEOUT
insert into t1 values ('RUC');
--connection con1
commit;
set transaction isolation level READ COMMITTED;
start transaction;
insert into t1 values('RC');
--connection con2
commit;
set transaction isolation level READ COMMITTED;
start transaction;
--error ER_LOCK_WAIT_TIMEOUT
insert into t1 values ('RC');
commit;
--connection con1
commit;
set transaction isolation level REPEATABLE READ;
start transaction;
insert into t1 values('RR');
--connection con2
commit;
set transaction isolation level REPEATABLE READ;
start transaction;
--error ER_LOCK_WAIT_TIMEOUT
insert into t1 values ('RR');
--connection con1
commit;
set transaction isolation level SERIALIZABLE;
start transaction;
insert into t1 values('S');
--connection con2
commit;
set transaction isolation level SERIALIZABLE;
start transaction;
--error ER_LOCK_WAIT_TIMEOUT
insert into t1 values ('S');
commit;
--connection con1
commit;
select * from t1;
drop table t1;
create table t1(a blob unique) engine=Innodb;
--connection con1
set transaction isolation level READ UNCOMMITTED;
start transaction;
insert into t1 values('RUC');
--connection con2
set transaction isolation level READ UNCOMMITTED;
start transaction;
--send insert into t1 values ('RUC');
--connection con1
rollback;
--connection con2
--reap
commit;
--connection con1
set transaction isolation level READ COMMITTED;
start transaction;
insert into t1 values('RC');
--connection con2
set transaction isolation level READ COMMITTED;
start transaction;
--send insert into t1 values ('RC');
--connection con1
rollback;
--connection con2
--reap
commit;
--connection con1
set transaction isolation level REPEATABLE READ;
start transaction;
insert into t1 values('RR');
--connection con2
set transaction isolation level REPEATABLE READ;
start transaction;
--send insert into t1 values ('RR');
--connection con1
rollback;
--connection con2
--reap
commit;
--connection con1
set transaction isolation level SERIALIZABLE;
start transaction;
insert into t1 values('S');
--connection con2
set transaction isolation level SERIALIZABLE;
start transaction;
--send insert into t1 values ('S');
--connection con1
rollback;
--connection con2
--reap
commit;
connection default;
drop table t1;
disconnect con1;
disconnect con2;
--echo # MDEV-20131 Assertion `!pk->has_virtual()' failed
--error ER_TOO_LONG_KEY
create table t1 (a text, primary key(a(1871))) engine=innodb;