mirror of
https://github.com/MariaDB/server.git
synced 2025-01-27 01:04:19 +01:00
ebbbe9d960
cannot ignore the error in MHNSW_Share::acquire() - it could be a deadlock signal, after which no further operations are allowed
233 lines
8.7 KiB
Text
233 lines
8.7 KiB
Text
source include/have_innodb.inc;
|
|
source include/have_sequence.inc;
|
|
|
|
create table t1 (id int auto_increment primary key, v vector(8) not null, vector index (v)) engine=innodb;
|
|
show create table t1;
|
|
# print unpack("H*",pack("f*",map{rand}1..8))
|
|
insert t1 (v) values
|
|
(x'106d263fdf68ba3eb08d533f97d46e3fd1e1ec3edc4c123f984c563f621a233f'),
|
|
(x'd55bee3c56eb9e3e84e3093f838dce3eb7cd653fe32d7d3f12de133c5715d23e'),
|
|
(x'fcd5553f3822443f5dae413f2593493f7777363f5f7f113ebf12373d4d145a3f'),
|
|
(x'7493093fd9a27d3e9b13783f8c66653f0bd7d23e50db983d251b013f1dba133f'),
|
|
(x'2e30373fae331a3eba94153ee32bce3e3311b33d5bc75d3f6c25653eb769113f'),
|
|
(x'381d5f3f2781de3e4f011f3f9353483f9bb37e3edd622d3eabecb63ec246953e'),
|
|
(x'4ee5dc3e214b103f0e7e583f5f36473e79d7823ea872ec3e3ab2913d1b84433f'),
|
|
(x'8826243f7d20f03e5135593f83ba653e44572d3fa87e8e3e943e0e3f649a293f'),
|
|
(x'3859ac3e7d21823ed3f5753fc79c143e61d39c3cee39ba3eb0b0133e815c173f'),
|
|
(x'cff0d93c32941e3f64b22a3f1e4f083f4ea2563fbff4a63e12a4703f6c824b3f');
|
|
|
|
### savepoints and rollbacks:
|
|
start transaction;
|
|
insert t1 values
|
|
(30, x'f8e2413ed4ff773fef8b893eba487b3febee3f3f9e6f693f5961fd3ee479303d');
|
|
delete from t1 where id=1;
|
|
update t1 set v=x'a17e353e91676a3f8005c53e319b2d3f1410133fc018153e8dca3e3f3144ac3e' where id=2;
|
|
savepoint foo;
|
|
insert t1 values
|
|
(31, x'6129683f90fe1f3e1437bc3ed8c8f63dd141033f21e3a93e54346c3f8c4e043f'),
|
|
(32, x'1ec8b83d398c4d3f2efb463f23947a3fa1a5093fdde6303e5580413f51569b3e');
|
|
delete from t1 where id=5;
|
|
rollback to savepoint foo;
|
|
insert t1 values
|
|
(33, x'86d1003d4262033f8086713ffc4a633e317e933c4dce013d9c4d573fca83b93e');
|
|
commit;
|
|
start transaction;
|
|
insert t1 values
|
|
(40, x'71046a3e85329b3e05240e3f45c9283f1847363f98d47d3f4224b73d487b613f'),
|
|
(41, x'71046a3e85329b3e05240e3f45c9283f1847363f98d47d3f4224b73d487b613f');
|
|
delete from t1 where id=7;
|
|
rollback;
|
|
|
|
--replace_regex /(\.\d{5})\d+/\1/
|
|
select id,vec_distance_euclidean(v, x'c923e33dc0da313fe7c7983e526b3d3fde63963e6eaf3a3f27fa133fe27a583f') d from t1 order by d limit 5;
|
|
--replace_regex /(\.\d{5})\d+/\1/
|
|
select id,vec_distance_euclidean(v, x'754b5f3ea2312b3fc169f43e4604883e1d20173e8dd7443f421b703fb11e0d3e') d from t1 order by d limit 5;
|
|
|
|
### two indexes in one transaction:
|
|
create table t2 (id int auto_increment primary key, v vector(6) not null, vector index (v)) engine=innodb;
|
|
|
|
insert t2 (v) values
|
|
(x'45cf153f830a313f7a0a113fb1ff533f47a1533fcf9e6e3f'),
|
|
(x'4b311d3fdd82423f35ba7d3fa041223dfd7db03e72d5833e'),
|
|
(x'f0d4123f6fc1833ea30a483fd9649d3cb94d733f4574a63d'),
|
|
(x'7ff8a53bf68e4a3e66e3563f214dea3e63372f3ec24d513f'),
|
|
(x'4709683f0d44473f8a045f3f40f3693df7f1303fdb98b73e'),
|
|
(x'09de2b3f5db80d3fb4405f3f64aadc3ecfa6183f823c733f'),
|
|
(x'a93a143f7f71e33d0cde5c3ff106373fd6f6233fc1f4fc3e'),
|
|
(x'11236e3de44a0d3f8241023d44d8383f2f70733f44d65c3f'),
|
|
(x'b5e47c3f35d3413fad8a533d5945133f66dbf33d92c6103f');
|
|
|
|
start transaction;
|
|
insert t1 values
|
|
(50, x'acae183f56ddc43e5093983d280df53e6fa2093f79c01a3eb1591f3f423a0e3d'),
|
|
(51, x'6285303f42ef6e3f355e313f3e96a53e70959b3edd720b3ec07f733e5bc8603f');
|
|
insert t2 values
|
|
(20, x'58dc7d3fc9feaa3e19e26b3f31820c3f93070b3fc4e36e3f'),
|
|
(21, x'35e05d3f18e8513fb81a3d3f8acf7d3e794a1d3c72f9613f');
|
|
commit;
|
|
|
|
--replace_regex /(\.\d{5})\d+/\1/
|
|
select id,vec_distance_euclidean(v, x'1f4d053f7056493f937da03dd8c97a3f220cbb3c926c1c3facca213ec0618a3e') d from t1 order by d limit 5;
|
|
--replace_regex /(\.\d{5})\d+/\1/
|
|
select id,vec_distance_euclidean(v, x'f618663f256be73e62cd453f8bcdbf3e16ae503c3858313f') d from t2 order by d limit 5;
|
|
|
|
### streaming
|
|
|
|
connect con2, localhost, root;
|
|
--disable_ps2_protocol
|
|
select get_lock('a:5', 10);
|
|
--enable_ps2_protocol
|
|
|
|
connection default;
|
|
#set innodb_snapshot_isolation=ON;
|
|
send select id,vec_distance_euclidean(v, x'1f4d053f7056493f937da03dd8c97a3f220cbb3c926c1c3facca213ec0618a3e') d from t1
|
|
where get_lock(concat('a:', id), 10)+id < 11 order by d limit 3;
|
|
|
|
connection con2;
|
|
let $wait_condition= select count(*) = 1 from information_schema.processlist where state = 'user lock';
|
|
source include/wait_condition.inc;
|
|
|
|
delete from t1 where id=2;
|
|
|
|
--disable_ps2_protocol
|
|
select release_all_locks();
|
|
--enable_ps2_protocol
|
|
|
|
disconnect con2;
|
|
connection default;
|
|
--replace_regex /(\.\d{5})\d+/\1/
|
|
reap;
|
|
|
|
drop table t1, t2;
|
|
|
|
--echo #
|
|
--echo # MDEV-34989 After selecting from empty table with vector key the next insert hangs
|
|
--echo #
|
|
create table t (v vector(5) not null, vector key(v)) engine=InnoDB;
|
|
select vec_distance_euclidean(v, x'B047263C9F87233fcfd27e3eae493e3f0329f43e') as e from t order by e limit 1;
|
|
insert into t values (x'B047263C9F87233fcfd27e3eae493e3f0329f43e');
|
|
drop table t;
|
|
|
|
--echo #
|
|
--echo # MDEV-35039 Number of indexes inside InnoDB differs from that defined in MariaDB after altering table with vector key
|
|
--echo #
|
|
create table t (v vector(1) not null, vector index (v)) row_format=compressed engine=innodb;
|
|
alter table t add f int;
|
|
insert into t values (x'00000000',1);
|
|
show create table t;
|
|
drop table t;
|
|
|
|
--echo #
|
|
--echo # MDEV-35055 ASAN errors in TABLE_SHARE::lock_share upon committing transaction after FLUSH on table with vector key
|
|
--echo #
|
|
create table t (pk int primary key, v vector(3) not null, vector index(v)) engine=innodb;
|
|
start transaction;
|
|
insert into t values (1,vec_fromtext('[1,2,3]'));
|
|
connect con1,localhost,root;
|
|
flush tables;
|
|
disconnect con1;
|
|
connection default;
|
|
commit;
|
|
drop table t;
|
|
|
|
--echo #
|
|
--echo # MDEV-35060 Assertion failure upon DML on table with vector under lock
|
|
--echo #
|
|
create table t (a int, v vector(1) not null, vector(v)) engine=innodb;
|
|
insert into t values (1,x'00000000'),(2,x'00000000');
|
|
lock table t write;
|
|
delete from t;
|
|
drop table t;
|
|
|
|
--echo #
|
|
--echo # MDEV-35061 XA PREPARE "not supported by the engine" from storage engine mhnsw, memory leak
|
|
--echo #
|
|
connect con1,localhost,root;
|
|
create table t (a int, v vector(1) not null, vector(v)) engine=innodb;
|
|
xa start 'x';
|
|
insert into t values (1,x'00000000');
|
|
xa end 'x';
|
|
--error ER_GET_ERRNO
|
|
xa prepare 'x';
|
|
disconnect con1;
|
|
connection default;
|
|
#xa commit 'x';
|
|
xa recover;
|
|
DROP TABLE t;
|
|
|
|
--echo #
|
|
--echo # MDEV-35104 Invalid (old?) table or database name upon DDL on table with vector key and unique key
|
|
--echo #
|
|
create table t (f varchar(1024) not null, v vector(2) not null, unique(f)) engine=innodb charset=utf8mb3;
|
|
alter table t add vector (v);
|
|
drop table t;
|
|
|
|
--echo #
|
|
--echo # MDEV-35159 Assertion `tab->join->select_limit < (~ (ha_rows) 0)' fails upon forcing vector key
|
|
--echo #
|
|
create table t (v vector(1) not null, vector vec(v), unique vu(v)) engine=innodb;
|
|
select * from t force index(vec) order by v;
|
|
drop table t;
|
|
|
|
--echo #
|
|
--echo # MDEV-35203 ASAN errors or assertion failures in row_sel_convert_mysql_key_to_innobase upon query from table with usual key on vector field
|
|
--echo #
|
|
create table t (v vector(1), key(v)) engine=innodb;
|
|
select v from t where v = vec_fromtext('[1]');
|
|
drop table t;
|
|
|
|
--echo #
|
|
--echo # MDEV-35130 Assertion fails in trx_t::check_bulk_buffer upon CREATE.. SELECT with vector key
|
|
--echo #
|
|
CREATE TABLE t (pk INT PRIMARY KEY, v VECTOR(5) NOT NULL, VECTOR(v)) ENGINE=InnoDB SELECT 1 AS pk, x'f09baa3ea172763f123def3e0c7fe53e288bf33e' AS v;
|
|
DROP TABLE t;
|
|
|
|
--echo #
|
|
--echo # MDEV-35287 ER_KEY_NOT_FOUND upon INSERT into InnoDB table with vector key under READ COMMITTED
|
|
--echo #
|
|
set unique_checks=0, foreign_key_checks=0;
|
|
set session transaction isolation level read committed;
|
|
create table t (v vector(1) not null, vector (v)) engine=innodb;
|
|
insert into t values (0x31313131),(0x32323232);
|
|
drop table t;
|
|
set unique_checks=default, foreign_key_checks=default;
|
|
set session transaction isolation level repeatable read;
|
|
|
|
--echo #
|
|
--echo # MDEV-35214 Server crashes in FVectorNode::gref_len with insufficient mhnsw_max_cache_size
|
|
--echo #
|
|
set global mhnsw_max_cache_size= 1024*1024*2;
|
|
create table t (v vector(1) not null, vector(v)) engine=innodb;
|
|
--disable_view_protocol
|
|
start transaction;
|
|
insert into t select 0x30303030 from seq_1_to_200;
|
|
select v from t order by vec_distance_euclidean(v, 0x31313131) limit 2;
|
|
commit;
|
|
--enable_view_protocol
|
|
drop table t;
|
|
set global mhnsw_max_cache_size= default;
|
|
|
|
--echo #
|
|
--echo # MDEV-35319 ER_LOCK_DEADLOCK not detected upon DML on table with vector key, server crashes
|
|
--echo #
|
|
create table t (pk int, b vector(1) not null, vector(b), primary key (pk)) engine=innodb;
|
|
insert into t values (1,0x31313131),(2,0x32323232);
|
|
start transaction;
|
|
insert into t values (3,0x33333333);
|
|
|
|
--connect con1,localhost,root
|
|
--send DELETE from t
|
|
|
|
--connection default
|
|
--let $show_statement= show processlist
|
|
--let $field= State
|
|
--let $condition= = 'Updating'
|
|
--source include/wait_show_condition.inc
|
|
set innodb_lock_wait_timeout= 1;
|
|
delete from t;
|
|
rollback;
|
|
--connection con1
|
|
--error ER_LOCK_DEADLOCK
|
|
--reap
|
|
drop table t;
|
|
--disconnect con1
|