1. 28 Jun, 2006 3 commits
    • unknown's avatar
      A fix for Bug#19022 "Memory bug when switching db during trigger execution". · 17f77591
      unknown authored
      No test case as the bug is in an existing test case (rpl_trigger.test
      when it is run under valgrind).
      The warning was caused by memory corruption in replication slave: thd->db
      was pointing at a stack address that was previously used by 
      sp_head::execute()::old_db. This happened because mysql_change_db
      behaved differently in replication slave and did not make a copy of the 
      argument to assign to thd->db. 
      The solution is to always free the old value of thd->db and allocate a new
      copy, regardless whether we're running in a replication slave or not.
      
      
      sql/log_event.cc:
        Move rewrite_db to log_event.cc, the only place where it is used.
      sql/slave.cc:
        Move rewrite_db to log_event.cc
      sql/slave.h:
        Remove an unneeded declaration.
      sql/sql_class.h:
        Fix set_db to always free the old db, even if the argument is NULL.
        Add a comment.
      sql/sql_db.cc:
        Always make a deep copy of the argument in mysql_change_db, even 
        if running in a replication slave. This is necessary because 
        sp_use_new_db (stored procedures) assumes that mysql_change_db always makes
        a deep copy of the argument, and thus passes a pointer to stack into it.
        This assumption was true for all cases except the replication slave thread.
      17f77591
    • unknown's avatar
      Merge bk-internal:/home/bk/mysql-5.0-runtime · 2f39dd8c
      unknown authored
      into  mysql.com:/home/jimw/my/mysql-5.0-18005
      
      
      sql/sql_trigger.cc:
        Auto merged
      2f39dd8c
    • unknown's avatar
      Bug #18005: Creating a trigger on mysql.event leads to server crash on scheduler startup · cad32d97
      unknown authored
      Bug #18361: Triggers on mysql.user table cause server crash
      
       Because they do not work, we do not allow creating triggers on tables
       within the 'mysql' schema.
      
       (They may be made to work and re-enabled at some later date, but not
       in 5.0 or 5.1.)
      
      
      mysql-test/r/trigger.result:
        Add new results
      mysql-test/t/trigger.test:
        Add new regression test for creating triggers on system schema
      sql/share/errmsg.txt:
        Add new error message
      sql/sql_trigger.cc:
        Disallow creating triggers on tables in the 'mysql' schema
      cad32d97
  2. 27 Jun, 2006 5 commits
    • unknown's avatar
      Merge mysql.com:/home/tomash/src/mysql_ab/mysql-5.0 · fdc140bd
      unknown authored
      into  mysql.com:/home/tomash/src/mysql_ab/mysql-5.0-bug17203
      
      fdc140bd
    • unknown's avatar
      Bug#17203: "sql_no_cache sql_cache" in views created from prepared statement · 04193106
      unknown authored
      The problem was that we restored SQL_CACHE, SQL_NO_CACHE flags in SELECT
      statement from internal structures based on value set later at runtime, not
      the original value set by the user.
      
      The solution is to remember that original value.
      
      
      mysql-test/r/auto_increment.result:
        Update result to not report SQL_NO_CACHE if it wasn't there at first place.
      mysql-test/r/func_compress.result:
        Update result to not report SQL_NO_CACHE if it wasn't there at first place.
      mysql-test/r/func_math.result:
        Update result to not report SQL_NO_CACHE if it wasn't there at first place.
      mysql-test/r/func_system.result:
        Update result to not report SQL_NO_CACHE if it wasn't there at first place.
      mysql-test/r/func_time.result:
        Update result to not report SQL_NO_CACHE if it wasn't there at first place.
      mysql-test/r/information_schema.result:
        Update result to not report SQL_NO_CACHE if it wasn't there at first place.
      mysql-test/r/query_cache.result:
        Update result to not report SQL_NO_CACHE if it wasn't there at first place.
      mysql-test/r/rpl_get_lock.result:
        Update result to not report SQL_NO_CACHE if it wasn't there at first place.
      mysql-test/r/rpl_master_pos_wait.result:
        Update result to not report SQL_NO_CACHE if it wasn't there at first place.
      mysql-test/r/show_check.result:
        Add result for bug#17203.
      mysql-test/r/subselect.result:
        Update result to not report SQL_NO_CACHE if it wasn't there at first place.
      mysql-test/r/type_blob.result:
        Update result to not report SQL_NO_CACHE if it wasn't there at first place.
      mysql-test/r/variables.result:
        Update result to not report SQL_NO_CACHE if it wasn't there at first place.
      mysql-test/r/view.result:
        Update result to not report SQL_NO_CACHE if it wasn't there at first place.
      mysql-test/t/show_check.test:
        Add test case for bug#17203.
      sql/sql_lex.cc:
        Reset SELECT_LEX::sql_cache together with SELECT_LEX::options.
      sql/sql_lex.h:
        Add SELECT_LEX::sql_cache field to store original user setting.
      sql/sql_select.cc:
        Output SQL_CACHE and SQL_NO_CACHE depending on stored original user setting.
      sql/sql_yacc.yy:
        Make effect of SQL_CACHE and SQL_NO_CACHE mutually exclusive.  Ignore
        SQL_CACHE if SQL_NO_CACHE was used.  Remember what was set by the user.
        Reset SELECT_LEX::sql_cache together with SELECT_LEX::options.
      04193106
    • unknown's avatar
      6b343082
    • unknown's avatar
      Fix yet another place with an obsolete explicit cast to byte *. · df6f4605
      unknown authored
      
      sql/set_var.h:
        Fix yet another place with an obsolete explicit cast to byte *
      df6f4605
    • unknown's avatar
      Fix compilation failures on Windows caused by the patch for Bug#17199. · f44a3834
      unknown authored
      Fix a minor issue with Bug#16206 (bdb.test failed if the tree is compiled 
      without blackhole).
      
      
      include/my_sys.h:
        Change declaration of my_strdup_with_length to accept const char *,
        not const byte *: in 5 places out of 6 where this function is used,
        it's being passed char *, not byte *
      mysql-test/r/bdb.result:
        Remove dependency on an optional engine (updated test results).
      mysql-test/t/bdb.test:
        Remove dependency on an optional engine.
      mysys/my_malloc.c:
        my_strdup_with_length: const byte * -> const char *
      mysys/safemalloc.c:
        my_strdup_with_length: const byte * -> const char *
      sql/ha_federated.cc:
        my_strdup_with_length: const byte * -> const char *
      sql/log_event.cc:
        my_strdup_with_length: const byte * -> const char *
      sql/set_var.cc:
        my_strdup_with_length: const byte * -> const char *
      sql/sql_class.h:
        Change db_length type to uint from uint32 (see also table.h)
      sql/table.h:
        Change the type of db_length to uint from uint32: LEX_STRING uses uint for 
        length, we need a small and consistent set of types to store length to 
        minimize cast and compile failures.
      f44a3834
  3. 26 Jun, 2006 14 commits
    • unknown's avatar
      Merge bk-internal.mysql.com:/home/bk/mysql-5.0 · 35f9da31
      unknown authored
      into  mysql.com:/opt/local/work/mysql-5.0-17199
      
      
      sql/sql_insert.cc:
        Auto merged
      sql/sql_parse.cc:
        Auto merged
      sql/sql_table.cc:
        Auto merged
      35f9da31
    • unknown's avatar
      Merge kboortz@bk-internal.mysql.com:/home/bk/mysql-5.0 · b4151e1b
      unknown authored
      into mysql.com:/Users/kent/mysql/bk/mysql-5.0-new
      
      b4151e1b
    • unknown's avatar
      Merge mysql.com:/Users/kent/mysql/bk/mysql-4.1-new · 5fb0091c
      unknown authored
      into mysql.com:/Users/kent/mysql/bk/mysql-5.0-new
      
      
      scripts/make_binary_distribution.sh:
        Auto merged
      5fb0091c
    • unknown's avatar
      Merge mysql.com:/Users/kent/mysql/bk/mysql-4.0 · f72d80e2
      unknown authored
      into mysql.com:/Users/kent/mysql/bk/mysql-4.1-new
      
      
      scripts/make_binary_distribution.sh:
        Auto merged
      scripts/make_sharedlib_distribution.sh:
        Auto merged
      f72d80e2
    • unknown's avatar
      make_sharedlib_distribution.sh: · abffdb65
      unknown authored
        For compatibility, don't use {..,..} in pattern matching
      make_binary_distribution.sh:
        Added .dylib and .sl as shared library extensions
      
      
      scripts/make_binary_distribution.sh:
        Added .dylib and .sl as shared library extensions
      scripts/make_sharedlib_distribution.sh:
        For compatibility, don't use {..,..} in pattern matching
      abffdb65
    • unknown's avatar
      Merge bk-internal.mysql.com:/home/bk/mysql-5.0-runtime · 409d3420
      unknown authored
      into  mysql.com:/opt/local/work/mysql-5.0-17199
      
      
      mysql-test/r/create.result:
        Auto merged
      mysql-test/t/create.test:
        Auto merged
      sql/item_strfunc.cc:
        Auto merged
      sql/log_event.cc:
        Auto merged
      sql/slave.cc:
        Auto merged
      sql/sp_head.cc:
        Auto merged
      sql/sql_class.h:
        Auto merged
      sql/sql_db.cc:
        Auto merged
      sql/sql_insert.cc:
        Auto merged
      sql/sql_lex.h:
        Auto merged
      sql/sql_parse.cc:
        Auto merged
      sql/sql_table.cc:
        Auto merged
      sql/sql_yacc.yy:
        Auto merged
      mysql-test/r/sp.result:
        SCCS merged
      mysql-test/t/sp.test:
        SCCS merged
      409d3420
    • unknown's avatar
      A fix and a test case for · 2783fc82
      unknown authored
       Bug#19022 "Memory bug when switching db during trigger execution"
       Bug#17199 "Problem when view calls function from another database."
       Bug#18444 "Fully qualified stored function names don't work correctly in
                  SELECT statements"
      
       Documentation note: this patch introduces a change in behaviour of prepared
       statements.
      
       This patch adds a few new invariants with regard to how THD::db should
       be used. These invariants should be preserved in future:
      
        - one should never refer to THD::db by pointer and always make a deep copy
          (strmake, strdup)
        - one should never compare two databases by pointer, but use strncmp or
          my_strncasecmp
        - TABLE_LIST object table->db should be always initialized in the parser or
          by creator of the object.
      
          For prepared statements it means that if the current database is changed
          after a statement is prepared, the database that was current at prepare
          remains active. This also means that you can not prepare a statement that
          implicitly refers to the current database if the latter is not set.
          This is not documented, and therefore needs documentation. This is NOT a
          change in behavior for almost all SQL statements except:
           - ALTER TABLE t1 RENAME t2 
           - OPTIMIZE TABLE t1
           - ANALYZE TABLE t1
           - TRUNCATE TABLE t1 --
           until this patch t1 or t2 could be evaluated at the first execution of
           prepared statement. 
      
           CURRENT_DATABASE() still works OK and is evaluated at every execution
           of prepared statement.
      
           Note, that in stored routines this is not an issue as the default
           database is the database of the stored procedure and "use" statement
           is prohibited in stored routines.
      
        This patch makes obsolete the use of check_db_used (it was never used in the
        old code too) and all other places that check for table->db and assign it
        from THD::db if it's NULL, except the parser.
      
       How this patch was created: THD::{db,db_length} were replaced with a
       LEX_STRING, THD::db. All the places that refer to THD::{db,db_length} were
       manually checked and:
        - if the place uses thd->db by pointer, it was fixed to make a deep copy
        - if a place compared two db pointers, it was fixed to compare them by value
          (via strcmp/my_strcasecmp, whatever was approproate)
       Then this intermediate patch was used to write a smaller patch that does the
       same thing but without a rename.
      
       TODO in 5.1:
         - remove check_db_used
         - deploy THD::set_db in mysql_change_db
      
       See also comments to individual files.
      
      
      mysql-test/r/create.result:
        Modify the result file: a database can never be NULL.
      mysql-test/r/ps.result:
        Update test results (Bug#17199 et al)
      mysql-test/r/sp.result:
        Update test results (Bug#17199 et al)
      mysql-test/t/create.test:
        Update the id of the returned error.
      mysql-test/t/ps.test:
        Add test coverage for prepared statements and current database. In scope of
        work on Bug#17199 "Problem when view calls function from another database."
      mysql-test/t/sp.test:
        Add a test case for Bug#17199 "Problem when view calls function from another
        database." and Bug#18444 "Fully qualified stored function names don't work
        correctly in SELECT statements". Test a complementary problem.
      sql/item_strfunc.cc:
        Touch the code that reads thd->db (cleanup).
      sql/log_event.cc:
        While we are at it, replace direct access to thd->db with a method.
        Should simplify future conversion of THD::db to LEX_STRING.
      sql/slave.cc:
        While we are at it, replace direct access to thd->db with a method.
        Should simplify future conversion of THD::db to LEX_STRING.
      sql/slave.h:
        Remove a declaration for a method that is used only in one module.
      sql/sp.cc:
        Rewrite sp_use_new_db: this is a cleanup that I needed in order to understand
        this function and ensure that it has no bugs.
      sql/sp.h:
        Add a new declaration for sp_use_new_db (uses LEX_STRINGs) and a comment.
      sql/sp_head.cc:
        - drop sp_name_current_db_new - a creator of sp_name class that was used
        when sp_name was created for an identifier without an explicitly initialized
        database. Now we pass thd->db to constructor of sp_name right in the 
        parser.
        - rewrite sp_head::init_strings: name->m_db is always set now
        - use the new variant of sp_use_new_db
        - we don't need to update thd->db with SP MEM_ROOT pointer anymore when
        parsing a stored procedure, as noone will refer to it (yes!)
      sql/sp_head.h:
        - remove unneded methods and members
      sql/sql_class.h:
        - introduce 3 THD  methods to work with THD::db:
          .set_db to assign the current database
          .reset_db to reset the current database (temporarily) or set it to NULL
          .opt_copy_db_to - to deep-copy thd->db to a pointer if it's not NULL
      sql/sql_db.cc:
        While we are at it, replace direct access to thd->db with a method.
        Should simplify future conversion of THD::db to LEX_STRING.
      sql/sql_insert.cc:
        - replace checks with asserts: table_list->db must be always set in the parser.
      sql/sql_lex.h:
        - add a comment
      sql/sql_parse.cc:
        - implement the invariant described in the changeset comment.
        - remove juggling with lex->sphead in SQLCOM_CREATE_PROCEDURE:
          now db_load_routine uses its own LEX object and doesn't damage the main
          LEX.
        - add DBUG_ASSERT(0) to unused "check_db_used"
      sql/sql_table.cc:
        - replace a check with an assert (table_ident->db)
      sql/sql_trigger.cc:
        While we are at it, replace direct access to thd->db with a method.
        Should simplify future conversion of THD::db to LEX_STRING.
      sql/sql_udf.cc:
        - use thd->set_db instead of direct modification of to thd->db
      sql/sql_view.cc:
        - replace a check with an assert (view->db)
      sql/sql_yacc.yy:
        - make sure that we always copy table->db or name->db or ident->db or
          select_lex->db from thd->db if the former is not set. If thd->db
          is not set but is accessed, return an error.
      sql/tztime.cc:
        - be nice, never copy thd->db by pointer.
      2783fc82
    • unknown's avatar
      Merge istruewing@bk-internal.mysql.com:/home/bk/mysql-5.0 · b4df1487
      unknown authored
      into  mysql.com:/nfstmp1/ingo/autopush-75/mysql-5.0
      
      b4df1487
    • unknown's avatar
      Merge mysql.com:/home/alik/MySQL/devel/5.0-tree · 28ed7015
      unknown authored
      into  mysql.com:/home/alik/MySQL/devel/5.0-rt
      
      28ed7015
    • unknown's avatar
      Merge istruewing@bk-internal.mysql.com:/home/bk/mysql-5.0 · bddeccf1
      unknown authored
      into  mysql.com:/home/mydev/mysql-5.0-bug16986-main
      
      
      sql/sql_table.cc:
        Auto merged
      bddeccf1
    • unknown's avatar
      Merge mysql.com:/home/mydev/mysql-5.0--main · 3f672ff8
      unknown authored
      into  mysql.com:/home/mydev/mysql-5.0-bug16986-main
      
      
      sql/mysql_priv.h:
        Auto merged
      sql/sql_base.cc:
        Auto merged
      sql/sql_parse.cc:
        Auto merged
      3f672ff8
    • unknown's avatar
      Bug#16986 - Deadlock condition with MyISAM tables · e6d5fe0f
      unknown authored
      Addendum fixes after changing the condition variable
      for the global read lock.
      
      The stress test suite revealed some deadlocks. Some were
      related to the new condition variable (COND_global_read_lock)
      and some were general problems with the global read lock.
      
      It is now necessary to signal COND_global_read_lock whenever 
      COND_refresh is signalled.
      
      We need to wait for the release of a global read lock if one 
      is set before every operation that requires a write lock.
      But we must not wait if we have locked tables by LOCK TABLES.
      After setting a global read lock a thread waits until all
      write locks are released.
      
      
      mysql-test/r/lock_multi.result:
        Bug#16986 - Deadlock condition with MyISAM tables
        Addendum fixes after changing the condition variable
        for the global read lock.
        Added test results.
      mysql-test/t/lock_multi.test:
        Bug#16986 - Deadlock condition with MyISAM tables
        Addendum fixes after changing the condition variable
        for the global read lock.
        Added tests for possible deadlocks that did not occur
        with the stress test suite.
      mysys/thr_lock.c:
        Bug#16986 - Deadlock condition with MyISAM tables
        Addendum fixes after changing the condition variable
        for the global read lock.
        Added a protection against an infinite loop that occurs
        with the test case for Bug #20662.
      sql/lock.cc:
        Bug#16986 - Deadlock condition with MyISAM tables
        Addendum fixes after changing the condition variable
        for the global read lock.
        Signal COND_global_read_lock whenever COND_refresh
        is signalled by using the new function broadcast_refresh().
        Added the definition of a new function that signals 
        COND_global_read_lock whenever COND_refresh is signalled.
      sql/mysql_priv.h:
        Bug#16986 - Deadlock condition with MyISAM tables
        Addendum fixes after changing the condition variable
        for the global read lock.
        Added a declaration for a new function that signals 
        COND_global_read_lock whenever COND_refresh is signalled.
      sql/sql_base.cc:
        Bug#16986 - Deadlock condition with MyISAM tables
        Addendum fixes after changing the condition variable
        for the global read lock.
        Signal COND_global_read_lock whenever COND_refresh
        is signalled by using the new function broadcast_refresh().
      sql/sql_handler.cc:
        Bug#16986 - Deadlock condition with MyISAM tables
        Addendum fixes after changing the condition variable
        for the global read lock.
        Signal COND_global_read_lock whenever COND_refresh
        is signalled by using the new function broadcast_refresh().
      sql/sql_insert.cc:
        Bug#16986 - Deadlock condition with MyISAM tables
        Addendum fixes after changing the condition variable
        for the global read lock.
        Removed global read lock handling from inside of 
        INSERT DELAYED. It is handled on a higher level now.
      sql/sql_parse.cc:
        Bug#16986 - Deadlock condition with MyISAM tables
        Addendum fixes after changing the condition variable
        for the global read lock.
        Wait for the release of a global read lock if one is set
        before every operation that requires a write lock.
        But don't wait if locked tables exist already.
      sql/sql_table.cc:
        Bug#16986 - Deadlock condition with MyISAM tables
        Addendum fixes after changing the condition variable
        for the global read lock.
        Removed global read lock handling from inside of 
        CREATE TABLE. It is handled on a higher level now.
        Signal COND_global_read_lock whenever COND_refresh
        is signalled by using the new function broadcast_refresh().
      e6d5fe0f
    • unknown's avatar
      Merge bk-internal.mysql.com:/home/bk/mysql-5.0-maint · 0ff0cdc6
      unknown authored
      into  mysql.com:/home/tnurnberg/mysql-5.0-maint-18462
      
      
      mysql-test/r/mysqldump.result:
        Auto merged
      mysql-test/t/mysqldump.test:
        Auto merged
      client/mysqldump.c:
        SCCS merged
      0ff0cdc6
    • unknown's avatar
      Merge bk-internal.mysql.com:/home/bk/mysql-5.0 · 3b6a7ef8
      unknown authored
      into  mysql.com:/data0/bk/mysql-5.0-maint
      
      
      sql/sp_head.cc:
        Auto merged
      sql/table.cc:
        Auto merged
      3b6a7ef8
  4. 24 Jun, 2006 2 commits
    • unknown's avatar
      Merge knielsen@10.100.52.19:/usr/local/mysql/tmp-5.0 · 1ccd344f
      unknown authored
      into  mysql.com:/data0/knielsen/tmp-5.0
      
      1ccd344f
    • unknown's avatar
      Fix race condition in test case wait_timeout. · d0d405ee
      unknown authored
      Sometimes the helper connection (that is watching for the main connection
      to time out) would itself time out first, causing the test to fail.
      
      
      mysql-test/t/wait_timeout.test:
        Increase connection timeout in connection wait_con so we will not loose
        the connection that is watching for the real wait_timeout to trigger.
      d0d405ee
  5. 23 Jun, 2006 9 commits
  6. 22 Jun, 2006 7 commits
    • unknown's avatar
      mysql.spec.sh: · 3f0032f4
      unknown authored
        Disable the simplistic auto dependency scan for test/bench (bug#20078)
      
      
      support-files/mysql.spec.sh:
        Disable the simplistic auto dependency scan for test/bench (bug#20078)
      3f0032f4
    • unknown's avatar
      Merge bk-internal.mysql.com:/home/bk/mysql-5.0-maint · 71019ccf
      unknown authored
      into  mysql.com:/home/tnurnberg/mysql-5.0-maint-19409
      
      71019ccf
    • unknown's avatar
      Merge bk-internal.mysql.com:/home/bk/mysql-5.0 · 774da9ec
      unknown authored
      into  mysql.com:/opt/local/work/mysql-5.0-runtime
      
      774da9ec
    • unknown's avatar
      Merge clam.ndb.mysql.com:/space/pekka/ndb/version/my50 · f2533800
      unknown authored
      into  clam.ndb.mysql.com:/space/pekka/ndb/version/my50-bug18781
      
      
      ndb/src/kernel/blocks/dbdih/DbdihMain.cpp:
        Auto merged
      ndb/src/ndbapi/ndberror.c:
        Auto merged
      f2533800
    • unknown's avatar
      #19409: Test 'func_timestamp' fails on Windows x64 · b3be4f2c
      unknown authored
      - The setting of "ENV{'TZ'}" doesn't affect the timezone
        used by MySQL Server on Windows.
      - Explicitly set timezone in test cases before doing UTC/localtime
        conversions so tests produce deterministic results
      
      
      mysql-test/r/func_timestamp.result:
        Update test results
      mysql-test/r/type_timestamp.result:
        Update test results
      mysql-test/t/func_timestamp.test:
        Specifically set timezone to make tests that do localtime/UTC conversions deterministic
      mysql-test/t/type_timestamp.test:
        Specifically set timezone to make tests that do localtime/UTC conversions deterministic
      b3be4f2c
    • unknown's avatar
      Bug#19408 Test 'func_time' fails on Windows x64 · 1f6e95d4
      unknown authored
      - The setting of "ENV{'TZ'}" doesn't affect the timezone
        used by MySQL Server on Windows.
      - Explicitly set timezone to "+03:00" in test case before
        doing the calculatiosn to check that there is three hours
        difference between utc and local time.
      (Magnus' fix)
      
      
      mysql-test/r/func_time.result:
        Update test results
      mysql-test/t/func_time.test:
        Set timezone to GMT-3, to make it possible to use "interval 3 hour"
      1f6e95d4
    • unknown's avatar
      Merge mysql.com:/home/tomash/src/mysql_ab/mysql-5.0 · ae58c588
      unknown authored
      into  mysql.com:/home/tomash/src/mysql_ab/mysql-5.0-bug15811
      
      ae58c588