Skip to content

Commit 85a1c7b

Browse files
Dmitry Lenevdahlerlend
authored andcommitted
Follow-up to fix for bug#25817660: Combination of virtual index, foreign key and trigger asserts
The problem which was solved by original patch for handler::my_eval_gcolumn_expr_with_open() call affected handler::my_prepare_gcolumn_template() call too. The latter call too tried to initialize current LEX object before trying to open table. This happened even during regular processing and, indeed, destroyed the current statement context, causing an assert error in dispatch_command(). Similarly to the original patch we solve the problem by removing the calls to lex_start() and lex_end() from the handler::my_prepare_gcolumn_template(). This is safe since neither of thd->dd_client()->acquire(), open_table_uncached() nor innobase_build_v_templ_callback() use the current LEX object.
1 parent 8ecc34e commit 85a1c7b

File tree

4 files changed

+21
-3
lines changed

4 files changed

+21
-3
lines changed

mysql-test/r/foreign_key.result

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,17 @@ fld1
533533
SELECT * FROM t2;
534534
fld1 fld2
535535
2 2
536+
# The same test but with server restart before UPDATE.
537+
# Triggers different code path in InnoDB which was not
538+
# covered by original fix for the bug.
539+
# restart
540+
UPDATE t1 SET fld1= 3;
541+
SELECT * FROM t1;
542+
fld1
543+
3
544+
SELECT * FROM t2;
545+
fld1 fld2
546+
3 3
536547
DROP TABLE t2;
537548
DROP TABLE t1;
538549
#

mysql-test/suite/innodb/t/disabled.def

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,3 @@ analyze_table @solaris : Bug#22607584 2016-03-01 Shaohua Failing too
1717
innodb.innodb_tsof_use_2 @windows : Bug#25716110 2017-03-14 Anitha Fails consistently on windows
1818
innodb.skip_locked_nowait : Bug#25886814 2017-04-13 Allen Failing sporadically on PB2
1919
innodb.innodb_tsof_use_1 : Bug#26161492 2017-05-29 Erlend Fails sporadically
20-
virtual_fk_restart : Bug#25817660 2017-04-01 dlenev Debug assertion due virtual column support code

mysql-test/t/foreign_key.test

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,16 @@ UPDATE t1 SET fld1= 2;
516516
SELECT * FROM t1;
517517
SELECT * FROM t2;
518518

519+
--echo # The same test but with server restart before UPDATE.
520+
--echo # Triggers different code path in InnoDB which was not
521+
--echo # covered by original fix for the bug.
522+
523+
--source include/restart_mysqld.inc
524+
UPDATE t1 SET fld1= 3;
525+
526+
SELECT * FROM t1;
527+
SELECT * FROM t2;
528+
519529
DROP TABLE t2;
520530
DROP TABLE t1;
521531

sql/handler.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8773,7 +8773,6 @@ bool handler::my_prepare_gcolumn_template(THD *thd,
87738773
build_table_filename(path, sizeof(path) - 1 - reg_ext_length,
87748774
db_name, table_name, "", 0, &was_truncated);
87758775
DBUG_ASSERT(!was_truncated);
8776-
lex_start(thd);
87778776
bool rc= true;
87788777

87798778
MDL_ticket *mdl_ticket= NULL;
@@ -8805,7 +8804,6 @@ bool handler::my_prepare_gcolumn_template(THD *thd,
88058804
intern_close_table(table);
88068805
rc= false;
88078806
}
8808-
lex_end(thd->lex);
88098807
return rc;
88108808
}
88118809

0 commit comments

Comments
 (0)