1. 25 Aug, 2006 1 commit
    • unknown's avatar
      Fix for bug#21795: SP: sp_head::is_not_allowed_in_function() contains · dfb72bb9
      unknown authored
      erroneous check
      
      Problem: Actually there were two problems in the server code. The check
      for SQLCOM_FLUSH in SF/Triggers were not according to the existing
      architecture which uses sp_get_flags_for_command() from sp_head.cc .
      This function was also missing a check for SQLCOM_FLUSH which has a
      problem combined with prelocking. This changeset fixes both of these
      deficiencies as well as the erroneous check in
      sp_head::is_not_allowed_in_function() which was a copy&paste error.
      
      
      mysql-test/r/sp-error.result:
        update result
      mysql-test/r/trigger.result:
        update result
      mysql-test/t/sp-error.test:
        FLUSH can create a problem with prelocking, hence it's disabled.
        There is a better way to check this than a check in the parser.
        Now we use sp_get_flags_for_command() and the error returned is
        different.
      mysql-test/t/trigger.test:
        FLUSH can create a problem with prelocking, hence it's disabled.
        There is a better way to check this than a check in the parser.
        Now we use sp_get_flags_for_command() and the error returned is
        different.
      sql/sp_head.cc:
        FLUSH and RESET are not allowed inside a SF/Trigger.
        Because they don't imply a COMMIT sp_head::HAS_COMMIT_OR_ROLLBACK
        cannot be used. Two new flags were introduced for that reason.
      sql/sp_head.h:
        Don't check m_type as this check is erroneous. This is probably
        a copy and paste error when moving code from somewhere else. Another
        fact which supports this was prefixing the enum value with the name
        of class sp_head.
        
        Adding two new flags HAS_SQLCOM_RESET and HAS_SQLCOM_FLUSH. The values
        are 2048 and 4096 because in the 5.1 branch there are already new flags
        which are with values up-to 1024.
      sql/sql_parse.cc:
        FLUSH can cause a problem with prelocking in SF/Trigger and
        therefore is already disabled. RESET is also disabled because
        is handled by the same code as FLUSH. We won't allow RESET inside
        SF/Trigger at that stage without thorough analysis. The check for
        them is already done in the parser by calling
        is_not_allowed_in_function()
      sql/sql_yacc.yy:
        By listing SQLCOM_FLUSH as command which implies COMMIT
        in sp_get_flags_for_command() the check in sql_yacc.yy is
        obsolete.
      dfb72bb9
  2. 24 Aug, 2006 2 commits
    • unknown's avatar
      Fix for bug#21416 SP: Recursion level higher than zero needed for non-recursive call · ae78479b
      unknown authored
      The following procedure was not possible if max_sp_recursion_depth is 0
      create procedure show_proc() show create procedure show_proc;
        
      Actually there is no recursive call but the limit is checked.
        
      Solved by temporarily increasing the thread's limit just before the fetch from cache
      and decreasing after that.
      
      
      mysql-test/r/sp.result:
        update result
      mysql-test/t/sp.test:
        Test for bug #21416 SP: Recursion level higher than zero needed for non-recursive call
      sql/sp.cc:
        Increase the max_sp_recursion_depth temporarily for SHOW CREATE PROCEDURE call.
        This call is in fact not recursive but is counted as such. Outcome, it will work
        always but if max_sp_recursion_depth is reached we are going to cache one more
        sp_head instance.
      ae78479b
    • unknown's avatar
      BUG#21166: Prepared statement causes signal 11 on second execution · f98a9109
      unknown authored
      Changes in an item tree done by optimizer weren't properly
      registered and went unnoticed, which resulted in preliminary freeing
      of used memory.
      
      
      mysql-test/r/ps.result:
        Add result for bug#21166: Prepared statement causes signal 11
        on second execution.
      mysql-test/t/ps.test:
        Add test case for bug#21166: Prepared statement causes signal 11
        on second execution.
      sql/item.cc:
        Move Item::transform() and Item_default_value::transform() from
        item.h here and use THD::change_item_tree() instead of plain
        assignment.
        Change Item_field::set_no_const_sub() to be used with Item::walk()
        instead of Item::transform().
      sql/item.h:
        Move definition of Item::transform() and Item_default_value::transform()
        to item.cc.
        Change Item::set_no_const_sub() to be used with Item::walk()
        instead of Item::transform().
      sql/item_cmpfunc.cc:
        Use Item::walk() to execute Item::set_no_const_sub().
        Use THD::change_item_tree() instead of plain assignment.
      sql/item_func.cc:
        Add assert and comment to Item_func::traverse_cond().
      sql/item_row.cc:
        Use THD::change_item_tree() instead of plain assignment.
      sql/item_strfunc.cc:
        Move Item_func_make_set::transform() from item_strfunc.h here and use
        THD::change_item_tree() instead of plain assignment.
      sql/item_strfunc.h:
        Move definition of Item_func_make_set::transform() to item_strfunc.cc.
      f98a9109
  3. 23 Aug, 2006 2 commits
    • unknown's avatar
      Fix for BUG#16899: Possible buffer overflow in handling of DEFINER-clause · e07c2db2
      unknown authored
        
      User name (host name) has limit on length. The server code relies on these
      limits when storing the names. The problem was that sometimes these limits
      were not checked properly, so that could lead to buffer overflow.
      
      The fix is to check length of user/host name in parser and if string is too
      long, throw an error.
      
      
      mysql-test/r/grant.result:
        Updated result file.
      mysql-test/r/sp.result:
        Updated result file.
      mysql-test/r/trigger.result:
        Updated result file.
      mysql-test/r/view.result:
        Updated result file.
      mysql-test/t/grant.test:
        Added test for BUG#16899.
      mysql-test/t/sp.test:
        Added test for BUG#16899.
      mysql-test/t/trigger.test:
        Added test for BUG#16899.
      mysql-test/t/view.test:
        Added test for BUG#16899.
      sql/mysql_priv.h:
        Added prototype for new function.
      sql/share/errmsg.txt:
        Added new resources.
      sql/sql_acl.cc:
        Remove outdated checks.
      sql/sql_parse.cc:
        Add a new function for checking string length.
      sql/sql_yacc.yy:
        Check length of user/host name.
      e07c2db2
    • unknown's avatar
      Bug#8153 (Stored procedure with subquery and continue handler, wrong result) · 06abd6c2
      unknown authored
      Implemented code review comments
      Test cleanup
      
      
      sql/protocol.cc:
        Bug#8153 (Stored procedure with subquery and continue handler, wrong result)
        
        Implemented code review comments
      06abd6c2
  4. 22 Aug, 2006 3 commits
    • unknown's avatar
      Merge malff@bk-internal.mysql.com:/home/bk/mysql-5.0-runtime · b57681f9
      unknown authored
      into  weblab.(none):/home/marcsql/TREE/mysql-5.0-8153
      
      
      mysql-test/r/sp.result:
        Auto merged
      mysql-test/t/sp.test:
        Auto merged
      sql/mysqld.cc:
        Auto merged
      b57681f9
    • unknown's avatar
      Merge moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.0 · 9a9d7c31
      unknown authored
      into  moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.0-bug21051-2
      
      
      include/mysql_com.h:
        Auto merged
      sql/sql_class.cc:
        Auto merged
      9a9d7c31
    • unknown's avatar
      BUG#21051: RESET QUERY CACHE very slow when query_cache_type=0 · 24edd5d9
      unknown authored
      There were two problems: RESET QUERY CACHE took a long time to complete
      and other threads were blocked during this time.
      
      The patch does three things:
        1 fixes a bug with improper use of test-lock-test_again technique.
            AKA Double-Checked Locking is applicable here only in few places.
        2 Somewhat improves performance of RESET QUERY CACHE.
            Do my_hash_reset() instead of deleting elements one by one.  Note
            however that the slowdown also happens when inserting into sorted
            list of free blocks, should be rewritten using balanced tree.
        3 Makes RESET QUERY CACHE non-blocking.
            The patch adjusts the locking protocol of the query cache in the
            following way: it introduces a flag flush_in_progress, which is
            set when Query_cache::flush_cache() is in progress.  This call
            sets the flag on enter, and then releases the lock.  Every other
            call is able to acquire the lock, but does nothing if
            flush_in_progress is set (as if the query cache is disabled).
            The only exception is the concurrent calls to
            Query_cache::flush_cache(), that are blocked until the flush is
            over.  When leaving Query_cache::flush_cache(), the lock is
            acquired and the flag is reset, and one thread waiting on
            Query_cache::flush_cache() (if any) is notified that it may
            proceed.
      
      
      include/mysql_com.h:
        Add comment for NET::query_cache_query.
      sql/net_serv.cc:
        Use query_cache_init_query() for initialization of
        NET::query_cache_query if query cache is used.
        Do not access net->query_cache_query without a lock.
      sql/sql_cache.cc:
        Fix bug with accessing query_cache_size, Query_cache_query::wri and
        thd->net.query_cache_query before acquiring the lock---leave
        double-check locking only in safe places.
        Wherever we check that cache is usable (query_cache_size > 0) we now
        also check that flush_in_progress is false, i.e. we are not in the
        middle of cache flush.
        Add Query_cache::not_in_flush_or_wait() method and use it in
        Query_cache::flush_cache(), so that threads doing cache flush will
        wait it to finish, while other threads will bypass the cache as if
        it is disabled.
        Extract Query_cache::free_query_internal() from Query_cache::free_query(),
        which does not removes elements from the hash, and use it together with
        my_hash_reset() in Query_cache::flush_cache().
      sql/sql_cache.h:
        Add declarations for new members and methods.
        Make is_cacheable() a static method.
        Add query_cache_init_query() function.
      sql/sql_class.cc:
        Use query_cache_init_query() for initialization of
        NET::query_cache_query.
      24edd5d9
  5. 21 Aug, 2006 2 commits
    • unknown's avatar
      Merge bk-internal.mysql.com:/home/bk/mysql-5.0-runtime · 8d498ce7
      unknown authored
      into  mockturtle.local:/home/dlenev/src/mysql-5.0-bg21216-2
      
      8d498ce7
    • unknown's avatar
      Fix for bug#21216 "Simultaneous DROP TABLE and SHOW OPEN TABLES causes · c9a9d014
      unknown authored
      server to crash".
      
      Crash caused by assertion failure happened when one ran SHOW OPEN TABLES
      while concurrently doing DROP TABLE (or RENAME TABLE, CREATE TABLE LIKE
      or any other command that takes name-lock) in other connection.
      For non-debug version of server problem exposed itself as wrong output
      of SHOW OPEN TABLES statement (it was missing name-locked tables).
      Finally in 5.1 both debug and non-debug versions simply crashed in
      this situation due to NULL-pointer dereference.
      
      This problem was caused by the fact that table placeholders which were
      added to table cache in order to obtain name-lock had TABLE_SHARE::table_name
      set to 0. Therefore they broke assumption that this member is non-0 for
      all tables in table cache which was checked by assert in list_open_tables()
      (in 5.1 this function simply relies on it).
      The fix simply sets this member for such placeholders to appropriate value
      making this assumption true again.
      
      This patch also includes test for similar bug 12212 "Crash that happens
      during removing of database name from cache" reappeared in 5.1 as bug 19403.
      
      
      mysql-test/r/drop.result:
        Added test for bug#21216 "Simultaneous DROP TABLE and SHOW OPEN TABLES
        causes server to crash" and bug#12212/19403 "Crash that happens during
        removing of database name from cache".
      mysql-test/t/drop.test:
        Added test for bug#21216 "Simultaneous DROP TABLE and SHOW OPEN TABLES
        causes server to crash" and bug#12212/19403 "Crash that happens during
        removing of database name from cache".
      sql/lock.cc:
        lock_table_name():
          Our code assumes that TABLE_SHARE::table_name for objects in table cache
          is non-NULL (for example look at assertion in list_open_tables()). This
          was not true for table placeholders that were added to table cache for
          name-locking. So let us set this member for such placeholders.
      c9a9d014
  6. 19 Aug, 2006 1 commit
    • unknown's avatar
      WL#3432 (Compile the Parser with a --debug --verbose option) · a91d8ffd
      unknown authored
      Corrected build issues : the build can not be conditional.
      to keep a unique source .tar.gz distribution.
      
      
      configure.in:
        Rolling back previous change
      sql/Makefile.am:
        Partially rolling back previous change.
        The build has to be unconditional, for the source .tar.gz distribution
      sql/mysql_priv.h:
        WL#3432 (Compile the Parser with a --debug --verbose option)
      sql/sql_parse.cc:
        WL#3432 (Compile the Parser with a --debug --verbose option)
        
        Moved turn_parser_debug_on to sql_yacc.yy
      sql/sql_yacc.yy:
        WL#3432 (Compile the Parser with a --debug --verbose option)
        
        Moved turn_parser_debug_on to sql_yacc.yy
      a91d8ffd
  7. 17 Aug, 2006 1 commit
    • unknown's avatar
      WL#3432 (Compile the Parser with a --debug --verbose option) · beecf734
      unknown authored
      Changed the automake build process :
      - ./configure.in
      - ./sql/Makefile.am
      to compile an instrumented parser for debug=yes or debug=full builds
      
      Changed the (primary) runtime invocation of the parser :
      - sql/sql_parse.cc
      to generate bison traces in stderr when the DBUG "parser_debug" flag is set.
      
      
      configure.in:
        WL#3432 (Compile the Parser with a --debug --verbose option)
        
        New Automake condition : MYSQL_CONF_DEBUG
      sql/Makefile.am:
        WL#3432 (Compile the Parser with a --debug --verbose option)
        
        In Debug mode, compile sql_yacc.yy with --debug --verbose
      sql/sql_parse.cc:
        WL#3432 (Compile the Parser with a --debug --verbose option)
        
        Conditionally turn the bison parser debug on at runtime.
      beecf734
  8. 15 Aug, 2006 1 commit
  9. 03 Aug, 2006 1 commit
    • unknown's avatar
      Bug#8153 (Stored procedure with subquery and continue handler, wrong result) · dd587d41
      unknown authored
      Before this fix,
      - a runtime error in a statement in a stored procedure with no error handlers
      was properly detected (as expected)
      - a runtime error in a statement with an error handler inherited from a non
      local runtime context (i.e., proc a with a handler, calling proc b) was
      properly detected (as expected)
      - a runtime error in a statement with a *local* error handler was executed
      as follows :
      a) the statement would succeed, regardless of the error condition, (bug)
      b) the error handler would be called (as expected).
      
      The root cause is that functions like my_messqge_sql would "forget" to set
      the thread flag thd->net.report_error to 1, because of the check involving
      sp_rcontext::found_handler_here().
      Failure to set this flag would cause, later in the call stack,
      in Item_func::fix_fields() at line 190, the code to return FALSE and consider
      that executing the statement was successful.
      
      With this fix :
      - error handling code, that was duplicated in different places in the code,
      is now implemented in sp_rcontext::handle_error(),
      - handle_error() correctly sets thd->net.report_error when a handler is
      present, regardless of the handler location (local, or in the call stack).
      
      A test case, bug8153_subselect, has been written to demonstrate the change
      of behavior before and after the fix.
      
      Another test case, bug8153_function_a, as also been writen.
      This test has the same behavior before and after the fix.
      This test has been written to demonstrate that the previous expected
      result of procedure bug18787, was incorrect, since select no_such_function()
      should fail and therefore not produce a result.
      
      The incorrect result for bug18787 has the same root cause as Bug#8153,
      and the expected result has been adjusted.
      
      
      sql/mysqld.cc:
        Bug#8153, use sp_rcontext::handle_error() to handle errors.
      sql/sql_error.cc:
        Bug#8153, use sp_rcontext::handle_error() to handle errors.
      sql/protocol.cc:
        Bug#8153, use sp_rcontext::handle_error() to handle errors.
      sql/sp_rcontext.h:
        Bug#8153, created helper sp_rcontext::handle_error() to handle errors.
      sql/sp_rcontext.cc:
        Bug#8153, created helper sp_rcontext::handle_error() to handle errors.
      mysql-test/t/sp.test:
        Bug#8153, added test cases.
      mysql-test/r/sp.result:
        Bug#8153, added test cases, fixed expected result of bug18787.
      dd587d41
  10. 02 Aug, 2006 15 commits
    • unknown's avatar
      Disable a failing test case (filed a p1 bug) · 20bbefdb
      unknown authored
      20bbefdb
    • unknown's avatar
      Merge bk-internal.mysql.com:/home/bk/mysql-5.0 · 4f3a18e1
      unknown authored
      into  bodhi.local:/opt/local/work/mysql-5.0-runtime-merge
      
      
      sql/item.cc:
        Auto merged
      sql/item_func.cc:
        Auto merged
      sql/item_func.h:
        Auto merged
      sql/mysql_priv.h:
        Auto merged
      sql/sql_lex.h:
        Auto merged
      sql/sql_parse.cc:
        Auto merged
      sql/sql_show.cc:
        Auto merged
      sql/sql_view.cc:
        Auto merged
      sql/sql_yacc.yy:
        Auto merged
      sql/table.h:
        Auto merged
      mysql-test/r/sp.result:
        Manual merge.
      mysql-test/r/udf.result:
        Manual merge.
      mysql-test/t/sp.test:
        Manual merge.
      mysql-test/t/udf.test:
        Manual merge.
      4f3a18e1
    • unknown's avatar
      A post-merge fix. · b39cf252
      unknown authored
      b39cf252
    • unknown's avatar
      Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-5.0-opt · b9dc69b8
      unknown authored
      into  moonbone.local:/work/tmp_merge-5.0-opt-mysql
      
      
      client/mysql.cc:
        Auto merged
      b9dc69b8
    • unknown's avatar
      Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-4.1 · 397be189
      unknown authored
      into  moonbone.local:/work/tmp_merge-5.0-opt-mysql
      
      
      mysql-test/r/ps_1general.result:
        Auto merged
      mysql-test/t/ps_1general.test:
        Auto merged
      397be189
    • unknown's avatar
      Merge moonbone.local:/work/tmp_merge-4.1-opt-mysql · d47f48f7
      unknown authored
      into  moonbone.local:/work/tmp_merge-5.0-opt-mysql
      
      
      mysql-test/Makefile.am:
        Auto merged
      scripts/make_win_src_distribution.sh:
        Auto merged
      sql/item_strfunc.cc:
        Auto merged
      sql/mysql_priv.h:
        Auto merged
      sql/sql_parse.cc:
        Auto merged
      sql/sql_select.cc:
        Auto merged
      client/mysqltest.c:
        Manual merge
      d47f48f7
    • unknown's avatar
      Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-5.0 · ffdb852f
      unknown authored
      into  moonbone.local:/work/tmp_merge-5.0-opt-mysql
      
      
      client/mysql.cc:
        Auto merged
      mysql-test/r/date_formats.result:
        Auto merged
      mysql-test/r/func_str.result:
        Auto merged
      mysql-test/t/date_formats.test:
        Auto merged
      mysql-test/t/func_str.test:
        Auto merged
      mysql-test/t/udf.test:
        Auto merged
      sql/field.cc:
        Auto merged
      sql/field.h:
        Auto merged
      sql/item_strfunc.cc:
        Auto merged
      sql/mysql_priv.h:
        Auto merged
      sql/sql_class.cc:
        Auto merged
      sql/sql_parse.cc:
        Auto merged
      sql/sql_select.cc:
        Auto merged
      sql/time.cc:
        Auto merged
      mysql-test/r/sp.result:
        Manual merge
      mysql-test/t/sp.test:
        Manual merge
      ffdb852f
    • unknown's avatar
      Merge moonbone.local:/work/tmp_merge-4.1 · ed531699
      unknown authored
      into  moonbone.local:/work/tmp_merge-4.1-opt-mysql
      
      ed531699
    • unknown's avatar
      Merge moonbone.local:/work/tmp_merge-4.1 · 02c4142f
      unknown authored
      into  moonbone.local:/work/tmp_merge-4.1-opt-mysql
      
      
      sql/item_strfunc.cc:
        Auto merged
      sql/mysql_priv.h:
        Auto merged
      sql/sql_parse.cc:
        Auto merged
      sql/sql_select.cc:
        Auto merged
      02c4142f
    • unknown's avatar
      Merge bk@192.168.21.1:mysql-4.1 · b594639a
      unknown authored
      into  mysql.com:/home/hf/work/mysql-4.1.20317
      
      b594639a
    • unknown's avatar
      Merge bk-internal.mysql.com:/home/bk/mysql-5.0 · 9813aff5
      unknown authored
      into  bodhi.local:/opt/local/work/mysql-5.0-runtime-merge
      
      
      include/mysql.h:
        Auto merged
      include/sql_common.h:
        Auto merged
      libmysql/libmysql.c:
        Auto merged
      mysql-test/mysql-test-run.pl:
        Auto merged
      mysql-test/r/mysqldump.result:
        Auto merged
      mysql-test/t/udf.test:
        Auto merged
      ndb/src/mgmsrv/ConfigInfo.cpp:
        Auto merged
      sql/item.cc:
        Auto merged
      sql/item_func.h:
        Auto merged
      sql/mysql_priv.h:
        Auto merged
      sql/slave.cc:
        Auto merged
      sql/sp.cc:
        Auto merged
      sql/sql_lex.cc:
        Auto merged
      sql/sql_parse.cc:
        Auto merged
      sql-common/client.c:
        Auto merged
      sql/sql_yacc.yy:
        Auto merged
      sql/table.h:
        Auto merged
      mysql-test/r/ps.result:
        Manual merge.
      mysql-test/r/sp.result:
        Manual merge.
      mysql-test/t/ps.test:
        Manual merge.
      mysql-test/t/sp.test:
        Manual merge.
      sql/sql_prepare.cc:
        Manual merge.
      sql/table.cc:
        Manual merge.
      tests/mysql_client_test.c:
        Manual merge.
      9813aff5
    • unknown's avatar
      Merge grichter@bk-internal.mysql.com:/home/bk/mysql-5.0 · 0a5b8ba6
      unknown authored
      into  lmy002.wdf.sap.corp:/home/georg/work/mysql/prod/mysql-5.0
      
      0a5b8ba6
    • unknown's avatar
      Fix a compilation failiure on QNX · ec05d4b0
      unknown authored
      
      sql/udf_example.c:
        Declare tmp_error at the beginning of the block (this is C now)
      ec05d4b0
    • unknown's avatar
      Bug #21396: Wrong error number generated for a missing table · 00e2974f
      unknown authored
      
      BitKeeper/etc/collapsed:
        BitKeeper file /home/georg/work/mysql/prod/mysql-5.0/BitKeeper/etc/collapsed
      mysys/my_open.c:
        Win64 bit fix: Replacing 32-bit value (0xFFFFFFFF) by a generic error constant.
      00e2974f
    • unknown's avatar
      .del-sp.test.orig: · eae15716
      unknown authored
        Delete: mysql-test/t/sp.test.orig
      
      
      BitKeeper/deleted/.del-sp.test.orig:
        Delete: mysql-test/t/sp.test.orig
      eae15716
  11. 01 Aug, 2006 9 commits
  12. 31 Jul, 2006 2 commits