Bug #115913 instant ddl crash
Submitted: 23 Aug 2024 7:52 Modified: 23 Aug 2024 10:08
Reporter: zongyi chen (OCA) Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server Severity:S6 (Debug Builds)
Version: OS:Any
Assigned to: CPU Architecture:Any
Tags: instant ddl

[23 Aug 2024 7:52] zongyi chen
Description:
CREATE TABLE `tt_1056` (
  `a` int DEFAULT NULL,
  `d1` double DEFAULT NULL,
  `v2` varchar(14) DEFAULT NULL,
  `t3` tinyint(1) DEFAULT NULL,
  `v4` varchar(16) DEFAULT NULL,
  `i5` int DEFAULT NULL,
  `i6` int NOT NULL AUTO_INCREMENT,
  `gN101` varchar(16) GENERATED ALWAYS AS (concat(substr(`v4`,1,11),substr(`v4`,1,5))) VIRTUAL,
  KEY `tt_1056i0` (`d1` DESC,`i5`,`i6`,`t3`,`v4` DESC,`v2`),
  KEY `tt_1056i1` (`i6` DESC,`t3` DESC,`i5`),
  KEY `tt_1056i2` (`i5`),
  KEY `tt_1056i3` (`i5`,`i6`)
);

insert into tt_1056(a, d1, v2, t3, v4, i5, i6) values(1, 0, 'test', 1, '', 1, 587891);

alter table tt_1056 drop column a,algorithm = instant;

insert into tt_1056(d1, v2, t3, v4, i5, i6) values(0, 'test', 1, '', 1, 587892);

START TRANSACTION;

DELETE FROM tt_1056;

SET DEBUG = "+d, compare_end_range";

SELECT * FROM tt_1056  WHERE gN101 = 'test';

UPDATE tt_1056 SET i6 = 587891 WHERE d1 = 0.00000;

SET DEBUG = "-d, compare_end_range";

COMMIT;

DROP TABLE tt_1056;

How to repeat:
CREATE TABLE `tt_1056` (
  `a` int DEFAULT NULL,
  `d1` double DEFAULT NULL,
  `v2` varchar(14) DEFAULT NULL,
  `t3` tinyint(1) DEFAULT NULL,
  `v4` varchar(16) DEFAULT NULL,
  `i5` int DEFAULT NULL,
  `i6` int NOT NULL AUTO_INCREMENT,
  `gN101` varchar(16) GENERATED ALWAYS AS (concat(substr(`v4`,1,11),substr(`v4`,1,5))) VIRTUAL,
  KEY `tt_1056i0` (`d1` DESC,`i5`,`i6`,`t3`,`v4` DESC,`v2`),
  KEY `tt_1056i1` (`i6` DESC,`t3` DESC,`i5`),
  KEY `tt_1056i2` (`i5`),
  KEY `tt_1056i3` (`i5`,`i6`)
);

insert into tt_1056(a, d1, v2, t3, v4, i5, i6) values(1, 0, 'test', 1, '', 1, 587891);

alter table tt_1056 drop column a,algorithm = instant;

insert into tt_1056(d1, v2, t3, v4, i5, i6) values(0, 'test', 1, '', 1, 587892);

START TRANSACTION;

DELETE FROM tt_1056;

SET DEBUG = "+d, compare_end_range";

SELECT * FROM tt_1056  WHERE gN101 = 'test';

UPDATE tt_1056 SET i6 = 587891 WHERE d1 = 0.00000;

SET DEBUG = "-d, compare_end_range";

COMMIT;

DROP TABLE tt_1056;
[23 Aug 2024 8:42] zongyi chen
fixed by:
@@ -2950,9 +2950,9 @@ static MY_ATTRIBUTE((warn_unused_result)) bool row_sel_store_mysql_field_func(
     }
   } else {
     /* Field is stored in the row. */
-
-    data = rec_get_nth_field_instant(rec, offsets, field_no, rec_index, &len,
-                                     &col_convert_heap);
+    const dict_index_t* index_tmp = clust_templ_for_sec == true ? prebuilt_index : rec_index;
+    data = rec_get_nth_field_instant(rec, offsets, field_no, index_tmp, &len,
+                                    &col_convert_heap);
 
     if (len == UNIV_SQL_NULL) {
       /* MySQL assumes that the field for an SQL
[23 Aug 2024 9:31] MySQL Verification Team
Hi Mr. chen,

Thank you very much for your bug report.

We tried to repeat it with 8.0.39, 8.4.2 and 9.0.1 and in each one we get the following error:

ERROR 1193 (HY000) at line 15: Unknown system variable 'DEBUG'

Hence, you have to add some definitions in your test case.

Can't repeat.
[23 Aug 2024 9:35] zongyi chen
refer to:https://bugs.mysql.com/bug.php?id=115890&thanks=4
is same bug
[23 Aug 2024 9:47] MySQL Verification Team
Hi Mr. chen,

You have not specified anywhere in  that this is a debug binary.

With debug binary, server crashes.

However, this is a duplicate bug of the following one:

https://bugs.mysql.com/bug.php?id=115890

Please, do not create duplicate bugs in our bugs forum.

Duplicate.
[23 Aug 2024 10:08] zongyi chen
it happened in realese too. 
SET DEBUG = "+d, compare_end_range";  is to make it stable to reproduce
[23 Aug 2024 10:16] MySQL Verification Team
Hi,

In 8.0.39 , 8.4.2 and 9.0.1 releases (our official binaries) we always get the same error:

ERROR 1193 (HY000) at line 15: Unknown system variable 'DEBUG'
[23 Aug 2024 11:20] MySQL Verification Team
Hi,

Only one more comment.

Without "SET DEBUG .....", our official release binaries of 8.0.39, 8.4.2 and 9.0.1 work without the problem what so ever .... We do not even get the slightest warning.

Duplicate.