Bug #50385 test suite fails without query cache
Submitted: 15 Jan 2010 22:39 Modified: 11 Mar 2014 21:18
Reporter: Sergei Golubchik Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Locking Severity:S3 (Non-critical)
Version:5.1 OS:Any
Assigned to: Assigned Account CPU Architecture:Any

[15 Jan 2010 22:39] Sergei Golubchik
Description:
in the parser in a few places the lock level depends on whether a query cache is compiled in, for example:

 insert_lock_option:
           /* empty */
           {
#ifdef HAVE_QUERY_CACHE
             /*
              If it is SP we do not allow insert optimisation whan result of
               insert visible only after the table unlocking but everyone can
               read table.
             */
             $$= (Lex->sphead ? TL_WRITE_DEFAULT : TL_WRITE_CONCURRENT_INSERT);
#else
             $$= TL_WRITE_CONCURRENT_INSERT;
#endif

The correct behavior is inside the ifdef - triggers (Lex->sphead != 0) should use TL_WRITE_DEFAULT that will be normal or low priority write lock depending on the top-level insert. There's a test case for that.

the behavior in the #else branch is wrong, the lock level in the trigger won't depend on the lock level of the top level insert.

How to repeat:
build without a query cache, run the test suite.

Suggested fix:
remove all #ifdef HAVE_QUERY_CACHE that affect lock levels from sql_yacc.yy
[17 Jan 2010 11:28] Sveta Smirnova
Thank you for the report.

Verified as described.
[17 Jan 2010 12:45] Sveta Smirnova
D1, because some of tests crash.

Failed tests: main.udf main.innodb_mysql  main.mysql_client_test main.func_misc main.sp_notembedded main.trigger
[11 Mar 2014 21:18] Paul Dubois
Fixed in 5.7.1.

Changes for test suite. No changelog entry needed.