Details
-
Bug
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
-
10.2(EOL), 10.3(EOL), 10.4(EOL)
Description
Note: It might well be a duplicate of MDEV-18153, the results are exactly the same, but it's a different SQL_MODE (and thus different affected versions), and different table structures, so I'm filing it separately just in case.
CREATE TABLE t1 (c CHAR(8), v BINARY(8) AS (c), KEY(v)); |
INSERT INTO t1 (c) VALUES ('foo') ; |
|
SET SQL_MODE= 'PAD_CHAR_TO_FULL_LENGTH'; |
DELETE FROM t1 WHERE c <> 'bar'; |
|
# Cleanup
|
DROP TABLE t1; |
10.2 0c20b247de with MyISAM |
mysqltest: At line 5: query 'DELETE FROM t1 WHERE c <> 'bar'' failed: 126: Index for table './test/t1.MYI' is corrupt; try to repair it
|
10.2 debug 0c20b247de with InnoDB |
2019-01-06 22:02:13 140655082366720 [ERROR] InnoDB: Record in index `v` of table `test`.`t1` was not found on update: TUPLE (info_bits=0, 2 fields): {[8]foo (0x666F6F2020202020),[6] (0x000000000200)} at: COMPACT RECORD(info_bits=0, 2 fields): {[8]foo (0x666F6F0000000000),[6] (0x000000000200)}
|
mysqld: /data/src/10.2/storage/innobase/row/row0upd.cc:2436: dberr_t row_upd_sec_index_entry(upd_node_t*, que_thr_t*): Assertion `0' failed.
|
190106 22:02:13 [ERROR] mysqld got signal 6 ;
|
|
#7 0x00007fecd7f19ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
|
#8 0x000055bf73ba59bb in row_upd_sec_index_entry (node=0x7fec88136de0, thr=0x7fec880848a8) at /data/src/10.2/storage/innobase/row/row0upd.cc:2436
|
#9 0x000055bf73ba6031 in row_upd_sec_step (node=0x7fec88136de0, thr=0x7fec880848a8) at /data/src/10.2/storage/innobase/row/row0upd.cc:2549
|
#10 0x000055bf73ba82b2 in row_upd (node=0x7fec88136de0, thr=0x7fec880848a8) at /data/src/10.2/storage/innobase/row/row0upd.cc:3308
|
#11 0x000055bf73ba8603 in row_upd_step (thr=0x7fec880848a8) at /data/src/10.2/storage/innobase/row/row0upd.cc:3425
|
#12 0x000055bf73b4ec37 in row_update_for_mysql (prebuilt=0x7fec881362d8) at /data/src/10.2/storage/innobase/row/row0mysql.cc:1830
|
#13 0x000055bf73a1536b in ha_innobase::delete_row (this=0x7fec88135498, record=0x7fec880311d0 "\371foo foo ", '\245' <repeats 31 times>, "\030\022\003\210\354\177") at /data/src/10.2/storage/innobase/handler/ha_innodb.cc:9098
|
#14 0x000055bf73709360 in handler::ha_delete_row (this=0x7fec88135498, buf=0x7fec880311d0 "\371foo foo ", '\245' <repeats 31 times>, "\030\022\003\210\354\177") at /data/src/10.2/sql/handler.cc:6021
|
#15 0x000055bf73898cb4 in mysql_delete (thd=0x7fec88000b00, table_list=0x7fec88012530, conds=0x7fec88012ce8, order_list=0x7fec88005078, limit=18446744073709551615, options=0, result=0x0) at /data/src/10.2/sql/sql_delete.cc:583
|
#16 0x000055bf73484616 in mysql_execute_command (thd=0x7fec88000b00) at /data/src/10.2/sql/sql_parse.cc:4636
|
#17 0x000055bf7348ef51 in mysql_parse (thd=0x7fec88000b00, rawbuf=0x7fec88012448 "DELETE FROM t1 WHERE c <> 'bar'", length=31, parser_state=0x7fecd0385200, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:8015
|
#18 0x000055bf7347c88b in dispatch_command (command=COM_QUERY, thd=0x7fec88000b00, packet=0x7fec88096261 "DELETE FROM t1 WHERE c <> 'bar'", packet_length=31, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1826
|
#19 0x000055bf7347b1e2 in do_command (thd=0x7fec88000b00) at /data/src/10.2/sql/sql_parse.cc:1379
|
#20 0x000055bf735cdccd in do_handle_one_connection (connect=0x55bf772692d0) at /data/src/10.2/sql/sql_connect.cc:1335
|
#21 0x000055bf735cda5a in handle_one_connection (arg=0x55bf772692d0) at /data/src/10.2/sql/sql_connect.cc:1241
|
#22 0x000055bf739f397c in pfs_spawn_thread (arg=0x55bf771af6d0) at /data/src/10.2/storage/perfschema/pfs.cc:1862
|
#23 0x00007fecd9bf0494 in start_thread (arg=0x7fecd0386700) at pthread_create.c:333
|
#24 0x00007fecd7fd693f in clone () from /lib/x86_64-linux-gnu/libc.so.6
|
10.2 non-debug 0c20b247de with InnoDB |
2019-01-06 22:03:36 140321956206336 [ERROR] InnoDB: Record in index `v` of table `test`.`t1` was not found on update: TUPLE (info_bits=0, 2 fields): {[8]foo (0x666F6F2020202020),[6] (0x000000000200)} at: COMPACT RECORD(info_bits=0, 2 fields): {[8]foo (0x666F6F0000000000),[6] (0x000000000200)}
|
Attachments
Issue Links
- causes
-
MDEV-33717 ERROR 1901 (HY000) at line 29: Function or expression ... cannot be used in the GENERATED ALWAYS AS clause of ...
-
- Closed
-
- relates to
-
MDEV-17890 Server crash on DELETE with YEAR field with truncated expr
-
- Closed
-
-
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
-
- Closed
-
-
MDEV-20472 Document MDEV-18156 - sql_mode dependency in vcol expressions
-
- Closed
-
-
MDEV-18153 Assertion `0' or Assertion `btr_validate_index(index, 0)' failed in row_upd_sec_index_entry or error code 126: Index is corrupted upon UPDATE with TIME_ROUND_FRACTIONAL
-
- Closed
-
-
MDEV-20610 Assertion failed or btr_validate_index(..) in row_upd_sec_index_entry on a time_zone change
-
- Stalled
-
-
MDEV-20618 Assertion `btr_validate_index(index, 0, false)' failed in row_upd_sec_index_entry
-
- Closed
-
-
MDEV-20763 Table corruption or Assertion `btr_validate_index(index, 0, false)' failed in row_upd_sec_index_entry with virtual column and EMPTY_STRING_IS_NULL SQL mode
-
- Closed
-
-
MDEV-28190 sql_mode makes MDEV-371 virtual column expressions nondeterministic
-
- Closed
-
-
MDEV-29777 Unable to create stored generated column with "CONCAT" and a "CHAR" column as function argument.
-
- Closed
-
The problem happens because after changing sql_mode, the value of the column 'v' changes from CONCAT('bar',0x0000000000) to CONCAT('bar', 0x2020202020).
The engine then notices that the index value does not match to the column value and reports an index corruption.
This script demonstrates the difference:
+------------------+
| nopad |
+------------------+
| 666F6F0000000000 |
+------------------+
+------------------+
| pad |
+------------------+
| 666F6F2020202020 |
+------------------+
A possible solution would be to disallow CHAR columns inside virtual column expressions.