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.
This commit is contained in:
Sergei Golubchik 2018-08-22 22:06:40 +02:00
parent b0ef1b388b
commit 5d650d366d
3 changed files with 29 additions and 0 deletions

View file

@ -89,3 +89,13 @@ 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;

View file

@ -79,3 +79,19 @@ commit;
select pk, left(c, 10), length(c), i from t1;
drop table t1;
disconnect c1;
#
# 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
#
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)
--send CREATE TABLE t2 LIKE t1
--connection default
DELETE FROM t1;
--connection con1
--reap
--disconnect con1
--connection default
DROP TABLE t1, t2;

View file

@ -6736,7 +6736,10 @@ void TABLE::mark_columns_used_by_virtual_fields(void)
for (uint i= 0 ; i < s->fields ; i++)
{
if (bitmap_is_set(&tmp_set, i))
{
s->field[i]->flags|= PART_INDIRECT_KEY_FLAG;
field[i]->flags|= PART_INDIRECT_KEY_FLAG;
}
}
bitmap_clear_all(&tmp_set);
}