[MDEV-20423] Assertion `0' failed or `btr_validate_index(index, 0, false)' in row_upd_sec_index_entry or error code 126: Index is corrupted upon DELETE with TIME_ROUND_FRACTIONAL Created: 2019-08-26  Updated: 2019-09-18  Resolved: 2019-09-18

Status: Closed
Project: MariaDB Server
Component/s: Data types, Virtual Columns
Affects Version/s: 10.4
Fix Version/s: 10.4.9, 10.5.0

Type: Bug Priority: Critical
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-18156 Assertion `0' failed or `btr_validate... Closed
relates to MDEV-20610 Assertion failed or btr_validate_inde... Confirmed
relates to MDEV-20618 Assertion `btr_validate_index(index, ... Closed

 Description   

This crash is very similar to MDEV-18156, but now with TIME_ROUND_FRACTIONAL instead of PAD_CHAR_TO_FULL_LENGTH.
It should be addressed in a separate patch after the fix for MDEV-18156 propagates to 10.4.

This crash is also very similar to MDEV-18153, but the generation expressions are different:

  • GENERATED ALWAYS AS (CAST(a AS DATETIME(3))) VIRTUAL
  • GENERATED ALWAYS AS (CAST(a AS TIME(3))) VIRTUAL

MDEV-18156 needs MDEV-18156 as a dependency. MDEV-18153 can possibly be fixed alone.

SET sql_mode='';
CREATE OR REPLACE TABLE t1 (
  a DATETIME(6),
  v VARCHAR(30) GENERATED ALWAYS AS (CAST(a AS DATETIME(3))) VIRTUAL,
  KEY (v)
);
INSERT IGNORE INTO t1 (a) VALUES ('2001-01-01 10:20:30.999999');
SELECT * FROM t1;
SET sql_mode=TIME_ROUND_FRACTIONAL;
FLUSH TABLES;
SELECT * FROM t1;
UPDATE t1 SET a='2001-01-02 10:20:30.999999';

#0  0x00007ffff76f357f in raise () from /lib64/libc.so.6
#1  0x00007ffff76dd895 in abort () from /lib64/libc.so.6
#2  0x00007ffff76dd769 in __assert_fail_base.cold.0 () from /lib64/libc.so.6
#3  0x00007ffff76eba26 in __assert_fail () from /lib64/libc.so.6
#4  0x0000000000eff9ac in row_upd_sec_index_entry (node=0x7fff60083cd0, thr=0x7fff60083fd8)
    at /home/bar/maria-git/server.10.4/storage/innobase/row/row0upd.cc:2429
#5  0x0000000000f0001e in row_upd_sec_step (node=0x7fff60083cd0, thr=0x7fff60083fd8)
    at /home/bar/maria-git/server.10.4/storage/innobase/row/row0upd.cc:2543
#6  0x0000000000f02736 in row_upd (node=0x7fff60083cd0, thr=0x7fff60083fd8)
    at /home/bar/maria-git/server.10.4/storage/innobase/row/row0upd.cc:3319
#7  0x0000000000f02a9d in row_upd_step (thr=0x7fff60083fd8)
    at /home/bar/maria-git/server.10.4/storage/innobase/row/row0upd.cc:3434
#8  0x0000000000eb654c in row_update_for_mysql (prebuilt=0x7fff60083518)
    at /home/bar/maria-git/server.10.4/storage/innobase/row/row0mysql.cc:1889
#9  0x0000000000d60723 in ha_innobase::update_row (this=0x7fff6001dcf8, 
    old_row=0x7fff6001d8a0 "\374\231g\202\245\036\017B?\027\062\060\060\061-01-01 10:20:31.000", 
    new_row=0x7fff6001d870 "\374\231g\204\245\036\017B?\027\062\060\060\061-01-02 10:20:31.000")
    at /home/bar/maria-git/server.10.4/storage/innobase/handler/ha_innodb.cc:8840
#10 0x0000000000b4bc0a in handler::ha_update_row (this=0x7fff6001dcf8, 
    old_data=0x7fff6001d8a0 "\374\231g\202\245\036\017B?\027\062\060\060\061-01-01 10:20:31.000", 
    new_data=0x7fff6001d870 "\374\231g\204\245\036\017B?\027\062\060\060\061-01-02 10:20:31.000")
    at /home/bar/maria-git/server.10.4/sql/handler.cc:6727
#11 0x000000000091b9ad in mysql_update (thd=0x7fff60000d60, table_list=0x7fff60014270, fields=..., 
    values=..., conds=0x0, order_num=0, order=0x0, limit=18446744073709551615, ignore=false, 
    found_return=0x7ffff41d6218, updated_return=0x7ffff41d6210)
    at /home/bar/maria-git/server.10.4/sql/sql_update.cc:1045
#12 0x0000000000820bc2 in mysql_execute_command (thd=0x7fff60000d60)
    at /home/bar/maria-git/server.10.4/sql/sql_parse.cc:4369
#13 0x000000000082cd07 in mysql_parse (thd=0x7fff60000d60, 
    rawbuf=0x7fff60014168 "UPDATE t1 SET a='2001-01-02 10:20:30.999999'", length=44, 
    parser_state=0x7ffff41d7000, is_com_multi=false, is_next_command=false)
    at /home/bar/maria-git/server.10.4/sql/sql_parse.cc:7908
#14 0x000000000081981c in dispatch_command (command=COM_QUERY, thd=0x7fff60000d60, 
    packet=0x7fff600085e1 "UPDATE t1 SET a='2001-01-02 10:20:30.999999'", packet_length=44, 
    is_com_multi=false, is_next_command=false) at /home/bar/maria-git/server.10.4/sql/sql_parse.cc:1842
#15 0x0000000000817fc6 in do_command (thd=0x7fff60000d60)

The same problem is repeatable with TIME type cast:

SET sql_mode='';
CREATE OR REPLACE TABLE t1 (
  a TIME(6),
  v VARCHAR(30) GENERATED ALWAYS AS (CAST(a AS TIME(3))) VIRTUAL,
  KEY (v)
);
INSERT IGNORE INTO t1 (a) VALUES ('10:20:30.999999');
SELECT * FROM t1;
SET sql_mode=TIME_ROUND_FRACTIONAL;
FLUSH TABLES;
SELECT * FROM t1;
UPDATE t1 SET a='11:20:30.999999';



 Comments   
Comment by Elena Stepanova [ 2019-08-26 ]

Looks very much like MDEV-18153, does it need to be separate?

Generated at Thu Feb 08 08:59:22 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.