Details
-
Bug
-
Status: Stalled (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.2(EOL), 10.3(EOL), 10.4(EOL), 10.5, 10.6
-
None
Description
This bug is reported to fix the crash in InnoDB.
The root cause of the problem is however in the server, which allows to use in indexed virtual columns unsafe expressions depending on the session varianbles. For details see:
- MDEV-34037 - @@time_zone
- MDEV-34038 - @@dev_precision_increment
- MDEV-34039 - @@max_allowed_packet
The following scripts demonstrate the crash in InnoDB on @@time_zone change. However, a similar crash can also happen on @@div_precision_increment and @@max_allowed_packet. This needs to be checked.
This script demonstrates the crash:
SET time_zone='+00:00'; |
CREATE OR REPLACE TABLE t1 ( |
a DATETIME,
|
v TIMESTAMP GENERATED ALWAYS AS (a), |
KEY(v) |
);
|
INSERT INTO t1 (a) VALUES ('2001-01-01 10:20:30'); |
SET time_zone='+10:00'; |
UPDATE t1 SET a='2000-01-01 10:20:30'; |
crashes with the following stack trace:
#3 0x00007ffff76eba26 in __assert_fail () from /lib64/libc.so.6
|
#4 0x0000000000f9eede in row_upd_sec_index_entry (node=0x7fff68070158,
|
thr=0x7fff68073798)
|
at /home/bar/maria-git/server.10.4.frac2/storage/innobase/row/row0upd.cc:2425
|
#5 0x0000000000f9f6c9 in row_upd_sec_step (node=0x7fff68070158,
|
thr=0x7fff68073798)
|
at /home/bar/maria-git/server.10.4.frac2/storage/innobase/row/row0upd.cc:2539
|
#6 0x0000000000fa256e in row_upd (node=0x7fff68070158, thr=0x7fff68073798)
|
at /home/bar/maria-git/server.10.4.frac2/storage/innobase/row/row0upd.cc:3315
|
#7 0x0000000000fa29d5 in row_upd_step (thr=0x7fff68073798)
|
at /home/bar/maria-git/server.10.4.frac2/storage/innobase/row/row0upd.cc:3430
|
#8 0x0000000000f4134b in row_update_for_mysql (prebuilt=0x7fff6806f678)
|
at /home/bar/maria-git/server.10.4.frac2/storage/innobase/row/row0mysql.cc:1889
|
#9 0x0000000000da6a72 in ha_innobase::update_row (this=0x7fff6806dd88,
|
old_row=0x7fff680698e0 "\371\231g\202\245\036:O\315N\245\245\245\245\245\245\b\231\006h\377\177",
|
new_row=0x7fff680698d0 "\371\231dB\245\036\070mHN\245\245\245\245\245\245\371\231g\202\245\036:O\315N\245\245\245\245\245\245\b\231\006h\377\177")
|
at /home/bar/maria-git/server.10.4.frac2/storage/innobase/handler/ha_innodb.cc:8841
|
#10 0x0000000000b7195f in handler::ha_update_row (this=0x7fff6806dd88,
|
old_data=0x7fff680698e0 "\371\231g\202\245\036:O\315N\245\245\245\245\245\245\b\231\006h\377\177",
|
new_data=0x7fff680698d0 "\371\231dB\245\036\070mHN\245\245\245\245\245\245\371\231g\202\245\036:O\315N\245\245\245\245\245\245\b\231\006h\377\177")
|
at /home/bar/maria-git/server.10.4.frac2/sql/handler.cc:6719
|
#11 0x00000000009242f6 in mysql_update (thd=0x7fff68000d60,
|
table_list=0x7fff68014250, 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.frac2/sql/sql_update.cc:1047
|
This happens because DATETIME -> TIMESTAMP conversion depends in the @@time_zone system variable.
The same problem is repeatable with TIMESTAMP->DATETIME conversion:
SET time_zone='+00:00'; |
CREATE OR REPLACE TABLE t1 ( |
a TIMESTAMP, |
v DATETIME GENERATED ALWAYS AS (a), |
KEY(v) |
);
|
INSERT INTO t1 (a) VALUES ('2001-01-01 10:20:30'); |
SET time_zone='+10:00'; |
UPDATE t1 SET a='2000-01-01 10:20:30'; |
Attachments
Issue Links
- relates to
-
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-18156 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 PAD_CHAR_TO_FULL_LENGTH
- 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-34025 Virtual columns do not check assignment cast validity
- Closed
-
MDEV-20618 Assertion `btr_validate_index(index, 0, false)' failed in row_upd_sec_index_entry
- Closed
-
MDEV-20661 Virtual fields are not recalculated on system fields value assignment
- 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-22061 InnoDB: Assertion of missing row in sec index row_start upon REPLACE on a system-versioned table
- Closed
-
MDEV-26405 Assertion `0' failed in row_upd_sec_index_entry
- Closed
-
MDEV-34037 DATETIME <-> TIMESTAMP conversion in a virtual column corrups the table on @@time_zone change
- In Review
-
MDEV-34038 A division in an indexed virtual column corrupts the table on @@dev_precision_increment change
- Open
-
MDEV-34039 Some string functions in a virtual column lead the table corruption on @@max_allowed_packet change
- Open