Hi Jan, On Tue, Jan 21, 2014 at 12:18:13PM +0200, Jan Lindström wrote:
Hi,
While the original problem is tokudb related and below fix does nicely address it and I'm sure that you did run regression testing, my question is does below change have any affect on other storage engines ? Why not add test case that is run all/most of the supported storage engines ?
The problem is that I am not aware of any location where I could add a test and then it would be run for every available storage engine. The effect of the change is that now EXPLAIN INSERT ... SELECT does not make a handler->start_bulk_insert() call that's not paired with a end_bulk_insert() call.
R: Jan
At file:///home/psergey/chroot/saucy-x64/home/psergey/dev2/10.0/
------------------------------------------------------------ revno: 3963 revision-id: psergey@askmonty.org-20140121100256-pwiacbt684azw6kj parent: elenst@opensuse.home-20131228163657-kk32bmtqogy61mwm committer: Sergey Petrunya <psergey@askmonty.org> branch nick: 10.0 timestamp: Tue 2014-01-21 14:02:56 +0400 message: MDEV-5426: Assertion `toku_ft_needed_unlocked(src_h)' failed (errno=11) ... - the problem was caused by EXPLAIN INSERT SELECT. For that statement, the code would call select_insert::prepare2(), which would call handler->ha_start_bulk_insert(). The corresponding handler->end_bulk_insert() call is made from select_insert::send_eof or select_insert::abort_result_set which are never called for EXPLAIN INSERT SELECT. - Fixed by re-using approach of mysql-5.6: don't call ha_start_bulk_insert() if we are in EXPLAIN. === modified file 'sql/sql_insert.cc' --- a/sql/sql_insert.cc 2013-12-16 12:02:21 +0000 +++ b/sql/sql_insert.cc 2014-01-21 10:02:56 +0000 @@ -3555,7 +3555,8 @@ int select_insert::prepare2(void) { DBUG_ENTER("select_insert::prepare2"); if (thd->lex->current_select->options & OPTION_BUFFER_RESULT && - thd->locked_tables_mode <= LTM_LOCK_TABLES) + thd->locked_tables_mode <= LTM_LOCK_TABLES && + !thd->lex->describe) table->file->ha_start_bulk_insert((ha_rows) 0); DBUG_RETURN(0); }
=== added file 'storage/tokudb/mysql-test/tokudb_mariadb/r/mdev5426.result' --- a/storage/tokudb/mysql-test/tokudb_mariadb/r/mdev5426.result 1970-01-01 00:00:00 +0000 +++ b/storage/tokudb/mysql-test/tokudb_mariadb/r/mdev5426.result 2014-01-21 10:02:56 +0000 @@ -0,0 +1,6 @@ +CREATE TABLE t1 (i INT) ENGINE=TokuDB; +EXPLAIN INSERT INTO t1 SELECT * FROM t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 1 Using temporary +INSERT INTO t1 SELECT * FROM t1; +DROP TABLE t1;
=== added file 'storage/tokudb/mysql-test/tokudb_mariadb/t/mdev5426.test' --- a/storage/tokudb/mysql-test/tokudb_mariadb/t/mdev5426.test 1970-01-01 00:00:00 +0000 +++ b/storage/tokudb/mysql-test/tokudb_mariadb/t/mdev5426.test 2014-01-21 10:02:56 +0000 @@ -0,0 +1,10 @@ + +CREATE TABLE t1 (i INT) ENGINE=TokuDB; +EXPLAIN INSERT INTO t1 SELECT * FROM t1; + +--connect con1,localhost,root,,test +INSERT INTO t1 SELECT * FROM t1; + +--connection default +--disconnect con1 +DROP TABLE t1;
-- BR Sergei -- Sergei Petrunia, Software Developer MariaDB | Skype: sergefp | Blog: http://s.petrunia.net/blog