Commit graph

5 commits

Author SHA1 Message Date
unknown
e9452db1c1 Fix for bug#19634 "Re-execution of multi-delete which involve trigger/stored
function crashes server".

Attempts to execute prepared multi-delete statement which involved trigger or
stored function caused server crashes (the same happened for such statements
included in stored procedures in cases when one tried to execute them more
than once).

The problem was caused by yet another incorrect usage of check_table_access()
routine (the latter assumes that table list which it gets as argument
corresponds to value LEX::query_tables_own_last). We solve this problem by
juggling with LEX::query_tables_own_last value when we call
check_table_access() for LEX::auxilliary_table_list (better solution is too
intrusive and should be done in 5.1).


mysql-test/r/sp-prelocking.result:
  Added test for bug#19634 "Re-execution of multi-delete which involve trigger/
  stored function crashes server".
mysql-test/t/sp-prelocking.test:
  Added test for bug#19634 "Re-execution of multi-delete which involve trigger/
  stored function crashes server".
sql/sql_parse.cc:
  To call safely check_table_access() for LEX::auxilliary_table_list we have
  to juggle with LEX::query_tables_own_last value.
2006-06-21 01:50:20 +04:00
unknown
1d73c16b87 A fix and a test case for Bug#15683 "crash, Function on nested
VIEWs, Prepared statement": we didn't mark the nested views
as 'prelockng placeholders' when building the prelocking list. 
This resulted in these views being processed (merged, materialized)
before they are actually used. 


