Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.2.2, 10.3.0, 10.4.0, 10.5.0, 10.6.0
Description
A peculiar design constraint of MariaDB virtual columns is that evaluation errors for non-indexed virtual columns are allowed (only reported when attempting to read from the virtual column).
If an index on a virtual column exists, then an INSERT that causes (say) a division by 0 would be rejected, like the test case below shows. But, we are not consistently enforcing this rule during online CREATE INDEX: we wrongly allow erroneous data to be inserted into the secondary indexes as NULL values.
--source include/have_innodb.inc
|
--source include/have_debug.inc
|
--source include/have_debug_sync.inc
|
|
CREATE TABLE t(a INT, b INT AS (a/a) VIRTUAL) ENGINE=InnoDB; |
|
INSERT INTO t SET a=0; |
SELECT * FROM t; |
DELETE FROM t; |
|
ALTER TABLE t ADD INDEX(b); |
--error ER_DIVISION_BY_ZERO
|
INSERT INTO t SET a=0; |
|
ALTER TABLE t DROP INDEX b; |
|
connect (con1,localhost,root,,); |
SET DEBUG_SYNC = 'row_log_apply_before SIGNAL scanned WAIT_FOR apply'; |
send ALTER TABLE t ADD INDEX(b); |
|
connection default; |
SET DEBUG_SYNC = 'now WAIT_FOR scanned'; |
INSERT INTO t SET a=0; |
SET DEBUG_SYNC = 'now SIGNAL apply'; |
|
connection con1; |
--echo # ERROR 1: The ALTER TABLE fails to fail!
|
#--error ER_DIVISION_BY_ZERO |
reap;
|
connection default; |
|
SELECT * FROM t; |
CHECK TABLE t; |
|
DELETE FROM t; |
ALTER TABLE t DROP INDEX b; |
connection con1; |
SET DEBUG_SYNC = 'row_log_apply_after SIGNAL applied WAIT_FOR commit'; |
send ALTER TABLE t ADD INDEX(b); |
|
connection default; |
SET DEBUG_SYNC = 'now WAIT_FOR applied'; |
INSERT INTO t SET a=0; |
SET DEBUG_SYNC = 'now SIGNAL commit'; |
|
connection con1; |
--echo # ERROR 2: The ALTER TABLE fails to fail!
|
#--error ER_DIVISION_BY_ZERO |
reap;
|
connection default; |
|
CHECK TABLE t; |
SELECT * FROM t; |
SHOW CREATE TABLE t; |
|
SET DEBUG_SYNC = RESET; |
DROP TABLE t; |
I think that the logic needs to be fixed so that both ERROR cases highlighted by the test will be reported correctly.
Attachments
Issue Links
- relates to
-
MDEV-20154 Assertion `len <= col->len || ((col->mtype) == 5 || (col->mtype) == 14)' failed in row_merge_buf_add
- Closed
-
MDEV-26229 Innodb crash after insert while concurrent ADD INDEX is run
- Stalled