An error occurred fetching the project authors.
  1. 31 May, 2010 1 commit
    • Tor Didriksen's avatar
      Bug #49829 Many "hides virtual function" warnings with SunStudio · 8231f082
      Tor Didriksen authored
      Backport from mysql-pe (of those parts which have not been upmerged from 5.1)
      
      
      
      sql/field.cc:
        Local scope variable or method argument same as class attribute.
      sql/item.cc:
        Rename auto variable to avoid name clash.
      sql/item.h:
        Item_ref::basic_const_item had wrong signature (missing const)
        and was thus never called.
      sql/partition_info.cc:
        Rename, to avoid name clashes.
      sql/sql_load.cc:
        Rename, to avoid name clashes.
      8231f082
  2. 08 May, 2010 1 commit
    • He Zhenxing's avatar
      Bug#53189 Table map version unused and can be removed · df0b6707
      He Zhenxing authored
      MYSQL_BIN_LOG m_table_map_version member and it's associated 
      functions were not used in the logic of binlogging and replication,
      this patch removed all related code.
      
      sql/log.cc:
        removed unused m_table_map_version variable and functions
      sql/log.h:
        removed unused m_table_map_version variable and functions
      sql/log_event.h:
        Removed unused LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F flag
      sql/sql_class.cc:
        Removed unused LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F flag
      sql/sql_load.cc:
        Removed unused LOG_EVENT_UPDATE_TABLE_MAP_VERSION_F flag
      sql/table.cc:
        removed unused table_map_version variable
      sql/table.h:
        removed unused table_map_version variable
      df0b6707
  3. 05 May, 2010 1 commit
    • Alexander Barkov's avatar
      Bug#51571 load xml infile causes server crash · 3c93a784
      Alexander Barkov authored
        
        Problem:
        item->name was NULL for Item_user_var_as_out_param
        which made strcmp(something, item->name) crash in the LOAD XML code.
        
        Fix:
        - item_func.h: Adding set_name() in constuctor for Item_user_var_as_out_param
        - sql_load.cc: Changing the condition in write_execute_load_query_log_event() which
        distiguished between Item_user_var_as_out_param and Item_field
        from
          if (item->name == NULL)
        to
          if (item->type() == Item::FIELD_ITEM)
        - loadxml.result, loadxml.test: adding tests
      3c93a784
  4. 03 May, 2010 1 commit
    • Kristofer Pettersson's avatar
      Bug#50373 --secure-file-priv="" · 5dd5d705
      Kristofer Pettersson authored
      Iterative patch improvement. Previously committed patch
      caused wrong result on Windows. The previous patch also
      broke secure_file_priv for symlinks since not all file
      paths which must be compared against this variable are
      normalized using the same norm.
      
      The server variable opt_secure_file_priv wasn't
      normalized properly and caused the operations
      LOAD DATA INFILE .. INTO TABLE ..
      and
      SELECT load_file(..)
      to do different interpretations of the 
      --secure-file-priv option.
           
      The patch moves code to the server initialization
      routines so that the path always is normalized
      once and only once.
            
      It was also intended that setting the option
      to an empty string should be equal to 
      lifting all previously set restrictions. This
      is also fixed by this patch.
      
      
      mysql-test/r/loaddata.result:
        * Removed test code which will currently break the much used --mem feature of mtr.
      mysql-test/t/loaddata.test:
        * Removed test code which will currently break the much used --mem feature of mtr.
      sql/item_strfunc.cc:
        * Replaced string comparing code on opt_secure_file_priv with an interface which guarantees that both file paths are normalized using the same norm on all platforms.
      sql/mysql_priv.h:
        * Added signature for is_secure_file_path()
      sql/mysqld.cc:
        * New function for checking if a path compatible with the secure path restriction.
        * Added initialization of the opt_secure_file_priv variable.
      sql/sql_class.cc:
        * Replaced string comparing code on opt_secure_file_priv with an interface which guarantees that both file paths are normalized using the same norm on all platforms.
      sql/sql_load.cc:
        * Replaced string comparing code on opt_secure_file_priv with an interface which guarantees that both file paths are normalized using the same norm on all platforms.
      5dd5d705
  5. 28 Apr, 2010 1 commit
    • Konstantin Osipov's avatar
      Committing on behalf or Dmitry Lenev: · 1ab519d9
      Konstantin Osipov authored
      Fix for bug #46947 "Embedded SELECT without FOR UPDATE is
      causing a lock", with after-review fixes.
      
      SELECT statements with subqueries referencing InnoDB tables
      were acquiring shared locks on rows in these tables when they
      were executed in REPEATABLE-READ mode and with statement or
      mixed mode binary logging turned on.
      
      This was a regression which were introduced when fixing
      bug 39843.
      
      The problem was that for tables belonging to subqueries
      parser set TL_READ_DEFAULT as a lock type. In cases when
      statement/mixed binary logging at open_tables() time this
      type of lock was converted to TL_READ_NO_INSERT lock at
      open_tables() time and caused InnoDB engine to acquire
      shared locks on reads from these tables. Although in some
      cases such behavior was correct (e.g. for subqueries in
      DELETE) in case of SELECT it has caused unnecessary locking.
      
      This patch tries to solve this problem by rethinking our
      approach to how we handle locking for SELECT and subqueries.
      Now we always set TL_READ_DEFAULT lock type for all cases
      when we read data. When at open_tables() time this lock
      is interpreted as TL_READ_NO_INSERT or TL_READ depending
      on whether this statement as a whole or call to function
      which uses particular table should be written to the
      binary log or not (if yes then statement should be properly
      serialized with concurrent statements and stronger lock
      should be acquired).
      
      Test coverage is added for both InnoDB and MyISAM.
      
      This patch introduces an "incompatible" change in locking
      scheme for subqueries used in SELECT ... FOR UPDATE and
      SELECT .. IN SHARE MODE.
      In 4.1 the server would use a snapshot InnoDB read for 
      subqueries in SELECT FOR UPDATE and SELECT .. IN SHARE MODE
      statements, regardless of whether the binary log is on or off.
      If the user required a different type of read (i.e. locking read),
      he/she could request so explicitly by providing FOR UPDATE/IN SHARE MODE
      clause for each individual subquery.
      On of the patches for 5.0 broke this behaviour (which was not documented
      or tested), and started to use locking reads fora all subqueries in SELECT ... 
      FOR UPDATE/IN SHARE MODE. This patch restored 4.1 behaviour.
      
      mysql-test/include/check_concurrent_insert.inc:
        Added auxiliary script which allows to check if statement
        reading table allows concurrent inserts in it.
      mysql-test/include/check_no_concurrent_insert.inc:
        Added auxiliary script which allows to check that statement
        reading table doesn't allow concurrent inserts in it.
      mysql-test/include/check_no_row_lock.inc:
        Added auxiliary script which allows to check if statement
        reading table doesn't take locks on its rows.
      mysql-test/include/check_shared_row_lock.inc:
        Added auxiliary script which allows to check if statement
        reading table takes shared locks on some of its rows.
      mysql-test/r/bug39022.result:
        After bug #46947 'Embedded SELECT without FOR UPDATE is
        causing a lock' was fixed test case for bug 39022 has to
        be adjusted in order to trigger execution path on which
        original problem was encountered.
      mysql-test/r/innodb_mysql_lock2.result:
        Added coverage for handling of locking in various cases when
        we read data from InnoDB tables (includes test case for
        bug #46947 'Embedded SELECT without FOR UPDATE is causing a
        lock').
      mysql-test/r/lock_sync.result:
        Added coverage for handling of locking in various cases when
        we read data from MyISAM tables.
      mysql-test/t/bug39022.test:
        After bug #46947 'Embedded SELECT without FOR UPDATE is
        causing a lock' was fixed test case for bug 39022 has to
        be adjusted in order to trigger execution path on which
        original problem was encountered.
      mysql-test/t/innodb_mysql_lock2.test:
        Added coverage for handling of locking in various cases when
        we read data from InnoDB tables (includes test case for
        bug #46947 'Embedded SELECT without FOR UPDATE is causing a
        lock').
      mysql-test/t/lock_sync.test:
        Added coverage for handling of locking in various cases when
        we read data from MyISAM tables.
      sql/log_event.cc:
        Since LEX::lock_option member was removed we no longer can
        rely on its value in Load_log_event::print_query() to
        determine that log event correponds to LOAD DATA CONCURRENT
        statement (this was not correct in all situations anyway).
        A new Load_log_event's member was introduced as a replacement.
        It is initialized at event object construction time and
        explicitly indicates whether LOAD DATA was concurrent.
      sql/log_event.h:
        Since LEX::lock_option member was removed we no longer can
        rely on its value in Load_log_event::print_query() to
        determine that log event correponds to LOAD DATA CONCURRENT
        statement (this was not correct in all situations anyway).
        A new Load_log_event's member was introduced as a replacement.
        It is initialized at event object construction time and
        explicitly indicates whether LOAD DATA was concurrent.
      sql/sp_head.cc:
        sp_head::reset_lex():
          Before parsing substatement reset part of parser state
          which needs this (e.g. set Yacc_state::m_lock_type to
          default value).
      sql/sql_acl.cc:
        Since LEX::reset_n_backup_query_tables_list() now also
        resets LEX::sql_command member (as it became part of
        Query_tables_list class) we have to restore it in cases
        when while working with proxy Query_table_list we assume
        that LEX::sql_command still corresponds to original SQL
        command being executed (for example, when we are logging
        statement to the binary log while having Query_tables_list
        reset and backed up).
      sql/sql_base.cc:
        Changed read_lock_type_for_table() to return a weak TL_READ
        type of lock in cases when we are executing statement which
        won't update tables directly and table doesn't belong to
        statement's prelocking list and thus can't be used by a
        stored function. It is OK to do so since in this case table
        won't be used by statement or function call which will be
        written to the binary log, so serializability requirements
        for it can be relaxed.
        One of results from this change is that SELECTs on InnoDB
        tables no longer takes shared row locks for tables which
        are used in subqueries (i.e. bug #46947 is fixed).
        Another result is that for similar SELECTs on MyISAM tables
        concurrent inserts are allowed.
        In order to implement this change signature of
        read_lock_type_for_table() function was changed to take
        pointers to Query_tables_list and TABLE_LIST objects.
      sql/sql_base.h:
        - Function read_lock_type_for_table() now takes pointers
          to Query_tables_list and TABLE_LIST elements as its
          arguments since to correctly determine lock type it needs
          to know what statement is being performed and whether table
          element for which lock type to be determined belongs to
          prelocking list.
      sql/sql_lex.cc:
        - Removed LEX::lock_option and st_select_lex::lock_option
          members. Places in parser that were using them now use
          Yacc_state::m_lock_type instead.
        - To emphasize that LEX::sql_command member is used during
          process of opening and locking of tables it was moved to
          Query_tables_list class. It is now reset by
          Query_tables_list::reset_query_tables_list() method.
      sql/sql_lex.h:
        - Removed st_select_lex::lock_option member as there is no
          real need for per-SELECT lock type (HIGH_PRIORITY option
          should apply to the whole statement. FOR UPDATE/LOCK IN
          SHARE MODE clauses can be handled without this member).
          The main effect which was achieved by introduction of this
          member, i.e. using TL_READ_DEFAULT lock type for
          subqueries, is now achieved by setting LEX::lock_option
          (or rather its replacement - Yacc_state::m_lock_type) to
          TL_READ_DEFAULT in almost all cases.
        - To emphasize that LEX::sql_command member is used during
          process of opening and locking of tables it was moved to
          Query_tables_list class.
        - Replaced LEX::lock_option with Yacc_state::m_lock_type
          in order to emphasize that this value is relevant only
          during parsing. Unlike for LEX::lock_option the default
          value for Yacc_state::m_lock_type is TL_READ_DEFAULT.
          Note that for cases when it is OK to take a "weak" read
          lock (e.g. simple SELECT) this lock type will be converted
          to TL_READ at open_tables() time. So this change won't
          cause negative change in behavior for such statements.
          OTOH this change ensures that, for example, for SELECTs
          which are used in stored functions TL_READ_NO_INSERT lock
          is taken when necessary and as result calls to such stored
          functions can be written to the binary log with correct
          serialization.
      sql/sql_load.cc:
        Load_log_event constructor now requires a parameter that
        indicates whether LOAD DATA is concurrent.
      sql/sql_parse.cc:
        LEX::lock_option was replaced with Yacc_state::m_lock_type.
        And instead of resetting the latter implicitly in
        mysql_init_multi_delete() we do it explicitly in the
        places in parser which call this function.
      sql/sql_priv.h:
        - To be able more easily distinguish high-priority SELECTs
          in st_select_lex::print() method added flag for
          HIGH_PRIORITY option.
      sql/sql_select.cc:
        Changed code not to rely on LEX::lock_option to determine
        that it is high-priority SELECT. It was replaced with
        Yacc_state::m_lock_type which is accessible only at
        parse time. So instead of LEX::lock_option we now rely
        on a newly introduced flag for st_select_lex::options -
        SELECT_HIGH_PRIORITY.
      sql/sql_show.cc:
        Since LEX::reset_n_backup_query_tables_list() now also
        resets LEX::sql_command member (as it became part of
        Query_tables_list class) we have to restore it in cases
        when while working with proxy Query_table_list we assume
        that LEX::sql_command still corresponds to original SQL
        command being executed.
      sql/sql_table.cc:
        Since LEX::reset_query_tables_list() now also resets
        LEX::sql_command member (as it became part of
        Query_tables_list class) we have to restore value of this
        member when this method is called by mysql_admin_table(),
        to make this code safe for re-execution.
      sql/sql_trigger.cc:
        Since LEX::reset_n_backup_query_tables_list() now also
        resets LEX::sql_command member (as it became part of
        Query_tables_list class) we have to restore it in cases
        when while working with proxy Query_table_list we assume
        that LEX::sql_command still corresponds to original SQL
        command being executed (for example, when we are logging
        statement to the binary log while having Query_tables_list
        reset and backed up).
      sql/sql_update.cc:
        Function read_lock_type_for_table() now takes pointers
        to Query_tables_list and TABLE_LIST elements as its
        arguments since to correctly determine lock type it needs
        to know what statement is being performed and whether table
        element for which lock type to be determined belongs to
        prelocking list.
      sql/sql_yacc.yy:
        - Removed st_select_lex::lock_option member as there is no
          real need for per-SELECT lock type (HIGH_PRIORITY option
          should apply to the whole statement. FOR UPDATE/LOCK IN
          SHARE MODE clauses can be handled without this member).
          The main effect which was achieved by introduction of this
          member, i.e. using TL_READ_DEFAULT lock type for
          subqueries, is now achieved by setting LEX::lock_option
          (or rather its replacement - Yacc_state::m_lock_type) to
          TL_READ_DEFAULT in almost all cases.
        - Replaced LEX::lock_option with Yacc_state::m_lock_type
          in order to emphasize that this value is relevant only
          during parsing. Unlike for LEX::lock_option the default
          value for Yacc_state::m_lock_type is TL_READ_DEFAULT.
          Note that for cases when it is OK to take a "weak" read
          lock (e.g. simple SELECT) this lock type will be converted
          to TL_READ at open_tables() time. So this change won't
          cause negative change in behavior for such statements.
          OTOH this change ensures that, for example, for SELECTs
          which are used in stored functions TL_READ_NO_INSERT lock
          is taken when necessary and as result calls to such stored
          functions can be written to the binary log with correct
          serialization.
        - To be able more easily distinguish high-priority SELECTs
          in st_select_lex::print() method we now use new flag
          in st_select_lex::options bit-field.
      1ab519d9
  6. 16 Apr, 2010 1 commit
    • Kristofer Pettersson's avatar
      Bug#50373 --secure-file-priv="" · 794a4413
      Kristofer Pettersson authored
      The server variable opt_secure_file_priv wasn't
      normalized properly and caused the operations
      LOAD DATA INFILE .. INTO TABLE ..
      and
      SELECT load_file(..)
      to do different interpretations of the 
      --secure-file-priv option.
      
      The patch moves code to the server initialization
      routines so that the path always is normalized
      once and only once.
      
      It was also intended that setting the option
      to an empty string should be equal to 
      lifting all previously set restrictions. This
      is also fixed by this patch.
      
      
      sql/mysqld.cc:
        * If --secure_file_option is an empty string then the option variable
          should be unset.
        * opt_secure_file_option should be normalized once when the server starts.
      sql/sql_load.cc:
        * moved variable normalization code to fix_paths()
      794a4413
  7. 31 Mar, 2010 1 commit
    • Mats Kindahl's avatar
      WL#5030: Split and remove mysql_priv.h · 23d8586d
      Mats Kindahl authored
      This patch:
      
      - Moves all definitions from the mysql_priv.h file into
        header files for the component where the variable is
        defined
      - Creates header files if the component lacks one
      - Eliminates all include directives from mysql_priv.h
      - Eliminates all circular include cycles
      - Rename time.cc to sql_time.cc
      - Rename mysql_priv.h to sql_priv.h
      23d8586d
  8. 09 Mar, 2010 1 commit
    • Alexey Botchkov's avatar
      Bug#51377 Crash in information_schema / processlist on concurrent DDL workload · e1addb05
      Alexey Botchkov authored
          the fill_schema_processlist function accesses THD::query() without proper protection
          so the parallel thread killing can lead to access to the freed meemory.
      
      per-file comments:
        sql/sql_load.cc
      Bug#51377      Crash in information_schema / processlist on concurrent DDL workload
          the THD::set_query_inner() call needs to be protected.
          But here we don't need to change the original thd->query() at all.
        sql/sql_show.cc
      Bug#51377      Crash in information_schema / processlist on concurrent DDL workload
          protect the THD::query() access with the THD::LOCK_thd_data mutex.
      e1addb05
  9. 24 Feb, 2010 1 commit
    • Jon Olav Hauglid's avatar
      Followup to Bug#45225 Locking: hang if drop table with no timeout · e60ef893
      Jon Olav Hauglid authored
      This patch prevents system threads and system table accesses from
      using user-specified values for "lock_wait_timeout". Instead all
      such accesses are done using the default value (1 year).
      
      This prevents background tasks (such as replication, events, 
      accessing stored function definitions, logging, reading time-zone
      information, etc.) from failing in cases where the global value
      of "lock_wait_timeout" is set very low.
      
      The patch also simplifies the open tables API. Rather than adding
      another convenience function for opening and locking system tables,
      this patch removes most of the existing convenience functions for
      open_and_lock_tables_derived(). Before, open_and_lock_tables() was
      a convenience function that enforced derived tables handling, while
      open_and_lock_tables_derived() was the main function where derived
      tables handling was optional. Now, this convencience function is
      gone and the main function is renamed to open_and_lock_tables(). 
      
      No test case added as it would have required the use of --sleep to
      check that system threads and system tables have a different timeout
      value from the user-specified "lock_wait_timeout" system variable.
      e60ef893
  10. 04 Feb, 2010 1 commit
    • Konstantin Osipov's avatar
      Merge next-mr -> next-4284. · 00dc9a6e
      Konstantin Osipov authored
      Cherry-pick a fix Bug#37148 from next-mr, to preserve
      file ids of the added files, and ensure that all the necessary
      changes have been pulled.
      
      Since initially Bug#37148 was null-merged into 6.0,
      the changeset that is now being cherry-picked was likewise
      null merged into next-4284.
      
      Now that Bug#37148 has been reapplied to 6.0, try to make
      it work with next-4284. This is also necessary to be able
      to pull other changes from 5.1-rep into next-4284.
      
      To resolve the merge issues use this changeset applied
      to 6.0:
      revid:jperkin@sun.com-20091216103628-ylhqf7s6yegui2t9
      revno: 3776.1.1
      committer: He Zhenxing <zhenxing.he@sun.com>
      branch nick: 6.0-codebase-bugfixing
      timestamp: Thu 2009-12-17 17:02:50 +0800
      message:
        Fix merge problem with Bug#37148
      
      
      
      00dc9a6e
  11. 24 Jan, 2010 1 commit
  12. 07 Jan, 2010 1 commit
  13. 06 Dec, 2009 1 commit
    • Luis Soares's avatar
      BUG#49479: Slave stops with syntax error: LOAD DATA event without · 59571928
      Luis Soares authored
      escaped field names
      
      When in mixed or statement mode, the master logs LOAD DATA
      queries by resorting to an Execute_load_query_log_event. This
      event does not contain the original query, but a rewritten
      version of it, which includes the table field names. However, the
      rewrite does not escape the field names. If these names match a
      reserved keyword, then the slave will stop with a syntax error
      when executing the event.
      
      We fix this by escaping the fields names as it happens already
      for the table name.
      
      mysql-test/extra/rpl_tests/rpl_loaddata.test:
        Added test case for the reported bug.
      mysql-test/r/mysqlbinlog.result:
        Changed result to support escaped field name.
      mysql-test/suite/binlog/r/binlog_killed_simulate.result:
        Changed result to support escaped field name.
      mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result:
        Changed result to support escaped field name.
      mysql-test/suite/binlog/r/binlog_stm_blackhole.result:
        Changed result to support escaped field name.
      mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result:
        Changed result to support escaped field name.
      mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result:
        Changed result to support escaped field name.
      mysql-test/suite/rpl/r/rpl_loaddata.result:
        Added result for new test. 
        Changed show slave status positions which are now different because of
        extra escape character in field names.
      mysql-test/suite/rpl/r/rpl_loaddata_fatal.result:
        Changed show slave status positions which are now different because of
        extra escape character.
      mysql-test/suite/rpl/r/rpl_loaddata_map.result:
        Changed result to support escaped field name.
      mysql-test/suite/rpl/r/rpl_stm_log.result:
        Changed result to support escaped field name.
      mysql-test/t/mysqlbinlog.test:
        Changed positions which is now different because of extra escape 
        character in field names.
      sql/sql_load.cc:
        Appended escape characters before and after field names.
      59571928
  14. 01 Dec, 2009 1 commit
    • Konstantin Osipov's avatar
      Backport of: · 5969dcda
      Konstantin Osipov authored
      ----------------------------------------------------------
      revno: 2630.4.26
      committer: Konstantin Osipov <konstantin@mysql.com>
      branch nick: mysql-6.0-prelocked_mode-to-push
      timestamp: Fri 2008-06-06 23:19:04 +0400
      message:
        WL#3726: work on review comments.
        Remove thd->locked_tables. Always store MYSQL_LOCK instances in
        thd->lock.
        Rename thd->prelocked_mode to thd->locked_tables_mode.
        Use thd->locked_tables_mode to determine if we
        are under LOCK TABLES. Update the code to not assume that
        if thd->lock is set, LOCK TABLES mode is off.
        Review comments.
      
      
      sql/ha_ndbcluster_binlog.cc:
        Don't unlock the lock under LOCK TABLES (safety).
      sql/handler.cc:
        There is no thd->locked_tables any more.
        Update comments.
      sql/lock.cc:
        There is no thd->locked_tables any more.
      sql/log.cc:
        Rename thd->prelocked_mode to thd->locked_tables_mode.
      sql/set_var.cc:
        Use thd->locked_tables_mode to determine if we are under LOCK TABLES.
      sql/sp_head.cc:
        Rename thd->prelocked_mode to thd->locked_tables_mode.
      sql/sql_base.cc:
        Use thd->locked_tables_mode to determine if we are under LOCK TABLES.
        Remove thd->locked_tables.
      sql/sql_cache.cc:
        Use thd->locked_tables_mode to determine if we are under LOCK TABLES.
      sql/sql_class.cc:
        Avoid code duplication.
        Do not release the table locks prematurely if we're under LOCK TABLES.
        Use thd->locked_tables_mode instead of thd->locked_tables.
      sql/sql_class.h:
        Remove thd->locked_tables.
        Make prelocked mode a kind of LOCK TABLES mode.
        Update comments.
      sql/sql_cursor.cc:
        Update comments.
      sql/sql_insert.cc:
        Use thd->locked_tables_mode to determine if we are under LOCK TABLES.
        Rename thd->prelocked_mode to thd->locked_tables_mode.
      sql/sql_load.cc:
        Rename thd->prelocked_mode to thd->locked_tables_mode.
      sql/sql_parse.cc:
        Use thd->locked_tables_mode to determine if we are under LOCK TABLES.
        Remove thd->locked_tables.
      sql/sql_partition.cc:
        Use thd->locked_tables_mode to determine if we are under LOCK TABLES.
      sql/sql_rename.cc:
        Use thd->locked_tables_mode to determine if we are under LOCK TABLES.
      sql/sql_select.cc:
        Use thd->locked_tables_mode to determine if we are under LOCK TABLES.
      sql/sql_table.cc:
        Use thd->locked_tables_mode to determine if we are under LOCK TABLES.
      sql/sql_trigger.cc:
        Use thd->locked_tables_mode to determine if we are under LOCK TABLES.
      sql/sql_update.cc:
        Use thd->locked_tables_mode to determine if we are under LOCK TABLES.
      sql/sql_view.cc:
        Use thd->locked_tables_mode to determine if we are under LOCK TABLES.
      storage/myisam/ha_myisam.cc:
        Use thd->locked_tables_mode to determine if we are under LOCK TABLES.
      5969dcda
  15. 28 Nov, 2009 1 commit
    • unknown's avatar
      Bug #43913 rpl_cross_version can't pass on conflicts complainig clash with --slave-load-tm · b9f9fe2e
      unknown authored
            
      The 'slave_patternload_file' is assigned to the real path of the load data file 
      when initializing the object of Relay_log_info. But the path of the load data
      file is not formatted to real path when executing event from relay log. So the 
      error will be encountered if the path of the load data file is a symbolic link.
      
      Actually the global 'opt_secure_file_priv' is not formatted to real path when 
      loading data from file. So the same thing will happen too.
      
            
      To fix these errors, the path of the load data file should be formatted to 
      real path when executing event from relay log. And the 'opt_secure_file_priv' 
      should be formatted to real path when loading data infile.
      
      
      mysql-test/suite/rpl/r/rpl_loaddata_symlink.result:
        Test result for bug#43913.
      mysql-test/suite/rpl/t/rpl_loaddata_symlink-master.sh:
        Added the test file to create a link from $MYSQLTEST_VARDIR/std_data 
        to $MYSQLTEST_VARDIR/std_data_master_link
      mysql-test/suite/rpl/t/rpl_loaddata_symlink-slave.sh:
        Added the test file to create a link from $MYSQLTEST_VARDIR/std_data 
        to $MYSQLTEST_VARDIR/std_data_slave_link
      mysql-test/suite/rpl/t/rpl_loaddata_symlink.test:
        Added the test file to verify if loading data infile will work fine 
        if the path of the load data file is a symbolic link.
      sql/rpl_rli.cc:
        Added call 'my_realpath' function for avoiding sometimes the 'fn_format' 
        function can't format real path rightly.
      b9f9fe2e
  16. 25 Nov, 2009 1 commit
    • MySQL Build Team's avatar
      Backport into build-200911241145-5.1.40sp1 · 610f0f1b
      MySQL Build Team authored
      > ------------------------------------------------------------
      > revno: 3184.7.1
      > revision-id: luis.soares@sun.com-20091027151553-ri74b2zdchw8wyg7
      > parent: joro@sun.com-20091019135504-e6fmhf4xyy0wdymb
      > committer: Luis Soares <luis.soares@sun.com>
      > branch nick: mysql-5.1-bugteam
      > timestamp: Tue 2009-10-27 15:15:53 +0000
      > message:
      >   BUG#48297: Schema name is ignored when LOAD DATA is written into 
      >   binlog, replication aborts
      >   
      >   In SBR or MBR, the schema name is not being written to the binlog
      >   when executing a LOAD DATA statement. This becomes a problem when
      >   the current database (lets call it db1) is different from the
      >   table's schema (lets call it db2). For instance, take the
      >   following statements:
      >     
      >     use db1;
      >     load data local infile 'infile.txt' into table db2.t
      >   
      >   Should this statement be logged without t's schema (db2), when
      >   replaying it, one can get db1.t populated instead of db2.t (if
      >   db1.t exists). On the other hand, if there is no db1.t at all,
      >   replication will stop.
      >   
      >   We fix this by always logging the table (in load file) with fully
      >   qualified name when its schema is different from the current
      >   database or when no default database was selected.
      610f0f1b
  17. 21 Nov, 2009 1 commit
    • He Zhenxing's avatar
      BUG#37148 Most callers of mysql_bin_log.write ignore the return result · dd383cad
      He Zhenxing authored
      This is the non-ndb part of the patch.
      
      The return value of mysql_bin_log.write was ignored by most callers,
      which may lead to inconsistent on master and slave if the transaction
      was committed while the binlog was not correctly written. If
      my_error() is call in mysql_bin_log.write, this could also lead to
      assertion issue if my_ok() or my_error() is called after.
      
      This fixed the problem by let the caller to check and handle the
      return value of mysql_bin_log.write. This patch only adresses the
      simple cases.
      
      
      mysql-test/include/binlog_inject_error.inc:
        inject binlog write error when doing a query
      mysql-test/suite/binlog/t/binlog_write_error.test:
        Simple test case to check if proper error is reported when injecting binlog write errors.
      sql/events.cc:
        check return value of mysql_bin_log.write
      sql/log.cc:
        check return value of mysql_bin_log.write
      sql/log_event.cc:
        check return value of mysql_bin_log.write
      sql/log_event_old.cc:
        check return value of mysql_bin_log.write
      sql/mysql_priv.h:
        Change write_bin_log to return int instead of void
      sql/rpl_injector.cc:
        check return value of writing binlog
      sql/sp.cc:
        check return value of writing binlog
      sql/sp_head.cc:
        return 1 if writing binlog failed
      sql/sql_acl.cc:
        check return value of writing binlog
      sql/sql_base.cc:
        check return value of writing binlog
      sql/sql_class.h:
        Change binlog_show_create_table to return int
      sql/sql_db.cc:
        Change write_to_binlog to return int
        check return value of writing binlog
      sql/sql_delete.cc:
        check return value of writing binlog
      sql/sql_insert.cc:
        check return value of writing binlog
      sql/sql_load.cc:
        check return value of writing binlog
      sql/sql_parse.cc:
        check return value of writing binlog
      sql/sql_partition.cc:
        check return value of writing binlog
      sql/sql_rename.cc:
        check return value of writing binlog
      sql/sql_repl.cc:
        check return value of writing binlog
      sql/sql_table.cc:
        Change write_bin_log to return int, and return 1 if there was error writing binlog
      sql/sql_tablespace.cc:
        check return value of writing binlog
      sql/sql_trigger.cc:
        check return value of writing binlog
      sql/sql_udf.cc:
        check return value of writing binlog
      sql/sql_update.cc:
        check return value of writing binlog
      sql/sql_view.cc:
        check return value of writing binlog
      dd383cad
  18. 04 Nov, 2009 1 commit
    • Luis Soares's avatar
      BUG#48048: Deprecated constructs need removal in Betony · fb175a1b
      Luis Soares authored
      NOTE: Backport of:
      
      bzr log -r revid:sp1r-serg@sergbook.mysql.com-20070505200319-38337
      ------------------------------------------------------------
      revno: 2469.263.4
      committer: serg@sergbook.mysql.com
      timestamp: Sat 2007-05-05 13:03:19 -0700
      message:
        Removing deprecated features:
        --master-XXX command-line options
        log_bin_trust_routine_creators
        table_type
        BACKUP TABLE ...
        RESTORE TABLE ...
        SHOW PLUGIN
        LOAD TABLE ... FROM MASTER
        LOAD DATA FROM MASTER
        SHOW INNODB STATUS
        SHOW MUTEX STATUS
        SHOW TABLE TYPES
        ... TIMESTAMP(N)
        ... TYPE=engine
        
        RESET SLAVE don't reset connection parameters anymore
        LOAD DATA: check opt_secure_file_priv before access(filename)
        improved WARN_DEPRECATED macro
      
      fb175a1b
  19. 03 Nov, 2009 1 commit
    • Alfranio Correia's avatar
      WL#2687 WL#5072 BUG#40278 BUG#47175 · 19c380aa
      Alfranio Correia authored
      Non-transactional updates that take place inside a transaction present problems
      for logging because they are visible to other clients before the transaction
      is committed, and they are not rolled back even if the transaction is rolled
      back. It is not always possible to log correctly in statement format when both
      transactional and non-transactional tables are used in the same transaction.
      
      In the current patch, we ensure that such scenario is completely safe under the
      ROW and MIXED modes.
      19c380aa
  20. 27 Oct, 2009 1 commit
    • Luis Soares's avatar
      BUG#48297: Schema name is ignored when LOAD DATA is written into · a3829176
      Luis Soares authored
      binlog, replication aborts
      
      In SBR or MBR, the schema name is not being written to the binlog
      when executing a LOAD DATA statement. This becomes a problem when
      the current database (lets call it db1) is different from the
      table's schema (lets call it db2). For instance, take the
      following statements:
        
        use db1;
        load data local infile 'infile.txt' into table db2.t
      
      Should this statement be logged without t's schema (db2), when
      replaying it, one can get db1.t populated instead of db2.t (if
      db1.t exists). On the other hand, if there is no db1.t at all,
      replication will stop.
      
      We fix this by always logging the table (in load file) with fully
      qualified name when its schema is different from the current
      database or when no default database was selected.
      a3829176
  21. 16 Oct, 2009 1 commit
    • Georgi Kodinov's avatar
      Bug #40877: multi statement execution fails in 5.1.30 · 7b4ef910
      Georgi Kodinov authored
            
      Implemented the server infrastructure for the fix:
      
      1. Added a function LEX_STRING *thd_query_string(THD) to return
      a LEX_STRING structure instead of char *.
      This is the function that must be called in innodb instead of 
      thd_query()
      
      2. Did some encapsulation in THD : aggregated thd_query and 
      thd_query_length into a LEX_STRING and made accessor and mutator 
      methods for easy code updating. 
      
      3. Updated the server code to use the new methods where applicable.
      7b4ef910
  22. 12 Oct, 2009 1 commit
  23. 28 Sep, 2009 1 commit
    • Tatiana A. Nurnberg's avatar
      Bug#43746: YACC return wrong query string when parse 'load data infile' sql statement · 4102363f
      Tatiana A. Nurnberg authored
      "load data" statements were written to the binlog as a mix of the original statement
      and bits recreated from parse-info. This relied on implementation details and broke
      with IGNORE_SPACES and versioned comments.
      
      We now completely resynthesize the query for LOAD DATA for binlog (which among other
      things normalizes them somewhat with regard to case, spaces, etc.).
      We have already parsed the query properly, so we make use of that rather
      than mix-and-match string literals and parsed items.
      This should make us safe with regard to versioned comments, even those
      spanning multiple tokens. Also no longer affected by IGNORE_SPACES.
      
      mysql-test/r/mysqlbinlog.result:
        LOAD DATA INFILE normalized
      mysql-test/suite/binlog/r/binlog_killed_simulate.result:
        LOAD DATA INFILE normalized
      mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result:
        LOAD DATA INFILE normalized
      mysql-test/suite/binlog/r/binlog_stm_blackhole.result:
        LOAD DATA INFILE normalized
      mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result:
        LOAD DATA INFILE normalized
      mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result:
        LOAD DATA INFILE normalized
      mysql-test/suite/rpl/r/rpl_loaddata.result:
        LOAD DATA INFILE normalized
      mysql-test/suite/rpl/r/rpl_loaddata_fatal.result:
        LOAD DATA INFILE normalized; offsets adjusted to reflect that
      mysql-test/suite/rpl/r/rpl_loaddata_map.result:
        LOAD DATA INFILE normalized
      mysql-test/suite/rpl/r/rpl_loaddatalocal.result:
        test for #43746 - trying to break LOAD DATA part of parser
      mysql-test/suite/rpl/r/rpl_stm_log.result:
        LOAD DATA INFILE normalized
      mysql-test/suite/rpl/t/rpl_loaddatalocal.test:
        try to break the LOAD DATA part of the parser (test for #43746)
      mysql-test/t/mysqlbinlog.test:
        LOAD DATA INFILE normalized; adjust offsets to reflect that
      sql/log_event.cc:
        clean up Load_log_event::print_query and friends so they don't print
        excess spaces. add support for printing charset names to print_query.
      sql/log_event.h:
        We already have three places where we synthesize LOAD DATA queries.
        Better use one of those!
      sql/sql_lex.h:
        When binlogging LOAD DATA statements, we make up the statement to
        be logged (from the parse-info, rather than substrings of the
        original query) now. Consequently, we no longer need (string-)
        pointers into the original query.
      sql/sql_load.cc:
        Completely rewrote write_execute_load_query_log_event() to synthesize the
        LOAD DATA statement wholesale, rather than piece it together from
        synthesized bits and literal excerpts from the original query. This
        will not only give us a nice, normalized statement (all uppercase,
        no excess spaces, etc.), it will also handle comments, including
        versioned comments right, which is certainly more than we can say
        about the previous incarnation.
      sql/sql_yacc.yy:
        We're no longer assembling LOAD DATA statements from bodyparts of the
        original query, so some bookkeeping in the parser can go.
      4102363f
  24. 10 Sep, 2009 1 commit
    • Marc Alff's avatar
      WL#2110 (SIGNAL) · 63e56390
      Marc Alff authored
      WL#2265 (RESIGNAL)
      
      Manual merge of SIGNAL and RESIGNAL to mysql-trunk-signal,
      plus required dependencies.
      63e56390
  25. 31 Jul, 2009 1 commit
    • Gleb Shchepa's avatar
      Bug# 30946: mysqldump silently ignores --default-character-set · 4e95179a
      Gleb Shchepa authored
                  when used with --tab
      
      1) New syntax: added CHARACTER SET clause to the
        SELECT ... INTO OUTFILE (to complement the same clause in
        LOAD DATA INFILE).
        mysqldump is updated to use this in --tab mode.
      
      2) ESCAPED BY/ENCLOSED BY field parameters are documented as
         accepting CHAR argument, however SELECT .. INTO OUTFILE
         silently ignored rests of multisymbol arguments.
         For the symmetrical behavior with LOAD DATA INFILE the
         server has been modified to fail with the same error:
      
           ERROR 42000: Field separator argument is not what is
                        expected; check the manual
      
      3) Current LOAD DATA INFILE recognizes field/line separators
         "as is" without converting from client charset to data
         file charset. So, it is supposed, that input file of
         LOAD DATA INFILE consists of data in one charset and
         separators in other charset. For the compatibility with
         that [buggy] behaviour SELECT INTO OUTFILE implementation
         has been saved "as is" too, but the new warning message
         has been added:
      
           Non-ASCII separator arguments are not fully supported
      
         This message warns on field/line separators that contain
         non-ASCII symbols.
      
      
      client/mysqldump.c:
        mysqldump has been updated to call SELECT ... INTO OUTFILE
        statement with a charset from the --default-charset command
        line parameter.
      mysql-test/r/mysqldump.result:
        Added test case for bug #30946.
      mysql-test/r/outfile_loaddata.result:
        Added test case for bug #30946.
      mysql-test/t/mysqldump.test:
        Added test case for bug #30946.
      mysql-test/t/outfile_loaddata.test:
        Added test case for bug #30946.
      sql/field.cc:
        String conversion code has been moved from check_string_copy_error()
        to convert_to_printable() for reuse.
      sql/share/errmsg.txt:
        New WARN_NON_ASCII_SEPARATOR_NOT_IMPLEMENTED message has been added.
      sql/sql_class.cc:
        The select_export::prepare() method has been modified to:
        
          1) raise the ER_WRONG_FIELD_TERMINATORS error on multisymbol
             ENCLOSED BY/ESCAPED BY field arguments like LOAD DATA INFILE;
        
          2) warn with a new WARN_NON_ASCII_SEPARATOR_NOT_IMPLEMENTED
             message on non-ASCII field or line separators.
        
        The select_export::send_data() merhod has been modified to
        convert item data to output charset (see new SELECT INTO OUTFILE
        syntax). By default the BINARY charset is used for backward
        compatibility.
      sql/sql_class.h:
        The select_export::write_cs field added to keep output
        charset.
      sql/sql_load.cc:
        mysql_load has been modified to warn on non-ASCII field or
        line separators with a new WARN_NON_ASCII_SEPARATOR_NOT_IMPLEMENTED
        message.
      sql/sql_string.cc:
        New global function has been added: convert_to_printable()
        (common code has been moved from check_string_copy_error()).
      sql/sql_string.h:
        New String::is_ascii() method and new global convert_to_printable()
        function have been added.
      sql/sql_yacc.yy:
        New syntax: added CHARACTER SET clause to the
        SELECT ... INTO OUTFILE (to complement the same clause in
        LOAD DATA INFILE). By default the BINARY charset is used for
        backward compatibility.
      4e95179a
  26. 14 Jul, 2009 1 commit
    • Sven Sandberg's avatar
      BUG#39934: Slave stops for engine that only support row-based logging · 41783de5
      Sven Sandberg authored
      General overview:
      The logic for switching to row format when binlog_format=MIXED had
      numerous flaws. The underlying problem was the lack of a consistent
      architecture.
      General purpose of this changeset:
      This changeset introduces an architecture for switching to row format
      when binlog_format=MIXED. It enforces the architecture where it has
      to. It leaves some bugs to be fixed later. It adds extensive tests to
      verify that unsafe statements work as expected and that appropriate
      errors are produced by problems with the selection of binlog format.
      It was not practical to split this into smaller pieces of work.
      
      Problem 1:
      To determine the logging mode, the code has to take several parameters
      into account (namely: (1) the value of binlog_format; (2) the
      capabilities of the engines; (3) the type of the current statement:
      normal, unsafe, or row injection). These parameters may conflict in
      several ways, namely:
       - binlog_format=STATEMENT for a row injection
       - binlog_format=STATEMENT for an unsafe statement
       - binlog_format=STATEMENT for an engine only supporting row logging
       - binlog_format=ROW for an engine only supporting statement logging
       - statement is unsafe and engine does not support row logging
       - row injection in a table that does not support statement logging
       - statement modifies one table that does not support row logging and
         one that does not support statement logging
      Several of these conflicts were not detected, or were detected with
      an inappropriate error message. The problem of BUG#39934 was that no
      appropriate error message was written for the case when an engine
      only supporting row logging executed a row injection with
      binlog_format=ROW. However, all above cases must be handled.
      Fix 1:
      Introduce new error codes (sql/share/errmsg.txt). Ensure that all
      conditions are detected and handled in decide_logging_format()
      
      Problem 2:
      The binlog format shall be determined once per statement, in
      decide_logging_format(). It shall not be changed before or after that.
      Before decide_logging_format() is called, all information necessary to
      determine the logging format must be available. This principle ensures
      that all unsafe statements are handled in a consistent way.
      However, this principle is not followed:
      thd->set_current_stmt_binlog_row_based_if_mixed() is called in several
      places, including from code executing UPDATE..LIMIT,
      INSERT..SELECT..LIMIT, DELETE..LIMIT, INSERT DELAYED, and
      SET @@binlog_format. After Problem 1 was fixed, that caused
      inconsistencies where these unsafe statements would not print the
      appropriate warnings or errors for some of the conflicts.
      Fix 2:
      Remove calls to THD::set_current_stmt_binlog_row_based_if_mixed() from
      code executed after decide_logging_format(). Compensate by calling the
      set_current_stmt_unsafe() at parse time. This way, all unsafe statements
      are detected by decide_logging_format().
      
      Problem 3:
      INSERT DELAYED is not unsafe: it is logged in statement format even if
      binlog_format=MIXED, and no warning is printed even if
      binlog_format=STATEMENT. This is BUG#45825.
      Fix 3:
      Made INSERT DELAYED set itself to unsafe at parse time. This allows
      decide_logging_format() to detect that a warning should be printed or
      the binlog_format changed.
      
      Problem 4:
      LIMIT clause were not marked as unsafe when executed inside stored
      functions/triggers/views/prepared statements. This is
      BUG#45785.
      Fix 4:
      Make statements containing the LIMIT clause marked as unsafe at
      parse time, instead of at execution time. This allows propagating
      unsafe-ness to the view.
      
      
      mysql-test/extra/rpl_tests/create_recursive_construct.inc:
        Added auxiliary file used by binlog_unsafe.test to create and
        execute recursive constructs
        (functions/procedures/triggers/views/prepared statements).
      mysql-test/extra/rpl_tests/rpl_foreign_key.test:
        removed unnecessary set @@session.binlog_format
      mysql-test/extra/rpl_tests/rpl_insert_delayed.test:
        Filter out table id from table map events in binlog listing.
        Got rid of $binlog_format_statement.
      mysql-test/extra/rpl_tests/rpl_ndb_apply_status.test:
        disable warnings around call to unsafe procedure
      mysql-test/include/rpl_udf.inc:
        Disabled warnings for code that generates warnings
        for some binlog formats. That would otherwise cause
        inconsistencies in the result file.
      mysql-test/r/mysqldump.result:
        Views are now unsafe if they contain a LIMIT clause.
        That fixed BUG#45831. Due to BUG#45832, a warning is
        printed for the CREATE VIEW statement.
      mysql-test/r/sp_trans.result:
        Unsafe statements in stored procedures did not give a warning if
        binlog_format=statement. This is BUG#45824. Now they do, so this
        result file gets a new warning.
      mysql-test/suite/binlog/r/binlog_multi_engine.result:
        Error message changed.
      mysql-test/suite/binlog/r/binlog_statement_insert_delayed.result:
        INSERT DELAYED didn't generate a warning when binlog_format=STATEMENT.
        That was BUG#45825. Now there is a warning, so result file needs to be
        updated.
      mysql-test/suite/binlog/r/binlog_stm_ps.result:
        Changed error message.
      mysql-test/suite/binlog/r/binlog_unsafe.result:
        updated result file:
         - error message changed
         - added test for most combinations of unsafe constructs invoked
           from recursive constructs
         - INSERT DELAYED now gives a warning (because BUG#45826 is fixed)
         - INSERT..SELECT..LIMIT now gives a warning from inside recursive
           constructs (because BUG#45785 was fixed)
         - When a recursive construct (e.g., stored proc or function)
           contains more than one statement, at least one of which is
           unsafe, then all statements in the recursive construct give
           warnings. This is a new bug introduced by this changeset.
           It will be addressed in a post-push fix.
      mysql-test/suite/binlog/t/binlog_innodb.test:
        Changed error code for innodb updates with READ COMMITTED or 
        READ UNCOMMITTED transaction isolation level and
        binlog_format=statement.
      mysql-test/suite/binlog/t/binlog_multi_engine.test:
        The error code has changed for statements where more than one
        engine is involved and one of them is self-logging.
      mysql-test/suite/binlog/t/binlog_unsafe-master.opt:
        Since binlog_unsafe now tests unsafe-ness of UDF's, we need an extra
        flag in the .opt file.
      mysql-test/suite/binlog/t/binlog_unsafe.test:
         - Clarified comment.
         - Rewrote first part of test. Now it tests not only unsafe variables
           and functions, but also unsafe-ness due to INSERT..SELECT..LIMIT,
           INSERT DELAYED, insert into two autoinc columns, use of UDF's, and
           access to log tables in the mysql database.
           Also, in addition to functions, procedures, triggers, and prepared
           statements, it now also tests views; and it constructs recursive
           calls in two levels by combining these recursive constructs.
           Part of the logic is in extra/rpl_tests/create_recursive_construct.inc.
         - added tests for all special system variables that should not be unsafe.
         - added specific tests for BUG#45785 and BUG#45825
      mysql-test/suite/rpl/r/rpl_events.result:
        updated result file
      mysql-test/suite/rpl/r/rpl_extraColmaster_innodb.result:
        updated result file
      mysql-test/suite/rpl/r/rpl_extraColmaster_myisam.result:
        updated result file
      mysql-test/suite/rpl/r/rpl_foreign_key_innodb.result:
        updated result file
      mysql-test/suite/rpl/r/rpl_idempotency.result:
        updated result file
      mysql-test/suite/rpl/r/rpl_mix_found_rows.result:
        Split rpl_found_rows.test into rpl_mix_found_rows.test (a new file) and
        rpl_stm_found_rows.test (renamed rpl_found_rows.test). This file equals
        the second half of the old rpl_found_rows.result, with the following
        modifications:
         - minor formatting changes
         - additional initialization
      mysql-test/suite/rpl/r/rpl_mix_insert_delayed.result:
        Moved out code operating in mixed mode from rpl_stm_insert_delayed
        (into rpl_mix_insert_delayed) and got rid of explicit setting of
        binlog format.
      mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result:
        updated result file
      mysql-test/suite/rpl/r/rpl_row_idempotency.result:
        Moved the second half of rpl_idempotency.test, which only
        executed in row mode, to rpl_row_idempotency.test. This is
        the new result file.
      mysql-test/suite/rpl/r/rpl_row_insert_delayed.result:
        Got rid of unnecessary explicit setting of binlog format.
      mysql-test/suite/rpl/r/rpl_stm_found_rows.result:
        Split rpl_found_rows.test into rpl_mix_found_rows.test (a new file) and
        rpl_stm_found_rows.test (renamed rpl_found_rows.test). Changes in
        this file:
         - minor formatting changes
         - warning is now issued for unsafe statements inside procedures
           (since BUG#45824 is fixed)
         - second half of file is moved to rpl_mix_found_rows.result
      mysql-test/suite/rpl/r/rpl_stm_insert_delayed.result:
        Moved out code operating in mixed mode from rpl_stm_insert_delayed
        (into rpl_mix_insert_delayed) and got rid of explicit setting of
        binlog format.
      mysql-test/suite/rpl/r/rpl_stm_loadfile.result:
        error message changed
      mysql-test/suite/rpl/r/rpl_temporary_errors.result:
        updated result file
      mysql-test/suite/rpl/r/rpl_udf.result:
        Remove explicit set of binlog format (and triplicate test execution)
        and rely on test system executing the test in all binlog formats.
      mysql-test/suite/rpl/t/rpl_bug31076.test:
        Test is only valid in mixed or row mode since it generates row events.
      mysql-test/suite/rpl/t/rpl_events.test:
        Removed explicit set of binlog_format and removed duplicate testing.
        Instead, we rely on the test system to try all binlog formats.
      mysql-test/suite/rpl/t/rpl_extraColmaster_innodb.test:
        Removed triplicate testing and instead relying on test system.
        Test is only relevant for row format since statement-based replication
        cannot handle extra columns on master.
      mysql-test/suite/rpl/t/rpl_extraColmaster_myisam.test:
        Removed triplicate testing and instead relying on test system.
        Test is only relevant for row format since statement-based replication
        cannot handle extra columns on master.
      mysql-test/suite/rpl/t/rpl_idempotency-slave.opt:
        Removed .opt file to avoid server restarts.
      mysql-test/suite/rpl/t/rpl_idempotency.test:
        - Moved out row-only tests to a new test file, rpl_row_idempotency.test.
          rpl_idempotency now only contains tests that execute in all
          binlog_formats.
        - While I was here, also removed .opt file to avoid server restarts.
          The slave_exec_mode is now set inside the test instead.
      mysql-test/suite/rpl/t/rpl_mix_found_rows.test:
        Split rpl_found_rows.test into rpl_mix_found_rows.test (a new file) and
        rpl_stm_found_rows.test (renamed rpl_found_rows.test). This file
        contains the second half of the original rpl_found_rows.test with the
        follwing changes:
         - initialization
         - removed SET_BINLOG_FORMAT and added have_binlog_format_mixed.inc
         - minor formatting changes
      mysql-test/suite/rpl/t/rpl_mix_insert_delayed.test:
        Moved out code operating in mixed mode from rpl_stm_insert_delayed
        (into rpl_mix_insert_delayed) and got rid of explicit setting of
        binlog format.
      mysql-test/suite/rpl/t/rpl_rbr_to_sbr.test:
        Test cannot execute in statement mode, since we no longer
        switch to row format when binlog_format=statement.
        Enforced mixed mode throughout the test.
      mysql-test/suite/rpl/t/rpl_row_idempotency.test:
        Moved the second half of rpl_idempotency.test, which only
        executed in row mode, to this new file. We now rely on the
        test system to set binlog format.
      mysql-test/suite/rpl/t/rpl_row_insert_delayed.test:
         - Got rid of unnecessary explicit setting of binlog format.
         - extra/rpl_tests/rpl_insert_delayed.test does not need the
           $binlog_format_statement variable any more, so that was
           removed.
      mysql-test/suite/rpl/t/rpl_slave_skip.test:
        The test switches binlog_format internally and master generates both
        row and statement events. Hence, the slave must be able to log in both
        statement and row format. Hence test was changed to only execute in
        mixed mode.
      mysql-test/suite/rpl/t/rpl_stm_found_rows.test:
        Split rpl_found_rows.test into rpl_mix_found_rows.test (a new file) and
        rpl_stm_found_rows.test (renamed rpl_found_rows.test). Changes in
        this file:
         - minor formatting changes
         - added have_binlog_format_statement and removed SET BINLOG_FORMAT.
         - second half of file is moved to rpl_mix_found_rows.test
         - added cleanup code
      mysql-test/suite/rpl/t/rpl_stm_insert_delayed.test:
        Moved out code operating in mixed mode from rpl_stm_insert_delayed
        (into rpl_mix_insert_delayed) and got rid of explicit setting of
        binlog format.
      mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test:
        The test switches binlog_format internally and master generates both
        row and statement events. Hence, the slave must be able to log in both
        statement and row format. Hence test was changed to only execute in
        mixed mode on slave.
      mysql-test/suite/rpl/t/rpl_temporary_errors.test:
        Removed explicit set of binlog format. Instead, the test now only
        executes in row mode.
      mysql-test/suite/rpl/t/rpl_udf.test:
        Remove explicit set of binlog format (and triplicate test execution)
        and rely on test system executing the test in all binlog formats.
      mysql-test/suite/rpl_ndb/combinations:
        Added combinations file for rpl_ndb.
      mysql-test/suite/rpl_ndb/r/rpl_ndb_binlog_format_errors.result:
        new result file
      mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result:
        updated result file
      mysql-test/suite/rpl_ndb/t/rpl_ndb_2innodb.test:
        The test needs slave to be able to switch to row mode, so the
        test was changed to only execute in mixed and row mode.
      mysql-test/suite/rpl_ndb/t/rpl_ndb_2myisam.test:
        The test needs slave to be able to switch to row mode, so the
        test was changed to only execute in mixed and row mode.
      mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test:
        The test needs slave to be able to switch to row mode, so the
        test was changed to only execute in mixed and row mode.
      mysql-test/suite/rpl_ndb/t/rpl_ndb_binlog_format_errors-master.opt:
        new option file
      mysql-test/suite/rpl_ndb/t/rpl_ndb_binlog_format_errors-slave.opt:
        new option file
      mysql-test/suite/rpl_ndb/t/rpl_ndb_binlog_format_errors.test:
        New test case to verify all errors and warnings generated by
        decide_logging_format.
      mysql-test/suite/rpl_ndb/t/rpl_ndb_blob.test:
        The test needs slave to be able to switch to row mode, so the
        test was changed to only execute in mixed and row mode.
      mysql-test/suite/rpl_ndb/t/rpl_ndb_blob2.test:
        The test needs slave to be able to switch to row mode, so the
        test was changed to only execute in mixed and row mode.
      mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test:
        The test needs slave to be able to switch to row mode, so the
        test was changed to only execute in mixed and row mode.
      mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_simplex.test:
        The test needs slave to be able to switch to row mode, so the
        test was changed to only execute in mixed and row mode.
        While I was here, also made the test clean up after itself.
      mysql-test/suite/rpl_ndb/t/rpl_ndb_commit_afterflush.test:
        The test needs slave to be able to switch to row mode, so the
        test was changed to only execute in mixed and row mode.
      mysql-test/suite/rpl_ndb/t/rpl_ndb_ctype_ucs2_def.test:
        The test needs slave to be able to switch to row mode, so the
        test was changed to only execute in mixed and row mode.
      mysql-test/suite/rpl_ndb/t/rpl_ndb_delete_nowhere.test:
        The test needs slave to be able to switch to row mode, so the
        test was changed to only execute in mixed and row mode.
      mysql-test/suite/rpl_ndb/t/rpl_ndb_do_db.test:
        The test needs slave to be able to switch to row mode, so the
        test was changed to only execute in mixed and row mode.
      mysql-test/suite/rpl_ndb/t/rpl_ndb_do_table.test:
        The test needs slave to be able to switch to row mode, so the
        test was changed to only execute in mixed and row mode.
      mysql-test/suite/rpl_ndb/t/rpl_ndb_func003.test:
        The test needs slave to be able to switch to row mode, so the
        test was changed to only execute in mixed and row mode.
      mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb_trans.test:
        The test needs slave to be able to switch to row mode, so the
        test was changed to only execute in mixed and row mode.
      mysql-test/suite/rpl_ndb/t/rpl_ndb_insert_ignore.test:
        The test needs slave to be able to switch to row mode, so the
        test was changed to only execute in mixed and row mode.
      mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions.test:
        The test needs slave to be able to switch to row mode, so the
        test was changed to only execute in mixed and row mode.
      mysql-test/suite/rpl_ndb/t/rpl_ndb_multi_update3.test:
        The test needs slave to be able to switch to row mode, so the
        test was changed to only execute in mixed and row mode.
      mysql-test/suite/rpl_ndb/t/rpl_ndb_rep_ignore.test:
        The test needs slave to be able to switch to row mode, so the
        test was changed to only execute in mixed and row mode.
      mysql-test/suite/rpl_ndb/t/rpl_ndb_row_001.test:
        The test needs slave to be able to switch to row mode, so the
        test was changed to only execute in mixed and row mode.
      mysql-test/suite/rpl_ndb/t/rpl_ndb_sp003.test:
        The test needs slave to be able to switch to row mode, so the
        test was changed to only execute in mixed and row mode.
      mysql-test/suite/rpl_ndb/t/rpl_ndb_sp006.test:
        The test needs slave to be able to switch to row mode, so the
        test was changed to only execute in mixed and row mode.
      mysql-test/suite/rpl_ndb/t/rpl_ndb_trig004.test:
        The test needs slave to be able to switch to row mode, so the
        test was changed to only execute in mixed and row mode.
      mysql-test/t/partition_innodb_stmt.test:
        Changed error code for innodb updates with READ COMMITTED or 
        READ UNCOMMITTED transaction isolation level and
        binlog_format=statement.
      sql/event_db_repository.cc:
        Use member function to read current_stmt_binlog_row_based.
      sql/events.cc:
        Use member function to read current_stmt_binlog_row_based.
      sql/ha_ndbcluster_binlog.cc:
        reset_current_stmt_binlog_row_based() is not a no-op for the ndb_binlog
        thread any more. Instead, the ndb_binlog thread now forces row mode both
        initially and just after calling mysql_parse.  (mysql_parse() is the only
        place where reset_current_stmt_binlog_row_based() may be called from
        the ndb_binlog thread, so these are the only two places that need to
        change.)
      sql/ha_partition.cc:
        Use member function to read current_stmt_binlog_row_based.
      sql/handler.cc:
        Use member function to read current_stmt_binlog_row_based.
      sql/item_create.cc:
        Added DBUG_ENTER to some functions, to be able to trace when
        set_stmt_unsafe is called.
      sql/log.cc:
        Use member function to read current_stmt_binlog_row_based.
      sql/log_event.cc:
         - Moved logic for changing to row format out of do_apply_event (and into
           decide_logging_format).
         - Added @todo comment for post-push cleanup.
      sql/log_event_old.cc:
        Move logic for changing to row format out of do_apply_event (and into
        decide_logging_format).
      sql/mysql_priv.h:
        Make decide_logging_format() a member of the THD class, for two reasons:
         - It is natural from an object-oriented perspective.
         - decide_logging_format() needs to access private members of THD
           (specifically, the new binlog_warning_flags field).
      sql/rpl_injector.cc:
        Removed call to set_current_stmt_binlog_row_based().
        From now on, only decide_logging_fromat is allowed to modify
        current_stmt_binlog_row_based. This call is from the ndb_binlog
        thread, mostly executing code in ha_ndbcluster_binlog.cc.
        This call can be safely removed, because:
         - current_stmt_binlog_row_based is initialized for the ndb_binlog
           thread's THD object when the THD object is created. So we're
           not going to read uninitialized memory.
         - The behavior of ndb_binlog thread does not use the state of the
           current_stmt_binlog_row_based. It is conceivable that the
           ndb_binlog thread would rely on the current_stmt_binlog_format
           in two situations:
            (1) when it calls mysql_parse;
            (2) when it calls THD::binlog_query.
           In case (1), it always clears THD::options&OPTION_BIN_LOG (because
           run_query() in ha_ndbcluster_binlog.cc is only called with
           disable_binlogging = TRUE).
           In case (2), it always uses qtype=STMT_QUERY_TYPE.
      sql/set_var.cc:
        Added @todo comment for post-push cleanup.
      sql/share/errmsg.txt:
        Added new error messages and clarified ER_BINLOG_UNSAFE_STATEMENT.
      sql/sp.cc:
        Added DBUG_ENTER, to be able to trace when set_stmt_unsafe is called.
        Got rid of MYSQL_QUERY_TYPE: it was equivalent to STMT_QUERY_TYPE.
      sql/sp_head.cc:
        Use member function to read current_stmt_binlog_row_based.
      sql/sp_head.h:
        Added DBUG_ENTER, to be able to trace when set_stmt_unsafe is called.
      sql/sql_acl.cc:
        Got rid of MYSQL_QUERY_TYPE: it was equivalent to STMT_QUERY_TYPE.
      sql/sql_base.cc:
         - Made decide_logging_format take care of all logic for deciding the
           logging format, and for determining the related warnings and errors.
           See comment above decide_logging_format for details.
         - Made decide_logging_format a member function of THD, since it needs
           to access private members of THD and since its purpose is to update
           the state of a THD object.
         - Added DBUG_ENTER, to be able to trace when set_stmt_unsafe is called.
      sql/sql_class.cc:
        - Moved logic for determining unsafe warnings away from THD::binlog_query
          (and into decide_logging_format()). Now, it works like this:
          1. decide_logging_format detects that the current statement shall
             produce a warning, if it ever makes it to the binlog
          2. decide_logging_format sets a flag of THD::binlog_warning_flags.
          3. THD::binlog_query reads the flag. If the flag is set, it generates
             a warning.
        - Use member function to read current_stmt_binlog_row_based.
      sql/sql_class.h:
        - Added THD::binlog_warning_flags (see sql_class.cc for explanation).
        - Made decide_logging_format() and reset_for_next_command() member
          functions of THD (instead of standalone functions). This was needed
          for two reasons: (1) the functions need to access the private member
          THD::binlog_warning_flags; (2) the purpose of these functions is to
          update the staet of a THD object, so from an object-oriented point
          of view they should be member functions.
        - Encapsulated current_stmt_binlog_row_based, so it is now private and
          can only be accessed from a member function. Also changed the
          data type to an enumeration instead of a bool.
        - Removed MYSQL_QUERY_TYPE, because it was equivalent to
          STMT_QUERY_TYPE anyways.
        - When reset_current_stmt_binlog_row_based was called from the
          ndb_binlog thread, it would behave as a no-op. This special
          case has been removed, and the behavior of
          reset_current_stmt_binlog_row_based does not depend on which thread
          calls it any more. The special case did not serve any purpose,
          since the ndb binlog thread did not take the
          current_stmt_binlog_row_based flag into account anyways.
      sql/sql_delete.cc:
        - Moved logic for setting row format for DELETE..LIMIT away from
          mysql_prepare_delete.
          (Instead, we mark the statement as unsafe at parse time (sql_yacc.yy)
          and rely on decide_logging_format() (sql_class.cc) to set row format.)
          This is part of the fix for BUG#45831.
        - Use member function to read current_stmt_binlog_row_based.
      sql/sql_insert.cc:
         - Removed unnecessary calls to thd->lex->set_stmt_unsafe() and
           thd->set_current_stmt_binlog_row_based_if_mixed() from
           handle_delayed_insert(). The calls are unnecessary because they
           have already been made; they were made in the constructor of
           the `di' object.
         - Since decide_logging_format() is now a member function of THD, code
           that calls decide_logging_format() had to be updated.
         - Added DBUG_ENTER call, to be able to trace when set_stmt_unsafe is
           called.
         - Moved call to set_stmt_unsafe() for INSERT..SELECT..LIMIT away from
           mysql_insert_select_prepare() (and into decide_logging_format).
           This is part of the fix for BUG#45831.
         - Use member function to read current_stmt_binlog_row_based.
      sql/sql_lex.h:
         - Added the flag BINLOG_STMT_FLAG_ROW_INJECTION to enum_binlog_stmt_flag.
           This was necessary so that a statement can identify itself as a row
           injection.
         - Added appropriate setter and getter functions for the new flag.
         - Added or clarified some comments.
         - Added DBUG_ENTER()
      sql/sql_load.cc:
        Use member function to read current_stmt_binlog_row_based.
      sql/sql_parse.cc:
         - Made mysql_reset_thd_for_next_command() clear thd->binlog_warning_flags.
         - Since thd->binlog_warning_flags is private, it must be set in a
           member function of THD. Hence, moved the body of
           mysql_reset_thd_for_next_command() to the new member function
           THD::reset_thd_for_next_command(), and made
           mysql_reset_thd_for_next_command() call
           THD::reset_thd_for_next_command().
         - Removed confusing comment.
         - Use member function to read current_stmt_binlog_row_based.
      sql/sql_repl.cc:
        Use member function to read current_stmt_binlog_row_based.
      sql/sql_table.cc:
        Use member function to read current_stmt_binlog_row_based.
      sql/sql_udf.cc:
        Use member function to read current_stmt_binlog_row_based.
      sql/sql_update.cc:
        Moved logic for setting row format for UPDATE..LIMIT away from
        mysql_prepare_update.
        (Instead, we mark the statement as unsafe at parse time (sql_yacc.yy)
        and rely on decide_logging_format() (sql_class.cc) to set row format.)
        This is part of the fix for BUG#45831.
      sql/sql_yacc.yy:
        Made INSERT DELAYED, INSERT..SELECT..LIMIT, UPDATE..LIMIT, and
        DELETE..LIMIT mark themselves as unsafe at parse time (instead
        of at execution time).
        This is part of the fixes BUG#45831 and BUG#45825.
      storage/example/ha_example.cc:
        Made exampledb accept inserts. This was needed by the new test case
        rpl_ndb_binlog_format_errors, because it needs an engine that
        is statement-only (and accepts inserts).
      storage/example/ha_example.h:
        Made exampledb a statement-only engine instead of a row-only engine.
        No existing test relied exampledb's row-only capabilities. The new
        test case rpl_ndb_binlog_format_errors needs an engine that is
        statement-only.
      storage/innobase/handler/ha_innodb.cc:
        - Changed error error code and message given by innodb when 
          binlog_format=STATEMENT and transaction isolation level is
          READ COMMITTED or READ UNCOMMITTED.
        - While I was here, also simplified the condition for
          checking when to give the error.
      41783de5
  27. 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
  28. 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
  29. 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
  30. 21 Feb, 2009 1 commit
    • Alfranio Correia's avatar
      BUG#38174 secure-file-priv breaks LOAD DATA INFILE replication in statement mode · d822ab89
      Alfranio Correia authored
                        
      If secure-file-priv was set on slave, it became unable to execute
      LOAD DATA INFILE statements sent from master using mixed or
      statement-based replication.
                        
      This patch fixes the issue by ignoring this security restriction
      and checking if the files are created and read by the slave in the
      --slave-load-tmpdir while executing the SQL Thread.
      d822ab89
  31. 10 Feb, 2009 1 commit
  32. 17 Sep, 2008 1 commit
    • Tatiana A. Nurnberg's avatar
      Bug#37114: sql_mode NO_BACKSLASH_ESCAPES does not work properly with LOAD DATA INFILE · 2f082d9d
      Tatiana A. Nurnberg authored
      NO_BACKSLASH_ESCAPES was not heeded in LOAD DATA INFILE
      and SELECT INTO OUTFILE.  It is now.
      
      mysql-test/r/loaddata.result:
        Show that SQL-mode NO_BACKSLASH_ESCAPES is heeded in
        INFILE/OUTFILE, and that dump/restore cycles work!
      mysql-test/t/loaddata.test:
        Show that SQL-mode NO_BACKSLASH_ESCAPES is heeded in
        INFILE/OUTFILE, and that dump/restore cycles work!
      sql/sql_class.cc:
        Add function to enquire whether ESCAPED BY was given.
        When doing SELECT...OUTFILE, use ESCAPED BY if specifically
        given; otherwise use sensible default value depending on
        SQL-mode features NO_BACKSLASH_ESCAPES.
      sql/sql_class.h:
        Add function to enquire whether ESCAPED BY was given.
      sql/sql_load.cc:
        When doing LOAD DATA INFILE, use ESCAPED BY if specifically
        given; otherwise use sensible default value depending on
        SQL-mode features NO_BACKSLASH_ESCAPES.
      2f082d9d
  33. 28 Mar, 2008 1 commit
    • unknown's avatar
      Fix for Bug#35469: server crash with LOAD DATA INFILE to a VIEW. · 4ec65151
      unknown authored
      The problem was that LOAD DATA code (sql_load.cc) didn't take into
      account that there may be items, representing references to other
      columns. This is a usual case in views. The crash happened because
      Item_direct_view_ref was casted to Item_user_var_as_out_param,
      which is not a base class.
      
      The fix is to
        1) Handle references properly;
        2) Ensure that an item is treated as a user variable only when
           it is a user variable indeed;
        3) Report an error if LOAD DATA is used to load data into
           non-updatable column.
      
      
      mysql-test/r/loaddata.result:
        Update result file.
      mysql-test/t/loaddata.test:
        Add a test case form Bug#35469: server crash with
        LOAD DATA INFILE to a VIEW.
      sql/share/errmsg.txt:
        Introduce a new error.
      sql/sql_load.cc:
        Handle reference-items properly.
      mysql-test/std_data/bug35649.data:
        Add a data file for the test case.
      4ec65151
  34. 21 Mar, 2008 1 commit
    • unknown's avatar
      Bug #26461: Intrinsic data type bool (1 byte) redefined to BOOL (4 bytes) · cebb6727
      unknown authored
      The bool data type was redefined to BOOL (4 bytes on windows).
      Removed the #define and fixed some of the warnings that were uncovered
      by this.
      Note that the fix also disables 2 warnings :
      4800 : 'type' : forcing value to bool 'true' or 'false' (performance warning)
      4805: 'operation' : unsafe mix of type 'type' and type 'type' in operation
      
      These warnings will be handled in a separate bug, as they are performance related or bogus.
      
      Fixed to int the return type of functions that return more than 
      2 distinct values.
      
      
      CMakeLists.txt:
        Bug #26461: disable the C4800 and C4805 warnings temporarily
      include/config-win.h:
        Bug #26461: 
         - no need for this define for Windows.
         - windows C++ compilers have a bool type
      include/my_global.h:
        Bug #26461: removed bool_defined (no longer needed)
      sql/handler.h:
        Bug #26461: bool functions must return boolean values
      sql/mysql_priv.h:
        Bug #26461: fixed return type of functions that return more than
        2 distinct values.
      sql/procedure.h:
        Bug #26461: fixed return type of functions that return more than
        2 distinct values.
      sql/sql_acl.cc:
        Bug #26461: fixed return type of functions that return more than
        2 distinct values.
      sql/sql_acl.h:
        Bug #26461: fixed return type of functions that return more than
        2 distinct values.
      sql/sql_analyse.cc:
        Bug #26461: fixed return type of functions that return more than
        2 distinct values.
      sql/sql_analyse.h:
        Bug #26461: fixed return type of functions that return more than
        2 distinct values.
      sql/sql_base.cc:
        Bug #26461: fixed return type of functions that return more than
        2 distinct values.
      sql/sql_db.cc:
        Bug #26461: fixed return type of functions that return more than
        2 distinct values.
      sql/sql_delete.cc:
        Bug #26461: fixed return type of functions that return more than
        2 distinct values.
      sql/sql_load.cc:
        Bug #26461: fixed return type of functions that return more than
        2 distinct values.
      sql/sql_parse.cc:
        Bug #26461: fixed return type of functions that return more than
        2 distinct values.
      sql/sql_prepare.cc:
        Bug #26461: fixed return type of functions that return more than
        2 distinct values.
      sql/sql_update.cc:
        Bug #26461: fixed return type of functions that return more than
        2 distinct values.
      cebb6727
  35. 19 Feb, 2008 2 commits
    • unknown's avatar
      Rename send_ok to my_ok. Similarly to my_error, it only records the status, · 14021c96
      unknown authored
      does not send it to the client.
      
      
      14021c96
    • unknown's avatar
      A fix and a test case for Bug#12713 "Error in a stored function called from · 526798db
      unknown authored
      a SELECT doesn't cause ROLLBACK of statem".
      
      The idea of the fix is to ensure that we always commit the current
      statement at the end of dispatch_command(). In order to not issue
      redundant disc syncs, an optimization of the two-phase commit
      protocol is implemented to bypass the two phase commit if
      the transaction is read-only.
      
      
      mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result:
        Update test results.
      mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result:
        Update test results.
      mysql-test/suite/rpl_ndb/t/disabled.def:
        Disable the tests, for which this changeset reveals a bug:
        the injector thread does not always add 'statement commit' to the
        rows injected in circular replication set up.
        To be investigated separately.
      sql/ha_ndbcluster_binlog.cc:
        Add close_thread_tables() to run_query: this ensures
        that all tables are closed and there is no pending statement transaction.
      sql/handler.cc:
        Implement optimisation of read-only transactions.
        If a transaction consists only of DML statements that do not change
        data, we do not perform a two-phase commit for it 
        (run one phase commit only).
      sql/handler.h:
        Implement optimisation of read-only transactions.
        If a transaction consists only of DML statements that do not change
        data, we do not perform a two-phase commit for it 
        (run one phase commit only).
      sql/log.cc:
        Mark the binlog transaction read-write whenever it's started.
        We never read from binlog, so it's safe and least intrusive to add
        this mark up here.
      sql/log_event.cc:
        Update to the new layout of thd->transaction.
      sql/rpl_injector.cc:
        Always commit statement transaction before committing the global one.
      sql/sp.cc:
        Ad comments.
      sql/sp_head.cc:
        Add comments.
      sql/sql_base.cc:
        Commit transaction at the end of the statement. Always.
      sql/sql_class.cc:
        Update thd_ha_data to return the right pointer in the new layout.
        
        Fix select_dumpvar::send_data to properly return operation status.
        A test case from commit.inc would lead to an assertion failure in the 
        diagnostics area (double assignment). Not test otherwise by the test suite.
      sql/sql_class.h:
        Implement a new layout of storage engine transaction info in which 
        it is easy to access all members related to the handlerton only
        based on ht->slot.
      sql/sql_cursor.cc:
        Update to the new layout of thd->transaction.
      sql/sql_delete.cc:
        Remove wrong and now redundant calls to ha_autocommit_or_rollback.
        The transaction is committed in one place, at the end of the statement.
        Remove calls to mysql_unlock_tables, since some engines count locks
        and commit statement transaction in unlock_tables(), which essentially
        equates mysql_unlock_tables to ha_autocommit_or_rollback.
        Previously it was necessary to unlock tables soon because we wanted
        to avoid sending of 'ok' packet to the client under locked tables.
        This is no longer necessary, since OK packet is also sent from one place
        at the end of transaction.
      sql/sql_do.cc:
        Add DO always clears the error, we must rollback the current
        statement before this happens. Otherwise the statement will be committed,
        and not rolled back in the end.
      sql/sql_insert.cc:
        Remove wrong and now redundant calls to ha_autocommit_or_rollback.
        The transaction is committed in one place, at the end of the statement.
        Remove calls to mysql_unlock_tables, since some engines count locks
        and commit statement transaction in unlock_tables(), which essentially
        equates mysql_unlock_tables to ha_autocommit_or_rollback.
        Previously it was necessary to unlock tables soon because we wanted
        to avoid sending of 'ok' packet to the client under locked tables.
        This is no longer necessary, since OK packet is also sent from one place
        at the end of transaction.
      sql/sql_load.cc:
        Remove wrong and now redundant calls to ha_autocommit_or_rollback.
        The transaction is committed in one place, at the end of the statement.
        Remove calls to mysql_unlock_tables, since some engines count locks
        and commit statement transaction in unlock_tables(), which essentially
        equates mysql_unlock_tables to ha_autocommit_or_rollback.
        Previously it was necessary to unlock tables soon because we wanted
        to avoid sending of 'ok' packet to the client under locked tables.
        This is no longer necessary, since OK packet is also sent from one place
        at the end of transaction.
      sql/sql_parse.cc:
        Implement optimisation of read-only transactions: bypass 2-phase
        commit for them.
        Always commit statement transaction before commiting the global one.
        Fix an unrelated crash in check_table_access, when called from 
        information_schema.
      sql/sql_partition.cc:
        Partitions commit at the end of a DDL operation.
        Make sure that send_ok() is done only if the commit has succeeded.
      sql/sql_table.cc:
        Use ha_autocommit_or_rollback and end_active_trans everywhere.
        Add end_trans to mysql_admin_table, so that it leaves no pending
        transaction.
      sql/sql_udf.cc:
        Remvove a redundant call to close_thread_tables()
      sql/sql_update.cc:
        Remove wrong and now redundant calls to ha_autocommit_or_rollback.
        The transaction is committed in one place, at the end of the statement.
        Remove calls to mysql_unlock_tables, since some engines count locks
        and commit statement transaction in unlock_tables(), which essentially
        equates mysql_unlock_tables to ha_autocommit_or_rollback.
        Previously it was necessary to unlock tables soon because we wanted
        to avoid sending of 'ok' packet to the client under locked tables.
        This is no longer necessary, since OK packet is also sent from one place
        at the end of transaction.
      mysql-test/include/commit.inc:
        New BitKeeper file ``mysql-test/include/commit.inc''
      mysql-test/r/commit_1innodb.result:
        New BitKeeper file ``mysql-test/r/commit_1innodb.result''
      mysql-test/t/commit_1innodb.test:
        New BitKeeper file ``mysql-test/t/commit_1innodb.test''
      526798db
  36. 30 Oct, 2007 1 commit
    • unknown's avatar
      Manual merge 5.0-rpl -> 5.1-rpl. · 356bdcb7
      unknown authored
      involved bug#12691, bug#27571
      
      
      mysql-test/suite/rpl/r/rpl_sp_effects.result:
        results changed
      sql/slave.cc:
        pended manual merge done (mats)
      sql/sql_delete.cc:
        manual merge
      sql/sql_insert.cc:
        manual merge
      sql/sql_load.cc:
        manual merge
      sql/sql_update.cc:
        manual merge.
      356bdcb7
  37. 29 Oct, 2007 1 commit
    • unknown's avatar
      Bug #27571 asynchronousity in setting mysql_`query`::error and · 95f3db7b
      unknown authored
                 Query_log_event::error_code
      
      A query can perform completely having the local var error of mysql_$query
      zero, where $query in insert, update, delete, load,
      and be  binlogged with error_code e.g KILLED_QUERY while there is no
      reason do to so.
      That can happen because Query_log_event consults thd->killed flag to
      evaluate error_code.
      
      Fixed with implementing a scheme suggested and partly implemented at
      time of bug@22725 work-on. error_status is cached immediatly after the
      control leaves the main rows-loop and that instance always corresponds
      to `error' the local of mysql_$query functions. The cached value
      is passed to Query_log_event constructor, not the default thd->killed
      which can be changed in between of the caching and the constructing.
      
      
      mysql-test/r/binlog_killed.result:
        results changed
      mysql-test/t/binlog_killed.test:
        Demonstrating that effective killing during rows-loop execution leads to the speficied actions:
        binlogging with the error for a query modified a not-transactional table or
        rolling back effects for transactional table;
        
        fixing possible non-determinism with ID when query_log_enabled;
        
        leave commented out tests for multi-update,delete due to another bug;
        
        removing an obsolete tests template;
        
        changing system rm to --remove_file.
      sql/log_event.cc:
        adding killed status arg
      sql/log_event.h:
        added killed status arg
      sql/sql_delete.cc:
        deploying the update part patch for delete, multi-delete
      sql/sql_insert.cc:
        deploying the update-part patch for insert..select
      sql/sql_load.cc:
        deploying the update-part patch for load data.
        simulation added.
      sql/sql_update.cc:
        Impementing the fix as described in the comments left by bug@22725.
        Also simulation of killing after the loop that would affect binlogging in the old code.
      mysql-test/t/binlog_killed_bug27571-master.opt:
        post rows-loop killing simulation's options
      mysql-test/t/binlog_killed_bug27571.test:
        Checking that if killing happens inbetween of the end of rows loop and
        recording into binlog that will not lead to recording any error incl
        the killed error.
      mysql-test/t/binlog_killed_simulate-master.opt:
        simulation options
      mysql-test/t/binlog_killed_simulate.test:
        tests for 
        a query (update is choosen) being killed after the row-loop;
        load data killed within the loop - effective killed error in the event is gained.
      95f3db7b
  38. 21 Aug, 2007 1 commit
    • unknown's avatar
      Bug #23333 stored function + non-transac table + transac table = breaks stmt-based binlog · a0849011
      unknown authored
      Binlogging of the statement with a side effect like a modified non-trans table did not happen.
      The artifact involved all binloggable dml queries.
      
      Fixed with changing the binlogging conditions all over the code to exploit thd->transaction.stmt.modified_non_trans_table
      introduced by the patch for bug@27417.
      
      Multi-delete case has own specific addressed by another bug@29136. Multi-update case has been addressed by bug#27716 and
      patch and will need merging.
      
      
      mysql-test/r/mix_innodb_myisam_binlog.result:
        results changed
      mysql-test/r/sp_trans_log.result:
        results changed
      mysql-test/t/mix_innodb_myisam_binlog.test:
        specific to the bug tests added
      mysql-test/t/sp_trans_log.test:
        refining of the proof of that there is an event in binlog
      sql/sql_delete.cc:
        deploying the binlogging check with thd->transaction.stmt.modified_non_trans_table
      sql/sql_insert.cc:
        binlogging when thd->transaction.stmt.modified_non_trans_table is TRUE. Merge with Bug#29571.
      sql/sql_load.cc:
        binlogging when thd->transaction.stmt.modified_non_trans_table is true
      sql/sql_update.cc:
        binlogging when thd->transaction.stmt.modified_non_trans_table is true
      a0849011
  39. 30 Jul, 2007 1 commit
    • unknown's avatar
      (pushing for Andrei) · 1307d3b8
      unknown authored
      Bug #27417 thd->no_trans_update.stmt lost value inside of SF-exec-stack
        
      Once had been set the flag might later got reset inside of a stored routine 
      execution stack.
      The reason was in that there was no check if a new statement started at time 
      of resetting.
      The artifact affects most of binlogable DML queries. Notice, that multi-update 
      is wrapped up within
        bug@27716 fix, multi-delete bug@29136.
        
      Fixed with saving parent's statement flag of whether the statement modified 
      non-transactional table, and unioning (merging) the value with that was gained 
      in mysql_execute_command.
        
      Resettling thd->no_trans_update members into thd->transaction.`member`;
      Asserting code;
      Effectively the following properties are held.
        
      1. At the end of a substatement thd->transaction.stmt.modified_non_trans_table
         reflects the fact if such a table got modified by the substatement.
         That also respects THD::really_abort_on_warnin() requirements.
      2. Eventually thd->transaction.stmt.modified_non_trans_table will be computed as
         the union of the values of all invoked sub-statements.
         That fixes this bug#27417;
      
      Computing of thd->transaction.all.modified_non_trans_table is refined to base to 
      the stmt's value for all the case including insert .. select statement which 
      before the patch had an extra issue bug@28960.
      Minor issues are covered with mysql_load, mysql_delete, and binloggin of insert in
      to temp_table select. 
        
      The supplied test verifies limitely, mostly asserts. The ultimate testing is defered
      for bug@13270, bug@23333.
      
      
      mysql-test/r/mix_innodb_myisam_binlog.result:
        results changed
      mysql-test/t/mix_innodb_myisam_binlog.test:
        regression test incl the related bug#28960.
      sql/ha_ndbcluster.cc:
        thd->transaction.{all,stmt}.modified_non_trans_table
        instead of
        thd->no_trans_update.{all,stmt}
      sql/handler.cc:
        thd->transaction.{all,stmt}.modified_non_trans_table
        instead of
        thd->no_trans_update.{all,stmt}
      sql/handler.h:
        new member added
      sql/log.cc:
        thd->transaction.{all,stmt}.modified_non_trans_table
        instead of
        thd->no_trans_update.{all,stmt}
      sql/set_var.cc:
        thd->transaction.{all,stmt}.modified_non_trans_table
        instead of
        thd->no_trans_update.{all,stmt}
      sql/sp_head.cc:
        thd->transaction.{all,stmt}.modified_non_trans_table
        instead of
        thd->no_trans_update.{all,stmt}
        
        and saving and merging stmt's flag at the end of a substatement.
      sql/sql_class.cc:
        thd->transaction.{all,stmt}.modified_non_trans_table
        instead of
        thd->no_trans_update.{all,stmt}
      sql/sql_class.h:
        thd->transaction.{all,stmt}.modified_non_trans_table
        instead of
        thd->no_trans_update.{all,stmt}
      sql/sql_delete.cc:
        correcting basic delete incl truncate branch and multi-delete queries to set
        stmt.modified_non_trans_table;
        optimization to set the flag at the end of per-row loop;
        multi-delete still has an extra issue similar to bug#27716 of multi-update 
        - to be address with bug_29136 fix.
      sql/sql_insert.cc:
        thd->transaction.{all,stmt}.modified_non_trans_table
        instead of
        thd->no_trans_update.{all,stmt}
      sql/sql_load.cc:
        eliminating a separate issue where the stmt flag was saved and re-stored after 
        write_record that actually could change it and the change would be lost but 
        should remain permanent;
        thd->transaction.{all,stmt}.modified_non_trans_table
        instead of
        thd->no_trans_update.{all,stmt}
      sql/sql_parse.cc:
        initialization to transaction.stmt.modified_non_trans_table at the common part 
        of all types of statements processing - mysql_execute_command().
      sql/sql_table.cc:
        moving the reset up to the mysql_execute_command() caller
      sql/sql_update.cc:
        correcting update query case (multi-update part of the issues covered by other 
        bug#27716 fix)
        thd->transaction.{all,stmt}.modified_non_trans_table
        instead of
        thd->no_trans_update.{all,stmt}
      1307d3b8