mariadb/storage
Konstantin Osipov 3a856d4425 A fix and a test case for Bug#47648 "main.merge fails sporadically".
If a prepared statement used both a MyISAMMRG table and a stored 
function or trigger, execution could fail with "No such table"
error or crash. 
The error would come from a failure of the MyISAMMRG engine
to meet the expectations of the prelocking algorithm, 
in particular maintain lex->query_tables_own_last pointer
in sync with lex->query_tables_last pointer/the contents
of lex->query_tables. When adding merge children, the merge
engine would extend the table list. Then, when adding 
prelocked tables, the prelocking algorithm would use a pointer
to the last merge child to assign to lex->query_tables_own_last.
Then, when merge children were removed at the end of
open_tables(), lex->query_tables_own_last
was not updated, and kept pointing
to a removed merge child.

The fix ensures that query_tables_own_last is always in
sync with lex->query_tables_last.

This is a regression introduced by WL#4144 and present only
in next-4284 tree and 6.0.

mysql-test/r/merge.result:
  Update results (Bug#47648).
mysql-test/t/merge.test:
  Add a test case for Bug#47648.
  Update the result file to reflect a fix of another bug
  in MyISAMMRG code: not maintaining lex->query_tables_own_last
  allowed a stored function or trigger to modify a merge table
  which was already updated by the main statement.
  It is not allowed for other storage engines, and should
  not be allowed for MyISAMMRG.
storage/myisammrg/ha_myisammrg.cc:
  When adding children to the list of tables to open,
  make sure that we properly set lex->query_tables_own_last.
  When removing the children, update lex->query_tables_own_last
  if necessary.
2010-02-15 19:35:53 +03:00
..
archive Manual merge from mysql-trunk-merge. 2010-01-28 01:13:10 +03:00
blackhole WL#2360 Performance schema 2009-12-04 18:26:15 -07:00
csv Merge mysql-next-mr to mysql-next-mr-svoj. 2009-12-09 15:03:34 +04:00
example merge mysql-5.1-rep+2-delivery1 --> mysql-5.1-rpl-merge 2010-01-07 15:39:11 +00:00
federated WL#2360 Performance schema 2009-12-09 20:19:51 -07:00
heap WL#4738 streamline/simplify @@variable creation process 2009-12-22 10:35:56 +01:00
ibmdb2i Manual merge from mysql-next-mr. 2009-12-22 09:32:58 +03:00
innobase Merge next-mr -> next-4284. 2010-02-02 12:22:17 +03:00
myisam Merge next-mr -> next-4284 2010-02-03 16:43:03 +03:00
myisammrg A fix and a test case for Bug#47648 "main.merge fails sporadically". 2010-02-15 19:35:53 +03:00
ndb Manual merge from mysql-trunk-merge. 2010-01-28 01:13:10 +03:00
perfschema Manual merge from mysql-next-mr. 2010-02-15 14:16:49 +03:00
Makefile.am Backport WL#3653 to 5.1 to enable bundled innodb plugin. 2009-06-10 10:59:49 +02:00
mysql_storage_engine.cmake WL#4903 Plugin Service API part I 2009-11-02 21:05:42 +01:00