An error occurred fetching the project authors.
  1. 01 Feb, 2010 1 commit
    • Mattias Jonsson's avatar
      Bug#42438: Crash ha_partition::change_table_ptr · 16c8298a
      Mattias Jonsson authored
      There was two problems:
      The first was the symptom, caused by bad error handling in
      ha_partition. It did not handle print_error etc. when
      having no partitions (when used by dummy handler).
      
      The second was the real problem that when dropping tables
      it reused the table type (storage engine) from when the lock
      was asked for, not the table type that it had when gaining
      the exclusive name lock. So that it tried to delete tables
      from wrong storage engines.
      
      Solutions for the first problem was to accept some handler
      calls to the partitioning handler even if it was not setup
      with any partitions, and also if possible fallback
      to use the base handler's default functions.
      
      Solution for the second problem was to remove the optimization
      to reuse the definition from the cache, instead always check
      the frm-file when holding the LOCK_open mutex
      
      (updated with a fix for a debug print crash and better
      comments as required by reviewer, and removed optimization
      to avoid reading the frm-file).
      
      mysql-test/r/partition_debug_sync.result:
        Bug#42438: Crash ha_partition::change_table_ptr
        
        New result file using DEBUG_SYNC for deterministic results.
      mysql-test/t/partition_debug_sync.test:
        Bug#42438: Crash ha_partition::change_table_ptr
        
        New test file using DEBUG_SYNC for deterministic results.
      sql/ha_partition.cc:
        Bug#42438: Crash ha_partition::change_table_ptr
        
        allow some handler calls, used by error handling, even when
        no partitions are setup. Fallback to default handling if possible.
      sql/sql_base.cc:
        Bug#42438: Crash ha_partition::change_table_ptr
        
        Added DEBUG_SYNC point for deterministic test cases.
      sql/sql_table.cc:
        Bug#42438: Crash ha_partition::change_table_ptr
        
        Always use the table type written in the .frm-file
        (i.e. the current table type) when deleting a table.
        
        Moved the check for log-table to not depend of the cache.
        
        Added DEBUG_SYNC points for deterministic test cases.
      16c8298a
  2. 27 Jan, 2010 1 commit
    • Davi Arnaut's avatar
      Bug#47734: Assertion failed: ! is_set() when locking a view with non-existing definer · ee66332c
      Davi Arnaut authored
      The problem was that a failure to open a view wasn't being
      properly handled. When opening a view with unknown definer,
      the open procedure would be treated as successful and would
      later crash when attempting to lock the view (which wasn't
      opened to begin with).
      
      The solution is to skip further processing when opening a
      table if it fails with a fatal error.
      
      mysql-test/r/view.result:
        Add test case result for Bug#47734.
      mysql-test/t/view.test:
        Add test case for Bug#47734.
      sql/sql_base.cc:
        Skip further processing if opening a table failed due to
        a fatal error (for the statement).
      ee66332c
  3. 24 Jan, 2010 1 commit
  4. 01 Dec, 2009 1 commit
    • Evgeny Potemkin's avatar
      Bug#48508: Crash on prepared statement re-execution. · 7853f553
      Evgeny Potemkin authored
      Actually there is two different bugs.
      The first one caused crash on queries with WHERE condition over views
      containing WHERE condition. A wrong check for prepared statement phase led
      to items for view fields being allocated in the execution memory and freed
      at the end of execution. Thus the optimized WHERE condition refers to
      unallocated memory on the second execution and server crashed.
      The second one caused by the Item_cond::compile function not saving changes
      it made to the item tree. Thus on the next execution changes weren't
      reverted and server crashed on dereferencing of unallocated space.
      
      The new helper function called is_stmt_prepare_or_first_stmt_execute
      is added to the Query_arena class.
      The find_field_in_view function now uses
      is_stmt_prepare_or_first_stmt_execute() to check whether
      newly created view items should be freed at the end of the query execution.
      The Item_cond::compile function now saves changes it makes to item tree.
      
      mysql-test/r/ps.result:
        Added a test case for the bug#48508.
      mysql-test/t/ps.test:
        Added a test case for the bug#48508.
      sql/item_cmpfunc.cc:
        Bug#48508: Crash on prepared statement re-execution.
        The Item_cond::compile function now saves changes it makes to item tree.
      sql/sql_base.cc:
        Bug#48508: Crash on prepared statement re-execution.
        The find_field_in_view function now uses
        is_stmt_prepare_or_first_stmt_execute() to check whether
        newly created view items should be freed at the end of the query execution.
      sql/sql_class.h:
        Bug#48508: Crash on prepared statement re-execution.
        The Query_arena::is_stmt_prepare_or_first_sp_execute function now correctly
        do its check.
      7853f553
  5. 25 Nov, 2009 1 commit
    • MySQL Build Team's avatar
      Backport into build-200911241145-5.1.40sp1 · 4d7944f8
      MySQL Build Team authored
      > ------------------------------------------------------------
      > revno: 1810.3961.12
      > revision-id: li-bing.song@sun.com-20091103090041-zj7nedx6ok5jgges
      > parent: davi.arnaut@sun.com-20091102201021-1brn7cjb1kvqg9gr
      > committer: <Li-Bing.Song@sun.com>
      > branch nick: mysql-5.0-bugteam
      > timestamp: Tue 2009-11-03 17:00:41 +0800
      > message:
      >   BUG#48216 Replication fails on all slaves after upgrade to 5.0.86 on master
      >   
      >   When a sessione is closed, all temporary tables of the session are automatically 
      >   dropped and are binlogged. But it will be binlogged with wrong database names when
      >   the length of the temporary tables' database names are greater than the 
      >   length of the current database name or the current database is not set.
      >   
      >   Query_log_event's db_len is forgot to set when Query_log_event's db is set.
      >   This patch wrote code to set db_len immediately after db has set.
      4d7944f8
  6. 20 Nov, 2009 1 commit
  7. 03 Nov, 2009 1 commit
    • unknown's avatar
      BUG#48216 Replication fails on all slaves after upgrade to 5.0.86 on master · 98198851
      unknown authored
      When a sessione is closed, all temporary tables of the session are automatically 
      dropped and are binlogged. But it will be binlogged with wrong database names when
      the length of the temporary tables' database names are greater than the 
      length of the current database name or the current database is not set.
      
      Query_log_event's db_len is forgot to set when Query_log_event's db is set.
      This patch wrote code to set db_len immediately after db has set.
      
      
      98198851
  8. 07 Oct, 2009 1 commit
  9. 30 Sep, 2009 1 commit
    • unknown's avatar
      Bug #45677 Slave stops with Duplicate entry for key PRIMARY when using trigger · 41e0d0a3
      unknown authored
      The problem is that there is only one autoinc value associated with 
      the query when binlogging. If more than one autoinc values are used 
      in the query, the autoinc values after the first one can be inserted 
      wrongly on slave. So these autoinc values can become inconsistent on 
      master and slave.
      
      The problem is resolved by marking all the statements that invoke 
      a trigger or call a function that updated autoinc fields as unsafe, 
      and will switch to row-format in Mixed mode. Actually, the statement 
      is safe if just one autoinc value is used in sub-statement, but it's 
      impossible to check how many autoinc values are used in sub-statement.)
      
      mysql-test/suite/rpl/r/rpl_auto_increment_update_failure.result:
        Test result for bug#45677
      mysql-test/suite/rpl/t/rpl_auto_increment_update_failure.test:
        Added test to verify the following two properties:
        P1) insert/update in an autoinc column causes statement to 
        be logged in row format if binlog_format=mixed
        P2) if binlog_format=mixed, and a trigger or function contains 
            two or more inserts/updates in a table that has an autoinc 
            column, then the slave should not go out of sync, even if 
            there are concurrent transactions.
      sql/sql_base.cc:
        Added function 'has_write_table_with_auto_increment' to check 
        if one (or more) write tables have auto_increment columns.
        
        Removed function 'has_two_write_locked_tables_with_auto_increment', 
        because the function is included in function 
        'has_write_table_with_auto_increment'.
      41e0d0a3
  10. 29 Sep, 2009 1 commit
    • Ingo Struewing's avatar
      WL#4259 - Debug Sync Facility · 4d57b851
      Ingo Struewing authored
      Backport from 6.0 to 5.1.
      Only those sync points are included, which are used in debug_sync.test.
      
        The Debug Sync Facility allows to place synchronization points
        in the code:
        
        open_tables(...)
        
        DEBUG_SYNC(thd, "after_open_tables");
        
        lock_tables(...)
        
        When activated, a sync point can
        
        - Send a signal and/or
        - Wait for a signal
        
        Nomenclature:
        
        - signal:            A value of a global variable that persists
                             until overwritten by a new signal. The global
                             variable can also be seen as a "signal post"
                             or "flag mast". Then the signal is what is
                             attached to the "signal post" or "flag mast".
        
        - send a signal:     Assign the value (the signal) to the global
                             variable ("set a flag") and broadcast a
                             global condition to wake those waiting for
                             a signal.
        
        - wait for a signal: Loop over waiting for the global condition until
                             the global value matches the wait-for signal.
        
        Please find more information in the top comment in debug_sync.cc
        or in the worklog entry.
      
      
      .bzrignore:
        WL#4259 - Debug Sync Facility
        Added the symbolic link libmysqld/debug_sync.cc.
      CMakeLists.txt:
        WL#4259 - Debug Sync Facility
        Added definition for ENABLED_DEBUG_SYNC.
      configure.in:
        WL#4259 - Debug Sync Facility
        Added definition for ENABLED_DEBUG_SYNC.
      include/my_sys.h:
        WL#4259 - Debug Sync Facility
        Added definition for the DEBUG_SYNC_C macro.
      libmysqld/CMakeLists.txt:
        WL#4259 - Debug Sync Facility
        Added sql/debug_sync.cc.
      libmysqld/Makefile.am:
        WL#4259 - Debug Sync Facility
        Added sql/debug_sync.cc.
      mysql-test/include/have_debug_sync.inc:
        WL#4259 - Debug Sync Facility
        New include file.
      mysql-test/mysql-test-run.pl:
        WL#4259 - Debug Sync Facility
        Added option --debug_sync_timeout.
      mysql-test/r/debug_sync.result:
        WL#4259 - Debug Sync Facility
        New test result.
      mysql-test/r/have_debug_sync.require:
        WL#4259 - Debug Sync Facility
        New require file.
      mysql-test/t/debug_sync.test:
        WL#4259 - Debug Sync Facility
        New test file.
      mysys/my_static.c:
        WL#4259 - Debug Sync Facility
        Added definition for debug_sync_C_callback_ptr.
      mysys/thr_lock.c:
        WL#4259 - Debug Sync Facility
        Added sync point "wait_for_lock".
      sql/CMakeLists.txt:
        WL#4259 - Debug Sync Facility
        Added debug_sync.cc and debug_sync.h.
      sql/Makefile.am:
        WL#4259 - Debug Sync Facility
        Added debug_sync.cc and debug_sync.h.
      sql/debug_sync.cc:
        WL#4259 - Debug Sync Facility
        New source file.
      sql/debug_sync.h:
        WL#4259 - Debug Sync Facility
        New header file.
      sql/mysqld.cc:
        WL#4259 - Debug Sync Facility
        Added opt_debug_sync_timeout.
        Added calls to debug_sync_init() and debug_sync_end().
        Fixed a purecov comment (unrelated).
      sql/set_var.cc:
        WL#4259 - Debug Sync Facility
        Added server variable "debug_sync".
      sql/set_var.h:
        WL#4259 - Debug Sync Facility
        Added declaration for server variable "debug_sync".
      sql/share/errmsg.txt:
        WL#4259 - Debug Sync Facility
        Added error messages ER_DEBUG_SYNC_TIMEOUT and ER_DEBUG_SYNC_HIT_LIMIT.
      sql/sql_base.cc:
        WL#4259 - Debug Sync Facility
        Added sync points "after_flush_unlock" and "before_lock_tables_takes_lock".
      sql/sql_class.cc:
        WL#4259 - Debug Sync Facility
        Added initialization for debug_sync_control to THD::THD.
        Added calls to debug_sync_init_thread() and debug_sync_end_thread().
      sql/sql_class.h:
        WL#4259 - Debug Sync Facility
        Added element debug_sync_control to THD.
      storage/myisam/myisamchk.c:
        Fixed a typo in an error message string (unrelated).
      4d57b851
  11. 24 Sep, 2009 1 commit
    • Luis Soares's avatar
      BUG#42829: binlogging enabled for all schemas regardless of · 9ae9f84e
      Luis Soares authored
      binlog-db-db / binlog-ignore-db
            
      InnoDB will return an error if statement based replication is used
      along with transaction isolation level READ-COMMITTED (or weaker),
      even if the statement in question is filtered out according to the
      binlog-do-db rules set. In this case, an error should not be printed.
            
      This patch addresses this issue by extending the existing check in
      external_lock to take into account the filter rules before deciding to
      print an error. Furthermore, it also changes decide_logging_format to
      take into consideration whether the statement is filtered out from 
      binlog before decision is made.
      
      sql/sql_base.cc:
        Changed the check on decide_logging_format to take into account
        whether statement is filtered or not in SBR.
      sql/sql_class.cc:
        Added the thd_binlog_filter_ok to INNODB_COMPATIBILITY_HOOKS set.
      storage/innobase/handler/ha_innodb.cc:
        Extended check in external_lock to take into consideration the
        filtering when deciding to throw an error.
      storage/innobase/handler/ha_innodb.h:
        Added declaration of new hook.
      storage/innodb_plugin/handler/ha_innodb.cc:
        Extended check in external_lock to take into consideration the
        filtering when deciding to throw an error.
      storage/innodb_plugin/handler/ha_innodb.h:
        Added declaration of new hook.
      9ae9f84e
  12. 28 Aug, 2009 1 commit
    • Staale Smedseng's avatar
      Bug #43414 Parenthesis (and other) warnings compiling MySQL · 1ba25ae4
      Staale Smedseng authored
      with gcc 4.3.2
            
      This patch fixes a number of GCC warnings about variables used
      before initialized. A new macro UNINIT_VAR() is introduced for
      use in the variable declaration, and LINT_INIT() usage will be
      gradually deprecated. (A workaround is used for g++, pending a
      patch for a g++ bug.)
            
      GCC warnings for unused results (attribute warn_unused_result)
      for a number of system calls (present at least in later
      Ubuntus, where the usual void cast trick doesn't work) are
      also fixed.
      
      
      client/mysqlmanager-pwgen.c:
        A fix for warn_unused_result, adding fallback to use of
        srand()/rand() if /dev/random cannot be used. Also actually
        adds calls to rand() in the second branch so that it actually
        creates a random password.
      1ba25ae4
  13. 27 Aug, 2009 1 commit
    • Alfranio Correia's avatar
      BUG#46861 Auto-closing of temporary tables broken by replicate-rewrite-db · ea06bbd2
      Alfranio Correia authored
      When a connection is dropped any remaining temporary table is also automatically
      dropped and the SQL statement of this operation is written to the binary log in
      order to drop such tables on the slave and keep the slave in sync. Specifically,
      the current code base creates the following type of statement:
      DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `db`.`table`;
      
      Unfortunately, appending the database to the table name in this manner circumvents
      the replicate-rewrite-db option (and any options that check the current database).
      To solve the issue, we started writing the statement to the binary as follows:
      use `db`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `table`;
      ea06bbd2
  14. 16 Jul, 2009 1 commit
  15. 26 Jun, 2009 1 commit
    • Evgeny Potemkin's avatar
      Bug#45266: Uninitialized variable lead to an empty result. · 93bac51e
      Evgeny Potemkin authored
      The TABLE::reginfo.impossible_range is used by the optimizer to indicate
      that the condition applied to the table is impossible. It wasn't initialized
      at table opening and this might lead to an empty result on complex queries:
      a query might set the impossible_range flag on a table and when the query finishes,
      all tables are returned back to the table cache. The next query that uses the table
      with the impossible_range flag set and an index over the table will see the flag
      and thus return an empty result.
      
      The open_table function now initializes the TABLE::reginfo.impossible_range
      variable.
      
      mysql-test/r/select.result:
        A test case for the bug#45266: Uninitialized variable lead to an empty result.
      mysql-test/t/select.test:
        A test case for the bug#45266: Uninitialized variable lead to an empty result.
      sql/sql_base.cc:
        Bug#45266: Uninitialized variable lead to an empty result.
        The open_table function now initializes the TABLE::reginfo.impossible_range
        variable.
      sql/sql_select.cc:
        Bug#45266: Uninitialized variable lead to an empty result.
        The open_table function now initializes the TABLE::reginfo.impossible_range
        variable.
      sql/structs.h:
        Bug#45266: Uninitialized variable lead to an empty result.
        A comment is added.
      93bac51e
  16. 19 Jun, 2009 1 commit
    • Sergey Glukhov's avatar
      Bug#44834 strxnmov is expected to behave as you'd expect · 9347649c
      Sergey Glukhov authored
      The problem: described in the bug report.
      The fix:
      --increase buffers where it's necessary
        (buffers which are used in stxnmov)
      --decrease buffer lengths which are used
      
      
      client/mysql.cc:
        --increase buffers where it's necessary
          (buffers which are used in stxnmov)
        --decrease buffer lengths which are used
          as argument for strxnmov function
      sql/ha_ndbcluster.cc:
        --increase buffers where it's necessary
          (buffers which are used in stxnmov)
        --decrease buffer lengths which are used
          as argument for strxnmov function
      sql/ha_ndbcluster_binlog.cc:
        --increase buffers where it's necessary
          (buffers which are used in stxnmov)
        --decrease buffer lengths which are used
          as argument for strxnmov function
      sql/handler.cc:
        --increase buffers where it's necessary
          (buffers which are used in stxnmov)
        --decrease buffer lengths which are used
          as argument for strxnmov function
      sql/log.cc:
        --increase buffers where it's necessary
          (buffers which are used in stxnmov)
        --decrease buffer lengths which are used
          as argument for strxnmov function
      sql/mysqld.cc:
        removed unnecessary line
      sql/parse_file.cc:
        --increase buffers where it's necessary
          (buffers which are used in stxnmov)
        --decrease buffer lengths which are used
          as argument for strxnmov function
      sql/sql_acl.cc:
        --increase buffers where it's necessary
          (buffers which are used in stxnmov)
        --decrease buffer lengths which are used
          as argument for strxnmov function
      sql/sql_base.cc:
        --increase buffers where it's necessary
          (buffers which are used in stxnmov)
        --decrease buffer lengths which are used
          as argument for strxnmov function
      sql/sql_db.cc:
        --increase buffers where it's necessary
          (buffers which are used in stxnmov)
        --decrease buffer lengths which are used
          as argument for strxnmov function
      sql/sql_delete.cc:
        --increase buffers where it's necessary
          (buffers which are used in stxnmov)
        --decrease buffer lengths which are used
          as argument for strxnmov function
      sql/sql_partition.cc:
        --increase buffers where it's necessary
          (buffers which are used in stxnmov)
        --decrease buffer lengths which are used
          as argument for strxnmov function
      sql/sql_rename.cc:
        --increase buffers where it's necessary
          (buffers which are used in stxnmov)
        --decrease buffer lengths which are used
          as argument for strxnmov function
      sql/sql_show.cc:
        --increase buffers where it's necessary
          (buffers which are used in stxnmov)
        --decrease buffer lengths which are used
          as argument for strxnmov function
      sql/sql_table.cc:
        --increase buffers where it's necessary
          (buffers which are used in stxnmov)
        --decrease buffer lengths which are used
          as argument for strxnmov function
      sql/sql_view.cc:
        --increase buffers where it's necessary
          (buffers which are used in stxnmov)
        --decrease buffer lengths which are used
          as argument for strxnmov function
      9347649c
  17. 17 Jun, 2009 1 commit
    • Staale Smedseng's avatar
      Bug #43414 Parenthesis (and other) warnings compiling MySQL · 3b0e6e41
      Staale Smedseng authored
      with gcc 4.3.2
            
      Compiling MySQL with gcc 4.3.2 and later produces a number of 
      warnings, many of which are new with the recent compiler
      versions.
                        
      This bug will be resolved in more than one patch to limit the
      size of changesets. This is the second patch, fixing more
      of the warnings.
      3b0e6e41
  18. 10 Jun, 2009 1 commit
    • Staale Smedseng's avatar
      Bug #43414 Parenthesis (and other) warnings compiling MySQL · a1035097
      Staale Smedseng authored
      with gcc 4.3.2
      
      Compiling MySQL with gcc 4.3.2 and later produces a number of 
      warnings, many of which are new with the recent compiler
      versions.
                  
      This bug will be resolved in more than one patch to limit the
      size of changesets. This is the second patch, fixing more
      of the warnings.
      a1035097
  19. 30 May, 2009 1 commit
    • He Zhenxing's avatar
      BUG#41948 Query_log_event constructor needlessly contorted · abf5f8da
      He Zhenxing authored
      Make the caller of Query_log_event, Execute_load_log_event
      constructors and THD::binlog_query to provide the error code
      instead of having the constructors to figure out the error code.
      
      sql/log_event.cc:
        Changed constructors of Query_log_event and Execute_load_log_event to accept the error code argument instead of figuring it out by itself
      sql/log_event.h:
        Changed constructors of Query_log_event and Execute_load_log_event to accept the error code argument
      abf5f8da
  20. 05 May, 2009 1 commit
    • Martin Hansson's avatar
      Bug#43580: Issue with Innodb on multi-table update · 391364fa
      Martin Hansson authored
                              
      Certain multi-updates gave different results on InnoDB from
      to MyISAM, due to on-the-fly updates being used on the former and
      the update order matters.
      Fixed by turning off on-the-fly updates when update order 
      dependencies are present.
      
      
      mysql-test/r/innodb_mysql.result:
        Bug#43580: Test result.
      mysql-test/suite/rpl/r/rpl_slave_skip.result:
        Bug#43580: Changed test result. The InnoDB result is now what it would have been on MyISAM.
      mysql-test/t/innodb_mysql.test:
        Bug#43580: Test case.
      sql/sql_base.cc:
        Bug#43580: Added a word of caution about using tmp_set here.
      sql/sql_update.cc:
        Bug#43580: Fix.
        Calls to TABLE::mark_columns_needed_for_update() are moved
        from mysql_multi_update_prepare() and right before the decison
        to do on-the-fly updates to the place where we do (or don't do)
        on-the-fly updates.
      391364fa
  21. 17 Apr, 2009 1 commit
    • Anurag Shekhar's avatar
      Bug#44040 MySQL allows creating a MERGE table upon VIEWs but crashes when · 0501328a
      Anurag Shekhar authored
              using it.
      The crash was due to a null pointer present for select_lex while 
      processing the view.
      Adding a check while opening the view to see if its a child of a 
      merge table fixed this problem.
      
      mysql-test/r/merge.result:
        Updated result for the new test case.
      mysql-test/t/merge.test:
        Added test case based on the bug description.
      sql/sql_base.cc:
        Added a check to check if the view being opened is a child table of a
        merge table and return error if it is.
      0501328a
  22. 27 Mar, 2009 2 commits
    • Staale Smedseng's avatar
      Bug#39953 Triggers are not working properly with multi table · 50ed1ef7
      Staale Smedseng authored
      updates
      
      Attempt to execute trigger or stored function with multi-UPDATE
      which used - but didn't update - a table that was also used by
      the calling statement led to an error. Read-only reference to
      tables used in the calling statement should be allowed.
       
      This problem was caused by the fact that check for conflicting
      use of tables in SP/triggers was performed in open_tables(),
      and in case of multi-UPDATE we didn't know exact lock type at
      this stage.
      
      We solve the problem by moving this check to lock_tables(), so
      it can be performed after exact lock types for tables used by
      multi-UPDATE are determined.
      
      
      mysql-test/r/trigger.result:
        Results for the added test case is added.
      mysql-test/t/trigger.test:
        A new test case is added, verifying correct table multi-update
        conflict resolution, both read-only and write.
      sql/sql_base.cc:
        The check for conflicting use of tables in SP/triggers is moved
        to lock_tables(), to be performed after the exact lock types
        have been determined. Also, an assert is added to open_ltable()
        to ensure this func is not used in a prelocked context.
      50ed1ef7
    • He Zhenxing's avatar
      BUG#37145 Killing a statement doing DDL may log binlog event with error code 1053 · 51a91166
      He Zhenxing authored
      When the thread executing a DDL was killed after finished its
      execution but before writing the binlog event, the error code in
      the binlog event could be set wrongly to ER_SERVER_SHUTDOWN or
      ER_QUERY_INTERRUPTED.
      
      This patch fixed the problem by ignoring the kill status when
      constructing the event for DDL statements.
      
      This patch also included the following changes in order to
      provide the test case.
      
       1) modified mysqltest to support variable for connection command
      
       2) modified mysql-test-run.pl, add new variable MYSQL_SLAVE to
          run mysql client against the slave mysqld.
      51a91166
  23. 26 Feb, 2009 1 commit
    • Georgi Kodinov's avatar
      Bug #41354: Access control is bypassed when all columns · a9d70703
      Georgi Kodinov authored
      of a view are selected by * wildcard
      
      Backported a part of the fix for 36086 to 5.0
      
      mysql-test/r/view_grant.result:
        Bug #41354: test case
      mysql-test/t/view_grant.test:
        Bug #41354: test case
      sql/sql_acl.cc:
        Bug #41354: return table error when no access and *
      sql/sql_base.cc:
        Bug #41354: backported the check in bug 36086 to 5.0
      a9d70703
  24. 23 Feb, 2009 1 commit
    • Leonard Zhou's avatar
      Bug#40013 mixed replication: row based format could lead to stale tmp tables on the · 61d706a4
      Leonard Zhou authored
      slave.
      
      In mixed mode, if we create a temporary table and do some update which switch to ROW format,
      the format will keep in ROW format until the session ends or the table is dropped explicitly. 
      When the session ends, the temp table is dropped automaticly at cleanup time.
      but it checks only current binlog format and so skip insertion of DROP TABLE instructions into binlog.
      So the temp table can't be dropped correctly at slave.
      
      Our solution is that when closing temp tables at cleanup time we check both binlog format and binlog mode,
      and we could write DROP TABLE instructions into binlog if current binlog format is ROW but in MIX mode.
      
      mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result:
        Test result file.
      mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test:
        Test file.
      sql/sql_base.cc:
        Didn't do binloging when both current format and default format are ROW.
      61d706a4
  25. 10 Feb, 2009 1 commit
  26. 06 Feb, 2009 1 commit
    • Mats Kindahl's avatar
      Bug #36763 · bd53d214
      Mats Kindahl authored
      TRUNCATE TABLE fails to replicate when stmt-based binlogging is not supported.
      
      There were two separate problems with the code, both of which are fixed with
      this patch:
      
      1. An error was printed by InnoDB for TRUNCATE TABLE in statement mode when
         the in isolation levels READ COMMITTED and READ UNCOMMITTED since InnoDB
         does permit statement-based replication for DML statements. However,
         the TRUNCATE TABLE is not transactional, but is a DDL, and should therefore
         be allowed to be replicated as a statement.
      
      2. The statement was not logged in mixed mode because of the error above, but
         the error was not reported to the client.
      
      This patch fixes the problem by treating TRUNCATE TABLE a DDL, that is, it is
      always logged as a statement and not reporting an error from InnoDB for TRUNCATE
      TABLE.
      
      
      mysql-test/extra/binlog_tests/binlog_truncate.test:
        Adding new test to check that TRUNCATE TABLE is written correctly
        to the binary log.
      mysql-test/extra/rpl_tests/rpl_truncate.test:
        Removing redundant testing by eliminating settings of BINLOG_FORMAT.
      mysql-test/extra/rpl_tests/rpl_truncate_helper.test:
        Replacing slave and master reset code with include file.
        Removing settings of BINLOG_FORMAT.
        Replacing printing of table contents to compare master and slave
        with diff_tables.inc.
      mysql-test/suite/binlog/t/binlog_truncate_innodb.test:
        Adding test for testing that TRUNCATE TABLE is logged correctly for InnoDB
        in all isolation levels.
      mysql-test/suite/binlog/t/binlog_truncate_myisam.test:
        Adding test for testing that TRUNCATE TABLE is logged correctly for MyISAM.
      mysql-test/suite/binlog/t/disabled.def:
        Disabling binlog_truncate_innodb since it does not work (yet).
      sql/sql_base.cc:
        Correcting setting of capabilities flags to make the comparison with 0
        later in the code work correctly.
      sql/sql_delete.cc:
        Re-organizing code to ensure that TRUNCATE TABLE is logged in statement
        format and that row format is not used unless there are rows to log (which
        there are not when delete_all_rows() is called, so this has to be logged
        as a statement).
      bd53d214
  27. 07 Jan, 2009 1 commit
    • Davi Arnaut's avatar
      Bug#41348: INSERT INTO tbl SELECT * FROM temp_tbl overwrites · 7ba37134
      Davi Arnaut authored
                 locking type of temp table
      
      The problem is that INSERT INTO .. SELECT FROM .. and CREATE
      TABLE .. SELECT FROM a temporary table could inadvertently
      overwrite the locking type of the temporary table. The lock
      type of temporary tables should be a write lock by default.
      
      The solution is to reset the lock type of temporary tables
      back to its default value after they are used in a statement.
      
      mysql-test/r/innodb_mysql.result:
        Add test case result for Bug#41348
      mysql-test/r/temp_table.result:
        Add test case result for Bug#41348
      mysql-test/t/innodb_mysql.test:
        Add test case for Bug#41348
      mysql-test/t/temp_table.test:
        Add test case for Bug#41348
      sql/sql_base.cc:
        Allow the lock type of temp tables to be overwritten now that
        the the value is being restored once the table is marked as
        free for re-use. This makes the behavior consistent with that
        of non-temporary tables and avoids confusion.
      7ba37134
  28. 27 Nov, 2008 1 commit
    • Sergey Glukhov's avatar
      Bug#37284 Crash in Field_string::type() · 1182c097
      Sergey Glukhov authored
      The bug is repeatable with latest(1.0.1) InnoDB plugin on Linux, Win,
      If MySQL is compiled with valgrind there are errors about
      using of uninitialized variable(orig_table).
      The fix is to set field->orig_table correct value.
      
      
      mysql-test/r/innodb_mysql.result:
        test result
      mysql-test/t/innodb_mysql.test:
        test case
      sql/sql_base.cc:
        set field->orig_table to 'table' value because it may be bogus and
        it leads to crash on Field_string::type() function.
      1182c097
  29. 10 Nov, 2008 1 commit
  30. 17 Oct, 2008 1 commit
    • Georgi Kodinov's avatar
      Bug #33811: Call to stored procedure with SELECT * / RIGHT JOIN · 697b2839
      Georgi Kodinov authored
      fails after the first time
        
      Two separate problems : 
        1. When flattening joins the linked list used for name resolution 
        (next_name_resolution_table) was not updated.
        Fixed by updating the pointers when extending the table list
        
        2. The items created by expanding a * (star) as a column reference
        were marked as fixed, but no cached table was assigned to them 
        (unlike what Item_field::fix_fields does).
        Fixed by assigning a cached table (so the re-preparation is done
        faster).
        
      Note that the fix for #2 hides the fix for #1 in most cases
      (except when a table reference cannot be cached).
      
      mysql-test/r/sp.result:
        Bug #33811: test case
      mysql-test/t/sp.test:
        Bug #33811: test case
      sql/sql_base.cc:
        Bug #33811: cache the table for Item_fields created by expanding '*'
      sql/sql_select.cc:
        Bug #33811: maintain a correct name resolution chain when
        flattening joins.
      697b2839
  31. 09 Oct, 2008 1 commit
  32. 07 Oct, 2008 1 commit
    • Gleb Shchepa's avatar
      Bug #38691: segfault/abort in ``UPDATE ...JOIN'' while · f48b42e7
      Gleb Shchepa authored
                ``FLUSH TABLES WITH READ LOCK''
      
      Concurrent execution of 1) multitable update with a
      NATURAL/USING join and 2) a such query as "FLUSH TABLES
      WITH READ LOCK" or "ALTER TABLE" of updating table led
      to a server crash.
      
      
      The mysql_multi_update_prepare() function call is optimized
      to lock updating tables only, so it postpones locking to
      the last, and if locking fails, it does cleanup of modified
      syntax structures and repeats a query analysis.  However,
      that cleanup procedure was incomplete for NATURAL/USING join
      syntax data: 1) some Field_item items pointed into freed
      table structures, and 2) the TABLE_LIST::join_columns fields
      was not reset.
      
      Major change:
        short-living Field *Natural_join_column::table_field has
        been replaced with long-living Item*.
      
      
      mysql-test/r/lock_multi.result:
        Added test case for bug #38691.
      mysql-test/t/lock_multi.test:
        Added test case for bug #38691.
      sql/item.cc:
        Bug #38691: segfault/abort in ``UPDATE ...JOIN'' while
                  ``FLUSH TABLES WITH READ LOCK''
        
        The Item_field constructor has been modified to allocate
        and copy original database/table/field names always (not
        during PS preparation/1st execution only), because
        an initialization of Item_field items with a pointer to
        short-living Field structures is a common practice.
      sql/sql_base.cc:
        Bug #38691: segfault/abort in ``UPDATE ...JOIN'' while
                  ``FLUSH TABLES WITH READ LOCK''
        
        1) Type adjustment for Natural_join_column::table_field
           (Field to Item_field);
        2) The setup_natural_join_row_types function has been
           updated to take into account new
           first_natural_join_processing flag to skip unnecessary
           reinitialization of Natural_join_column::join_columns
           during table reopening after lock_tables() failure
           (like the 'first_execution' flag for PS).
      sql/sql_lex.cc:
        Bug #38691: segfault/abort in ``UPDATE ...JOIN'' while
                  ``FLUSH TABLES WITH READ LOCK''
        
        Initialization of the new
        st_select_lex::first_natural_join_processing flag has
        been added.
      sql/sql_lex.h:
        Bug #38691: segfault/abort in ``UPDATE ...JOIN'' while
                  ``FLUSH TABLES WITH READ LOCK''
        
        The st_select_lex::first_natural_join_processing flag
        has been added to skip unnecessary rebuilding of
        NATURAL/USING JOIN structures during table reopening
        after lock_tables failure.
      sql/sql_update.cc:
        Bug #38691: segfault/abort in ``UPDATE ...JOIN'' while
                  ``FLUSH TABLES WITH READ LOCK''
        
        Extra cleanup calls have been added to reset
        Natural_join_column::table_field items.
      sql/table.cc:
        Bug #38691: segfault/abort in ``UPDATE ...JOIN'' while
                  ``FLUSH TABLES WITH READ LOCK''
        
        Type adjustment for Natural_join_column::table_field
        (Field to Item_field).
      sql/table.h:
        Bug #38691: segfault/abort in ``UPDATE ...JOIN'' while
                  ``FLUSH TABLES WITH READ LOCK''
        
        Type of the Natural_join_column::table_field field has
        been changed from Field that points into short-living
        TABLE memory to long-living Item_field that can be
        linked to (fixed) reopened table.
      f48b42e7
  33. 03 Oct, 2008 1 commit
  34. 02 Oct, 2008 1 commit
  35. 29 Sep, 2008 1 commit
    • Davi Arnaut's avatar
      Bug#34306: Can't make copy of log tables when server binary log is enabled · 0406d409
      Davi Arnaut authored
      The problem is that when statement-based replication was enabled,
      statements such as INSERT INTO .. SELECT FROM .. and CREATE TABLE
      .. SELECT FROM need to grab a read lock on the source table that
      does not permit concurrent inserts, which would in turn be denied
      if the source table is a log table because log tables can't be
      locked exclusively.
      
      The solution is to not take such a lock when the source table is
      a log table as it is unsafe to replicate log tables under statement
      based replication. Furthermore, the read lock that does not permits
      concurrent inserts is now only taken if statement-based replication
      is enabled and if the source table is not a log table.
      
      include/thr_lock.h:
        Introduce yet another lock type that my get upgraded depending
        on the binary log format. This is not a optimal solution but
        can be easily improved later.
      mysql-test/r/log_tables.result:
        Add test case result for Bug#34306
      mysql-test/suite/binlog/r/binlog_stm_row.result:
        Add test case result for Bug#34306
      mysql-test/suite/binlog/t/binlog_stm_row.test:
        Add test case for Bug#34306
      mysql-test/t/log_tables.test:
        Add test case for Bug#34306
      sql/lock.cc:
        Assert that TL_READ_DEFAULT is not a real lock type.
      sql/mysql_priv.h:
        Export new function.
      sql/mysqld.cc:
        Remove using_update_log.
      sql/sql_base.cc:
        Introduce function that returns the appropriate read lock type
        depending on how the statement is going to be replicated. It will
        only take a TL_READ_NO_INSERT log if the binary is enabled and the
        binary log format is statement-based and the table is not a log table.
      sql/sql_parse.cc:
        Remove using_update_log.
      sql/sql_update.cc:
        Use new function to choose read lock type.
      sql/sql_yacc.yy:
        The lock type is now decided at open_tables time. This old behavior was
        actually misleading as the binary log format can be dynamically switched
        and this would not change for statements that have already been parsed
        when the binary log format is changed (ie: prepared statements).
      0406d409
  36. 18 Sep, 2008 1 commit
    • Gleb Shchepa's avatar
      Bug#26020: User-Defined Variables are not consistent with · e9cb71fc
      Gleb Shchepa authored
                 columns data types
      
      The "SELECT @lastId, @lastId := Id FROM t" query returns
      different result sets depending on the type of the Id column
      (INT or BIGINT).
      
      Note: this fix doesn't cover the case when a select query
      references an user variable and stored function that
      updates a value of that variable, in this case a result
      is indeterminate.
      
      
      The server uses incorrect assumption about a constantness of
      an user variable value as a select list item: 
      
      The server caches a last query number where that variable
      was changed and compares this number with a current query
      number. If these numbers are different, the server guesses,
      that the variable is not updating in the current query, so
      a respective select list item is a constant. However, in some
      common cases the server updates cached query number too late.
      
      
      The server has been modified to memorize user variable
      assignments during the parse phase to take them into account
      on the next (query preparation) phase independently of the
      order of user variable references/assignments in a select
      item list.
      
      
      mysql-test/r/user_var.result:
        Added test case for bug #26020.
      mysql-test/t/user_var.test:
        Added test case for bug #26020.
      sql/item_func.cc:
        An update of entry and update_query_id variables has been
        moved from Item_func_set_user_var::fix_fields() to a separate
        method, Item_func_set_user_var::set_entry().
      sql/item_func.h:
        1. The Item_func_set_user_var::set_entry() method has been
        added to update Item_func_set_user_var::entry.
        
        2. The Item_func_set_user_var::entry_thd field has beend
        added to update Item_func_set_user_var::entry only when
        needed.
      sql/sql_base.cc:
        Fix: setup_fiedls() calls Item_func_set_user_var::set_entry()
        for all items from the thd->lex->set_var_list before the first
        call of ::fix_fields().
      sql/sql_lex.cc:
        The lex_start function has been modified to reset
        the st_lex::set_var_list list.
      sql/sql_lex.h:
        New st_lex::set_var_list field has been added to
        memorize all user variable assignments in the current
        select query.
      sql/sql_yacc.yy:
        The variable_aux rule has been modified to memorize
        in-query user variable assignments in the
        st_lex::set_var_list list.
      e9cb71fc
  37. 03 Sep, 2008 1 commit
    • Martin Hansson's avatar
      Bug#36086: SELECT * from views don't check column grants · 3bad2119
      Martin Hansson authored
      This patch also fixes bugs 36963 and 35600.
                            
      - In many places a view was confused with an anonymous derived
        table, i.e. access checking was skipped. Fixed by introducing a
        predicate to tell the difference between named and anonymous
        derived tables.
                            
      - When inserting fields for "SELECT * ", there was no 
        distinction between base tables and views, where one should be
        made. View privileges are checked elsewhere.
      
      mysql-test/include/grant_cache.inc:
        Bug#36086: Changed test case.
      mysql-test/r/grant2.result:
        Bug#36086: Changed test result.
      mysql-test/r/grant_cache_no_prot.result:
        Bug#36086: Changed test result.
      mysql-test/r/grant_cache_ps_prot.result:
        Bug#36086: Changed test result.
      mysql-test/r/view_grant.result:
        Bug#36086: Test result.
      mysql-test/t/grant2.test:
        Bug#36086: Changed test case.
      mysql-test/t/view_grant.test:
        Bug#36086: Test case.
      sql/item.cc:
        Bug#36086: Replaced conditional with new methods.
      sql/sql_acl.cc:
        Bug no 35600: 
        In mysql_table_grant:
          Replaced conditional with the new accessor method.
        
        In check_grant:
         - Changed the requirement table->derived != null to 
           checking all anonymous derived tables.
         - Use of the accessor methods for getting object and database 
           names.
            
        Bug#36086: In check_grant_all_columns:
          - Updated comment. This function is now called for views
            as well.
          - The error message should not disclose any column names 
            unless the user has privilege to see all column names.
          - Changed names of Field_iterator_table_ref methods.
      sql/sql_base.cc:
        Bug no 36963: In insert_fields()
          - Commented.
          - We should call check_grant_all_columns() for views in  
            this case.        
          - Changed names of Field_iterator_table_ref methods.
          - We should not disclose column names in the error message
            when the user has no approprate privilege.
      sql/sql_cache.cc:
        Bug#36086: Replaced test with new predicate method.
      sql/sql_derived.cc:
        Bug#36086: commenting only. Updated and doxygenated
        comment for mysql_derived_prepare().
      sql/sql_parse.cc:
        Bug no 35600: 
        - In check_single_table_access:
          Due to the bug, check_grant would raise an error for a
          SHOW CREATE TABLE command for a TEMPTABLE view. It should in
          fact not be be invoked in this case. This table privilege
          is checked already.
          There is a test case for this in information_schema_db.test.
            
        - In check_access: replaced table->derived
      sql/table.cc:
        Bug#36086: 
        
        - In TABLE_LIST::set_underlying_merge(): 
          Commenting only. Doxygenated, corrected spelling,
          added.
        
        - Renamed table_name() and db_name() methods of 
          Field_iterator_table_ref in order to be consistent
          with new methods in TABLE_LIST.
      sql/table.h:
        Bug#36086: 
          - Commented GRANT_INFO.
          - Added a predicate is_anonymous_derived_table() to    
            TABLE_LIST.
          - Added get_table_name() and get_db_name() to   
            TABLE_LIST in order to hide the disparate   
            representation of these properties.
      3bad2119
  38. 21 Aug, 2008 1 commit
    • Alexander Barkov's avatar
      Additional fix for bug#31455 (rpl decoder) · 762df2d0
      Alexander Barkov authored
      - Implementing --base64-format=decode-rows, to display
        SQL-alike decoded row events without their BINLOG statements.
      - Adding --base64-format=decode-rows into tests when
        calling mysqlbinlog to avoid non-deterministic results
      - Removing resetting of last_table_id in "RESET MASTER",
        which appeared to be dangerous.
      762df2d0
  39. 20 Aug, 2008 1 commit
    • Alexander Barkov's avatar
      Bug#31455 mysqlbinlog don't print user readable info about RBR events · 0c5bc2ea
      Alexander Barkov authored
      Implementing -v command line parameter to mysqlbinlog
      to decode and print row events.
      
      mysql-test/include/mysqlbinlog_row_engine.inc
      mysql-test/r/mysqlbinlog_row.result
      mysql-test/r/mysqlbinlog_row_big.result
      mysql-test/r/mysqlbinlog_row_innodb.result
      mysql-test/r/mysqlbinlog_row_myisam.result
      mysql-test/r/mysqlbinlog_row_trans.result
      mysql-test/t/mysqlbinlog_row.test
      mysql-test/t/mysqlbinlog_row_big.test
      mysql-test/t/mysqlbinlog_row_innodb.test
      mysql-test/t/mysqlbinlog_row_myisam.test
      mysql-test/t/mysqlbinlog_row_trans.test
        Adding tests 
      
      client/Makefile.am
        Adding new files to symlink
        
      client/mysqlbinlog.cc
        Adding -v option
      
      sql/log_event.cc
        Impelentations of the new methods
      
      sql/log_event.h
        Declaration of the new methods and member
      
      sql/mysql_priv.h
        Adding new function prototype
      
      sql/rpl_tblmap.cc
        Adding pre-processor conditions 
      
      sql/rpl_tblmap.h
        Adding pre-processor conditions 
      
      sql/rpl_utility.h
        Adding pre-processor conditions 
      
      sql/sql_base.cc
        Adding reset_table_id_sequence() function.
      
      sql/sql_repl.cc
        Resetting table_id on "RESET MASTER"
        
      .bzrignore
        Ignoring new symlinked files
      0c5bc2ea