mysql-test/r/sp-prelocking.result:
  Test results fixed (Bug#15683)
mysql-test/t/sp-prelocking.test:
  Add a test case for Bug#15683
sql/sql_view.cc:
  When initializing tables used in a view, inherite 
  its 'prelocking_placeholder' flag. This flag is set when we're 
  opening the view in order to build the prelocking list for a query.
  In this case we should only calculate the list to 
  prelock, and should not merge neither this view nor any of the 
  nested views, of there are any. The flag is used to indicate this 
  mode.
2006-03-28 15:06:29 +04:00
unknown
313ea47da4 Add new option "check-testcases" to mysql-test-run.pl
Cleanup the sideeffects from most of the  testcases with sideeffects.


mysql-test/mysql-test-run.pl:
  Add option "check-testcases" to mysql-test-run.pl
  Will execute "include/check-testcase.test" once before each tescase and record the output into "var/tmp/check-testcase.result"
  After the teastcase it will run again and this time compare the output with previously recorded file.
mysql-test/r/analyze.result:
  Drop table t1 at end of test
mysql-test/r/create_select_tmp.result:
  Drop table t1 at end of test
mysql-test/r/ctype_cp932.result:
  Drop table t1 at end of test
mysql-test/r/ctype_recoding.result:
  Drop table t1 at end of test
mysql-test/r/grant2.result:
  Drop user mysqltest_2 and mysqltest_A@'%'
mysql-test/r/join_outer.result:
  Drop view v1 to cleanup
mysql-test/r/ps_1general.result:
  Drop table t1 at end of test
mysql-test/r/query_cache.result:
  Drop function "f1"
mysql-test/r/read_only.result:
  Reset the "read_only" flag
mysql-test/r/rpl000001.result:
  Remove user "blafasel2"
mysql-test/r/rpl000017.result:
  Remove user "replicate"
mysql-test/r/rpl_failed_optimize.result:
  Drop table t1 to cleanup
mysql-test/r/rpl_flush_tables.result:
  Drop tables t3, t4, t5
mysql-test/r/rpl_ignore_revoke.result:
  Delete user "user_foo"
mysql-test/r/rpl_insert_id.result:
  Drop table t1 to cleanup
mysql-test/r/rpl_loaddata.result:
  Drop tyable t1 to cleanup
mysql-test/r/rpl_loaddata_rule_m.result:
  Drop tyable t1 to cleanup
mysql-test/r/rpl_loaddata_rule_s.result:
  Drop tyable t1 to cleanup
mysql-test/r/rpl_misc_functions.result:
  Drop tyable t1 to cleanup
mysql-test/r/rpl_multi_update3.result:
  Drop tyable t1 and t2 to cleanup
mysql-test/r/rpl_replicate_do.result:
  Drop tyable t1 to cleanup
mysql-test/r/rpl_skip_error.result:
  Drop tyable t1 to cleanup
mysql-test/r/rpl_slave_status.result:
  Drop tyable t1 to cleanup
mysql-test/r/sp-prelocking.result:
  Drop view v1 and tables t1, t2, t3 and t4 to cleanup
mysql-test/r/sp-security.result:
  Delete users to cleanup
  Delete remaining traces in tables_priv and procs_priv
mysql-test/r/subselect_innodb.result:
  Drop procedure p1 to cleanup
mysql-test/r/trigger-compat.result:
  Drop trigger wl2818_trg1 and wl2818_trg2.
  Drop table t1, t2
  Drop database mysqltest_db1
  And the users "mysqltest_dfn@localhost" and "mysqltest_inv@localhost"
mysql-test/r/type_bit.result:
  Drop tables t1 and t2 to cleanup
mysql-test/r/variables.result:
  Set GLOBAL max_join_size to 10 as it originally was in variables-master.opt
mysql-test/r/view_grant.result:
  Dop user "test@localhost" to cleanup
mysql-test/t/analyze.test:
  Drop table t1 to cleanup
mysql-test/t/create_select_tmp.test:
  Drop table t1 to cleanup
mysql-test/t/ctype_cp932.test:
  Drop table t1 to cleanup
mysql-test/t/ctype_recoding.test:
  Drop table t1 to cleanup
mysql-test/t/fulltext_var.test:
  Restore the original ft_boolean_syntax
mysql-test/t/grant2.test:
  Drop users "mysqltest_2" and "mysqltest_A@'%'" to cleanup
mysql-test/t/innodb_cache.test:
  Reset query_cache_size to original value
mysql-test/t/join_outer.test:
  Drop view v1 to cleanup
mysql-test/t/ps_1general.test:
  Drop table t1 to cleanup
mysql-test/t/query_cache.test:
  Drop function "f1" to cleanup
mysql-test/t/read_only.test:
  Reset the readonly flag
mysql-test/t/rpl000001.test:
  Delete user "blafasel2" to cleanup
mysql-test/t/rpl000017.test:
  Delete user "replicate" to cleanup
mysql-test/t/rpl_failed_optimize.test:
  Drop table t1 to cleanup
mysql-test/t/rpl_flush_tables.test:
  Droip table t3, t4 and t5 to cleanup
mysql-test/t/rpl_ignore_revoke.test:
  Delet user "user_foo" to cleanup
mysql-test/t/rpl_insert_id.test:
  drop table t1 to cleanup
mysql-test/t/rpl_loaddata.test:
  Drop table t1 to cleanup
mysql-test/t/rpl_loaddata_rule_m.test:
  Drop table t1 to cleanup
mysql-test/t/rpl_loaddata_rule_s.test:
  Drop table t1 to cleanup
mysql-test/t/rpl_misc_functions.test:
  Drop table t1 to cleanup
mysql-test/t/rpl_multi_update3.test:
  Drop table t1 and t2 to cleanup
mysql-test/t/rpl_replicate_do.test:
  Drop table t1 to cleanup
mysql-test/t/rpl_skip_error.test:
  Drop table t1 to cleanup
mysql-test/t/rpl_slave_status.test:
  Drop table t1 to cleanup
mysql-test/t/sp-prelocking.test:
  Drop table t1, t2 t3 and t4 to cleanup
  Drop view v1
mysql-test/t/sp-security.test:
  Delete  test users from mysql.user, mysql.db, mysql.procs_priv and mysql.tables_priv
  Drop table t1 to cleanup
mysql-test/t/subselect_innodb.test:
  Drop procedure p1 to cleanup
mysql-test/t/trigger-compat.test:
  Drop trigger wl2818_trg1 and wl2818_trg2 to cleanup
  Drop table t1, t2
  Drop users
  drop database mysqltest_db1
mysql-test/t/type_bit.test:
  drop table t1 and t2 to cleanup
mysql-test/t/variables-master.opt:
  Increase max_join_size to 100.
mysql-test/t/variables.test:
  Set max_join_size to 10, which was the original value in variables-master.opt
mysql-test/t/view_grant.test:
  Drop the user "test@localhost"
mysql-test/include/check-testcase.test:
  New BitKeeper file ``mysql-test/include/check-testcase.test''
2006-01-26 17:54:34 +01:00
unknown
b323667ffc Prelocking-free SPs, post-review fixes:
* Don't activate prelocking mode for evaluating procedure arguments when it is not necessary.
* Code structure simplification and cleanup.
* Cleanup in .test files


mysql-test/r/sp-prelocking.result:
  Prelocking-free SPs, post-review fixes:
  Added comment, s/testdb/mysqltest/, fixed a wrong test (error wasnt reported because of known bug in mysqltestrun)
mysql-test/r/sp-security.result:
  Don't drop the table we're not using.
mysql-test/r/sp.result:
  Prelocking-free SPs, post-review fixes:
  remove redundant "drop table if exists t3" statements
mysql-test/t/sp-prelocking.test:
  Prelocking-free SPs, post-review fixes:
  Added comment, s/testdb/mysqltest/, fixed a wrong test (error wasnt reported because of known bug in mysqltestrun)
mysql-test/t/sp-security.test:
  Don't drop the table we're not using.
mysql-test/t/sp.test:
  Prelocking-free SPs, post-review fixes:
  remove redundant "drop table if exists t3" statements
sql/sp.cc:
  New, better defined, sp_get_prelocking_info() function to get info about
    statement prelocking options
sql/sp.h:
  Prelocking-free SPs, post-review fixes: New, better defined, sp_get_prelocking_info() 
  function to get info about statement prelocking options
sql/sp_cache.h:
  Prelocking-free SPs, post-review fixes: Amended the comments
sql/sp_head.cc:
  Prelocking-free SPs, post-review fixes: Amend the comments, simplify the code that 
  attaches removes statement's prelocking tables.
sql/sql_base.cc:
  Prelocking-free SPs, post-review fixes:
  * Use a better defined sp_get_prelocking_info() function to get info about 
    statement prelocking options
  * Don't activate prelocked mode for evaluation of SP arguments that use tables 
    but don't need prelocking.
sql/sql_class.cc:
  Prelocking-free SPs, post-review fixes: Initialize THD members in the order they are declared.
2005-08-03 03:37:32 +00:00
unknown
11abe15eab Added Non-prelocked SP execution: Now a PROCEDURE doesn't enter/leave prelocked mode for
its body, but lets each statement to get/release its own locks. This allows a broader set
of statements to be executed inside PROCEDUREs (but breaks replication)
This patch should fix BUG#8072, BUG#8766, BUG#9563, BUG#11126


mysql-test/r/sp-security.result:
  Drop tables this test attempts to create
mysql-test/r/sp-threads.result:
  Update test results
mysql-test/r/sp.result:
  Disabled a test that triggers BUG#11986, cleanup used tables when tests start.
mysql-test/r/view.result:
  Enabled a test case that now works with prelocking-free SPs
mysql-test/t/sp-security.test:
  Drop tables this test attempts to create
mysql-test/t/sp.test:
  Disabled a test that triggers BUG#11986, cleanup used tables when tests start.
mysql-test/t/view.test:
  Enabled a test case that now works with prelocking-free SPs
sql/handler.cc:
  Rename: thd->transaction.in_sub_stmt -> thd->in_sub_stmt
sql/item_func.cc:
  Rename: thd->transaction.in_sub_stmt -> thd->in_sub_stmt
sql/sp.cc:
  Non-prelocked SP execution: Added support for skipping prelocking of procedure body for
  "CALL proc(...)" statements.
sql/sp.h:
  Non-prelocked SP execution: Added support for skipping prelocking of procedure body for
  "CALL proc(...)" statements.
sql/sp_cache.h:
  Added comments
sql/sp_head.cc:
  Non-prelocked SP execution:
  * Try to unlock tables after PROCEDURE arguments have been evaluated.
  * Make sp_lex_keeper be able to execute in 2 modes: A) when already in prelocked mode
    B) when its statement enters/leaves prelocked mode itself.
sql/sp_head.h:
  Non-prelocked SP execution:  Make sp_lex_keeper to additionally keep list of tables it 
  needs to prelock when its statement enters/leaves prelocked mode on its own.
sql/sql_base.cc:
  Non-prelocked SP execution: Make open_tables() to
   * detect 'CALL proc(...)' and not to do prelocking for procedure body statements.
   * Make lex->query_tables_last to point precisely to a boundary in lex->query_tables 
     list where 'own' tables and views' tables end and added-for-prelocking tables begin.
     (it was not true before - view's tables could end up after query_tables_own_last)
sql/sql_class.cc:
  Rename: thd->transaction.in_sub_stmt -> thd->in_sub_stmt
sql/sql_class.h:
  Rename: thd->transaction.in_sub_stmt -> thd->in_sub_stmt
sql/sql_lex.cc:
  Non-prelocked SP execution: More rigourous cleanup in st_lex::cleanup_after_one_table_open()
sql/sql_parse.cc:
  Rename: thd->transaction.in_sub_stmt -> thd->in_sub_stmt, remove outdated comments
sql/sql_trigger.h:
  Rename: thd->transaction.in_sub_stmt -> thd->in_sub_stmt
2005-07-30 08:19:57 +00:00