mariadb/mysql-test/suite/vcol/r/index.result
Sergei Golubchik 5d650d366d MDEV-16961 Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' failed upon concurrent DELETE and DDL with virtual blob column
After iterating all fields and setting PART_INDIRECT_KEY_FLAG as
necessary, TABLE::mark_columns_used_by_virtual_fields() remembers
in TABLE_SHARE that this operation was done and need not be repeated.

But as the flag is set in TABLE_SHARE, PART_INDIRECT_KEY_FLAG must
be set in TABLE_SHARE::field[], not only in TABLE::field[].

Otherwise all new TABLEs opened from this TABLE_SHARE will
never have it.
2018-08-22 22:18:44 +02:00

101 lines
2.3 KiB
Text

#
# Test table with a key that consists of indirect virtual fields
#
CREATE TABLE t1 (a int, b int as (a+1) virtual, c int as (b+1) virtual, index(c)) engine=myisam;
insert into t1 (a) values (1),(2),(3);
update t1 set a=5 where a=3;
delete from t1 where a=1;
select * from t1;
a b c
2 3 4
5 6 7
select * from t1 where c=7;
a b c
5 6 7
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
select * from t1;
a b c
2 3 4
5 6 7
drop table t1;
CREATE TABLE t1 (a int, b int as (a+1) virtual, c int as (b+1) virtual, index(c)) engine=innodb;
insert into t1 (a) values (1),(2),(3);
update t1 set a=5 where a=3;
delete from t1 where a=1;
select * from t1;
a b c
2 3 4
5 6 7
select * from t1 where c=7;
a b c
5 6 7
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
select * from t1;
a b c
2 3 4
5 6 7
drop table t1;
#
# MDEV-15114
# ASAN heap-use-after-free in mem_heap_dup or
# dfield_data_is_binary_equal
#
CREATE TABLE t1 (
pk INT,
extra tinyint,
c TEXT,
vc LONGTEXT AS (c) VIRTUAL,
i INT,
PRIMARY KEY(pk),
UNIQUE(i),
INDEX(vc(64))
) ENGINE=InnoDB;
INSERT INTO t1 (pk,extra, c, i) VALUES (1, 10, REPEAT('foo ',15000),0);
REPLACE INTO t1 (pk,extra, c,i) SELECT pk,extra+10, c,i FROM t1;
select pk, extra, left(c, 10), length(c), left(vc,10), length(vc), extra from t1;
pk extra left(c, 10) length(c) left(vc,10) length(vc) extra
1 20 foo foo fo 60000 foo foo fo 60000 20
DROP TABLE t1;
#
# Update of deleted row with binary logging enabled
#
SET BINLOG_FORMAT=row;
CREATE TABLE t1 (
pk INT,
c TEXT,
vc LONGTEXT AS (c) VIRTUAL,
i INT,
PRIMARY KEY(pk),
UNIQUE(i),
INDEX(vc(64))
) ENGINE=InnoDB;
INSERT INTO t1 (pk,c,i) VALUES (1,REPEAT('foo ',15000),10);
INSERT INTO t1 (pk,c,i) VALUES (2,REPEAT('bar ',15000),11);
connect c1,localhost,root,,;
connection c1;
begin;
DELETE from t1 WHERE pk=1;
connection default;
update t1 set pk=1 where pk=2;
connection c1;
commit;
connection default;
select pk, left(c, 10), length(c), i from t1;
pk left(c, 10) length(c) i
1 bar bar ba 60000 11
drop table t1;
disconnect c1;
CREATE TABLE t1 (b BLOB, vb TEXT AS (b) PERSISTENT, KEY(vb(64))) ENGINE=InnoDB;
INSERT INTO t1 (b) VALUES ('foo');
connect con1,localhost,root,,test;
CREATE TABLE t2 LIKE t1;
connection default;
DELETE FROM t1;
connection con1;
disconnect con1;
connection default;
DROP TABLE t1, t2;