List:Commits« Previous MessageNext Message »
From:Sven Sandberg Date:June 30 2009 2:46pm
Subject:bzr commit into mysql-5.1-bugteam branch (sven.sandberg:2944) Bug#39934
View as plain text  
#At file:///home/sven/bzr/b39934-mats-slave_row_engine/5.1-bugteam/ based on revid:staale.smedseng@stripped

 2944 Sven Sandberg	2009-06-30
      BUG#39934: Slave stops for engine that only support row-based logging
      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 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 in 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.
      
      Problem 3:
      When a statement contains several sub-statements (in a stored
      function, procedure, trigger, or prepared statement), and two or more
      sub-statements caused unsafe warnings, then several identical warnings
      were returned to the client. This is BUG#45826.
      Fix 3:
      Ensure only one warning is returned to the client for each statement.
      
      Problem 4:
      Views that contain a LIMIT clause were not marked as unsafe. This
      is BUG#45831.
      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.
      
      Problem 5:
      INSERT DELAYED didn't generate a warning when binlog_format=STATEMENT.
      This is BUG#45825.
      Fix 5:
      Made INSERT DELAYED set itself to unsafe at parse time instead of
      at execution time. This allows decide_logging_format() to detect that
      a warning should be printed.
     @ 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/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
         - there is now at most one warning per statement (because BUG#45826
           is fixed)
         - INSERT DELAYED now gives a warning (because BUG#45826 is fixed)
         - added test for INSERT..SELECT..LIMIT
     @ 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.test
         - Clarified comment.
         - Added test for INSERT..SELECT..LIMIT and INSERT DELAYED.
     @ 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_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.test
        Since slave now fails if it is in statement mode and sees row events,
        we need to force slave into row format.
     @ 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 don't
        switch to row logging in statement mode any more. Enforced
        mixed mode throughout the test.
     @ mysql-test/suite/rpl/t/rpl_row_insert_delayed.test
        Got rid of unnecessary explicit setting of binlog format.
     @ 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.
     @ 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/r/rpl_ndb_circular_simplex.result
        updated result file
     @ mysql-test/suite/rpl_ndb/r/rpl_ndb_stm_innodb.result
        Each of the five calls to tpcb.trans() (defined in include/tpcb.inc)
        from rpl_ndb_apply_status.test now generates a warning, since
        tpcb.trans() uses UUID() and since BUG#45824 was fixed.
     @ 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_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.
     @ sql/item_create.cc
        Added DBUG_ENTER to some functions.
     @ 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/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
     @ sql/sp_head.h
        Added DBUG_ENTER
     @ 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.
     @ 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.
     @ 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.
     @ 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.
     @ 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
         - 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.
     @ 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_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.
     @ 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.

    added:
      mysql-test/suite/rpl/r/rpl_mix_found_rows.result
      mysql-test/suite/rpl/r/rpl_mix_insert_delayed.result
      mysql-test/suite/rpl/t/rpl_mix_found_rows.test
      mysql-test/suite/rpl/t/rpl_mix_insert_delayed.test
    renamed:
      mysql-test/suite/rpl/r/rpl_found_rows.result => mysql-test/suite/rpl/r/rpl_stm_found_rows.result
      mysql-test/suite/rpl/t/rpl_found_rows.test => mysql-test/suite/rpl/t/rpl_stm_found_rows.test
    modified:
      mysql-test/extra/rpl_tests/rpl_foreign_key.test
      mysql-test/extra/rpl_tests/rpl_insert_delayed.test
      mysql-test/include/rpl_udf.inc
      mysql-test/r/mysqldump.result
      mysql-test/r/sp_trans.result
      mysql-test/suite/binlog/r/binlog_multi_engine.result
      mysql-test/suite/binlog/r/binlog_statement_insert_delayed.result
      mysql-test/suite/binlog/r/binlog_stm_ps.result
      mysql-test/suite/binlog/r/binlog_unsafe.result
      mysql-test/suite/binlog/t/binlog_multi_engine.test
      mysql-test/suite/binlog/t/binlog_unsafe.test
      mysql-test/suite/rpl/r/rpl_events.result
      mysql-test/suite/rpl/r/rpl_extraColmaster_innodb.result
      mysql-test/suite/rpl/r/rpl_extraColmaster_myisam.result
      mysql-test/suite/rpl/r/rpl_foreign_key_innodb.result
      mysql-test/suite/rpl/r/rpl_idempotency.result
      mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result
      mysql-test/suite/rpl/r/rpl_row_insert_delayed.result

      mysql-test/suite/rpl/r/rpl_stm_insert_delayed.result
      mysql-test/suite/rpl/r/rpl_stm_loadfile.result
      mysql-test/suite/rpl/r/rpl_temporary_errors.result
      mysql-test/suite/rpl/r/rpl_udf.result
      mysql-test/suite/rpl/t/rpl_bug31076.test
      mysql-test/suite/rpl/t/rpl_events.test
      mysql-test/suite/rpl/t/rpl_extraColmaster_innodb.test
      mysql-test/suite/rpl/t/rpl_extraColmaster_myisam.test
      mysql-test/suite/rpl/t/rpl_idempotency.test
      mysql-test/suite/rpl/t/rpl_rbr_to_sbr.test
      mysql-test/suite/rpl/t/rpl_row_insert_delayed.test
      mysql-test/suite/rpl/t/rpl_slave_skip.test
      mysql-test/suite/rpl/t/rpl_stm_insert_delayed.test
      mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test
      mysql-test/suite/rpl/t/rpl_temporary_errors.test
      mysql-test/suite/rpl/t/rpl_udf.test
      mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result
      mysql-test/suite/rpl_ndb/r/rpl_ndb_stm_innodb.result
      mysql-test/suite/rpl_ndb/t/rpl_ndb_2innodb.test
      mysql-test/suite/rpl_ndb/t/rpl_ndb_2myisam.test
      mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test
      mysql-test/suite/rpl_ndb/t/rpl_ndb_blob.test
      mysql-test/suite/rpl_ndb/t/rpl_ndb_blob2.test
      mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test
      mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_simplex.test
      mysql-test/suite/rpl_ndb/t/rpl_ndb_commit_afterflush.test
      mysql-test/suite/rpl_ndb/t/rpl_ndb_ctype_ucs2_def.test
      mysql-test/suite/rpl_ndb/t/rpl_ndb_delete_nowhere.test
      mysql-test/suite/rpl_ndb/t/rpl_ndb_do_db.test
      mysql-test/suite/rpl_ndb/t/rpl_ndb_do_table.test
      mysql-test/suite/rpl_ndb/t/rpl_ndb_func003.test
      mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb_trans.test
      mysql-test/suite/rpl_ndb/t/rpl_ndb_insert_ignore.test
      mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions.test
      mysql-test/suite/rpl_ndb/t/rpl_ndb_multi_update3.test
      mysql-test/suite/rpl_ndb/t/rpl_ndb_rep_ignore.test
      mysql-test/suite/rpl_ndb/t/rpl_ndb_row_001.test
      mysql-test/suite/rpl_ndb/t/rpl_ndb_sp003.test
      mysql-test/suite/rpl_ndb/t/rpl_ndb_sp006.test
      mysql-test/suite/rpl_ndb/t/rpl_ndb_trig004.test
      sql/item_create.cc
      sql/log_event.cc
      sql/log_event_old.cc
      sql/mysql_priv.h
      sql/rpl_injector.cc
      sql/set_var.cc
      sql/share/errmsg.txt
      sql/sp.cc
      sql/sp_head.h
      sql/sql_base.cc
      sql/sql_class.cc
      sql/sql_class.h
      sql/sql_delete.cc
      sql/sql_insert.cc
      sql/sql_lex.h
      sql/sql_parse.cc
      sql/sql_update.cc
      sql/sql_yacc.yy
      mysql-test/suite/rpl/r/rpl_stm_found_rows.result
      mysql-test/suite/rpl/t/rpl_stm_found_rows.test
=== modified file 'mysql-test/extra/rpl_tests/rpl_foreign_key.test'
--- a/mysql-test/extra/rpl_tests/rpl_foreign_key.test	2007-12-12 10:14:59 +0000
+++ b/mysql-test/extra/rpl_tests/rpl_foreign_key.test	2009-06-30 14:46:25 +0000
@@ -47,7 +47,6 @@ insert into t1 set b=1;
 insert into t2 set a=1, b=1;
 
 set foreign_key_checks=0;
-set @@session.binlog_format=row;
 delete from t1;
 
 --echo must sync w/o a problem (could not with the buggy code)

=== modified file 'mysql-test/extra/rpl_tests/rpl_insert_delayed.test'
--- a/mysql-test/extra/rpl_tests/rpl_insert_delayed.test	2007-07-27 14:29:48 +0000
+++ b/mysql-test/extra/rpl_tests/rpl_insert_delayed.test	2009-06-30 14:46:25 +0000
@@ -38,14 +38,14 @@ connection master;
 truncate table t1;
 # first scenario: duplicate on first row
 insert delayed into t1 values(10, "my name");
-if ($binlog_format_statement)
+if  (`SELECT @@global.binlog_format = 'STATEMENT'`)
 {
   # statement below will be converted to non-delayed INSERT and so
   # will stop at first error, guaranteeing replication.
   --error ER_DUP_ENTRY
   insert delayed into t1 values(10, "is Bond"), (20, "James Bond");
 }
-if (!$binlog_format_statement)
+if  (`SELECT @@global.binlog_format != 'STATEMENT'`)
 {
   insert delayed into t1 values(10, "is Bond"), (20, "James Bond");
 }
@@ -59,7 +59,7 @@ select * from t1;
 # second scenario: duplicate on second row
 connection master;
 delete from t1 where id!=10;
-if ($binlog_format_statement)
+if  (`SELECT @@global.binlog_format = 'STATEMENT'`)
 {
   # statement below will be converted to non-delayed INSERT and so
   # will be binlogged with its ER_DUP_ENTRY error code, guaranteeing
@@ -67,7 +67,7 @@ if ($binlog_format_statement)
   --error ER_DUP_ENTRY
   insert delayed into t1 values(20, "is Bond"), (10, "James Bond");
 }
-if (!$binlog_format_statement)
+if  (`SELECT @@global.binlog_format != 'STATEMENT'`)
 {
   insert delayed into t1 values(20, "is Bond"), (10, "James Bond");
 }
@@ -108,6 +108,7 @@ if  (`SELECT @@global.binlog_format != '
 {
   #must show two INSERT DELAYED
   --replace_column 1 x 2 x 3 x 4 x 5 x
+  --replace_regex /table_id: [0-9]+/table_id: #/
   show binlog events in 'master-bin.000002' LIMIT 2,2;
 }
 select * from t1;
@@ -118,6 +119,7 @@ if  (`SELECT @@global.binlog_format != '
 {
   #must show two INSERT DELAYED
   --replace_column 1 x 2 x 3 x 4 x 5 x
+  --replace_regex /table_id: [0-9]+/table_id: #/
   show binlog events in 'slave-bin.000002' LIMIT 2,2;
 }
 select * from t1;

=== modified file 'mysql-test/include/rpl_udf.inc'
--- a/mysql-test/include/rpl_udf.inc	2007-08-29 21:36:08 +0000
+++ b/mysql-test/include/rpl_udf.inc	2009-06-30 14:46:25 +0000
@@ -55,11 +55,13 @@ connection master;
 --echo "Running on the master"
 --enable_info
 eval CREATE TABLE t1(sum INT, price FLOAT(24)) ENGINE=$engine_type;
+--disable_warnings
 INSERT INTO t1 VALUES(myfunc_int(100), myfunc_double(50.00));
 INSERT INTO t1 VALUES(myfunc_int(10), myfunc_double(5.00));
 INSERT INTO t1 VALUES(myfunc_int(200), myfunc_double(25.00));
 INSERT INTO t1 VALUES(myfunc_int(1), myfunc_double(500.00));
 SELECT * FROM t1 ORDER BY sum;
+--enable_warnings
 --disable_info
 
 sync_slave_with_master;

=== modified file 'mysql-test/r/mysqldump.result'
--- a/mysql-test/r/mysqldump.result	2009-05-27 13:16:21 +0000
+++ b/mysql-test/r/mysqldump.result	2009-06-30 14:46:25 +0000
@@ -2239,6 +2239,8 @@ create  view v1 as
 select * from v3 where b in (1, 2, 3, 4, 5, 6, 7);
 create  view v2 as
 select v3.a from v3, v1 where v1.a=v3.a and v3.b=3 limit 1;
+Warnings:
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
 
 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
 /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;

=== modified file 'mysql-test/r/sp_trans.result'
--- a/mysql-test/r/sp_trans.result	2009-02-16 11:38:15 +0000
+++ b/mysql-test/r/sp_trans.result	2009-06-30 14:46:25 +0000
@@ -506,6 +506,8 @@ select count(*)*255 from t3 into table_s
 until table_size > max_table_size*2 end repeat;
 end|
 call bug14210_fill_table()|
+Warnings:
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
 drop procedure bug14210_fill_table|
 create table t4 like t3|
 create procedure bug14210()

=== modified file 'mysql-test/suite/binlog/r/binlog_multi_engine.result'
--- a/mysql-test/suite/binlog/r/binlog_multi_engine.result	2009-05-31 05:44:41 +0000
+++ b/mysql-test/suite/binlog/r/binlog_multi_engine.result	2009-06-30 14:46:25 +0000
@@ -42,7 +42,7 @@ INSERT INTO t1m VALUES (1,1), (1,2), (2,
 INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2);
 UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c;
 UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f;
-ERROR HY000: Binary logging not possible. Message: Statement cannot be written atomically since more than one engine involved and at least one engine is self-logging
+ERROR HY000: Statement cannot be written atomically since more than one engine is involved and at least one engine is self-logging
 TRUNCATE t1m;
 TRUNCATE t1b;
 TRUNCATE t1n;
@@ -68,9 +68,9 @@ INSERT INTO t1m VALUES (1,1), (1,2), (2,
 INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2);
 INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2);
 UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f;
-ERROR HY000: Binary logging not possible. Message: Statement cannot be written atomically since more than one engine involved and at least one engine is self-logging
+ERROR HY000: Statement cannot be written atomically since more than one engine is involved and at least one engine is self-logging
 UPDATE t1n, t1b SET e = 2, b = 3 WHERE f = c;
-ERROR HY000: Binary logging not possible. Message: Statement cannot be written atomically since more than one engine involved and at least one engine is self-logging
+ERROR HY000: Statement cannot be written atomically since more than one engine is involved and at least one engine is self-logging
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 mysqld-bin.000001	#	Query	#	#	BEGIN

=== modified file 'mysql-test/suite/binlog/r/binlog_statement_insert_delayed.result'
--- a/mysql-test/suite/binlog/r/binlog_statement_insert_delayed.result	2008-07-29 15:36:13 +0000
+++ b/mysql-test/suite/binlog/r/binlog_statement_insert_delayed.result	2009-06-30 14:46:25 +0000
@@ -12,7 +12,11 @@ master-bin.000001	#	Query	#	#	use `test`
 master-bin.000001	#	Query	#	#	use `test`; insert delayed into t1 values (300)
 master-bin.000001	#	Query	#	#	use `test`; FLUSH TABLES
 insert delayed into t1 values (null),(null),(null),(null);
+Warnings:
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
 insert delayed into t1 values (null),(null),(400),(null);
+Warnings:
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
 select * from t1;
 a
 207

=== modified file 'mysql-test/suite/binlog/r/binlog_stm_ps.result'
--- a/mysql-test/suite/binlog/r/binlog_stm_ps.result	2009-05-20 10:28:43 +0000
+++ b/mysql-test/suite/binlog/r/binlog_stm_ps.result	2009-06-30 14:46:25 +0000
@@ -11,7 +11,7 @@ prepare s from "insert into t1 select 10
 set @a=100;
 execute s using @a;
 Warnings:
-Note	1592	Statement may not be safe to log in statement format.
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	use `test`; create table t1 (a int)

=== modified file 'mysql-test/suite/binlog/r/binlog_unsafe.result'
--- a/mysql-test/suite/binlog/r/binlog_unsafe.result	2009-05-20 10:28:43 +0000
+++ b/mysql-test/suite/binlog/r/binlog_unsafe.result	2009-06-30 14:46:25 +0000
@@ -4,31 +4,35 @@ CREATE TABLE t2 (a CHAR(40));
 CREATE TABLE t3 (a INT AUTO_INCREMENT PRIMARY KEY);
 CREATE TABLE trigger_table (a CHAR(7));
 CREATE TABLE trigger_table2 (a INT);
-==== Non-deterministic statements ====
-INSERT DELAYED INTO t1 VALUES (5);
-==== Some variables that *should* be unsafe ====
+==== Statements that *should* be unsafe ====
 ---- Insert directly ----
 INSERT INTO t1 VALUES (@@global.sync_binlog);
 Warnings:
-Note	1592	Statement may not be safe to log in statement format.
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
 INSERT INTO t1 VALUES (@@session.insert_id);
 Warnings:
-Note	1592	Statement may not be safe to log in statement format.
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
 INSERT INTO t1 VALUES (@@global.auto_increment_increment);
 Warnings:
-Note	1592	Statement may not be safe to log in statement format.
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
 INSERT INTO t2 SELECT UUID();
 Warnings:
-Note	1592	Statement may not be safe to log in statement format.
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
 INSERT INTO t2 VALUES (@@session.sql_mode);
 Warnings:
-Note	1592	Statement may not be safe to log in statement format.
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
 INSERT INTO t2 VALUES (@@global.init_slave);
 Warnings:
-Note	1592	Statement may not be safe to log in statement format.
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
 INSERT INTO t2 VALUES (@@hostname);
 Warnings:
-Note	1592	Statement may not be safe to log in statement format.
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
+INSERT INTO t2 SELECT * FROM t1 LIMIT 1;
+Warnings:
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
+INSERT DELAYED INTO t1 VALUES (1), (2);
+Warnings:
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
 ---- Insert from stored procedure ----
 CREATE PROCEDURE proc()
 BEGIN
@@ -39,16 +43,12 @@ INSERT INTO t2 SELECT UUID();
 INSERT INTO t2 VALUES (@@session.sql_mode);
 INSERT INTO t2 VALUES (@@global.init_slave);
 INSERT INTO t2 VALUES (@@hostname);
+INSERT INTO t2 SELECT * FROM t1 LIMIT 1;
+INSERT DELAYED INTO t1 VALUES (1), (2);
 END|
 CALL proc();
 Warnings:
-Note	1592	Statement may not be safe to log in statement format.
-Note	1592	Statement may not be safe to log in statement format.
-Note	1592	Statement may not be safe to log in statement format.
-Note	1592	Statement may not be safe to log in statement format.
-Note	1592	Statement may not be safe to log in statement format.
-Note	1592	Statement may not be safe to log in statement format.
-Note	1592	Statement may not be safe to log in statement format.
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
 ---- Insert from stored function ----
 CREATE FUNCTION func()
 RETURNS INT
@@ -60,19 +60,15 @@ INSERT INTO t2 SELECT UUID();
 INSERT INTO t2 VALUES (@@session.sql_mode);
 INSERT INTO t2 VALUES (@@global.init_slave);
 INSERT INTO t2 VALUES (@@hostname);
+INSERT INTO t2 SELECT * FROM t1 LIMIT 1;
+INSERT DELAYED INTO t1 VALUES (1), (2);
 RETURN 0;
 END|
 SELECT func();
 func()
 0
 Warnings:
-Note	1592	Statement may not be safe to log in statement format.
-Note	1592	Statement may not be safe to log in statement format.
-Note	1592	Statement may not be safe to log in statement format.
-Note	1592	Statement may not be safe to log in statement format.
-Note	1592	Statement may not be safe to log in statement format.
-Note	1592	Statement may not be safe to log in statement format.
-Note	1592	Statement may not be safe to log in statement format.
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
 ---- Insert from trigger ----
 CREATE TRIGGER trig
 BEFORE INSERT ON trigger_table
@@ -85,17 +81,12 @@ INSERT INTO t2 SELECT UUID();
 INSERT INTO t2 VALUES (@@session.sql_mode);
 INSERT INTO t2 VALUES (@@global.init_slave);
 INSERT INTO t2 VALUES (@@hostname);
+INSERT INTO t2 SELECT * FROM t1 LIMIT 1;
+INSERT DELAYED INTO t1 VALUES (1), (2);
 END|
 INSERT INTO trigger_table VALUES ('bye.');
 Warnings:
-Note	1592	Statement may not be safe to log in statement format.
-Note	1592	Statement may not be safe to log in statement format.
-Note	1592	Statement may not be safe to log in statement format.
-Note	1592	Statement may not be safe to log in statement format.
-Note	1592	Statement may not be safe to log in statement format.
-Note	1592	Statement may not be safe to log in statement format.
-Note	1592	Statement may not be safe to log in statement format.
-Note	1592	Statement may not be safe to log in statement format.
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
 ---- Insert from prepared statement ----
 PREPARE p1 FROM 'INSERT INTO t1 VALUES (@@global.sync_binlog)';
 PREPARE p2 FROM 'INSERT INTO t1 VALUES (@@session.insert_id)';
@@ -104,27 +95,35 @@ PREPARE p4 FROM 'INSERT INTO t2 SELECT U
 PREPARE p5 FROM 'INSERT INTO t2 VALUES (@@session.sql_mode)';
 PREPARE p6 FROM 'INSERT INTO t2 VALUES (@@global.init_slave)';
 PREPARE p7 FROM 'INSERT INTO t2 VALUES (@@hostname)';
+PREPARE p8 FROM 'INSERT INTO t2 SELECT * FROM t1 LIMIT 1';
+PREPARE p9 FROM 'INSERT DELAYED INTO t1 VALUES (1), (2)';
 EXECUTE p1;
 Warnings:
-Note	1592	Statement may not be safe to log in statement format.
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
 EXECUTE p2;
 Warnings:
-Note	1592	Statement may not be safe to log in statement format.
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
 EXECUTE p3;
 Warnings:
-Note	1592	Statement may not be safe to log in statement format.
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
 EXECUTE p4;
 Warnings:
-Note	1592	Statement may not be safe to log in statement format.
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
 EXECUTE p5;
 Warnings:
-Note	1592	Statement may not be safe to log in statement format.
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
 EXECUTE p6;
 Warnings:
-Note	1592	Statement may not be safe to log in statement format.
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
 EXECUTE p7;
 Warnings:
-Note	1592	Statement may not be safe to log in statement format.
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
+EXECUTE p8;
+Warnings:
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
+EXECUTE p9;
+Warnings:
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
 ---- Insert from nested call of triggers / functions / procedures ----
 CREATE PROCEDURE proc1()
 INSERT INTO trigger_table VALUES ('ha!')|
@@ -154,13 +153,7 @@ EXECUTE prep6;
 func5()
 0
 Warnings:
-Note	1592	Statement may not be safe to log in statement format.
-Note	1592	Statement may not be safe to log in statement format.
-Note	1592	Statement may not be safe to log in statement format.
-Note	1592	Statement may not be safe to log in statement format.
-Note	1592	Statement may not be safe to log in statement format.
-Note	1592	Statement may not be safe to log in statement format.
-Note	1592	Statement may not be safe to log in statement format.
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
 ==== Variables that should *not* be unsafe ====
 INSERT INTO t1 VALUES (@@session.pseudo_thread_id);
 INSERT INTO t1 VALUES (@@session.pseudo_thread_id);
@@ -195,16 +188,16 @@ DROP TABLE t1, t2, t3, trigger_table, tr
 CREATE TABLE t1(a INT, b INT, KEY(a), PRIMARY KEY(b));
 INSERT INTO t1 SELECT * FROM t1 LIMIT 1;
 Warnings:
-Note	1592	Statement may not be safe to log in statement format.
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
 REPLACE INTO t1 SELECT * FROM t1 LIMIT 1;
 Warnings:
-Note	1592	Statement may not be safe to log in statement format.
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
 UPDATE t1 SET a=1 LIMIT 1;
 Warnings:
-Note	1592	Statement may not be safe to log in statement format.
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
 DELETE FROM t1 LIMIT 1;
 Warnings:
-Note	1592	Statement may not be safe to log in statement format.
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
 CREATE PROCEDURE p1()
 BEGIN
 INSERT INTO t1 SELECT * FROM t1 LIMIT 1;
@@ -214,10 +207,7 @@ DELETE FROM t1 LIMIT 1;
 END|
 CALL p1();
 Warnings:
-Note	1592	Statement may not be safe to log in statement format.
-Note	1592	Statement may not be safe to log in statement format.
-Note	1592	Statement may not be safe to log in statement format.
-Note	1592	Statement may not be safe to log in statement format.
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
 DROP PROCEDURE p1;
 DROP TABLE t1;
 DROP TABLE IF EXISTS t1;
@@ -225,7 +215,7 @@ CREATE TABLE t1 (a VARCHAR(100), b VARCH
 INSERT INTO t1 VALUES ('a','b');
 UPDATE t1 SET b = '%s%s%s%s%s%s%s%s%s%s%s%s%s%s' WHERE a = 'a' LIMIT 1;
 Warnings:
-Note	1592	Statement may not be safe to log in statement format.
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
 DROP TABLE t1;
 DROP TABLE IF EXISTS t1, t2;
 CREATE TABLE t1(i INT PRIMARY KEY);
@@ -234,7 +224,7 @@ CREATE TABLE t3(i INT, ch CHAR(50));
 "Should issue message Statement may not be safe to log in statement format."
 INSERT INTO t1 SELECT * FROM t2 LIMIT 1;
 Warnings:
-Note	1592	Statement may not be safe to log in statement format.
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
 CREATE FUNCTION func6()
 RETURNS INT
 BEGIN
@@ -246,7 +236,7 @@ END|
 "Should issue message Statement may not be safe to log in statement format only once"
 INSERT INTO t3 VALUES(func6(), UUID());
 Warnings:
-Note	1592	Statement may not be safe to log in statement format.
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
 "Check whether SET @@SQL_LOG_BIN = 0/1 doesn't work in substatements"
 CREATE FUNCTION fun_check_log_bin() RETURNS INT
 BEGIN
@@ -259,7 +249,7 @@ SELECT fun_check_log_bin();
 fun_check_log_bin()
 100
 Warnings:
-Note	1592	Statement may not be safe to log in statement format.
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
 "SQL_LOG_BIN should be ON still"
 SHOW VARIABLES LIKE "SQL_LOG_BIN";
 Variable_name	Value
@@ -315,16 +305,16 @@ CREATE TABLE t1(i INT PRIMARY KEY);
 CREATE TABLE t2(i INT PRIMARY KEY);
 INSERT INTO t1 SELECT * FROM t2 LIMIT 1;
 Warnings:
-Note	1592	Statement may not be safe to log in statement format.
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
 INSERT INTO t1 VALUES(@@global.sync_binlog);
 Warnings:
-Note	1592	Statement may not be safe to log in statement format.
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
 UPDATE t1 SET i = 999 LIMIT 1;
 Warnings:
-Note	1592	Statement may not be safe to log in statement format.
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
 DELETE FROM t1 LIMIT 1;
 Warnings:
-Note	1592	Statement may not be safe to log in statement format.
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
 DROP TABLE t1, t2;
 SET @@SESSION.SQL_MODE = @save_sql_mode;
 "End of tests"

=== modified file 'mysql-test/suite/binlog/t/binlog_multi_engine.test'
--- a/mysql-test/suite/binlog/t/binlog_multi_engine.test	2008-10-02 09:02:38 +0000
+++ b/mysql-test/suite/binlog/t/binlog_multi_engine.test	2009-06-30 14:46:25 +0000
@@ -60,7 +60,7 @@ let $wait_binlog_event= COMMIT;
 source include/wait_for_binlog_event.inc;
 
 UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c;
-error ER_BINLOG_LOGGING_IMPOSSIBLE;
+error ER_BINLOG_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE;
 UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f;
 
 # Not possible to test this since NDB writes its own binlog, which
@@ -84,7 +84,7 @@ INSERT INTO t1m VALUES (1,1), (1,2), (2,
 INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2);
 INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2);
 
-error ER_BINLOG_LOGGING_IMPOSSIBLE;
+error ER_BINLOG_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE;
 UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f;
 
 # Not possible to test this since NDB writes its own binlog, which
@@ -93,7 +93,7 @@ UPDATE t1m, t1n SET m = 2, e = 3 WHERE n
 
 #UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f;
 
-error ER_BINLOG_LOGGING_IMPOSSIBLE;
+error ER_BINLOG_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE;
 UPDATE t1n, t1b SET e = 2, b = 3 WHERE f = c;
 
 source include/show_binlog_events.inc;

=== modified file 'mysql-test/suite/binlog/t/binlog_unsafe.test'
--- a/mysql-test/suite/binlog/t/binlog_unsafe.test	2009-05-20 10:28:43 +0000
+++ b/mysql-test/suite/binlog/t/binlog_unsafe.test	2009-06-30 14:46:25 +0000
@@ -6,16 +6,22 @@
 # (e.g., @@variables), or because they include nondeterministic
 # queries (e.g., LIMIT), or because the time at which the query is
 # executed cannot be determined (e.g., INSERT DELAYED).  Such
-# statements should be marked unsafe.  All unsafe statements should
-# give a warning.
-# Yet the warning/error message isn't issued when SQL_LOG_BIN is turned off.
+# statements should be marked unsafe.
+#
+# All unsafe statements should give a warning when binlogging is on.
+# No warning should be printed if SQL_LOG_BIN is turned off.  If
+# binlogging is on and a statement contains several unsafe
+# sub-statements, then each unsafe sub-statement shall give a warning
+# in the error log; however, only one warning should be returned to
+# the client. (The reason is that the error log contains the statement
+# written out, so it is meaningful to see each failing statement.)
 #
 # This test verifies that a warning is generated for statements that
 # should be unsafe, when they are executed under statement mode
 # logging.
 #
-# All variables should be unsafe, with some exceptions.  Therefore,
-# this test also verifies that the exceptions do *not* generare a
+# All @@variables should be unsafe, with some exceptions.  Therefore,
+# this test also verifies that the exceptions do *not* generate a
 # warning.
 #
 #
@@ -75,12 +81,7 @@ CREATE TABLE trigger_table (a CHAR(7));
 CREATE TABLE trigger_table2 (a INT);
 
 
---echo ==== Non-deterministic statements ====
-
-INSERT DELAYED INTO t1 VALUES (5);
-
-
---echo ==== Some variables that *should* be unsafe ====
+--echo ==== Statements that *should* be unsafe ====
 
 --echo ---- Insert directly ----
 
@@ -91,6 +92,8 @@ INSERT INTO t2 SELECT UUID();
 INSERT INTO t2 VALUES (@@session.sql_mode);
 INSERT INTO t2 VALUES (@@global.init_slave);
 INSERT INTO t2 VALUES (@@hostname);
+INSERT INTO t2 SELECT * FROM t1 LIMIT 1;
+INSERT DELAYED INTO t1 VALUES (1), (2);
 
 --echo ---- Insert from stored procedure ----
 
@@ -104,6 +107,8 @@ BEGIN
   INSERT INTO t2 VALUES (@@session.sql_mode);
   INSERT INTO t2 VALUES (@@global.init_slave);
   INSERT INTO t2 VALUES (@@hostname);
+  INSERT INTO t2 SELECT * FROM t1 LIMIT 1;
+  INSERT DELAYED INTO t1 VALUES (1), (2);
 END|
 DELIMITER ;|
 
@@ -122,6 +127,8 @@ BEGIN
   INSERT INTO t2 VALUES (@@session.sql_mode);
   INSERT INTO t2 VALUES (@@global.init_slave);
   INSERT INTO t2 VALUES (@@hostname);
+  INSERT INTO t2 SELECT * FROM t1 LIMIT 1;
+  INSERT DELAYED INTO t1 VALUES (1), (2);
   RETURN 0;
 END|
 DELIMITER ;|
@@ -142,6 +149,8 @@ BEGIN
   INSERT INTO t2 VALUES (@@session.sql_mode);
   INSERT INTO t2 VALUES (@@global.init_slave);
   INSERT INTO t2 VALUES (@@hostname);
+  INSERT INTO t2 SELECT * FROM t1 LIMIT 1;
+  INSERT DELAYED INTO t1 VALUES (1), (2);
 END|
 DELIMITER ;|
 
@@ -156,9 +165,11 @@ PREPARE p4 FROM 'INSERT INTO t2 SELECT U
 PREPARE p5 FROM 'INSERT INTO t2 VALUES (@@session.sql_mode)';
 PREPARE p6 FROM 'INSERT INTO t2 VALUES (@@global.init_slave)';
 PREPARE p7 FROM 'INSERT INTO t2 VALUES (@@hostname)';
+PREPARE p8 FROM 'INSERT INTO t2 SELECT * FROM t1 LIMIT 1';
+PREPARE p9 FROM 'INSERT DELAYED INTO t1 VALUES (1), (2)';
 
 EXECUTE p1; EXECUTE p2; EXECUTE p3; EXECUTE p4; EXECUTE p5;
-EXECUTE p6; EXECUTE p7;
+EXECUTE p6; EXECUTE p7; EXECUTE p8; EXECUTE p9;
 
 --echo ---- Insert from nested call of triggers / functions / procedures ----
 
@@ -243,6 +254,8 @@ DROP PROCEDURE proc4;
 DROP FUNCTION  func5;
 DROP PREPARE   prep6;
 DROP TABLE t1, t2, t3, trigger_table, trigger_table2;
+
+
 #
 # BUG#34768 - nondeterministic INSERT using LIMIT logged in stmt mode if
 #             binlog_format=mixed

=== modified file 'mysql-test/suite/rpl/r/rpl_events.result'
--- a/mysql-test/suite/rpl/r/rpl_events.result	2009-01-30 13:44:49 +0000
+++ b/mysql-test/suite/rpl/r/rpl_events.result	2009-06-30 14:46:25 +0000
@@ -6,96 +6,6 @@ drop table if exists t1,t2,t3,t4,t5,t6,t
 start slave;
 SET @old_event_scheduler = @@global.event_scheduler;
 set global event_scheduler=1;
-set binlog_format=row;
-DROP EVENT IF EXISTS test.justonce;
-drop table if exists t1,t2;
-CREATE TABLE `t1` (
-`id` INT(10) UNSIGNED NOT NULL,
-`c` VARCHAR(50) NOT NULL,
-`ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
-PRIMARY KEY (`id`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-INSERT INTO t1 (id, c) VALUES (1, 'manually');
-"Creating event test.justonce on the master"
-CREATE EVENT test.justonce ON SCHEDULE EVERY 2 SECOND DO 
-INSERT IGNORE INTO t1 (id, c) VALUES (2, 'from justonce');
-"Checking event is active on master"
-SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'justonce';
-db	name	status	originator
-test	justonce	ENABLED	1
-"Checking event data on the master"
-ONE
-1
-"Checking event data on the slave"
-ZERO
-0
-"Checking event is inactive on slave"
-SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'justonce';
-db	name	status	originator
-test	justonce	SLAVESIDE_DISABLED	1
-"Dropping event test.slave_once on the slave"
-DROP EVENT IF EXISTS test.slave_once;
-CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO 
-INSERT IGNORE INTO t1(id, c) VALUES (3, 'from slave_once');
-"Checking event status on the slave for originator value = slave's server_id"
-SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_once';
-db	name	status	originator
-test	slave_once	ENABLED	2
-"Dropping event test.slave_once on the slave"
-DROP EVENT IF EXISTS test.slave_once;
-"Dropping event test.justonce on the master"
-DROP EVENT IF EXISTS test.justonce;
-"Creating event test.er on the master"
-CREATE EVENT test.er ON SCHEDULE EVERY 3 SECOND STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO 
-INSERT IGNORE INTO t1(id, c) VALUES (4, 'from er');
-"Checking event status on the master"
-SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
-db	name	status	originator	body
-test	er	ENABLED	1	INSERT IGNORE INTO t1(id, c) VALUES (4, 'from er')
-"Checking event status on the slave"
-SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
-db	name	status	originator	body
-test	er	SLAVESIDE_DISABLED	1	INSERT IGNORE INTO t1(id, c) VALUES (4, 'from er')
-"Altering event test.er on the master"
-ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO 
-INSERT IGNORE INTO t1(id, c) VALUES (5, 'from alter er');
-"Checking event status on the master"
-SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
-db	name	status	originator	body
-test	er	ENABLED	1	INSERT IGNORE INTO t1(id, c) VALUES (5, 'from alter er')
-"Checking event status on the slave"
-SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
-db	name	status	originator	body
-test	er	SLAVESIDE_DISABLED	1	INSERT IGNORE INTO t1(id, c) VALUES (5, 'from alter er')
-"Dropping event test.er on the master"
-DROP EVENT test.er;
-"Checking event status on the master"
-SELECT db, name, status, originator FROM mysql.event WHERE db = 'test';
-db	name	status	originator
-"Checking event status on the slave"
-SELECT db, name, status, originator FROM mysql.event WHERE db = 'test';
-db	name	status	originator
-"Creating event test.slave_terminate on the slave"
-CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO 
-INSERT IGNORE INTO t1(id, c) VALUES (6, 'from slave_terminate');
-"Checking event status on the slave"
-SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate';
-db	name	status	originator
-test	slave_terminate	ENABLED	2
-"Dropping event test.slave_terminate on the slave"
-DROP EVENT test.slave_terminate;
-"Creating event test.slave_terminate with DISABLE ON SLAVE on the slave"
-CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND DISABLE ON SLAVE DO 
-INSERT IGNORE INTO t1(c) VALUES (7, 'from slave_terminate');
-"Checking event status on the slave"
-SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate';
-db	name	status	originator
-test	slave_terminate	SLAVESIDE_DISABLED	2
-"Dropping event test.slave_terminate on the slave"
-DROP EVENT test.slave_terminate;
-"Cleanup"
-DROP TABLE t1;
-set binlog_format=statement;
 DROP EVENT IF EXISTS test.justonce;
 drop table if exists t1,t2;
 CREATE TABLE `t1` (

=== modified file 'mysql-test/suite/rpl/r/rpl_extraColmaster_innodb.result'
--- a/mysql-test/suite/rpl/r/rpl_extraColmaster_innodb.result	2009-02-05 09:49:32 +0000
+++ b/mysql-test/suite/rpl/r/rpl_extraColmaster_innodb.result	2009-06-30 14:46:25 +0000
@@ -4,7 +4,6 @@ reset master;
 reset slave;
 drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
 start slave;
-set binlog_format=row;
 
 ***********************************************************
 ***********************************************************
@@ -1145,2285 +1144,3 @@ c1	hex(c4)	c5
 3	6231623162316231	QA
 DROP TABLE t5;
 
-set binlog_format=statement;
-
-***********************************************************
-***********************************************************
-***************** Start of Testing ************************
-***********************************************************
-***********************************************************
-* This test format == binlog_format	STATEMENT and engine == 'InnoDB'
-***********************************************************
-***********************************************************
-
-***** Testing more columns on the Master *****
-
-CREATE TABLE t1 (f1 INT, f2 INT, f3 INT PRIMARY KEY, f4 CHAR(20),
-/* extra */
-f5 FLOAT DEFAULT '2.00', 
-f6 CHAR(4) DEFAULT 'TEST',
-f7 INT DEFAULT '0',
-f8 TEXT,
-f9 LONGBLOB,
-f10 BIT(63),
-f11 VARBINARY(64))ENGINE='InnoDB';
-
-* Alter Table on Slave and drop columns f5 through f11 *
-
-alter table t1 drop f5, drop f6, drop f7, drop f8, drop f9, drop f10, drop f11;
-
-* Insert data in Master then update and delete some rows*
-
-* Select count and 20 rows from Master *
-
-SELECT COUNT(*) FROM t1;
-COUNT(*)
-40
-
-SELECT f1,f2,f3,f4,f5,f6,f7,f8,f9,
-hex(f10),hex(f11) FROM t1 ORDER BY f3 LIMIT 20;
-f1	f2	f3	f4	f5	f6	f7	f8	f9	hex(f10)	hex(f11)
-2	2	2	second	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-3	3	3	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-5	5	5	second	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-6	6	6	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-8	8	8	second	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-9	9	9	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-11	11	11	second	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-12	12	12	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-14	14	14	second	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-15	15	15	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-17	17	17	second	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-18	18	18	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-20	20	20	second	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-21	21	21	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-23	23	23	second	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-24	24	24	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-26	26	26	second	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-27	27	27	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-29	29	29	second	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-30	30	30	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-
-* Select count and 20 rows from Slave *
-
-SELECT COUNT(*) FROM t1;
-COUNT(*)
-40
-
-SELECT * FROM t1 ORDER BY f3 LIMIT 20;
-f1	f2	f3	f4
-2	2	2	second
-3	3	3	next
-5	5	5	second
-6	6	6	next
-8	8	8	second
-9	9	9	next
-11	11	11	second
-12	12	12	next
-14	14	14	second
-15	15	15	next
-17	17	17	second
-18	18	18	next
-20	20	20	second
-21	21	21	next
-23	23	23	second
-24	24	24	next
-26	26	26	second
-27	27	27	next
-29	29	29	second
-30	30	30	next
-
-* Show Slave Status *
-
-show slave status;;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-
-
-***** Testing Altering table def scenario *****
-
-CREATE TABLE t2 (f1 INT, f2 INT, f3 INT PRIMARY KEY, f4 CHAR(20),
-/* extra */
-f5 DOUBLE DEFAULT '2.00', 
-f6 ENUM('a', 'b', 'c') default 'a',
-f7 DECIMAL(17,9) default '1000.00',
-f8 MEDIUMBLOB,
-f9 NUMERIC(6,4) default '2000.00',
-f10 VARCHAR(1024),
-f11 BINARY(20) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',
-f12 SET('a', 'b', 'c') default 'b')
-ENGINE='InnoDB';
-Warnings:
-Warning	1264	Out of range value for column 'f9' at row 1
-
-CREATE TABLE t3 (f1 INT, f2 INT, f3 INT PRIMARY KEY, f4 CHAR(20),
-/* extra */
-f5 DOUBLE DEFAULT '2.00', 
-f6 ENUM('a', 'b', 'c') default 'a',
-f8 MEDIUMBLOB,
-f10 VARCHAR(1024),
-f11 BINARY(20) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',
-f12 SET('a', 'b', 'c') default 'b')
-ENGINE='InnoDB';
-
-CREATE TABLE t4 (f1 INT, f2 INT, f3 INT PRIMARY KEY, f4 CHAR(20),
-/* extra */
-f5 DOUBLE DEFAULT '2.00', 
-f6 DECIMAL(17,9) default '1000.00',
-f7 MEDIUMBLOB,
-f8 NUMERIC(6,4) default '2000.00',
-f9 VARCHAR(1024),
-f10 BINARY(20) not null default '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',
-f11 CHAR(255))
-ENGINE='InnoDB';
-Warnings:
-Warning	1264	Out of range value for column 'f8' at row 1
-
-CREATE TABLE t31 (f1 INT, f2 INT, f3 INT PRIMARY KEY, f4 CHAR(20),
-/* extra */
-f5  BIGINT,
-f6  BLOB,
-f7  DATE,
-f8  DATETIME,
-f9  FLOAT,
-f10 INT,
-f11 LONGBLOB,
-f12 LONGTEXT,
-f13 MEDIUMBLOB,
-f14 MEDIUMINT,
-f15 MEDIUMTEXT,
-f16 REAL,
-f17 SMALLINT,
-f18 TEXT,
-f19 TIME,
-f20 TIMESTAMP,
-f21 TINYBLOB,
-f22 TINYINT,
-f23 TINYTEXT,
-f24 YEAR,
-f25 BINARY(255),
-f26 BIT(64),
-f27 CHAR(255),
-f28 DECIMAL(30,7),
-f29 DOUBLE,
-f30 ENUM ('a','b', 'c') default 'a',
-f31 FLOAT,
-f32 NUMERIC(17,9),
-f33 SET ('a', 'b', 'c') default 'b',
-f34 VARBINARY(1025),
-f35 VARCHAR(257)       
-) ENGINE='InnoDB';
-
-** Alter tables on slave and drop columns **
-
-alter table t2 drop f5, drop f6, drop f7, drop f8, drop f9, drop f10, drop f11, drop
-f12;
-alter table t3 drop f5, drop f6, drop f8, drop f10, drop f11, drop f12;
-alter table t4 drop f5, drop f6, drop f7, drop f8, drop f9, drop f10, drop f11;
-alter table t31 
-drop f5, drop f6, drop f7, drop f8, drop f9, drop f10, drop f11,
-drop f12, drop f13, drop f14, drop f15, drop f16, drop f17, drop f18,
-drop f19, drop f20, drop f21, drop f22, drop f23, drop f24, drop f25,
-drop f26, drop f27, drop f28, drop f29, drop f30, drop f31, drop f32,
-drop f33, drop f34, drop f35;
-
-** Insert Data into Master **
-INSERT into t2 set f1=1, f2=1, f3=1, f4='first', f8='f8: medium size blob', f10='f10:
-some var char';
-INSERT into t2 values (2, 2, 2, 'second',
-2.0, 'b', 2000.0002, 'f8: medium size blob', 2000, 'f10: some var char',
-'01234567', 'c'),
-(3, 3, 3, 'third',
-3.0, 'b', 3000.0003, 'f8: medium size blob', 3000, 'f10: some var char',
-'01234567', 'c');
-Warnings:
-Warning	1264	Out of range value for column 'f9' at row 1
-Warning	1264	Out of range value for column 'f9' at row 2
-INSERT into t3 set f1=1, f2=1, f3=1, f4='first', f10='f10: some var char';
-INSERT into t4 set f1=1, f2=1, f3=1, f4='first', f7='f7: medium size blob', f10='f10:
-binary data';
-INSERT into t31 set f1=1, f2=1, f3=1, f4='first';
-INSERT into t31 set f1=1, f2=1, f3=2, f4='second',
-f9=2.2,  f10='seven samurai', f28=222.222, f35='222';
-Warnings:
-Warning	1366	Incorrect integer value: 'seven samurai' for column 'f10' at row 1
-INSERT into t31 values (1, 1, 3, 'third',
-/* f5  BIGINT,  */            333333333333333333333333,
-/* f6  BLOB,  */              '3333333333333333333333',
-/* f7  DATE,  */              '2007-07-18',
-/* f8  DATETIME,  */          "2007-07-18",
-/* f9  FLOAT,  */             3.33333333,
-/* f10 INT,  */               333333333,
-/* f11 LONGBLOB,  */          '3333333333333333333',
-/* f12 LONGTEXT,  */          '3333333333333333333',
-/* f13 MEDIUMBLOB,  */        '3333333333333333333',
-/* f14 MEDIUMINT,  */         33,
-/* f15 MEDIUMTEXT,  */        3.3,
-/* f16 REAL,  */              3.3,
-/* f17 SMALLINT,  */          3,
-/* f18 TEXT,  */              '33',
-/* f19 TIME,  */              '2:59:58.999',
-/* f20 TIMESTAMP,  */         20000303000000,
-/* f21 TINYBLOB,  */          '3333',
-/* f22 TINYINT,  */           3,
-/* f23 TINYTEXT,  */          '3',
-/* f24 YEAR,  */              3000,
-/* f25 BINARY(255),  */       'three_33333',
-/* f26 BIT(64),  */           b'011', 
-/* f27 CHAR(255),  */         'three',
-/* f28 DECIMAL(30,7),  */     3.333,
-/* f29 DOUBLE,  */            3.333333333333333333333333333,
-/* f30 ENUM ('a','b','c')*/   'c',
-/* f31 FLOAT,  */             3.0,
-/* f32 NUMERIC(17,9),  */     3.3333,
-/* f33 SET ('a','b','c'),*/   'c',
-/*f34 VARBINARY(1025),*/      '3333 minus 3',
-/*f35 VARCHAR(257),*/         'three times three'
-      );
-Warnings:
-Warning	1264	Out of range value for column 'f5' at row 1
-Warning	1264	Out of range value for column 'f24' at row 1
-INSERT into t31 values (1, 1, 4, 'fourth',
-/* f5  BIGINT,  */            333333333333333333333333,
-/* f6  BLOB,  */              '3333333333333333333333',
-/* f7  DATE,  */              '2007-07-18',
-/* f8  DATETIME,  */          "2007-07-18",
-/* f9  FLOAT,  */             3.33333333,
-/* f10 INT,  */               333333333,
-/* f11 LONGBLOB,  */          '3333333333333333333',
-/* f12 LONGTEXT,  */          '3333333333333333333',
-/* f13 MEDIUMBLOB,  */        '3333333333333333333',
-/* f14 MEDIUMINT,  */         33,
-/* f15 MEDIUMTEXT,  */        3.3,
-/* f16 REAL,  */              3.3,
-/* f17 SMALLINT,  */          3,
-/* f18 TEXT,  */              '33',
-/* f19 TIME,  */              '2:59:58.999',
-/* f20 TIMESTAMP,  */         20000303000000,
-/* f21 TINYBLOB,  */          '3333',
-/* f22 TINYINT,  */           3,
-/* f23 TINYTEXT,  */          '3',
-/* f24 YEAR,  */              3000,
-/* f25 BINARY(255),  */       'three_33333',
-/* f26 BIT(64),  */           b'011',
-/* f27 CHAR(255),  */         'three',
-/* f28 DECIMAL(30,7),  */     3.333,
-/* f29 DOUBLE,  */            3.333333333333333333333333333,
-/* f30 ENUM ('a','b','c')*/   'c',
-/* f31 FLOAT,  */             3.0,
-/* f32 NUMERIC(17,9),  */     3.3333,
-/* f33 SET ('a','b','c'),*/   'c',
-/*f34 VARBINARY(1025),*/      '3333 minus 3',
-/*f35 VARCHAR(257),*/         'three times three'
-       ),
-(1, 1, 5, 'fifth',
-/* f5  BIGINT,  */            333333333333333333333333,
-/* f6  BLOB,  */              '3333333333333333333333',
-/* f7  DATE,  */              '2007-07-18',
-/* f8  DATETIME,  */          "2007-07-18",
-/* f9  FLOAT,  */             3.33333333,
-/* f10 INT,  */               333333333,
-/* f11 LONGBLOB,  */          '3333333333333333333',
-/* f12 LONGTEXT,  */          '3333333333333333333',
-/* f13 MEDIUMBLOB,  */        '3333333333333333333',
-/* f14 MEDIUMINT,  */         33,
-/* f15 MEDIUMTEXT,  */        3.3,
-/* f16 REAL,  */              3.3,
-/* f17 SMALLINT,  */          3,
-/* f18 TEXT,  */              '33',
-/* f19 TIME,  */              '2:59:58.999',
-/* f20 TIMESTAMP,  */         20000303000000,
-/* f21 TINYBLOB,  */          '3333',
-/* f22 TINYINT,  */           3,
-/* f23 TINYTEXT,  */          '3',
-/* f24 YEAR,  */              3000,
-/* f25 BINARY(255),  */       'three_33333',
-/* f26 BIT(64),  */           b'011',
-/* f27 CHAR(255),  */         'three',
-/* f28 DECIMAL(30,7),  */     3.333,
-/* f29 DOUBLE,  */            3.333333333333333333333333333,
-/* f30 ENUM ('a','b','c')*/   'c',
-/* f31 FLOAT,  */             3.0,
-/* f32 NUMERIC(17,9),  */     3.3333,
-/* f33 SET ('a','b','c'),*/   'c',
-/*f34 VARBINARY(1025),*/      '3333 minus 3',
-/*f35 VARCHAR(257),*/         'three times three'
-       ),
-(1, 1, 6, 'sixth',
-/* f5  BIGINT,  */            NULL,
-/* f6  BLOB,  */              '3333333333333333333333',
-/* f7  DATE,  */              '2007-07-18',
-/* f8  DATETIME,  */          "2007-07-18",
-/* f9  FLOAT,  */             3.33333333,
-/* f10 INT,  */               333333333,
-/* f11 LONGBLOB,  */          '3333333333333333333',
-/* f12 LONGTEXT,  */          '3333333333333333333',
-/* f13 MEDIUMBLOB,  */        '3333333333333333333',
-/* f14 MEDIUMINT,  */         33,
-/* f15 MEDIUMTEXT,  */        3.3,
-/* f16 REAL,  */              3.3,
-/* f17 SMALLINT,  */          3,
-/* f18 TEXT,  */              '33',
-/* f19 TIME,  */              '2:59:58.999',
-/* f20 TIMESTAMP,  */         20000303000000,
-/* f21 TINYBLOB,  */          '3333',
-/* f22 TINYINT,  */           3,
-/* f23 TINYTEXT,  */          '3',
-/* f24 YEAR,  */              3000,
-/* f25 BINARY(255),  */       'three_33333',
-/* f26 BIT(64),  */           b'011',
-/* f27 CHAR(255),  */         'three',
-/* f28 DECIMAL(30,7),  */     3.333,
-/* f29 DOUBLE,  */            3.333333333333333333333333333,
-/* f30 ENUM ('a','b','c')*/   'c',
-/* f31 FLOAT,  */             3.0,
-/* f32 NUMERIC(17,9),  */     3.3333,
-/* f33 SET ('a','b','c'),*/   'c',
-/*f34 VARBINARY(1025),*/      '3333 minus 3',
-/*f35 VARCHAR(257),*/         NULL
-);
-Warnings:
-Warning	1264	Out of range value for column 'f5' at row 1
-Warning	1264	Out of range value for column 'f24' at row 1
-Warning	1264	Out of range value for column 'f5' at row 2
-Warning	1264	Out of range value for column 'f24' at row 2
-Warning	1264	Out of range value for column 'f24' at row 3
-
-** Sync slave with master ** 
-** Do selects from tables **
-
-select * from t1 order by f3;
-f1	f2	f3	f4
-2	2	2	second
-3	3	3	next
-5	5	5	second
-6	6	6	next
-8	8	8	second
-9	9	9	next
-11	11	11	second
-12	12	12	next
-14	14	14	second
-15	15	15	next
-17	17	17	second
-18	18	18	next
-20	20	20	second
-21	21	21	next
-23	23	23	second
-24	24	24	next
-26	26	26	second
-27	27	27	next
-29	29	29	second
-30	30	30	next
-31	31	31	second
-32	32	32	second
-33	33	33	second
-34	34	34	second
-35	35	35	second
-36	36	36	second
-37	37	37	second
-38	38	38	second
-39	39	39	second
-40	40	40	second
-41	41	41	second
-42	42	42	second
-43	43	43	second
-44	44	44	second
-45	45	45	second
-46	46	46	second
-47	47	47	second
-48	48	48	second
-49	49	49	second
-50	50	50	second
-select * from t2 order by f1;
-f1	f2	f3	f4
-1	1	1	first
-2	2	2	second
-3	3	3	third
-select * from t3 order by f1;
-f1	f2	f3	f4
-1	1	1	first
-select * from t4 order by f1;
-f1	f2	f3	f4
-1	1	1	first
-select * from t31 order by f3;
-f1	f2	f3	f4
-1	1	1	first
-1	1	2	second
-1	1	3	third
-1	1	4	fourth
-1	1	5	fifth
-1	1	6	sixth
-
-** Do updates master **
-
-update t31 set f5=555555555555555 where f3=6;
-update t31 set f2=2 where f3=2;
-update t31 set f1=NULL where f3=1;
-update t31 set f3=NULL, f27=NULL, f35='f35 new value' where f3=3;
-Warnings:
-Warning	1048	Column 'f3' cannot be null
-
-** Delete from Master **
-
-delete from t1;
-delete from t2;
-delete from t3;
-delete from t4;
-delete from t31;
-
-** Check slave status **
-
-select * from t31;
-f1	f2	f3	f4
-show slave status;;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-
-****************************************
-* columns in master at middle of table *
-* Expect: Proper error message         *
-****************************************
-
-** Stop and Reset Slave **
-
-STOP SLAVE;
-RESET SLAVE;
-
-** create table slave side **
-CREATE TABLE t10 (a INT PRIMARY KEY, b BLOB, c CHAR(5)
-) ENGINE='InnoDB';
-
-** Connect to master and create table **
-

-CREATE TABLE t10 (a INT KEY, b BLOB, f DOUBLE DEFAULT '233',
-c CHAR(5), e INT DEFAULT '1')ENGINE='InnoDB';
-RESET MASTER;
-
-*** Start Slave ***
-START SLAVE;
-
-*** Master Data Insert ***
-set @b1 = 'b1b1b1b1';
-set @b1 = concat(@b1,@b1);
-INSERT INTO t10 () VALUES(1,@b1,DEFAULT,'Kyle',DEFAULT),
-(2,@b1,DEFAULT,'JOE',DEFAULT),
-(3,@b1,DEFAULT,'QA',DEFAULT);
-
-********************************************
-*** Expect slave to fail with Error 1523 ***
-********************************************
-
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1535
-Last_Error	Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1535
-Last_SQL_Error	Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
-
-*** Drop t10  ***
-DROP TABLE t10;
-
-*********************************************
-* More columns in master at middle of table *
-* Expect: Proper error message              *
-*********************************************
-
-*** Create t11 on slave  ***
-STOP SLAVE;
-RESET SLAVE;
-CREATE TABLE t11 (a INT PRIMARY KEY, b BLOB, c VARCHAR(254)
-) ENGINE='InnoDB';
-
-*** Create t11 on Master ***
-CREATE TABLE t11 (a INT KEY, b BLOB, f TEXT,
-c CHAR(5) DEFAULT 'test', e INT DEFAULT '1')ENGINE='InnoDB';
-RESET MASTER;
-
-*** Start Slave ***
-START SLAVE;
-
-*** Master Data Insert ***
-set @b1 = 'b1b1b1b1';
-set @b1 = concat(@b1,@b1);
-INSERT INTO t11 () VALUES(1,@b1,'Testing is fun','Kyle',DEFAULT),
-(2,@b1,'Testing is cool','JOE',DEFAULT),
-(3,@b1,DEFAULT,'QA',DEFAULT);
-
-********************************************
-*** Expect slave to fail with Error 1523 ***
-********************************************
-
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1535
-Last_Error	Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1535
-Last_SQL_Error	Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
-
-*** Drop t11  ***
-DROP TABLE t11;
-
-*********************************************
-* More columns in master at middle of table *
-* Expect: This one should pass blob-text    *
-*********************************************
-
-*** Create t12 on slave  ***
-STOP SLAVE;
-RESET SLAVE;
-CREATE TABLE t12 (a INT PRIMARY KEY, b BLOB, c BLOB
-) ENGINE='InnoDB';
-
-*** Create t12 on Master ***
-CREATE TABLE t12 (a INT KEY, b BLOB, f TEXT,
-c CHAR(5) DEFAULT 'test', e INT DEFAULT '1')ENGINE='InnoDB';
-RESET MASTER;
-
-*** Start Slave ***
-START SLAVE;
-
-*** Master Data Insert ***
-set @b1 = 'b1b1b1b1';
-set @b1 = concat(@b1,@b1);
-INSERT INTO t12 () VALUES(1,@b1,'Kyle',DEFAULT,DEFAULT),
-(2,@b1,'JOE',DEFAULT,DEFAULT),
-(3,@b1,'QA',DEFAULT,DEFAULT);
-
-SELECT a,hex(b),f,c,e FROM t12 ORDER BY a;
-a	hex(b)	f	c	e
-1	62316231623162316231623162316231	Kyle	test	1
-2	62316231623162316231623162316231	JOE	test	1
-3	62316231623162316231623162316231	QA	test	1
-
-*** Select on Slave ***
-SELECT a,hex(b),c FROM t12 ORDER BY a;
-a	hex(b)	c
-1	62316231623162316231623162316231	Kyle
-2	62316231623162316231623162316231	JOE
-3	62316231623162316231623162316231	QA
-
-*** Drop t12  ***
-DROP TABLE t12;
-
-****************************************************
-* - Alter Master adding columns at middle of table *
-*   Expect: columns added                          *
-****************************************************
-
-
-*** Create t14 on slave  ***
-STOP SLAVE;
-RESET SLAVE;
-CREATE TABLE t14 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
-) ENGINE='InnoDB';
-
-*** Create t14 on Master ***
-CREATE TABLE t14 (c1 INT KEY, c4 BLOB, c5 CHAR(5),
-c6 INT DEFAULT '1',
-c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
-)ENGINE='InnoDB';
-RESET MASTER;
-
-*** Start Slave ***
-START SLAVE;
-
-*** Master Data Insert ***
-ALTER TABLE t14 ADD COLUMN c2 DECIMAL(8,2) AFTER c1;
-ALTER TABLE t14 ADD COLUMN c3 TEXT AFTER c2;
-
-set @b1 = 'b1b1b1b1';
-set @b1 = concat(@b1,@b1);
-INSERT INTO t14 () VALUES(1,1.00,'Replication Testing Extra Col',@b1,'Kyle',DEFAULT,DEFAULT),
-(2,2.00,'This Test Should work',@b1,'JOE',DEFAULT,DEFAULT),
-(3,3.00,'If is does not, I will open a bug',@b1,'QA',DEFAULT,DEFAULT);
-
-SELECT c1,c2,c3,hex(c4),c5,c6,c7 FROM t14 ORDER BY c1;
-c1	c2	c3	hex(c4)	c5	c6	c7
-1	1.00	Replication Testing Extra Col	62316231623162316231623162316231	Kyle	1	CURRENT_TIMESTAMP
-2	2.00	This Test Should work	62316231623162316231623162316231	JOE	1	CURRENT_TIMESTAMP
-3	3.00	If is does not, I will open a bug	62316231623162316231623162316231	QA	1	CURRENT_TIMESTAMP
-
-*** Select on Slave ****
-SELECT c1,c2,c3,hex(c4),c5 FROM t14 ORDER BY c1;
-c1	c2	c3	hex(c4)	c5
-1	1.00	Replication Testing Extra Col	62316231623162316231623162316231	Kyle
-2	2.00	This Test Should work	62316231623162316231623162316231	JOE
-3	3.00	If is does not, I will open a bug	62316231623162316231623162316231	QA
-
-****************************************************
-* - Alter Master Dropping columns from the middle. *
-*   Expect: columns dropped                        *
-****************************************************
-
-*** connect to master and drop columns ***
-ALTER TABLE t14 DROP COLUMN c2;
-ALTER TABLE t14 DROP COLUMN c7;
-
-*** Select from Master ***
-SELECT c1,c3,hex(c4),c5,c6 FROM t14 ORDER BY c1;
-c1	c3	hex(c4)	c5	c6
-1	Replication Testing Extra Col	62316231623162316231623162316231	Kyle	1
-2	This Test Should work	62316231623162316231623162316231	JOE	1
-3	If is does not, I will open a bug	62316231623162316231623162316231	QA	1
-
-************
-* Bug30415 *
-************
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1091
-Last_Error	Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7'
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1091
-Last_SQL_Error	Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7'
-STOP SLAVE;
-RESET SLAVE;
-
-*** Drop t14  ***
-DROP TABLE t14;
-DROP TABLE t14;
-RESET MASTER;
-START SLAVE;
-
-*************************************************
-* - Alter Master adding columns at end of table *
-*   Expect: Error 1054                          *
-*************************************************
-
-*** Create t15 on slave  ***
-STOP SLAVE;
-RESET SLAVE;
-CREATE TABLE t15 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
-) ENGINE='InnoDB';
-
-*** Create t15 on Master ***
-CREATE TABLE t15 (c1 INT KEY, c4 BLOB, c5 CHAR(5),
-c6 INT DEFAULT '1',
-c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
-)ENGINE='InnoDB';
-RESET MASTER;
-
-*** Start Slave ***
-START SLAVE;
-
-*** Master Data Insert ***
-ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7;
-set @b1 = 'b1b1b1b1';
-set @b1 = concat(@b1,@b1);
-INSERT INTO t15 () VALUES(1,@b1,'Kyle',DEFAULT,DEFAULT,3.00),
-(2,@b1,'JOE',DEFAULT,DEFAULT,3.00),
-(3,@b1,'QA',DEFAULT,DEFAULT,3.00);
-SELECT c1,hex(c4),c5,c6,c7,c2 FROM t15 ORDER BY c1;
-c1	hex(c4)	c5	c6	c7	c2
-1	62316231623162316231623162316231	Kyle	1	CURRENT_TIMESTAMP	3.00
-2	62316231623162316231623162316231	JOE	1	CURRENT_TIMESTAMP	3.00
-3	62316231623162316231623162316231	QA	1	CURRENT_TIMESTAMP	3.00
-
-********************************************
-*** Expect slave to fail with Error 1054 ***
-********************************************
-
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1054
-Last_Error	Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7'
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1054
-Last_SQL_Error	Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7'
-STOP SLAVE;
-RESET SLAVE;
-
-*** Drop t15  ***
-DROP TABLE t15;
-DROP TABLE t15;
-RESET MASTER;
-START SLAVE;

-
-************************************************
-* - Create index on Master column not on slave *
-*   Expect:Warning                             *
-************************************************
-
-*** Create t16 on slave  ***
-STOP SLAVE;
-RESET SLAVE;
-CREATE TABLE t16 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
-) ENGINE='InnoDB';
-
-*** Create t16 on Master ***
-CREATE TABLE t16 (c1 INT KEY, c4 BLOB, c5 CHAR(5),
-c6 INT DEFAULT '1',
-c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
-)ENGINE='InnoDB';
-RESET MASTER;
-
-*** Start Slave ***
-START SLAVE;
-
-*** Master Create Index and Data Insert ***
-CREATE INDEX part_of_c6 ON t16 (c6);
-set @b1 = 'b1b1b1b1';
-set @b1 = concat(@b1,@b1);
-INSERT INTO t16 () VALUES(1,@b1,'Kyle',DEFAULT,DEFAULT),
-(2,@b1,'JOE',2,DEFAULT),
-(3,@b1,'QA',3,DEFAULT);
-SELECT c1,hex(c4),c5,c6,c7 FROM t16 ORDER BY c1;
-c1	hex(c4)	c5	c6	c7
-1	62316231623162316231623162316231	Kyle	1	CURRENT_TIMESTAMP
-2	62316231623162316231623162316231	JOE	2	CURRENT_TIMESTAMP
-3	62316231623162316231623162316231	QA	3	CURRENT_TIMESTAMP
-
-*****************
-*** BUG 30434 ***
-*****************
-
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1072
-Last_Error	Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)'
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1072
-Last_SQL_Error	Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)'
-STOP SLAVE;
-RESET SLAVE;
-
-*** Drop t16  ***
-DROP TABLE t16;
-DROP TABLE t16;
-RESET MASTER;
-START SLAVE;
-
-*****************************************************
-* - Delete rows using column on Master not on slave *
-*   Expect: Rows Deleted                            *
-*****************************************************
-
-*** Create t17 on slave  ***
-STOP SLAVE;
-RESET SLAVE;
-CREATE TABLE t17 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
-) ENGINE='InnoDB';
-
-*** Create t17 on Master ***
-CREATE TABLE t17 (c1 INT KEY, c4 BLOB, c5 CHAR(5),
-c6 INT DEFAULT '1',
-c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
-)ENGINE='InnoDB';
-RESET MASTER;
-
-*** Start Slave ***
-START SLAVE;
-
-*** Master Data Insert ***
-set @b1 = 'b1b1b1b1';
-set @b1 = concat(@b1,@b1);
-INSERT INTO t17 () VALUES(1,@b1,'Kyle',DEFAULT,DEFAULT),
-(2,@b1,'JOE',2,DEFAULT),
-(3,@b1,'QA',3,DEFAULT);
-SELECT c1,hex(c4),c5,c6,c7 FROM t17 ORDER BY c1;
-c1	hex(c4)	c5	c6	c7
-1	62316231623162316231623162316231	Kyle	1	CURRENT_TIMESTAMP
-2	62316231623162316231623162316231	JOE	2	CURRENT_TIMESTAMP
-3	62316231623162316231623162316231	QA	3	CURRENT_TIMESTAMP
-
-** Select * from Slave **
-SELECT c1,hex(c4),c5 FROM t17 ORDER BY c1;
-c1	hex(c4)	c5
-1	62316231623162316231623162316231	Kyle
-2	62316231623162316231623162316231	JOE
-3	62316231623162316231623162316231	QA
-
-** Delete from master **
-DELETE FROM t17 WHERE c6 = 3;
-SELECT c1,hex(c4),c5,c6,c7 FROM t17 ORDER BY c1;
-c1	hex(c4)	c5	c6	c7
-1	62316231623162316231623162316231	Kyle	1	CURRENT_TIMESTAMP
-2	62316231623162316231623162316231	JOE	2	CURRENT_TIMESTAMP
-
-** Check slave **
-SELECT c1,hex(c4),c5 FROM t17 ORDER BY c1;
-c1	hex(c4)	c5
-1	62316231623162316231623162316231	Kyle
-2	62316231623162316231623162316231	JOE
-DROP TABLE t17;
-
-
-*****************************************************
-* - Update row using column on Master not on slave *
-*   Expect: Rows updated                           *
-*****************************************************
-
-** Bug30674 **
-
-*** Create t18 on slave  ***
-
-STOP SLAVE;
-RESET SLAVE;
-CREATE TABLE t18 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
-) ENGINE='InnoDB';
-
-*** Create t18 on Master ***
-CREATE TABLE t18 (c1 INT KEY, c4 BLOB, c5 CHAR(5),
-c6 INT DEFAULT '1',
-c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
-)ENGINE='InnoDB';
-RESET MASTER;
-
-*** Start Slave ***
-START SLAVE;
-
-*** Master Data Insert ***
-set @b1 = 'b1b1b1b1';
-set @b1 = concat(@b1,@b1);
-INSERT INTO t18 () VALUES(1,@b1,'Kyle',DEFAULT,DEFAULT),
-(2,@b1,'JOE',2,DEFAULT),
-(3,@b1,'QA',3,DEFAULT);
-SELECT c1,hex(c4),c5,c6,c7 FROM t18 ORDER BY c1;
-c1	hex(c4)	c5	c6	c7
-1	62316231623162316231623162316231	Kyle	1	CURRENT_TIMESTAMP
-2	62316231623162316231623162316231	JOE	2	CURRENT_TIMESTAMP
-3	62316231623162316231623162316231	QA	3	CURRENT_TIMESTAMP
-
-** Select * from Slave **
-SELECT c1,hex(c4),c5 FROM t18 ORDER BY c1;
-c1	hex(c4)	c5
-1	62316231623162316231623162316231	Kyle
-2	62316231623162316231623162316231	JOE
-3	62316231623162316231623162316231	QA
-
-** update from master **
-UPDATE t18 SET c5 = 'TEST' WHERE c6 = 3;
-SELECT c1,hex(c4),c5,c6,c7 FROM t18 ORDER BY c1;
-c1	hex(c4)	c5	c6	c7
-1	62316231623162316231623162316231	Kyle	1	CURRENT_TIMESTAMP
-2	62316231623162316231623162316231	JOE	2	CURRENT_TIMESTAMP
-3	62316231623162316231623162316231	TEST	3	CURRENT_TIMESTAMP
-
-** Check slave **
-SELECT c1,hex(c4),c5 FROM t18 ORDER BY c1;
-c1	hex(c4)	c5
-1	62316231623162316231623162316231	Kyle
-2	62316231623162316231623162316231	JOE
-3	62316231623162316231623162316231	TEST
-DROP TABLE t18;
-
-
-*****************************************************
-* - Insert UUID  column on Master not on slave *
-*   Expect: Rows inserted                      *
-*****************************************************
-
-*** Create t5 on slave  ***
-STOP SLAVE;
-RESET SLAVE;
-CREATE TABLE t5 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
-) ENGINE='InnoDB';
-
-*** Create t5 on Master ***
-CREATE TABLE t5 (c1 INT KEY, c4 BLOB, c5 CHAR(5),
-c6 LONG, 
-c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
-)ENGINE='InnoDB';
-RESET MASTER;
-
-*** Start Slave ***
-START SLAVE;
-
-*** Master Data Insert ***
-set @b1 = 'b1b1b1b1';
-INSERT INTO t5 () VALUES(1,@b1,'Kyle',UUID(),DEFAULT),
-(2,@b1,'JOE',UUID(),DEFAULT),
-(3,@b1,'QA',UUID(),DEFAULT);
-SELECT c1,hex(c4),c5,c6,c7 FROM t5 ORDER BY c1;
-c1	hex(c4)	c5	c6	c7
-1	6231623162316231	Kyle	UUID	TIME
-2	6231623162316231	JOE	UUID	TIME
-3	6231623162316231	QA	UUID	TIME
-
-** Select * from Slave **
-SELECT c1,hex(c4),c5 FROM t5 ORDER BY c1;
-c1	hex(c4)	c5
-1	6231623162316231	Kyle
-2	6231623162316231	JOE
-3	6231623162316231	QA
-DROP TABLE t5;
-
-set binlog_format=mixed;
-
-***********************************************************
-***********************************************************
-***************** Start of Testing ************************
-***********************************************************
-***********************************************************
-* This test format == binlog_format	MIXED and engine == 'InnoDB'
-***********************************************************
-***********************************************************
-
-***** Testing more columns on the Master *****
-
-CREATE TABLE t1 (f1 INT, f2 INT, f3 INT PRIMARY KEY, f4 CHAR(20),
-/* extra */
-f5 FLOAT DEFAULT '2.00', 
-f6 CHAR(4) DEFAULT 'TEST',
-f7 INT DEFAULT '0',
-f8 TEXT,
-f9 LONGBLOB,
-f10 BIT(63),
-f11 VARBINARY(64))ENGINE='InnoDB';
-
-* Alter Table on Slave and drop columns f5 through f11 *
-
-alter table t1 drop f5, drop f6, drop f7, drop f8, drop f9, drop f10, drop f11;
-
-* Insert data in Master then update and delete some rows*
-
-* Select count and 20 rows from Master *
-
-SELECT COUNT(*) FROM t1;
-COUNT(*)
-40
-
-SELECT f1,f2,f3,f4,f5,f6,f7,f8,f9,
-hex(f10),hex(f11) FROM t1 ORDER BY f3 LIMIT 20;
-f1	f2	f3	f4	f5	f6	f7	f8	f9	hex(f10)	hex(f11)
-2	2	2	second	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-3	3	3	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-5	5	5	second	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-6	6	6	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-8	8	8	second	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-9	9	9	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-11	11	11	second	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-12	12	12	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-14	14	14	second	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-15	15	15	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-17	17	17	second	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-18	18	18	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-20	20	20	second	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-21	21	21	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-23	23	23	second	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-24	24	24	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-26	26	26	second	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-27	27	27	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-29	29	29	second	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-30	30	30	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-
-* Select count and 20 rows from Slave *
-
-SELECT COUNT(*) FROM t1;
-COUNT(*)
-40
-
-SELECT * FROM t1 ORDER BY f3 LIMIT 20;
-f1	f2	f3	f4
-2	2	2	second
-3	3	3	next
-5	5	5	second
-6	6	6	next
-8	8	8	second
-9	9	9	next
-11	11	11	second
-12	12	12	next
-14	14	14	second
-15	15	15	next
-17	17	17	second
-18	18	18	next
-20	20	20	second
-21	21	21	next
-23	23	23	second
-24	24	24	next
-26	26	26	second
-27	27	27	next
-29	29	29	second
-30	30	30	next
-
-* Show Slave Status *
-
-show slave status;;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-
-
-***** Testing Altering table def scenario *****
-
-CREATE TABLE t2 (f1 INT, f2 INT, f3 INT PRIMARY KEY, f4 CHAR(20),
-/* extra */
-f5 DOUBLE DEFAULT '2.00', 
-f6 ENUM('a', 'b', 'c') default 'a',
-f7 DECIMAL(17,9) default '1000.00',
-f8 MEDIUMBLOB,
-f9 NUMERIC(6,4) default '2000.00',
-f10 VARCHAR(1024),
-f11 BINARY(20) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',
-f12 SET('a', 'b', 'c') default 'b')
-ENGINE='InnoDB';
-Warnings:
-Warning	1264	Out of range value for column 'f9' at row 1
-
-CREATE TABLE t3 (f1 INT, f2 INT, f3 INT PRIMARY KEY, f4 CHAR(20),
-/* extra */
-f5 DOUBLE DEFAULT '2.00', 
-f6 ENUM('a', 'b', 'c') default 'a',
-f8 MEDIUMBLOB,
-f10 VARCHAR(1024),
-f11 BINARY(20) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',
-f12 SET('a', 'b', 'c') default 'b')
-ENGINE='InnoDB';
-
-CREATE TABLE t4 (f1 INT, f2 INT, f3 INT PRIMARY KEY, f4 CHAR(20),
-/* extra */
-f5 DOUBLE DEFAULT '2.00', 
-f6 DECIMAL(17,9) default '1000.00',
-f7 MEDIUMBLOB,
-f8 NUMERIC(6,4) default '2000.00',
-f9 VARCHAR(1024),
-f10 BINARY(20) not null default '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',
-f11 CHAR(255))
-ENGINE='InnoDB';
-Warnings:
-Warning	1264	Out of range value for column 'f8' at row 1
-
-CREATE TABLE t31 (f1 INT, f2 INT, f3 INT PRIMARY KEY, f4 CHAR(20),
-/* extra */
-f5  BIGINT,
-f6  BLOB,
-f7  DATE,
-f8  DATETIME,
-f9  FLOAT,
-f10 INT,
-f11 LONGBLOB,
-f12 LONGTEXT,
-f13 MEDIUMBLOB,
-f14 MEDIUMINT,
-f15 MEDIUMTEXT,
-f16 REAL,
-f17 SMALLINT,
-f18 TEXT,
-f19 TIME,
-f20 TIMESTAMP,
-f21 TINYBLOB,
-f22 TINYINT,
-f23 TINYTEXT,
-f24 YEAR,
-f25 BINARY(255),
-f26 BIT(64),
-f27 CHAR(255),
-f28 DECIMAL(30,7),
-f29 DOUBLE,
-f30 ENUM ('a','b', 'c') default 'a',
-f31 FLOAT,
-f32 NUMERIC(17,9),
-f33 SET ('a', 'b', 'c') default 'b',
-f34 VARBINARY(1025),
-f35 VARCHAR(257)       
-) ENGINE='InnoDB';
-
-** Alter tables on slave and drop columns **
-
-alter table t2 drop f5, drop f6, drop f7, drop f8, drop f9, drop f10, drop f11, drop
-f12;
-alter table t3 drop f5, drop f6, drop f8, drop f10, drop f11, drop f12;
-alter table t4 drop f5, drop f6, drop f7, drop f8, drop f9, drop f10, drop f11;
-alter table t31 
-drop f5, drop f6, drop f7, drop f8, drop f9, drop f10, drop f11,
-drop f12, drop f13, drop f14, drop f15, drop f16, drop f17, drop f18,
-drop f19, drop f20, drop f21, drop f22, drop f23, drop f24, drop f25,
-drop f26, drop f27, drop f28, drop f29, drop f30, drop f31, drop f32,
-drop f33, drop f34, drop f35;
-
-** Insert Data into Master **
-INSERT into t2 set f1=1, f2=1, f3=1, f4='first', f8='f8: medium size blob', f10='f10:
-some var char';
-INSERT into t2 values (2, 2, 2, 'second',
-2.0, 'b', 2000.0002, 'f8: medium size blob', 2000, 'f10: some var char',
-'01234567', 'c'),
-(3, 3, 3, 'third',
-3.0, 'b', 3000.0003, 'f8: medium size blob', 3000, 'f10: some var char',
-'01234567', 'c');
-Warnings:
-Warning	1264	Out of range value for column 'f9' at row 1
-Warning	1264	Out of range value for column 'f9' at row 2
-INSERT into t3 set f1=1, f2=1, f3=1, f4='first', f10='f10: some var char';
-INSERT into t4 set f1=1, f2=1, f3=1, f4='first', f7='f7: medium size blob', f10='f10:
-binary data';
-INSERT into t31 set f1=1, f2=1, f3=1, f4='first';
-INSERT into t31 set f1=1, f2=1, f3=2, f4='second',
-f9=2.2,  f10='seven samurai', f28=222.222, f35='222';
-Warnings:
-Warning	1366	Incorrect integer value: 'seven samurai' for column 'f10' at row 1
-INSERT into t31 values (1, 1, 3, 'third',
-/* f5  BIGINT,  */            333333333333333333333333,
-/* f6  BLOB,  */              '3333333333333333333333',
-/* f7  DATE,  */              '2007-07-18',
-/* f8  DATETIME,  */          "2007-07-18",
-/* f9  FLOAT,  */             3.33333333,
-/* f10 INT,  */               333333333,
-/* f11 LONGBLOB,  */          '3333333333333333333',
-/* f12 LONGTEXT,  */          '3333333333333333333',
-/* f13 MEDIUMBLOB,  */        '3333333333333333333',
-/* f14 MEDIUMINT,  */         33,
-/* f15 MEDIUMTEXT,  */        3.3,
-/* f16 REAL,  */              3.3,
-/* f17 SMALLINT,  */          3,
-/* f18 TEXT,  */              '33',
-/* f19 TIME,  */              '2:59:58.999',
-/* f20 TIMESTAMP,  */         20000303000000,
-/* f21 TINYBLOB,  */          '3333',
-/* f22 TINYINT,  */           3,
-/* f23 TINYTEXT,  */          '3',
-/* f24 YEAR,  */              3000,
-/* f25 BINARY(255),  */       'three_33333',
-/* f26 BIT(64),  */           b'011', 
-/* f27 CHAR(255),  */         'three',
-/* f28 DECIMAL(30,7),  */     3.333,
-/* f29 DOUBLE,  */            3.333333333333333333333333333,
-/* f30 ENUM ('a','b','c')*/   'c',
-/* f31 FLOAT,  */             3.0,
-/* f32 NUMERIC(17,9),  */     3.3333,
-/* f33 SET ('a','b','c'),*/   'c',
-/*f34 VARBINARY(1025),*/      '3333 minus 3',
-/*f35 VARCHAR(257),*/         'three times three'
-      );
-Warnings:
-Warning	1264	Out of range value for column 'f5' at row 1
-Warning	1264	Out of range value for column 'f24' at row 1
-INSERT into t31 values (1, 1, 4, 'fourth',
-/* f5  BIGINT,  */            333333333333333333333333,
-/* f6  BLOB,  */              '3333333333333333333333',
-/* f7  DATE,  */              '2007-07-18',
-/* f8  DATETIME,  */          "2007-07-18",
-/* f9  FLOAT,  */             3.33333333,
-/* f10 INT,  */               333333333,
-/* f11 LONGBLOB,  */          '3333333333333333333',
-/* f12 LONGTEXT,  */          '3333333333333333333',
-/* f13 MEDIUMBLOB,  */        '3333333333333333333',
-/* f14 MEDIUMINT,  */         33,
-/* f15 MEDIUMTEXT,  */        3.3,
-/* f16 REAL,  */              3.3,
-/* f17 SMALLINT,  */          3,
-/* f18 TEXT,  */              '33',
-/* f19 TIME,  */              '2:59:58.999',
-/* f20 TIMESTAMP,  */         20000303000000,
-/* f21 TINYBLOB,  */          '3333',
-/* f22 TINYINT,  */           3,
-/* f23 TINYTEXT,  */          '3',
-/* f24 YEAR,  */              3000,
-/* f25 BINARY(255),  */       'three_33333',
-/* f26 BIT(64),  */           b'011',
-/* f27 CHAR(255),  */         'three',
-/* f28 DECIMAL(30,7),  */     3.333,
-/* f29 DOUBLE,  */            3.333333333333333333333333333,
-/* f30 ENUM ('a','b','c')*/   'c',
-/* f31 FLOAT,  */             3.0,
-/* f32 NUMERIC(17,9),  */     3.3333,
-/* f33 SET ('a','b','c'),*/   'c',
-/*f34 VARBINARY(1025),*/      '3333 minus 3',
-/*f35 VARCHAR(257),*/         'three times three'
-       ),
-(1, 1, 5, 'fifth',
-/* f5  BIGINT,  */            333333333333333333333333,
-/* f6  BLOB,  */              '3333333333333333333333',
-/* f7  DATE,  */              '2007-07-18',
-/* f8  DATETIME,  */          "2007-07-18",
-/* f9  FLOAT,  */             3.33333333,
-/* f10 INT,  */               333333333,
-/* f11 LONGBLOB,  */          '3333333333333333333',
-/* f12 LONGTEXT,  */          '3333333333333333333',
-/* f13 MEDIUMBLOB,  */        '3333333333333333333',
-/* f14 MEDIUMINT,  */         33,
-/* f15 MEDIUMTEXT,  */        3.3,
-/* f16 REAL,  */              3.3,
-/* f17 SMALLINT,  */          3,
-/* f18 TEXT,  */              '33',
-/* f19 TIME,  */              '2:59:58.999',
-/* f20 TIMESTAMP,  */         20000303000000,
-/* f21 TINYBLOB,  */          '3333',
-/* f22 TINYINT,  */           3,
-/* f23 TINYTEXT,  */          '3',
-/* f24 YEAR,  */              3000,
-/* f25 BINARY(255),  */       'three_33333',
-/* f26 BIT(64),  */           b'011',
-/* f27 CHAR(255),  */         'three',
-/* f28 DECIMAL(30,7),  */     3.333,
-/* f29 DOUBLE,  */            3.333333333333333333333333333,
-/* f30 ENUM ('a','b','c')*/   'c',
-/* f31 FLOAT,  */             3.0,
-/* f32 NUMERIC(17,9),  */     3.3333,
-/* f33 SET ('a','b','c'),*/   'c',
-/*f34 VARBINARY(1025),*/      '3333 minus 3',
-/*f35 VARCHAR(257),*/         'three times three'
-       ),
-(1, 1, 6, 'sixth',
-/* f5  BIGINT,  */            NULL,
-/* f6  BLOB,  */              '3333333333333333333333',
-/* f7  DATE,  */              '2007-07-18',
-/* f8  DATETIME,  */          "2007-07-18",
-/* f9  FLOAT,  */             3.33333333,
-/* f10 INT,  */               333333333,
-/* f11 LONGBLOB,  */          '3333333333333333333',
-/* f12 LONGTEXT,  */          '3333333333333333333',
-/* f13 MEDIUMBLOB,  */        '3333333333333333333',
-/* f14 MEDIUMINT,  */         33,
-/* f15 MEDIUMTEXT,  */        3.3,
-/* f16 REAL,  */              3.3,
-/* f17 SMALLINT,  */          3,
-/* f18 TEXT,  */              '33',
-/* f19 TIME,  */              '2:59:58.999',
-/* f20 TIMESTAMP,  */         20000303000000,
-/* f21 TINYBLOB,  */          '3333',
-/* f22 TINYINT,  */           3,
-/* f23 TINYTEXT,  */          '3',
-/* f24 YEAR,  */              3000,
-/* f25 BINARY(255),  */       'three_33333',
-/* f26 BIT(64),  */           b'011',
-/* f27 CHAR(255),  */         'three',
-/* f28 DECIMAL(30,7),  */     3.333,
-/* f29 DOUBLE,  */            3.333333333333333333333333333,
-/* f30 ENUM ('a','b','c')*/   'c',
-/* f31 FLOAT,  */             3.0,
-/* f32 NUMERIC(17,9),  */     3.3333,
-/* f33 SET ('a','b','c'),*/   'c',
-/*f34 VARBINARY(1025),*/      '3333 minus 3',
-/*f35 VARCHAR(257),*/         NULL
-);
-Warnings:
-Warning	1264	Out of range value for column 'f5' at row 1
-Warning	1264	Out of range value for column 'f24' at row 1
-Warning	1264	Out of range value for column 'f5' at row 2
-Warning	1264	Out of range value for column 'f24' at row 2
-Warning	1264	Out of range value for column 'f24' at row 3
-
-** Sync slave with master ** 
-** Do selects from tables **
-
-select * from t1 order by f3;
-f1	f2	f3	f4
-2	2	2	second
-3	3	3	next
-5	5	5	second
-6	6	6	next
-8	8	8	second
-9	9	9	next
-11	11	11	second
-12	12	12	next
-14	14	14	second
-15	15	15	next
-17	17	17	second
-18	18	18	next
-20	20	20	second
-21	21	21	next
-23	23	23	second
-24	24	24	next
-26	26	26	second
-27	27	27	next
-29	29	29	second
-30	30	30	next
-31	31	31	second
-32	32	32	second
-33	33	33	second
-34	34	34	second
-35	35	35	second
-36	36	36	second
-37	37	37	second
-38	38	38	second
-39	39	39	second
-40	40	40	second
-41	41	41	second
-42	42	42	second
-43	43	43	second
-44	44	44	second
-45	45	45	second
-46	46	46	second
-47	47	47	second
-48	48	48	second
-49	49	49	second
-50	50	50	second
-select * from t2 order by f1;
-f1	f2	f3	f4
-1	1	1	first
-2	2	2	second
-3	3	3	third
-select * from t3 order by f1;
-f1	f2	f3	f4
-1	1	1	first
-select * from t4 order by f1;
-f1	f2	f3	f4
-1	1	1	first
-select * from t31 order by f3;
-f1	f2	f3	f4
-1	1	1	first
-1	1	2	second
-1	1	3	third
-1	1	4	fourth
-1	1	5	fifth
-1	1	6	sixth
-
-** Do updates master **
-
-update t31 set f5=555555555555555 where f3=6;
-update t31 set f2=2 where f3=2;
-update t31 set f1=NULL where f3=1;
-update t31 set f3=NULL, f27=NULL, f35='f35 new value' where f3=3;
-Warnings:
-Warning	1048	Column 'f3' cannot be null
-
-** Delete from Master **
-
-delete from t1;
-delete from t2;
-delete from t3;
-delete from t4;
-delete from t31;
-
-** Check slave status **
-
-select * from t31;
-f1	f2	f3	f4
-show slave status;;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-
-****************************************
-* columns in master at middle of table *
-* Expect: Proper error message         *
-****************************************
-
-** Stop and Reset Slave **
-
-STOP SLAVE;
-RESET SLAVE;
-
-** create table slave side **
-CREATE TABLE t10 (a INT PRIMARY KEY, b BLOB, c CHAR(5)
-) ENGINE='InnoDB';
-
-** Connect to master and create table **
-
-CREATE TABLE t10 (a INT KEY, b BLOB, f DOUBLE DEFAULT '233',
-c CHAR(5), e INT DEFAULT '1')ENGINE='InnoDB';
-RESET MASTER;
-
-*** Start Slave ***
-START SLAVE;
-
-*** Master Data Insert ***
-set @b1 = 'b1b1b1b1';
-set @b1 = concat(@b1,@b1);
-INSERT INTO t10 () VALUES(1,@b1,DEFAULT,'Kyle',DEFAULT),
-(2,@b1,DEFAULT,'JOE',DEFAULT),
-(3,@b1,DEFAULT,'QA',DEFAULT);
-
-********************************************
-*** Expect slave to fail with Error 1523 ***
-********************************************
-
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1535
-Last_Error	Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1535
-Last_SQL_Error	Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
-
-*** Drop t10  ***
-DROP TABLE t10;
-
-*********************************************
-* More columns in master at middle of table *
-* Expect: Proper error message              *
-*********************************************
-
-*** Create t11 on slave  ***
-STOP SLAVE;
-RESET SLAVE;
-CREATE TABLE t11 (a INT PRIMARY KEY, b BLOB, c VARCHAR(254)
-) ENGINE='InnoDB';
-
-*** Create t11 on Master ***
-CREATE TABLE t11 (a INT KEY, b BLOB, f TEXT,
-c CHAR(5) DEFAULT 'test', e INT DEFAULT '1')ENGINE='InnoDB';
-RESET MASTER;
-
-*** Start Slave ***
-START SLAVE;
-
-*** Master Data Insert ***
-set @b1 = 'b1b1b1b1';
-set @b1 = concat(@b1,@b1);
-INSERT INTO t11 () VALUES(1,@b1,'Testing is fun','Kyle',DEFAULT),
-(2,@b1,'Testing is cool','JOE',DEFAULT),
-(3,@b1,DEFAULT,'QA',DEFAULT);
-
-********************************************
-*** Expect slave to fail with Error 1523 ***
-********************************************
-
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1535
-Last_Error	Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1535
-Last_SQL_Error	Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
-
-*** Drop t11  ***
-DROP TABLE t11;
-
-*********************************************
-* More columns in master at middle of table *
-* Expect: This one should pass blob-text    *
-*********************************************
-
-*** Create t12 on slave  ***
-STOP SLAVE;
-RESET SLAVE;
-CREATE TABLE t12 (a INT PRIMARY KEY, b BLOB, c BLOB
-) ENGINE='InnoDB';
-
-*** Create t12 on Master ***
-CREATE TABLE t12 (a INT KEY, b BLOB, f TEXT,
-c CHAR(5) DEFAULT 'test', e INT DEFAULT '1')ENGINE='InnoDB';
-RESET MASTER;
-
-*** Start Slave ***
-START SLAVE;
-
-*** Master Data Insert ***
-set @b1 = 'b1b1b1b1';
-set @b1 = concat(@b1,@b1);
-INSERT INTO t12 () VALUES(1,@b1,'Kyle',DEFAULT,DEFAULT),
-(2,@b1,'JOE',DEFAULT,DEFAULT),
-(3,@b1,'QA',DEFAULT,DEFAULT);
-
-SELECT a,hex(b),f,c,e FROM t12 ORDER BY a;
-a	hex(b)	f	c	e
-1	62316231623162316231623162316231	Kyle	test	1

-2	62316231623162316231623162316231	JOE	test	1
-3	62316231623162316231623162316231	QA	test	1
-
-*** Select on Slave ***
-SELECT a,hex(b),c FROM t12 ORDER BY a;
-a	hex(b)	c
-1	62316231623162316231623162316231	Kyle
-2	62316231623162316231623162316231	JOE
-3	62316231623162316231623162316231	QA
-
-*** Drop t12  ***
-DROP TABLE t12;
-
-****************************************************
-* - Alter Master adding columns at middle of table *
-*   Expect: columns added                          *
-****************************************************
-
-
-*** Create t14 on slave  ***
-STOP SLAVE;
-RESET SLAVE;
-CREATE TABLE t14 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
-) ENGINE='InnoDB';
-
-*** Create t14 on Master ***
-CREATE TABLE t14 (c1 INT KEY, c4 BLOB, c5 CHAR(5),
-c6 INT DEFAULT '1',
-c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
-)ENGINE='InnoDB';
-RESET MASTER;
-
-*** Start Slave ***
-START SLAVE;
-
-*** Master Data Insert ***
-ALTER TABLE t14 ADD COLUMN c2 DECIMAL(8,2) AFTER c1;
-ALTER TABLE t14 ADD COLUMN c3 TEXT AFTER c2;
-
-set @b1 = 'b1b1b1b1';
-set @b1 = concat(@b1,@b1);
-INSERT INTO t14 () VALUES(1,1.00,'Replication Testing Extra Col',@b1,'Kyle',DEFAULT,DEFAULT),
-(2,2.00,'This Test Should work',@b1,'JOE',DEFAULT,DEFAULT),
-(3,3.00,'If is does not, I will open a bug',@b1,'QA',DEFAULT,DEFAULT);
-
-SELECT c1,c2,c3,hex(c4),c5,c6,c7 FROM t14 ORDER BY c1;
-c1	c2	c3	hex(c4)	c5	c6	c7
-1	1.00	Replication Testing Extra Col	62316231623162316231623162316231	Kyle	1	CURRENT_TIMESTAMP
-2	2.00	This Test Should work	62316231623162316231623162316231	JOE	1	CURRENT_TIMESTAMP
-3	3.00	If is does not, I will open a bug	62316231623162316231623162316231	QA	1	CURRENT_TIMESTAMP
-
-*** Select on Slave ****
-SELECT c1,c2,c3,hex(c4),c5 FROM t14 ORDER BY c1;
-c1	c2	c3	hex(c4)	c5
-1	1.00	Replication Testing Extra Col	62316231623162316231623162316231	Kyle
-2	2.00	This Test Should work	62316231623162316231623162316231	JOE
-3	3.00	If is does not, I will open a bug	62316231623162316231623162316231	QA
-
-****************************************************
-* - Alter Master Dropping columns from the middle. *
-*   Expect: columns dropped                        *
-****************************************************
-
-*** connect to master and drop columns ***
-ALTER TABLE t14 DROP COLUMN c2;
-ALTER TABLE t14 DROP COLUMN c7;
-
-*** Select from Master ***
-SELECT c1,c3,hex(c4),c5,c6 FROM t14 ORDER BY c1;
-c1	c3	hex(c4)	c5	c6
-1	Replication Testing Extra Col	62316231623162316231623162316231	Kyle	1
-2	This Test Should work	62316231623162316231623162316231	JOE	1
-3	If is does not, I will open a bug	62316231623162316231623162316231	QA	1
-
-************
-* Bug30415 *
-************
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1091
-Last_Error	Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7'
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1091
-Last_SQL_Error	Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7'
-STOP SLAVE;
-RESET SLAVE;
-
-*** Drop t14  ***
-DROP TABLE t14;
-DROP TABLE t14;
-RESET MASTER;
-START SLAVE;
-
-*************************************************
-* - Alter Master adding columns at end of table *
-*   Expect: Error 1054                          *
-*************************************************
-
-*** Create t15 on slave  ***
-STOP SLAVE;
-RESET SLAVE;
-CREATE TABLE t15 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
-) ENGINE='InnoDB';
-
-*** Create t15 on Master ***
-CREATE TABLE t15 (c1 INT KEY, c4 BLOB, c5 CHAR(5),
-c6 INT DEFAULT '1',
-c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
-)ENGINE='InnoDB';
-RESET MASTER;
-
-*** Start Slave ***
-START SLAVE;
-
-*** Master Data Insert ***
-ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7;
-set @b1 = 'b1b1b1b1';
-set @b1 = concat(@b1,@b1);
-INSERT INTO t15 () VALUES(1,@b1,'Kyle',DEFAULT,DEFAULT,3.00),
-(2,@b1,'JOE',DEFAULT,DEFAULT,3.00),
-(3,@b1,'QA',DEFAULT,DEFAULT,3.00);
-SELECT c1,hex(c4),c5,c6,c7,c2 FROM t15 ORDER BY c1;
-c1	hex(c4)	c5	c6	c7	c2
-1	62316231623162316231623162316231	Kyle	1	CURRENT_TIMESTAMP	3.00
-2	62316231623162316231623162316231	JOE	1	CURRENT_TIMESTAMP	3.00
-3	62316231623162316231623162316231	QA	1	CURRENT_TIMESTAMP	3.00
-
-********************************************
-*** Expect slave to fail with Error 1054 ***
-********************************************
-
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1054
-Last_Error	Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7'
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1054
-Last_SQL_Error	Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7'
-STOP SLAVE;
-RESET SLAVE;
-
-*** Drop t15  ***
-DROP TABLE t15;
-DROP TABLE t15;
-RESET MASTER;
-START SLAVE;
-
-************************************************
-* - Create index on Master column not on slave *
-*   Expect:Warning                             *
-************************************************
-
-*** Create t16 on slave  ***
-STOP SLAVE;
-RESET SLAVE;
-CREATE TABLE t16 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
-) ENGINE='InnoDB';
-
-*** Create t16 on Master ***
-CREATE TABLE t16 (c1 INT KEY, c4 BLOB, c5 CHAR(5),
-c6 INT DEFAULT '1',
-c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
-)ENGINE='InnoDB';
-RESET MASTER;
-
-*** Start Slave ***
-START SLAVE;
-
-*** Master Create Index and Data Insert ***
-CREATE INDEX part_of_c6 ON t16 (c6);
-set @b1 = 'b1b1b1b1';
-set @b1 = concat(@b1,@b1);
-INSERT INTO t16 () VALUES(1,@b1,'Kyle',DEFAULT,DEFAULT),
-(2,@b1,'JOE',2,DEFAULT),
-(3,@b1,'QA',3,DEFAULT);
-SELECT c1,hex(c4),c5,c6,c7 FROM t16 ORDER BY c1;
-c1	hex(c4)	c5	c6	c7
-1	62316231623162316231623162316231	Kyle	1	CURRENT_TIMESTAMP
-2	62316231623162316231623162316231	JOE	2	CURRENT_TIMESTAMP
-3	62316231623162316231623162316231	QA	3	CURRENT_TIMESTAMP
-
-*****************
-*** BUG 30434 ***
-*****************
-
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1072
-Last_Error	Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)'
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1072
-Last_SQL_Error	Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)'
-STOP SLAVE;
-RESET SLAVE;
-
-*** Drop t16  ***
-DROP TABLE t16;
-DROP TABLE t16;
-RESET MASTER;
-START SLAVE;
-
-*****************************************************
-* - Delete rows using column on Master not on slave *
-*   Expect: Rows Deleted                            *
-*****************************************************
-
-*** Create t17 on slave  ***
-STOP SLAVE;
-RESET SLAVE;
-CREATE TABLE t17 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
-) ENGINE='InnoDB';
-
-*** Create t17 on Master ***
-CREATE TABLE t17 (c1 INT KEY, c4 BLOB, c5 CHAR(5),
-c6 INT DEFAULT '1',
-c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
-)ENGINE='InnoDB';
-RESET MASTER;
-
-*** Start Slave ***
-START SLAVE;
-
-*** Master Data Insert ***
-set @b1 = 'b1b1b1b1';
-set @b1 = concat(@b1,@b1);
-INSERT INTO t17 () VALUES(1,@b1,'Kyle',DEFAULT,DEFAULT),
-(2,@b1,'JOE',2,DEFAULT),
-(3,@b1,'QA',3,DEFAULT);
-SELECT c1,hex(c4),c5,c6,c7 FROM t17 ORDER BY c1;
-c1	hex(c4)	c5	c6	c7
-1	62316231623162316231623162316231	Kyle	1	CURRENT_TIMESTAMP
-2	62316231623162316231623162316231	JOE	2	CURRENT_TIMESTAMP
-3	62316231623162316231623162316231	QA	3	CURRENT_TIMESTAMP
-
-** Select * from Slave **
-SELECT c1,hex(c4),c5 FROM t17 ORDER BY c1;
-c1	hex(c4)	c5
-1	62316231623162316231623162316231	Kyle
-2	62316231623162316231623162316231	JOE
-3	62316231623162316231623162316231	QA
-
-** Delete from master **
-DELETE FROM t17 WHERE c6 = 3;
-SELECT c1,hex(c4),c5,c6,c7 FROM t17 ORDER BY c1;
-c1	hex(c4)	c5	c6	c7
-1	62316231623162316231623162316231	Kyle	1	CURRENT_TIMESTAMP
-2	62316231623162316231623162316231	JOE	2	CURRENT_TIMESTAMP
-
-** Check slave **
-SELECT c1,hex(c4),c5 FROM t17 ORDER BY c1;
-c1	hex(c4)	c5
-1	62316231623162316231623162316231	Kyle
-2	62316231623162316231623162316231	JOE
-DROP TABLE t17;
-
-
-*****************************************************
-* - Update row using column on Master not on slave *
-*   Expect: Rows updated                           *
-*****************************************************
-
-** Bug30674 **
-
-*** Create t18 on slave  ***
-
-STOP SLAVE;
-RESET SLAVE;
-CREATE TABLE t18 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
-) ENGINE='InnoDB';
-
-*** Create t18 on Master ***
-CREATE TABLE t18 (c1 INT KEY, c4 BLOB, c5 CHAR(5),
-c6 INT DEFAULT '1',
-c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
-)ENGINE='InnoDB';
-RESET MASTER;
-
-*** Start Slave ***
-START SLAVE;
-
-*** Master Data Insert ***
-set @b1 = 'b1b1b1b1';
-set @b1 = concat(@b1,@b1);
-INSERT INTO t18 () VALUES(1,@b1,'Kyle',DEFAULT,DEFAULT),
-(2,@b1,'JOE',2,DEFAULT),
-(3,@b1,'QA',3,DEFAULT);
-SELECT c1,hex(c4),c5,c6,c7 FROM t18 ORDER BY c1;
-c1	hex(c4)	c5	c6	c7
-1	62316231623162316231623162316231	Kyle	1	CURRENT_TIMESTAMP
-2	62316231623162316231623162316231	JOE	2	CURRENT_TIMESTAMP
-3	62316231623162316231623162316231	QA	3	CURRENT_TIMESTAMP
-
-** Select * from Slave **
-SELECT c1,hex(c4),c5 FROM t18 ORDER BY c1;
-c1	hex(c4)	c5
-1	62316231623162316231623162316231	Kyle
-2	62316231623162316231623162316231	JOE
-3	62316231623162316231623162316231	QA
-
-** update from master **
-UPDATE t18 SET c5 = 'TEST' WHERE c6 = 3;
-SELECT c1,hex(c4),c5,c6,c7 FROM t18 ORDER BY c1;
-c1	hex(c4)	c5	c6	c7
-1	62316231623162316231623162316231	Kyle	1	CURRENT_TIMESTAMP
-2	62316231623162316231623162316231	JOE	2	CURRENT_TIMESTAMP
-3	62316231623162316231623162316231	TEST	3	CURRENT_TIMESTAMP
-
-** Check slave **
-SELECT c1,hex(c4),c5 FROM t18 ORDER BY c1;
-c1	hex(c4)	c5
-1	62316231623162316231623162316231	Kyle
-2	62316231623162316231623162316231	JOE
-3	62316231623162316231623162316231	TEST
-DROP TABLE t18;
-
-
-*****************************************************
-* - Insert UUID  column on Master not on slave *
-*   Expect: Rows inserted                      *
-*****************************************************
-
-*** Create t5 on slave  ***
-STOP SLAVE;
-RESET SLAVE;
-CREATE TABLE t5 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
-) ENGINE='InnoDB';
-
-*** Create t5 on Master ***
-CREATE TABLE t5 (c1 INT KEY, c4 BLOB, c5 CHAR(5),
-c6 LONG, 
-c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
-)ENGINE='InnoDB';
-RESET MASTER;
-
-*** Start Slave ***
-START SLAVE;
-
-*** Master Data Insert ***
-set @b1 = 'b1b1b1b1';
-INSERT INTO t5 () VALUES(1,@b1,'Kyle',UUID(),DEFAULT),
-(2,@b1,'JOE',UUID(),DEFAULT),
-(3,@b1,'QA',UUID(),DEFAULT);
-SELECT c1,hex(c4),c5,c6,c7 FROM t5 ORDER BY c1;
-c1	hex(c4)	c5	c6	c7
-1	6231623162316231	Kyle	UUID	TIME
-2	6231623162316231	JOE	UUID	TIME
-3	6231623162316231	QA	UUID	TIME
-
-** Select * from Slave **
-SELECT c1,hex(c4),c5 FROM t5 ORDER BY c1;
-c1	hex(c4)	c5
-1	6231623162316231	Kyle
-2	6231623162316231	JOE
-3	6231623162316231	QA
-DROP TABLE t5;
-

=== modified file 'mysql-test/suite/rpl/r/rpl_extraColmaster_myisam.result'
--- a/mysql-test/suite/rpl/r/rpl_extraColmaster_myisam.result	2009-02-05 09:49:32 +0000
+++ b/mysql-test/suite/rpl/r/rpl_extraColmaster_myisam.result	2009-06-30 14:46:25 +0000
@@ -4,7 +4,6 @@ reset master;
 reset slave;
 drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
 start slave;
-set binlog_format=row;
 
 ***********************************************************
 ***********************************************************
@@ -1145,2285 +1144,3 @@ c1	hex(c4)	c5
 3	6231623162316231	QA
 DROP TABLE t5;
 
-set binlog_format=statement;
-
-***********************************************************
-***********************************************************
-***************** Start of Testing ************************
-***********************************************************
-***********************************************************
-* This test format == binlog_format	STATEMENT and engine == 'MyISAM'
-***********************************************************
-***********************************************************
-
-***** Testing more columns on the Master *****
-
-CREATE TABLE t1 (f1 INT, f2 INT, f3 INT PRIMARY KEY, f4 CHAR(20),
-/* extra */
-f5 FLOAT DEFAULT '2.00', 
-f6 CHAR(4) DEFAULT 'TEST',
-f7 INT DEFAULT '0',
-f8 TEXT,
-f9 LONGBLOB,
-f10 BIT(63),
-f11 VARBINARY(64))ENGINE='MyISAM';
-
-* Alter Table on Slave and drop columns f5 through f11 *
-
-alter table t1 drop f5, drop f6, drop f7, drop f8, drop f9, drop f10, drop f11;
-
-* Insert data in Master then update and delete some rows*
-
-* Select count and 20 rows from Master *
-
-SELECT COUNT(*) FROM t1;
-COUNT(*)
-40
-
-SELECT f1,f2,f3,f4,f5,f6,f7,f8,f9,
-hex(f10),hex(f11) FROM t1 ORDER BY f3 LIMIT 20;
-f1	f2	f3	f4	f5	f6	f7	f8	f9	hex(f10)	hex(f11)
-2	2	2	second	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-3	3	3	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-5	5	5	second	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-6	6	6	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-8	8	8	second	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-9	9	9	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-11	11	11	second	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-12	12	12	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-14	14	14	second	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-15	15	15	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-17	17	17	second	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-18	18	18	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-20	20	20	second	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-21	21	21	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-23	23	23	second	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-24	24	24	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-26	26	26	second	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-27	27	27	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-29	29	29	second	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-30	30	30	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-
-* Select count and 20 rows from Slave *
-
-SELECT COUNT(*) FROM t1;
-COUNT(*)
-40
-
-SELECT * FROM t1 ORDER BY f3 LIMIT 20;
-f1	f2	f3	f4
-2	2	2	second
-3	3	3	next
-5	5	5	second
-6	6	6	next
-8	8	8	second
-9	9	9	next
-11	11	11	second
-12	12	12	next
-14	14	14	second
-15	15	15	next
-17	17	17	second
-18	18	18	next
-20	20	20	second
-21	21	21	next
-23	23	23	second
-24	24	24	next
-26	26	26	second
-27	27	27	next
-29	29	29	second
-30	30	30	next
-
-* Show Slave Status *
-
-show slave status;;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-
-
-***** Testing Altering table def scenario *****
-
-CREATE TABLE t2 (f1 INT, f2 INT, f3 INT PRIMARY KEY, f4 CHAR(20),
-/* extra */
-f5 DOUBLE DEFAULT '2.00', 
-f6 ENUM('a', 'b', 'c') default 'a',
-f7 DECIMAL(17,9) default '1000.00',
-f8 MEDIUMBLOB,
-f9 NUMERIC(6,4) default '2000.00',
-f10 VARCHAR(1024),
-f11 BINARY(20) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',
-f12 SET('a', 'b', 'c') default 'b')
-ENGINE='MyISAM';
-Warnings:
-Warning	1264	Out of range value for column 'f9' at row 1
-
-CREATE TABLE t3 (f1 INT, f2 INT, f3 INT PRIMARY KEY, f4 CHAR(20),
-/* extra */
-f5 DOUBLE DEFAULT '2.00', 
-f6 ENUM('a', 'b', 'c') default 'a',
-f8 MEDIUMBLOB,
-f10 VARCHAR(1024),
-f11 BINARY(20) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',
-f12 SET('a', 'b', 'c') default 'b')
-ENGINE='MyISAM';
-
-CREATE TABLE t4 (f1 INT, f2 INT, f3 INT PRIMARY KEY, f4 CHAR(20),
-/* extra */
-f5 DOUBLE DEFAULT '2.00', 
-f6 DECIMAL(17,9) default '1000.00',
-f7 MEDIUMBLOB,
-f8 NUMERIC(6,4) default '2000.00',
-f9 VARCHAR(1024),
-f10 BINARY(20) not null default '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',
-f11 CHAR(255))
-ENGINE='MyISAM';
-Warnings:
-Warning	1264	Out of range value for column 'f8' at row 1
-
-CREATE TABLE t31 (f1 INT, f2 INT, f3 INT PRIMARY KEY, f4 CHAR(20),
-/* extra */
-f5  BIGINT,
-f6  BLOB,
-f7  DATE,
-f8  DATETIME,
-f9  FLOAT,
-f10 INT,
-f11 LONGBLOB,
-f12 LONGTEXT,
-f13 MEDIUMBLOB,
-f14 MEDIUMINT,
-f15 MEDIUMTEXT,
-f16 REAL,
-f17 SMALLINT,
-f18 TEXT,
-f19 TIME,
-f20 TIMESTAMP,
-f21 TINYBLOB,
-f22 TINYINT,
-f23 TINYTEXT,
-f24 YEAR,
-f25 BINARY(255),
-f26 BIT(64),
-f27 CHAR(255),
-f28 DECIMAL(30,7),
-f29 DOUBLE,
-f30 ENUM ('a','b', 'c') default 'a',
-f31 FLOAT,
-f32 NUMERIC(17,9),
-f33 SET ('a', 'b', 'c') default 'b',
-f34 VARBINARY(1025),
-f35 VARCHAR(257)       
-) ENGINE='MyISAM';
-
-** Alter tables on slave and drop columns **
-
-alter table t2 drop f5, drop f6, drop f7, drop f8, drop f9, drop f10, drop f11, drop
-f12;
-alter table t3 drop f5, drop f6, drop f8, drop f10, drop f11, drop f12;
-alter table t4 drop f5, drop f6, drop f7, drop f8, drop f9, drop f10, drop f11;
-alter table t31 
-drop f5, drop f6, drop f7, drop f8, drop f9, drop f10, drop f11,
-drop f12, drop f13, drop f14, drop f15, drop f16, drop f17, drop f18,
-drop f19, drop f20, drop f21, drop f22, drop f23, drop f24, drop f25,
-drop f26, drop f27, drop f28, drop f29, drop f30, drop f31, drop f32,
-drop f33, drop f34, drop f35;
-
-** Insert Data into Master **
-INSERT into t2 set f1=1, f2=1, f3=1, f4='first', f8='f8: medium size blob', f10='f10:
-some var char';
-INSERT into t2 values (2, 2, 2, 'second',
-2.0, 'b', 2000.0002, 'f8: medium size blob', 2000, 'f10: some var char',
-'01234567', 'c'),
-(3, 3, 3, 'third',
-3.0, 'b', 3000.0003, 'f8: medium size blob', 3000, 'f10: some var char',
-'01234567', 'c');
-Warnings:
-Warning	1264	Out of range value for column 'f9' at row 1
-Warning	1264	Out of range value for column 'f9' at row 2
-INSERT into t3 set f1=1, f2=1, f3=1, f4='first', f10='f10: some var char';
-INSERT into t4 set f1=1, f2=1, f3=1, f4='first', f7='f7: medium size blob', f10='f10:
-binary data';
-INSERT into t31 set f1=1, f2=1, f3=1, f4='first';
-INSERT into t31 set f1=1, f2=1, f3=2, f4='second',
-f9=2.2,  f10='seven samurai', f28=222.222, f35='222';
-Warnings:
-Warning	1366	Incorrect integer value: 'seven samurai' for column 'f10' at row 1
-INSERT into t31 values (1, 1, 3, 'third',
-/* f5  BIGINT,  */            333333333333333333333333,
-/* f6  BLOB,  */              '3333333333333333333333',
-/* f7  DATE,  */              '2007-07-18',
-/* f8  DATETIME,  */          "2007-07-18",
-/* f9  FLOAT,  */             3.33333333,
-/* f10 INT,  */               333333333,
-/* f11 LONGBLOB,  */          '3333333333333333333',
-/* f12 LONGTEXT,  */          '3333333333333333333',
-/* f13 MEDIUMBLOB,  */        '3333333333333333333',
-/* f14 MEDIUMINT,  */         33,
-/* f15 MEDIUMTEXT,  */        3.3,
-/* f16 REAL,  */              3.3,
-/* f17 SMALLINT,  */          3,
-/* f18 TEXT,  */              '33',
-/* f19 TIME,  */              '2:59:58.999',
-/* f20 TIMESTAMP,  */         20000303000000,
-/* f21 TINYBLOB,  */          '3333',
-/* f22 TINYINT,  */           3,
-/* f23 TINYTEXT,  */          '3',
-/* f24 YEAR,  */              3000,
-/* f25 BINARY(255),  */       'three_33333',
-/* f26 BIT(64),  */           b'011', 
-/* f27 CHAR(255),  */         'three',
-/* f28 DECIMAL(30,7),  */     3.333,
-/* f29 DOUBLE,  */            3.333333333333333333333333333,
-/* f30 ENUM ('a','b','c')*/   'c',
-/* f31 FLOAT,  */             3.0,
-/* f32 NUMERIC(17,9),  */     3.3333,
-/* f33 SET ('a','b','c'),*/   'c',
-/*f34 VARBINARY(1025),*/      '3333 minus 3',
-/*f35 VARCHAR(257),*/         'three times three'
-      );
-Warnings:
-Warning	1264	Out of range value for column 'f5' at row 1
-Warning	1264	Out of range value for column 'f24' at row 1
-INSERT into t31 values (1, 1, 4, 'fourth',
-/* f5  BIGINT,  */            333333333333333333333333,
-/* f6  BLOB,  */              '3333333333333333333333',
-/* f7  DATE,  */              '2007-07-18',
-/* f8  DATETIME,  */          "2007-07-18",
-/* f9  FLOAT,  */             3.33333333,
-/* f10 INT,  */               333333333,
-/* f11 LONGBLOB,  */          '3333333333333333333',
-/* f12 LONGTEXT,  */          '3333333333333333333',
-/* f13 MEDIUMBLOB,  */        '3333333333333333333',
-/* f14 MEDIUMINT,  */         33,
-/* f15 MEDIUMTEXT,  */        3.3,
-/* f16 REAL,  */              3.3,
-/* f17 SMALLINT,  */          3,
-/* f18 TEXT,  */              '33',
-/* f19 TIME,  */              '2:59:58.999',
-/* f20 TIMESTAMP,  */         20000303000000,
-/* f21 TINYBLOB,  */          '3333',
-/* f22 TINYINT,  */           3,
-/* f23 TINYTEXT,  */          '3',
-/* f24 YEAR,  */              3000,
-/* f25 BINARY(255),  */       'three_33333',
-/* f26 BIT(64),  */           b'011',
-/* f27 CHAR(255),  */         'three',
-/* f28 DECIMAL(30,7),  */     3.333,
-/* f29 DOUBLE,  */            3.333333333333333333333333333,
-/* f30 ENUM ('a','b','c')*/   'c',
-/* f31 FLOAT,  */             3.0,
-/* f32 NUMERIC(17,9),  */     3.3333,
-/* f33 SET ('a','b','c'),*/   'c',
-/*f34 VARBINARY(1025),*/      '3333 minus 3',
-/*f35 VARCHAR(257),*/         'three times three'
-       ),
-(1, 1, 5, 'fifth',
-/* f5  BIGINT,  */            333333333333333333333333,
-/* f6  BLOB,  */              '3333333333333333333333',
-/* f7  DATE,  */              '2007-07-18',
-/* f8  DATETIME,  */          "2007-07-18",
-/* f9  FLOAT,  */             3.33333333,
-/* f10 INT,  */               333333333,
-/* f11 LONGBLOB,  */          '3333333333333333333',
-/* f12 LONGTEXT,  */          '3333333333333333333',
-/* f13 MEDIUMBLOB,  */        '3333333333333333333',
-/* f14 MEDIUMINT,  */         33,
-/* f15 MEDIUMTEXT,  */        3.3,
-/* f16 REAL,  */              3.3,
-/* f17 SMALLINT,  */          3,
-/* f18 TEXT,  */              '33',
-/* f19 TIME,  */              '2:59:58.999',
-/* f20 TIMESTAMP,  */         20000303000000,
-/* f21 TINYBLOB,  */          '3333',
-/* f22 TINYINT,  */           3,
-/* f23 TINYTEXT,  */          '3',
-/* f24 YEAR,  */              3000,
-/* f25 BINARY(255),  */       'three_33333',
-/* f26 BIT(64),  */           b'011',
-/* f27 CHAR(255),  */         'three',
-/* f28 DECIMAL(30,7),  */     3.333,
-/* f29 DOUBLE,  */            3.333333333333333333333333333,
-/* f30 ENUM ('a','b','c')*/   'c',
-/* f31 FLOAT,  */             3.0,
-/* f32 NUMERIC(17,9),  */     3.3333,
-/* f33 SET ('a','b','c'),*/   'c',
-/*f34 VARBINARY(1025),*/      '3333 minus 3',
-/*f35 VARCHAR(257),*/         'three times three'
-       ),
-(1, 1, 6, 'sixth',
-/* f5  BIGINT,  */            NULL,
-/* f6  BLOB,  */              '3333333333333333333333',
-/* f7  DATE,  */              '2007-07-18',
-/* f8  DATETIME,  */          "2007-07-18",
-/* f9  FLOAT,  */             3.33333333,
-/* f10 INT,  */               333333333,
-/* f11 LONGBLOB,  */          '3333333333333333333',
-/* f12 LONGTEXT,  */          '3333333333333333333',
-/* f13 MEDIUMBLOB,  */        '3333333333333333333',
-/* f14 MEDIUMINT,  */         33,
-/* f15 MEDIUMTEXT,  */        3.3,
-/* f16 REAL,  */              3.3,
-/* f17 SMALLINT,  */          3,
-/* f18 TEXT,  */              '33',
-/* f19 TIME,  */              '2:59:58.999',
-/* f20 TIMESTAMP,  */         20000303000000,
-/* f21 TINYBLOB,  */          '3333',
-/* f22 TINYINT,  */           3,
-/* f23 TINYTEXT,  */          '3',
-/* f24 YEAR,  */              3000,
-/* f25 BINARY(255),  */       'three_33333',
-/* f26 BIT(64),  */           b'011',
-/* f27 CHAR(255),  */         'three',
-/* f28 DECIMAL(30,7),  */     3.333,
-/* f29 DOUBLE,  */            3.333333333333333333333333333,
-/* f30 ENUM ('a','b','c')*/   'c',
-/* f31 FLOAT,  */             3.0,
-/* f32 NUMERIC(17,9),  */     3.3333,
-/* f33 SET ('a','b','c'),*/   'c',
-/*f34 VARBINARY(1025),*/      '3333 minus 3',
-/*f35 VARCHAR(257),*/         NULL
-);
-Warnings:
-Warning	1264	Out of range value for column 'f5' at row 1
-Warning	1264	Out of range value for column 'f24' at row 1
-Warning	1264	Out of range value for column 'f5' at row 2
-Warning	1264	Out of range value for column 'f24' at row 2
-Warning	1264	Out of range value for column 'f24' at row 3
-
-** Sync slave with master ** 
-** Do selects from tables **
-
-select * from t1 order by f3;
-f1	f2	f3	f4
-2	2	2	second
-3	3	3	next
-5	5	5	second
-6	6	6	next
-8	8	8	second
-9	9	9	next
-11	11	11	second
-12	12	12	next
-14	14	14	second
-15	15	15	next
-17	17	17	second
-18	18	18	next
-20	20	20	second
-21	21	21	next
-23	23	23	second
-24	24	24	next
-26	26	26	second
-27	27	27	next
-29	29	29	second
-30	30	30	next
-31	31	31	second
-32	32	32	second
-33	33	33	second
-34	34	34	second
-35	35	35	second
-36	36	36	second
-37	37	37	second
-38	38	38	second
-39	39	39	second
-40	40	40	second
-41	41	41	second
-42	42	42	second
-43	43	43	second
-44	44	44	second
-45	45	45	second
-46	46	46	second
-47	47	47	second
-48	48	48	second
-49	49	49	second
-50	50	50	second
-select * from t2 order by f1;
-f1	f2	f3	f4
-1	1	1	first
-2	2	2	second
-3	3	3	third
-select * from t3 order by f1;
-f1	f2	f3	f4
-1	1	1	first
-select * from t4 order by f1;
-f1	f2	f3	f4
-1	1	1	first
-select * from t31 order by f3;
-f1	f2	f3	f4
-1	1	1	first
-1	1	2	second
-1	1	3	third
-1	1	4	fourth
-1	1	5	fifth
-1	1	6	sixth
-
-** Do updates master **
-
-update t31 set f5=555555555555555 where f3=6;
-update t31 set f2=2 where f3=2;
-update t31 set f1=NULL where f3=1;
-update t31 set f3=NULL, f27=NULL, f35='f35 new value' where f3=3;
-Warnings:
-Warning	1048	Column 'f3' cannot be null
-
-** Delete from Master **
-
-delete from t1;
-delete from t2;
-delete from t3;
-delete from t4;
-delete from t31;
-
-** Check slave status **
-
-select * from t31;
-f1	f2	f3	f4
-show slave status;;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-
-****************************************
-* columns in master at middle of table *
-* Expect: Proper error message         *
-****************************************
-
-** Stop and Reset Slave **
-
-STOP SLAVE;
-RESET SLAVE;
-
-** create table slave side **
-CREATE TABLE t10 (a INT PRIMARY KEY, b BLOB, c CHAR(5)
-) ENGINE='MyISAM';
-
-** Connect to master and create table **
-
-CREATE TABLE t10 (a INT KEY, b BLOB, f DOUBLE DEFAULT '233',
-c CHAR(5), e INT DEFAULT '1')ENGINE='MyISAM';
-RESET MASTER;
-
-*** Start Slave ***
-START SLAVE;
-
-*** Master Data Insert ***
-set @b1 = 'b1b1b1b1';
-set @b1 = concat(@b1,@b1);
-INSERT INTO t10 () VALUES(1,@b1,DEFAULT,'Kyle',DEFAULT),
-(2,@b1,DEFAULT,'JOE',DEFAULT),
-(3,@b1,DEFAULT,'QA',DEFAULT);
-
-********************************************
-*** Expect slave to fail with Error 1523 ***
-********************************************
-
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1535
-Last_Error	Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1535
-Last_SQL_Error	Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
-
-*** Drop t10  ***
-DROP TABLE t10;
-
-*********************************************
-* More columns in master at middle of table *
-* Expect: Proper error message              *
-*********************************************
-
-*** Create t11 on slave  ***
-STOP SLAVE;
-RESET SLAVE;
-CREATE TABLE t11 (a INT PRIMARY KEY, b BLOB, c VARCHAR(254)
-) ENGINE='MyISAM';
-
-*** Create t11 on Master ***
-CREATE TABLE t11 (a INT KEY, b BLOB, f TEXT,
-c CHAR(5) DEFAULT 'test', e INT DEFAULT '1')ENGINE='MyISAM';
-RESET MASTER;
-
-*** Start Slave ***
-START SLAVE;
-
-*** Master Data Insert ***
-set @b1 = 'b1b1b1b1';
-set @b1 = concat(@b1,@b1);
-INSERT INTO t11 () VALUES(1,@b1,'Testing is fun','Kyle',DEFAULT),
-(2,@b1,'Testing is cool','JOE',DEFAULT),
-(3,@b1,DEFAULT,'QA',DEFAULT);
-
-********************************************
-*** Expect slave to fail with Error 1523 ***
-********************************************
-
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1535
-Last_Error	Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1535
-Last_SQL_Error	Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
-
-*** Drop t11  ***
-DROP TABLE t11;
-
-*********************************************
-* More columns in master at middle of table *
-* Expect: This one should pass blob-text    *
-*********************************************
-
-*** Create t12 on slave  ***
-STOP SLAVE;
-RESET SLAVE;
-CREATE TABLE t12 (a INT PRIMARY KEY, b BLOB, c BLOB
-) ENGINE='MyISAM';
-
-*** Create t12 on Master ***
-CREATE TABLE t12 (a INT KEY, b BLOB, f TEXT,
-c CHAR(5) DEFAULT 'test', e INT DEFAULT '1')ENGINE='MyISAM';
-RESET MASTER;
-
-*** Start Slave ***
-START SLAVE;
-
-*** Master Data Insert ***
-set @b1 = 'b1b1b1b1';
-set @b1 = concat(@b1,@b1);
-INSERT INTO t12 () VALUES(1,@b1,'Kyle',DEFAULT,DEFAULT),
-(2,@b1,'JOE',DEFAULT,DEFAULT),
-(3,@b1,'QA',DEFAULT,DEFAULT);
-
-SELECT a,hex(b),f,c,e FROM t12 ORDER BY a;
-a	hex(b)	f	c	e
-1	62316231623162316231623162316231	Kyle	test	1
-2	62316231623162316231623162316231	JOE	test	1
-3	62316231623162316231623162316231	QA	test	1
-
-*** Select on Slave ***
-SELECT a,hex(b),c FROM t12 ORDER BY a;
-a	hex(b)	c
-1	62316231623162316231623162316231	Kyle
-2	62316231623162316231623162316231	JOE
-3	62316231623162316231623162316231	QA
-
-*** Drop t12  ***
-DROP TABLE t12;
-
-****************************************************
-* - Alter Master adding columns at middle of table *
-*   Expect: columns added                          *
-****************************************************
-
-
-*** Create t14 on slave  ***
-STOP SLAVE;
-RESET SLAVE;
-CREATE TABLE t14 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
-) ENGINE='MyISAM';
-
-*** Create t14 on Master ***
-CREATE TABLE t14 (c1 INT KEY, c4 BLOB, c5 CHAR(5),
-c6 INT DEFAULT '1',
-c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
-)ENGINE='MyISAM';
-RESET MASTER;
-
-*** Start Slave ***
-START SLAVE;
-
-*** Master Data Insert ***
-ALTER TABLE t14 ADD COLUMN c2 DECIMAL(8,2) AFTER c1;
-ALTER TABLE t14 ADD COLUMN c3 TEXT AFTER c2;
-
-set @b1 = 'b1b1b1b1';
-set @b1 = concat(@b1,@b1);
-INSERT INTO t14 () VALUES(1,1.00,'Replication Testing Extra Col',@b1,'Kyle',DEFAULT,DEFAULT),
-(2,2.00,'This Test Should work',@b1,'JOE',DEFAULT,DEFAULT),
-(3,3.00,'If is does not, I will open a bug',@b1,'QA',DEFAULT,DEFAULT);
-
-SELECT c1,c2,c3,hex(c4),c5,c6,c7 FROM t14 ORDER BY c1;
-c1	c2	c3	hex(c4)	c5	c6	c7
-1	1.00	Replication Testing Extra Col	62316231623162316231623162316231	Kyle	1	CURRENT_TIMESTAMP
-2	2.00	This Test Should work	62316231623162316231623162316231	JOE	1	CURRENT_TIMESTAMP
-3	3.00	If is does not, I will open a bug	62316231623162316231623162316231	QA	1	CURRENT_TIMESTAMP
-
-*** Select on Slave ****
-SELECT c1,c2,c3,hex(c4),c5 FROM t14 ORDER BY c1;
-c1	c2	c3	hex(c4)	c5
-1	1.00	Replication Testing Extra Col	62316231623162316231623162316231	Kyle
-2	2.00	This Test Should work	62316231623162316231623162316231	JOE
-3	3.00	If is does not, I will open a bug	62316231623162316231623162316231	QA
-
-****************************************************
-* - Alter Master Dropping columns from the middle. *
-*   Expect: columns dropped                        *
-****************************************************
-
-*** connect to master and drop columns ***
-ALTER TABLE t14 DROP COLUMN c2;
-ALTER TABLE t14 DROP COLUMN c7;
-
-*** Select from Master ***
-SELECT c1,c3,hex(c4),c5,c6 FROM t14 ORDER BY c1;
-c1	c3	hex(c4)	c5	c6
-1	Replication Testing Extra Col	62316231623162316231623162316231	Kyle	1
-2	This Test Should work	62316231623162316231623162316231	JOE	1
-3	If is does not, I will open a bug	62316231623162316231623162316231	QA	1
-
-************
-* Bug30415 *
-************
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1091
-Last_Error	Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7'
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1091
-Last_SQL_Error	Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7'
-STOP SLAVE;
-RESET SLAVE;
-
-*** Drop t14  ***
-DROP TABLE t14;
-DROP TABLE t14;
-RESET MASTER;
-START SLAVE;
-
-*************************************************
-* - Alter Master adding columns at end of table *
-*   Expect: Error 1054                          *
-*************************************************
-
-*** Create t15 on slave  ***
-STOP SLAVE;
-RESET SLAVE;
-CREATE TABLE t15 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
-) ENGINE='MyISAM';
-
-*** Create t15 on Master ***
-CREATE TABLE t15 (c1 INT KEY, c4 BLOB, c5 CHAR(5),
-c6 INT DEFAULT '1',
-c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
-)ENGINE='MyISAM';
-RESET MASTER;
-
-*** Start Slave ***
-START SLAVE;
-
-*** Master Data Insert ***
-ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7;
-set @b1 = 'b1b1b1b1';
-set @b1 = concat(@b1,@b1);
-INSERT INTO t15 () VALUES(1,@b1,'Kyle',DEFAULT,DEFAULT,3.00),
-(2,@b1,'JOE',DEFAULT,DEFAULT,3.00),
-(3,@b1,'QA',DEFAULT,DEFAULT,3.00);
-SELECT c1,hex(c4),c5,c6,c7,c2 FROM t15 ORDER BY c1;
-c1	hex(c4)	c5	c6	c7	c2
-1	62316231623162316231623162316231	Kyle	1	CURRENT_TIMESTAMP	3.00
-2	62316231623162316231623162316231	JOE	1	CURRENT_TIMESTAMP	3.00
-3	62316231623162316231623162316231	QA	1	CURRENT_TIMESTAMP	3.00
-
-********************************************
-*** Expect slave to fail with Error 1054 ***
-********************************************
-
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1054
-Last_Error	Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7'
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1054
-Last_SQL_Error	Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7'
-STOP SLAVE;
-RESET SLAVE;
-
-*** Drop t15  ***
-DROP TABLE t15;
-DROP TABLE t15;
-RESET MASTER;
-START SLAVE;
-
-************************************************
-* - Create index on Master column not on slave *
-*   Expect:Warning                             *
-************************************************
-
-*** Create t16 on slave  ***
-STOP SLAVE;
-RESET SLAVE;
-CREATE TABLE t16 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
-) ENGINE='MyISAM';
-
-*** Create t16 on Master ***
-CREATE TABLE t16 (c1 INT KEY, c4 BLOB, c5 CHAR(5),
-c6 INT DEFAULT '1',
-c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
-)ENGINE='MyISAM';
-RESET MASTER;
-
-*** Start Slave ***
-START SLAVE;
-
-*** Master Create Index and Data Insert ***
-CREATE INDEX part_of_c6 ON t16 (c6);
-set @b1 = 'b1b1b1b1';
-set @b1 = concat(@b1,@b1);
-INSERT INTO t16 () VALUES(1,@b1,'Kyle',DEFAULT,DEFAULT),
-(2,@b1,'JOE',2,DEFAULT),
-(3,@b1,'QA',3,DEFAULT);
-SELECT c1,hex(c4),c5,c6,c7 FROM t16 ORDER BY c1;
-c1	hex(c4)	c5	c6	c7
-1	62316231623162316231623162316231	Kyle	1	CURRENT_TIMESTAMP
-2	62316231623162316231623162316231	JOE	2	CURRENT_TIMESTAMP
-3	62316231623162316231623162316231	QA	3	CURRENT_TIMESTAMP
-
-*****************
-*** BUG 30434 ***
-*****************
-
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1072
-Last_Error	Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)'
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1072
-Last_SQL_Error	Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)'
-STOP SLAVE;
-RESET SLAVE;
-
-*** Drop t16  ***
-DROP TABLE t16;
-DROP TABLE t16;
-RESET MASTER;
-START SLAVE;
-
-*****************************************************
-* - Delete rows using column on Master not on slave *
-*   Expect: Rows Deleted                            *
-*****************************************************
-
-*** Create t17 on slave  ***
-STOP SLAVE;
-RESET SLAVE;
-CREATE TABLE t17 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
-) ENGINE='MyISAM';
-
-*** Create t17 on Master ***
-CREATE TABLE t17 (c1 INT KEY, c4 BLOB, c5 CHAR(5),
-c6 INT DEFAULT '1',
-c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
-)ENGINE='MyISAM';
-RESET MASTER;
-
-*** Start Slave ***
-START SLAVE;
-
-*** Master Data Insert ***
-set @b1 = 'b1b1b1b1';
-set @b1 = concat(@b1,@b1);
-INSERT INTO t17 () VALUES(1,@b1,'Kyle',DEFAULT,DEFAULT),
-(2,@b1,'JOE',2,DEFAULT),
-(3,@b1,'QA',3,DEFAULT);
-SELECT c1,hex(c4),c5,c6,c7 FROM t17 ORDER BY c1;
-c1	hex(c4)	c5	c6	c7
-1	62316231623162316231623162316231	Kyle	1	CURRENT_TIMESTAMP
-2	62316231623162316231623162316231	JOE	2	CURRENT_TIMESTAMP
-3	62316231623162316231623162316231	QA	3	CURRENT_TIMESTAMP
-
-** Select * from Slave **
-SELECT c1,hex(c4),c5 FROM t17 ORDER BY c1;
-c1	hex(c4)	c5
-1	62316231623162316231623162316231	Kyle
-2	62316231623162316231623162316231	JOE
-3	62316231623162316231623162316231	QA
-
-** Delete from master **
-DELETE FROM t17 WHERE c6 = 3;
-SELECT c1,hex(c4),c5,c6,c7 FROM t17 ORDER BY c1;
-c1	hex(c4)	c5	c6	c7
-1	62316231623162316231623162316231	Kyle	1	CURRENT_TIMESTAMP
-2	62316231623162316231623162316231	JOE	2	CURRENT_TIMESTAMP
-
-** Check slave **
-SELECT c1,hex(c4),c5 FROM t17 ORDER BY c1;
-c1	hex(c4)	c5
-1	62316231623162316231623162316231	Kyle
-2	62316231623162316231623162316231	JOE
-DROP TABLE t17;
-
-
-*****************************************************
-* - Update row using column on Master not on slave *
-*   Expect: Rows updated                           *
-*****************************************************
-
-** Bug30674 **
-
-*** Create t18 on slave  ***
-
-STOP SLAVE;
-RESET SLAVE;
-CREATE TABLE t18 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
-) ENGINE='MyISAM';
-
-*** Create t18 on Master ***
-CREATE TABLE t18 (c1 INT KEY, c4 BLOB, c5 CHAR(5),
-c6 INT DEFAULT '1',
-c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
-)ENGINE='MyISAM';
-RESET MASTER;
-
-*** Start Slave ***
-START SLAVE;
-
-*** Master Data Insert ***
-set @b1 = 'b1b1b1b1';
-set @b1 = concat(@b1,@b1);
-INSERT INTO t18 () VALUES(1,@b1,'Kyle',DEFAULT,DEFAULT),
-(2,@b1,'JOE',2,DEFAULT),
-(3,@b1,'QA',3,DEFAULT);
-SELECT c1,hex(c4),c5,c6,c7 FROM t18 ORDER BY c1;
-c1	hex(c4)	c5	c6	c7
-1	62316231623162316231623162316231	Kyle	1	CURRENT_TIMESTAMP
-2	62316231623162316231623162316231	JOE	2	CURRENT_TIMESTAMP
-3	62316231623162316231623162316231	QA	3	CURRENT_TIMESTAMP
-
-** Select * from Slave **
-SELECT c1,hex(c4),c5 FROM t18 ORDER BY c1;
-c1	hex(c4)	c5
-1	62316231623162316231623162316231	Kyle
-2	62316231623162316231623162316231	JOE
-3	62316231623162316231623162316231	QA
-
-** update from master **
-UPDATE t18 SET c5 = 'TEST' WHERE c6 = 3;
-SELECT c1,hex(c4),c5,c6,c7 FROM t18 ORDER BY c1;
-c1	hex(c4)	c5	c6	c7
-1	62316231623162316231623162316231	Kyle	1	CURRENT_TIMESTAMP
-2	62316231623162316231623162316231	JOE	2	CURRENT_TIMESTAMP
-3	62316231623162316231623162316231	TEST	3	CURRENT_TIMESTAMP
-
-** Check slave **
-SELECT c1,hex(c4),c5 FROM t18 ORDER BY c1;
-c1	hex(c4)	c5
-1	62316231623162316231623162316231	Kyle
-2	62316231623162316231623162316231	JOE
-3	62316231623162316231623162316231	TEST
-DROP TABLE t18;
-
-
-*****************************************************
-* - Insert UUID  column on Master not on slave *
-*   Expect: Rows inserted                      *
-*****************************************************
-
-*** Create t5 on slave  ***
-STOP SLAVE;
-RESET SLAVE;
-CREATE TABLE t5 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
-) ENGINE='MyISAM';
-
-*** Create t5 on Master ***
-CREATE TABLE t5 (c1 INT KEY, c4 BLOB, c5 CHAR(5),
-c6 LONG, 
-c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
-)ENGINE='MyISAM';
-RESET MASTER;
-
-*** Start Slave ***
-START SLAVE;
-
-*** Master Data Insert ***
-set @b1 = 'b1b1b1b1';
-INSERT INTO t5 () VALUES(1,@b1,'Kyle',UUID(),DEFAULT),
-(2,@b1,'JOE',UUID(),DEFAULT),
-(3,@b1,'QA',UUID(),DEFAULT);
-SELECT c1,hex(c4),c5,c6,c7 FROM t5 ORDER BY c1;
-c1	hex(c4)	c5	c6	c7
-1	6231623162316231	Kyle	UUID	TIME
-2	6231623162316231	JOE	UUID	TIME
-3	6231623162316231	QA	UUID	TIME
-
-** Select * from Slave **
-SELECT c1,hex(c4),c5 FROM t5 ORDER BY c1;
-c1	hex(c4)	c5
-1	6231623162316231	Kyle
-2	6231623162316231	JOE
-3	6231623162316231	QA
-DROP TABLE t5;
-
-set binlog_format=mixed;
-
-***********************************************************
-***********************************************************
-***************** Start of Testing ************************
-***********************************************************
-***********************************************************
-* This test format == binlog_format	MIXED and engine == 'MyISAM'
-***********************************************************
-***********************************************************
-
-***** Testing more columns on the Master *****
-
-CREATE TABLE t1 (f1 INT, f2 INT, f3 INT PRIMARY KEY, f4 CHAR(20),
-/* extra */
-f5 FLOAT DEFAULT '2.00', 
-f6 CHAR(4) DEFAULT 'TEST',
-f7 INT DEFAULT '0',
-f8 TEXT,
-f9 LONGBLOB,
-f10 BIT(63),
-f11 VARBINARY(64))ENGINE='MyISAM';
-
-* Alter Table on Slave and drop columns f5 through f11 *
-
-alter table t1 drop f5, drop f6, drop f7, drop f8, drop f9, drop f10, drop f11;
-
-* Insert data in Master then update and delete some rows*
-
-* Select count and 20 rows from Master *
-
-SELECT COUNT(*) FROM t1;
-COUNT(*)
-40
-
-SELECT f1,f2,f3,f4,f5,f6,f7,f8,f9,
-hex(f10),hex(f11) FROM t1 ORDER BY f3 LIMIT 20;
-f1	f2	f3	f4	f5	f6	f7	f8	f9	hex(f10)	hex(f11)
-2	2	2	second	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-3	3	3	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-5	5	5	second	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-6	6	6	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-8	8	8	second	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-9	9	9	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-11	11	11	second	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-12	12	12	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-14	14	14	second	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-15	15	15	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-17	17	17	second	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-18	18	18	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-20	20	20	second	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-21	21	21	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-23	23	23	second	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-24	24	24	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-26	26	26	second	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-27	27	27	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-29	29	29	second	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-30	30	30	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
-
-* Select count and 20 rows from Slave *
-
-SELECT COUNT(*) FROM t1;
-COUNT(*)
-40
-
-SELECT * FROM t1 ORDER BY f3 LIMIT 20;
-f1	f2	f3	f4
-2	2	2	second
-3	3	3	next
-5	5	5	second
-6	6	6	next
-8	8	8	second
-9	9	9	next
-11	11	11	second
-12	12	12	next
-14	14	14	second
-15	15	15	next
-17	17	17	second
-18	18	18	next
-20	20	20	second
-21	21	21	next
-23	23	23	second
-24	24	24	next
-26	26	26	second
-27	27	27	next
-29	29	29	second
-30	30	30	next
-
-* Show Slave Status *
-
-show slave status;;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-
-
-***** Testing Altering table def scenario *****
-
-CREATE TABLE t2 (f1 INT, f2 INT, f3 INT PRIMARY KEY, f4 CHAR(20),
-/* extra */
-f5 DOUBLE DEFAULT '2.00', 
-f6 ENUM('a', 'b', 'c') default 'a',
-f7 DECIMAL(17,9) default '1000.00',
-f8 MEDIUMBLOB,
-f9 NUMERIC(6,4) default '2000.00',
-f10 VARCHAR(1024),
-f11 BINARY(20) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',
-f12 SET('a', 'b', 'c') default 'b')
-ENGINE='MyISAM';
-Warnings:
-Warning	1264	Out of range value for column 'f9' at row 1
-
-CREATE TABLE t3 (f1 INT, f2 INT, f3 INT PRIMARY KEY, f4 CHAR(20),
-/* extra */
-f5 DOUBLE DEFAULT '2.00', 
-f6 ENUM('a', 'b', 'c') default 'a',
-f8 MEDIUMBLOB,
-f10 VARCHAR(1024),
-f11 BINARY(20) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',
-f12 SET('a', 'b', 'c') default 'b')
-ENGINE='MyISAM';
-
-CREATE TABLE t4 (f1 INT, f2 INT, f3 INT PRIMARY KEY, f4 CHAR(20),
-/* extra */
-f5 DOUBLE DEFAULT '2.00', 
-f6 DECIMAL(17,9) default '1000.00',
-f7 MEDIUMBLOB,
-f8 NUMERIC(6,4) default '2000.00',
-f9 VARCHAR(1024),
-f10 BINARY(20) not null default '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',
-f11 CHAR(255))
-ENGINE='MyISAM';
-Warnings:
-Warning	1264	Out of range value for column 'f8' at row 1
-
-CREATE TABLE t31 (f1 INT, f2 INT, f3 INT PRIMARY KEY, f4 CHAR(20),
-/* extra */
-f5  BIGINT,
-f6  BLOB,
-f7  DATE,
-f8  DATETIME,
-f9  FLOAT,
-f10 INT,
-f11 LONGBLOB,
-f12 LONGTEXT,
-f13 MEDIUMBLOB,
-f14 MEDIUMINT,
-f15 MEDIUMTEXT,
-f16 REAL,
-f17 SMALLINT,
-f18 TEXT,
-f19 TIME,
-f20 TIMESTAMP,
-f21 TINYBLOB,
-f22 TINYINT,
-f23 TINYTEXT,
-f24 YEAR,
-f25 BINARY(255),
-f26 BIT(64),
-f27 CHAR(255),
-f28 DECIMAL(30,7),
-f29 DOUBLE,
-f30 ENUM ('a','b', 'c') default 'a',
-f31 FLOAT,
-f32 NUMERIC(17,9),
-f33 SET ('a', 'b', 'c') default 'b',
-f34 VARBINARY(1025),
-f35 VARCHAR(257)       
-) ENGINE='MyISAM';
-
-** Alter tables on slave and drop columns **
-
-alter table t2 drop f5, drop f6, drop f7, drop f8, drop f9, drop f10, drop f11, drop
-f12;
-alter table t3 drop f5, drop f6, drop f8, drop f10, drop f11, drop f12;
-alter table t4 drop f5, drop f6, drop f7, drop f8, drop f9, drop f10, drop f11;
-alter table t31 
-drop f5, drop f6, drop f7, drop f8, drop f9, drop f10, drop f11,
-drop f12, drop f13, drop f14, drop f15, drop f16, drop f17, drop f18,
-drop f19, drop f20, drop f21, drop f22, drop f23, drop f24, drop f25,
-drop f26, drop f27, drop f28, drop f29, drop f30, drop f31, drop f32,
-drop f33, drop f34, drop f35;
-
-** Insert Data into Master **
-INSERT into t2 set f1=1, f2=1, f3=1, f4='first', f8='f8: medium size blob', f10='f10:
-some var char';
-INSERT into t2 values (2, 2, 2, 'second',
-2.0, 'b', 2000.0002, 'f8: medium size blob', 2000, 'f10: some var char',
-'01234567', 'c'),
-(3, 3, 3, 'third',
-3.0, 'b', 3000.0003, 'f8: medium size blob', 3000, 'f10: some var char',
-'01234567', 'c');
-Warnings:
-Warning	1264	Out of range value for column 'f9' at row 1
-Warning	1264	Out of range value for column 'f9' at row 2
-INSERT into t3 set f1=1, f2=1, f3=1, f4='first', f10='f10: some var char';
-INSERT into t4 set f1=1, f2=1, f3=1, f4='first', f7='f7: medium size blob', f10='f10:
-binary data';
-INSERT into t31 set f1=1, f2=1, f3=1, f4='first';
-INSERT into t31 set f1=1, f2=1, f3=2, f4='second',
-f9=2.2,  f10='seven samurai', f28=222.222, f35='222';
-Warnings:
-Warning	1366	Incorrect integer value: 'seven samurai' for column 'f10' at row 1
-INSERT into t31 values (1, 1, 3, 'third',
-/* f5  BIGINT,  */            333333333333333333333333,
-/* f6  BLOB,  */              '3333333333333333333333',
-/* f7  DATE,  */              '2007-07-18',
-/* f8  DATETIME,  */          "2007-07-18",
-/* f9  FLOAT,  */             3.33333333,
-/* f10 INT,  */               333333333,
-/* f11 LONGBLOB,  */          '3333333333333333333',
-/* f12 LONGTEXT,  */          '3333333333333333333',
-/* f13 MEDIUMBLOB,  */        '3333333333333333333',
-/* f14 MEDIUMINT,  */         33,
-/* f15 MEDIUMTEXT,  */        3.3,
-/* f16 REAL,  */              3.3,
-/* f17 SMALLINT,  */          3,
-/* f18 TEXT,  */              '33',
-/* f19 TIME,  */              '2:59:58.999',
-/* f20 TIMESTAMP,  */         20000303000000,
-/* f21 TINYBLOB,  */          '3333',
-/* f22 TINYINT,  */           3,
-/* f23 TINYTEXT,  */          '3',
-/* f24 YEAR,  */              3000,
-/* f25 BINARY(255),  */       'three_33333',
-/* f26 BIT(64),  */           b'011', 
-/* f27 CHAR(255),  */         'three',
-/* f28 DECIMAL(30,7),  */     3.333,
-/* f29 DOUBLE,  */            3.333333333333333333333333333,
-/* f30 ENUM ('a','b','c')*/   'c',
-/* f31 FLOAT,  */             3.0,
-/* f32 NUMERIC(17,9),  */     3.3333,
-/* f33 SET ('a','b','c'),*/   'c',
-/*f34 VARBINARY(1025),*/      '3333 minus 3',
-/*f35 VARCHAR(257),*/         'three times three'
-      );
-Warnings:
-Warning	1264	Out of range value for column 'f5' at row 1
-Warning	1264	Out of range value for column 'f24' at row 1
-INSERT into t31 values (1, 1, 4, 'fourth',
-/* f5  BIGINT,  */            333333333333333333333333,
-/* f6  BLOB,  */              '3333333333333333333333',
-/* f7  DATE,  */              '2007-07-18',
-/* f8  DATETIME,  */          "2007-07-18",
-/* f9  FLOAT,  */             3.33333333,
-/* f10 INT,  */               333333333,
-/* f11 LONGBLOB,  */          '3333333333333333333',
-/* f12 LONGTEXT,  */          '3333333333333333333',
-/* f13 MEDIUMBLOB,  */        '3333333333333333333',
-/* f14 MEDIUMINT,  */         33,
-/* f15 MEDIUMTEXT,  */        3.3,
-/* f16 REAL,  */              3.3,
-/* f17 SMALLINT,  */          3,
-/* f18 TEXT,  */              '33',
-/* f19 TIME,  */              '2:59:58.999',
-/* f20 TIMESTAMP,  */         20000303000000,
-/* f21 TINYBLOB,  */          '3333',
-/* f22 TINYINT,  */           3,
-/* f23 TINYTEXT,  */          '3',
-/* f24 YEAR,  */              3000,
-/* f25 BINARY(255),  */       'three_33333',
-/* f26 BIT(64),  */           b'011',
-/* f27 CHAR(255),  */         'three',
-/* f28 DECIMAL(30,7),  */     3.333,
-/* f29 DOUBLE,  */            3.333333333333333333333333333,
-/* f30 ENUM ('a','b','c')*/   'c',
-/* f31 FLOAT,  */             3.0,
-/* f32 NUMERIC(17,9),  */     3.3333,
-/* f33 SET ('a','b','c'),*/   'c',
-/*f34 VARBINARY(1025),*/      '3333 minus 3',
-/*f35 VARCHAR(257),*/         'three times three'
-       ),
-(1, 1, 5, 'fifth',
-/* f5  BIGINT,  */            333333333333333333333333,
-/* f6  BLOB,  */              '3333333333333333333333',
-/* f7  DATE,  */              '2007-07-18',
-/* f8  DATETIME,  */          "2007-07-18",
-/* f9  FLOAT,  */             3.33333333,
-/* f10 INT,  */               333333333,
-/* f11 LONGBLOB,  */          '3333333333333333333',
-/* f12 LONGTEXT,  */          '3333333333333333333',
-/* f13 MEDIUMBLOB,  */        '3333333333333333333',
-/* f14 MEDIUMINT,  */         33,
-/* f15 MEDIUMTEXT,  */        3.3,
-/* f16 REAL,  */              3.3,
-/* f17 SMALLINT,  */          3,
-/* f18 TEXT,  */              '33',
-/* f19 TIME,  */              '2:59:58.999',
-/* f20 TIMESTAMP,  */         20000303000000,
-/* f21 TINYBLOB,  */          '3333',
-/* f22 TINYINT,  */           3,
-/* f23 TINYTEXT,  */          '3',
-/* f24 YEAR,  */              3000,
-/* f25 BINARY(255),  */       'three_33333',
-/* f26 BIT(64),  */           b'011',
-/* f27 CHAR(255),  */         'three',
-/* f28 DECIMAL(30,7),  */     3.333,
-/* f29 DOUBLE,  */            3.333333333333333333333333333,
-/* f30 ENUM ('a','b','c')*/   'c',
-/* f31 FLOAT,  */             3.0,
-/* f32 NUMERIC(17,9),  */     3.3333,
-/* f33 SET ('a','b','c'),*/   'c',
-/*f34 VARBINARY(1025),*/      '3333 minus 3',
-/*f35 VARCHAR(257),*/         'three times three'
-       ),
-(1, 1, 6, 'sixth',
-/* f5  BIGINT,  */            NULL,
-/* f6  BLOB,  */              '3333333333333333333333',
-/* f7  DATE,  */              '2007-07-18',
-/* f8  DATETIME,  */          "2007-07-18",
-/* f9  FLOAT,  */             3.33333333,
-/* f10 INT,  */               333333333,
-/* f11 LONGBLOB,  */          '3333333333333333333',
-/* f12 LONGTEXT,  */          '3333333333333333333',
-/* f13 MEDIUMBLOB,  */        '3333333333333333333',
-/* f14 MEDIUMINT,  */         33,
-/* f15 MEDIUMTEXT,  */        3.3,
-/* f16 REAL,  */              3.3,
-/* f17 SMALLINT,  */          3,
-/* f18 TEXT,  */              '33',
-/* f19 TIME,  */              '2:59:58.999',
-/* f20 TIMESTAMP,  */         20000303000000,
-/* f21 TINYBLOB,  */          '3333',
-/* f22 TINYINT,  */           3,
-/* f23 TINYTEXT,  */          '3',
-/* f24 YEAR,  */              3000,
-/* f25 BINARY(255),  */       'three_33333',
-/* f26 BIT(64),  */           b'011',
-/* f27 CHAR(255),  */         'three',
-/* f28 DECIMAL(30,7),  */     3.333,
-/* f29 DOUBLE,  */            3.333333333333333333333333333,
-/* f30 ENUM ('a','b','c')*/   'c',
-/* f31 FLOAT,  */             3.0,
-/* f32 NUMERIC(17,9),  */     3.3333,
-/* f33 SET ('a','b','c'),*/   'c',
-/*f34 VARBINARY(1025),*/      '3333 minus 3',
-/*f35 VARCHAR(257),*/         NULL
-);
-Warnings:
-Warning	1264	Out of range value for column 'f5' at row 1
-Warning	1264	Out of range value for column 'f24' at row 1
-Warning	1264	Out of range value for column 'f5' at row 2
-Warning	1264	Out of range value for column 'f24' at row 2
-Warning	1264	Out of range value for column 'f24' at row 3
-
-** Sync slave with master ** 
-** Do selects from tables **
-
-select * from t1 order by f3;
-f1	f2	f3	f4
-2	2	2	second
-3	3	3	next
-5	5	5	second
-6	6	6	next
-8	8	8	second
-9	9	9	next
-11	11	11	second
-12	12	12	next
-14	14	14	second
-15	15	15	next
-17	17	17	second
-18	18	18	next
-20	20	20	second
-21	21	21	next
-23	23	23	second
-24	24	24	next
-26	26	26	second
-27	27	27	next
-29	29	29	second
-30	30	30	next
-31	31	31	second
-32	32	32	second
-33	33	33	second
-34	34	34	second
-35	35	35	second
-36	36	36	second
-37	37	37	second
-38	38	38	second
-39	39	39	second
-40	40	40	second
-41	41	41	second
-42	42	42	second
-43	43	43	second
-44	44	44	second
-45	45	45	second
-46	46	46	second
-47	47	47	second
-48	48	48	second
-49	49	49	second
-50	50	50	second
-select * from t2 order by f1;
-f1	f2	f3	f4
-1	1	1	first
-2	2	2	second
-3	3	3	third
-select * from t3 order by f1;
-f1	f2	f3	f4
-1	1	1	first
-select * from t4 order by f1;
-f1	f2	f3	f4
-1	1	1	first
-select * from t31 order by f3;
-f1	f2	f3	f4
-1	1	1	first
-1	1	2	second
-1	1	3	third
-1	1	4	fourth
-1	1	5	fifth
-1	1	6	sixth
-
-** Do updates master **
-
-update t31 set f5=555555555555555 where f3=6;
-update t31 set f2=2 where f3=2;
-update t31 set f1=NULL where f3=1;
-update t31 set f3=NULL, f27=NULL, f35='f35 new value' where f3=3;
-Warnings:
-Warning	1048	Column 'f3' cannot be null
-
-** Delete from Master **
-
-delete from t1;
-delete from t2;
-delete from t3;
-delete from t4;
-delete from t31;
-
-** Check slave status **
-
-select * from t31;
-f1	f2	f3	f4
-show slave status;;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	Yes
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	0
-Last_Error	
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	0
-Last_SQL_Error	
-
-****************************************
-* columns in master at middle of table *
-* Expect: Proper error message         *
-****************************************
-
-** Stop and Reset Slave **
-
-STOP SLAVE;
-RESET SLAVE;
-
-** create table slave side **
-CREATE TABLE t10 (a INT PRIMARY KEY, b BLOB, c CHAR(5)
-) ENGINE='MyISAM';
-
-** Connect to master and create table **
-
-CREATE TABLE t10 (a INT KEY, b BLOB, f DOUBLE DEFAULT '233',
-c CHAR(5), e INT DEFAULT '1')ENGINE='MyISAM';
-RESET MASTER;
-
-*** Start Slave ***
-START SLAVE;
-
-*** Master Data Insert ***
-set @b1 = 'b1b1b1b1';
-set @b1 = concat(@b1,@b1);
-INSERT INTO t10 () VALUES(1,@b1,DEFAULT,'Kyle',DEFAULT),
-(2,@b1,DEFAULT,'JOE',DEFAULT),
-(3,@b1,DEFAULT,'QA',DEFAULT);
-
-********************************************
-*** Expect slave to fail with Error 1523 ***
-********************************************
-
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1535
-Last_Error	Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1535
-Last_SQL_Error	Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
-
-*** Drop t10  ***
-DROP TABLE t10;
-
-*********************************************
-* More columns in master at middle of table *
-* Expect: Proper error message              *
-*********************************************
-
-*** Create t11 on slave  ***
-STOP SLAVE;
-RESET SLAVE;
-CREATE TABLE t11 (a INT PRIMARY KEY, b BLOB, c VARCHAR(254)
-) ENGINE='MyISAM';
-
-*** Create t11 on Master ***
-CREATE TABLE t11 (a INT KEY, b BLOB, f TEXT,
-c CHAR(5) DEFAULT 'test', e INT DEFAULT '1')ENGINE='MyISAM';
-RESET MASTER;
-
-*** Start Slave ***
-START SLAVE;
-
-*** Master Data Insert ***
-set @b1 = 'b1b1b1b1';
-set @b1 = concat(@b1,@b1);
-INSERT INTO t11 () VALUES(1,@b1,'Testing is fun','Kyle',DEFAULT),
-(2,@b1,'Testing is cool','JOE',DEFAULT),
-(3,@b1,DEFAULT,'QA',DEFAULT);
-
-********************************************
-*** Expect slave to fail with Error 1523 ***
-********************************************
-
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1535
-Last_Error	Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1535
-Last_SQL_Error	Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
-START SLAVE;
-
-*** Drop t11  ***
-DROP TABLE t11;
-
-*********************************************
-* More columns in master at middle of table *
-* Expect: This one should pass blob-text    *
-*********************************************
-
-*** Create t12 on slave  ***
-STOP SLAVE;
-RESET SLAVE;
-CREATE TABLE t12 (a INT PRIMARY KEY, b BLOB, c BLOB
-) ENGINE='MyISAM';
-
-*** Create t12 on Master ***
-CREATE TABLE t12 (a INT KEY, b BLOB, f TEXT,
-c CHAR(5) DEFAULT 'test', e INT DEFAULT '1')ENGINE='MyISAM';
-RESET MASTER;
-
-*** Start Slave ***
-START SLAVE;
-
-*** Master Data Insert ***
-set @b1 = 'b1b1b1b1';
-set @b1 = concat(@b1,@b1);
-INSERT INTO t12 () VALUES(1,@b1,'Kyle',DEFAULT,DEFAULT),
-(2,@b1,'JOE',DEFAULT,DEFAULT),
-(3,@b1,'QA',DEFAULT,DEFAULT);
-
-SELECT a,hex(b),f,c,e FROM t12 ORDER BY a;
-a	hex(b)	f	c	e
-1	62316231623162316231623162316231	Kyle	test	1
-2	62316231623162316231623162316231	JOE	test	1
-3	62316231623162316231623162316231	QA	test	1
-
-*** Select on Slave ***
-SELECT a,hex(b),c FROM t12 ORDER BY a;
-a	hex(b)	c
-1	62316231623162316231623162316231	Kyle
-2	62316231623162316231623162316231	JOE
-3	62316231623162316231623162316231	QA
-
-*** Drop t12  ***
-DROP TABLE t12;
-
-****************************************************
-* - Alter Master adding columns at middle of table *
-*   Expect: columns added                          *
-****************************************************
-
-
-*** Create t14 on slave  ***
-STOP SLAVE;
-RESET SLAVE;
-CREATE TABLE t14 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
-) ENGINE='MyISAM';
-
-*** Create t14 on Master ***
-CREATE TABLE t14 (c1 INT KEY, c4 BLOB, c5 CHAR(5),
-c6 INT DEFAULT '1',
-c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
-)ENGINE='MyISAM';
-RESET MASTER;
-
-*** Start Slave ***
-START SLAVE;
-
-*** Master Data Insert ***
-ALTER TABLE t14 ADD COLUMN c2 DECIMAL(8,2) AFTER c1;
-ALTER TABLE t14 ADD COLUMN c3 TEXT AFTER c2;
-
-set @b1 = 'b1b1b1b1';
-set @b1 = concat(@b1,@b1);
-INSERT INTO t14 () VALUES(1,1.00,'Replication Testing Extra Col',@b1,'Kyle',DEFAULT,DEFAULT),
-(2,2.00,'This Test Should work',@b1,'JOE',DEFAULT,DEFAULT),
-(3,3.00,'If is does not, I will open a bug',@b1,'QA',DEFAULT,DEFAULT);
-
-SELECT c1,c2,c3,hex(c4),c5,c6,c7 FROM t14 ORDER BY c1;
-c1	c2	c3	hex(c4)	c5	c6	c7
-1	1.00	Replication Testing Extra Col	62316231623162316231623162316231	Kyle	1	CURRENT_TIMESTAMP
-2	2.00	This Test Should work	62316231623162316231623162316231	JOE	1	CURRENT_TIMESTAMP
-3	3.00	If is does not, I will open a bug	62316231623162316231623162316231	QA	1	CURRENT_TIMESTAMP
-
-*** Select on Slave ****
-SELECT c1,c2,c3,hex(c4),c5 FROM t14 ORDER BY c1;
-c1	c2	c3	hex(c4)	c5
-1	1.00	Replication Testing Extra Col	62316231623162316231623162316231	Kyle
-2	2.00	This Test Should work	62316231623162316231623162316231	JOE
-3	3.00	If is does not, I will open a bug	62316231623162316231623162316231	QA
-
-****************************************************
-* - Alter Master Dropping columns from the middle. *
-*   Expect: columns dropped                        *
-****************************************************
-
-*** connect to master and drop columns ***
-ALTER TABLE t14 DROP COLUMN c2;
-ALTER TABLE t14 DROP COLUMN c7;
-
-*** Select from Master ***
-SELECT c1,c3,hex(c4),c5,c6 FROM t14 ORDER BY c1;
-c1	c3	hex(c4)	c5	c6
-1	Replication Testing Extra Col	62316231623162316231623162316231	Kyle	1
-2	This Test Should work	62316231623162316231623162316231	JOE	1
-3	If is does not, I will open a bug	62316231623162316231623162316231	QA	1
-
-************
-* Bug30415 *
-************
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1091
-Last_Error	Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7'
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1091
-Last_SQL_Error	Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7'
-STOP SLAVE;
-RESET SLAVE;
-
-*** Drop t14  ***
-DROP TABLE t14;
-DROP TABLE t14;
-RESET MASTER;
-START SLAVE;
-
-*************************************************
-* - Alter Master adding columns at end of table *
-*   Expect: Error 1054                          *
-*************************************************
-
-*** Create t15 on slave  ***
-STOP SLAVE;
-RESET SLAVE;
-CREATE TABLE t15 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
-) ENGINE='MyISAM';
-
-*** Create t15 on Master ***
-CREATE TABLE t15 (c1 INT KEY, c4 BLOB, c5 CHAR(5),
-c6 INT DEFAULT '1',
-c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
-)ENGINE='MyISAM';
-RESET MASTER;
-
-*** Start Slave ***
-START SLAVE;
-
-*** Master Data Insert ***
-ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7;
-set @b1 = 'b1b1b1b1';
-set @b1 = concat(@b1,@b1);
-INSERT INTO t15 () VALUES(1,@b1,'Kyle',DEFAULT,DEFAULT,3.00),
-(2,@b1,'JOE',DEFAULT,DEFAULT,3.00),
-(3,@b1,'QA',DEFAULT,DEFAULT,3.00);
-SELECT c1,hex(c4),c5,c6,c7,c2 FROM t15 ORDER BY c1;
-c1	hex(c4)	c5	c6	c7	c2
-1	62316231623162316231623162316231	Kyle	1	CURRENT_TIMESTAMP	3.00
-2	62316231623162316231623162316231	JOE	1	CURRENT_TIMESTAMP	3.00
-3	62316231623162316231623162316231	QA	1	CURRENT_TIMESTAMP	3.00
-
-********************************************
-*** Expect slave to fail with Error 1054 ***
-********************************************
-
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1054
-Last_Error	Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7'
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1054
-Last_SQL_Error	Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7'
-STOP SLAVE;
-RESET SLAVE;
-
-*** Drop t15  ***
-DROP TABLE t15;
-DROP TABLE t15;
-RESET MASTER;
-START SLAVE;
-
-************************************************
-* - Create index on Master column not on slave *
-*   Expect:Warning                             *
-************************************************
-
-*** Create t16 on slave  ***
-STOP SLAVE;
-RESET SLAVE;
-CREATE TABLE t16 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
-) ENGINE='MyISAM';
-
-*** Create t16 on Master ***
-CREATE TABLE t16 (c1 INT KEY, c4 BLOB, c5 CHAR(5),
-c6 INT DEFAULT '1',
-c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
-)ENGINE='MyISAM';
-RESET MASTER;
-
-*** Start Slave ***
-START SLAVE;
-
-*** Master Create Index and Data Insert ***
-CREATE INDEX part_of_c6 ON t16 (c6);
-set @b1 = 'b1b1b1b1';
-set @b1 = concat(@b1,@b1);
-INSERT INTO t16 () VALUES(1,@b1,'Kyle',DEFAULT,DEFAULT),
-(2,@b1,'JOE',2,DEFAULT),
-(3,@b1,'QA',3,DEFAULT);
-SELECT c1,hex(c4),c5,c6,c7 FROM t16 ORDER BY c1;
-c1	hex(c4)	c5	c6	c7
-1	62316231623162316231623162316231	Kyle	1	CURRENT_TIMESTAMP
-2	62316231623162316231623162316231	JOE	2	CURRENT_TIMESTAMP
-3	62316231623162316231623162316231	QA	3	CURRENT_TIMESTAMP
-
-*****************
-*** BUG 30434 ***
-*****************
-
-SHOW SLAVE STATUS;
-Slave_IO_State	#
-Master_Host	127.0.0.1
-Master_User	root
-Master_Port	#
-Connect_Retry	1
-Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	#
-Relay_Log_File	#
-Relay_Log_Pos	#
-Relay_Master_Log_File	master-bin.000001
-Slave_IO_Running	Yes
-Slave_SQL_Running	No
-Replicate_Do_DB	
-Replicate_Ignore_DB	
-Replicate_Do_Table	
-Replicate_Ignore_Table	
-Replicate_Wild_Do_Table	
-Replicate_Wild_Ignore_Table	
-Last_Errno	1072
-Last_Error	Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)'
-Skip_Counter	0
-Exec_Master_Log_Pos	#
-Relay_Log_Space	#
-Until_Condition	None
-Until_Log_File	
-Until_Log_Pos	0
-Master_SSL_Allowed	No
-Master_SSL_CA_File	
-Master_SSL_CA_Path	
-Master_SSL_Cert	
-Master_SSL_Cipher	
-Master_SSL_Key	
-Seconds_Behind_Master	#
-Master_SSL_Verify_Server_Cert	No
-Last_IO_Errno	#
-Last_IO_Error	#
-Last_SQL_Errno	1072
-Last_SQL_Error	Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)'
-STOP SLAVE;
-RESET SLAVE;
-
-*** Drop t16  ***
-DROP TABLE t16;
-DROP TABLE t16;
-RESET MASTER;
-START SLAVE;
-
-*****************************************************
-* - Delete rows using column on Master not on slave *
-*   Expect: Rows Deleted                            *
-*****************************************************
-
-*** Create t17 on slave  ***
-STOP SLAVE;
-RESET SLAVE;
-CREATE TABLE t17 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
-) ENGINE='MyISAM';
-
-*** Create t17 on Master ***
-CREATE TABLE t17 (c1 INT KEY, c4 BLOB, c5 CHAR(5),
-c6 INT DEFAULT '1',
-c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
-)ENGINE='MyISAM';
-RESET MASTER;
-
-*** Start Slave ***
-START SLAVE;
-
-*** Master Data Insert ***
-set @b1 = 'b1b1b1b1';
-set @b1 = concat(@b1,@b1);
-INSERT INTO t17 () VALUES(1,@b1,'Kyle',DEFAULT,DEFAULT),
-(2,@b1,'JOE',2,DEFAULT),
-(3,@b1,'QA',3,DEFAULT);
-SELECT c1,hex(c4),c5,c6,c7 FROM t17 ORDER BY c1;
-c1	hex(c4)	c5	c6	c7
-1	62316231623162316231623162316231	Kyle	1	CURRENT_TIMESTAMP
-2	62316231623162316231623162316231	JOE	2	CURRENT_TIMESTAMP
-3	62316231623162316231623162316231	QA	3	CURRENT_TIMESTAMP
-
-** Select * from Slave **
-SELECT c1,hex(c4),c5 FROM t17 ORDER BY c1;
-c1	hex(c4)	c5
-1	62316231623162316231623162316231	Kyle
-2	62316231623162316231623162316231	JOE
-3	62316231623162316231623162316231	QA
-
-** Delete from master **
-DELETE FROM t17 WHERE c6 = 3;
-SELECT c1,hex(c4),c5,c6,c7 FROM t17 ORDER BY c1;
-c1	hex(c4)	c5	c6	c7
-1	62316231623162316231623162316231	Kyle	1	CURRENT_TIMESTAMP
-2	62316231623162316231623162316231	JOE	2	CURRENT_TIMESTAMP
-
-** Check slave **
-SELECT c1,hex(c4),c5 FROM t17 ORDER BY c1;
-c1	hex(c4)	c5
-1	62316231623162316231623162316231	Kyle
-2	62316231623162316231623162316231	JOE
-DROP TABLE t17;
-
-
-*****************************************************
-* - Update row using column on Master not on slave *
-*   Expect: Rows updated                           *
-*****************************************************
-
-** Bug30674 **
-
-*** Create t18 on slave  ***
-
-STOP SLAVE;
-RESET SLAVE;
-CREATE TABLE t18 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
-) ENGINE='MyISAM';
-
-*** Create t18 on Master ***
-CREATE TABLE t18 (c1 INT KEY, c4 BLOB, c5 CHAR(5),
-c6 INT DEFAULT '1',
-c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
-)ENGINE='MyISAM';
-RESET MASTER;
-
-*** Start Slave ***
-START SLAVE;
-
-*** Master Data Insert ***
-set @b1 = 'b1b1b1b1';
-set @b1 = concat(@b1,@b1);
-INSERT INTO t18 () VALUES(1,@b1,'Kyle',DEFAULT,DEFAULT),
-(2,@b1,'JOE',2,DEFAULT),
-(3,@b1,'QA',3,DEFAULT);
-SELECT c1,hex(c4),c5,c6,c7 FROM t18 ORDER BY c1;
-c1	hex(c4)	c5	c6	c7
-1	62316231623162316231623162316231	Kyle	1	CURRENT_TIMESTAMP
-2	62316231623162316231623162316231	JOE	2	CURRENT_TIMESTAMP
-3	62316231623162316231623162316231	QA	3	CURRENT_TIMESTAMP
-
-** Select * from Slave **
-SELECT c1,hex(c4),c5 FROM t18 ORDER BY c1;
-c1	hex(c4)	c5
-1	62316231623162316231623162316231	Kyle
-2	62316231623162316231623162316231	JOE
-3	62316231623162316231623162316231	QA
-
-** update from master **
-UPDATE t18 SET c5 = 'TEST' WHERE c6 = 3;
-SELECT c1,hex(c4),c5,c6,c7 FROM t18 ORDER BY c1;
-c1	hex(c4)	c5	c6	c7
-1	62316231623162316231623162316231	Kyle	1	CURRENT_TIMESTAMP
-2	62316231623162316231623162316231	JOE	2	CURRENT_TIMESTAMP
-3	62316231623162316231623162316231	TEST	3	CURRENT_TIMESTAMP
-
-** Check slave **
-SELECT c1,hex(c4),c5 FROM t18 ORDER BY c1;
-c1	hex(c4)	c5
-1	62316231623162316231623162316231	Kyle
-2	62316231623162316231623162316231	JOE
-3	62316231623162316231623162316231	TEST
-DROP TABLE t18;
-
-
-*****************************************************
-* - Insert UUID  column on Master not on slave *
-*   Expect: Rows inserted                      *
-*****************************************************
-
-*** Create t5 on slave  ***
-STOP SLAVE;
-RESET SLAVE;
-CREATE TABLE t5 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
-) ENGINE='MyISAM';
-
-*** Create t5 on Master ***
-CREATE TABLE t5 (c1 INT KEY, c4 BLOB, c5 CHAR(5),
-c6 LONG, 
-c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
-)ENGINE='MyISAM';
-RESET MASTER;
-
-*** Start Slave ***
-START SLAVE;
-
-*** Master Data Insert ***
-set @b1 = 'b1b1b1b1';
-INSERT INTO t5 () VALUES(1,@b1,'Kyle',UUID(),DEFAULT),
-(2,@b1,'JOE',UUID(),DEFAULT),
-(3,@b1,'QA',UUID(),DEFAULT);
-SELECT c1,hex(c4),c5,c6,c7 FROM t5 ORDER BY c1;
-c1	hex(c4)	c5	c6	c7
-1	6231623162316231	Kyle	UUID	TIME
-2	6231623162316231	JOE	UUID	TIME
-3	6231623162316231	QA	UUID	TIME
-
-** Select * from Slave **
-SELECT c1,hex(c4),c5 FROM t5 ORDER BY c1;
-c1	hex(c4)	c5
-1	6231623162316231	Kyle
-2	6231623162316231	JOE
-3	6231623162316231	QA
-DROP TABLE t5;
-

=== modified file 'mysql-test/suite/rpl/r/rpl_foreign_key_innodb.result'
--- a/mysql-test/suite/rpl/r/rpl_foreign_key_innodb.result	2007-12-12 10:14:59 +0000
+++ b/mysql-test/suite/rpl/r/rpl_foreign_key_innodb.result	2009-06-30 14:46:25 +0000
@@ -46,7 +46,6 @@ engine = INNODB;
 insert into t1 set b=1;
 insert into t2 set a=1, b=1;
 set foreign_key_checks=0;
-set @@session.binlog_format=row;
 delete from t1;
 must sync w/o a problem (could not with the buggy code)
 select count(*) from t1 /* must be zero */;

=== modified file 'mysql-test/suite/rpl/r/rpl_idempotency.result'
--- a/mysql-test/suite/rpl/r/rpl_idempotency.result	2009-04-05 12:03:04 +0000
+++ b/mysql-test/suite/rpl/r/rpl_idempotency.result	2009-06-30 14:46:25 +0000
@@ -91,6 +91,10 @@ select * from ti2 order by b /* must be 
 a	b
 1	1
 2	2
+STOP SLAVE;
+SET @old_slave_global_binlog_format= @@global.binlog_format;
+SET global binlog_format=row;
+START SLAVE;
 set @save_binlog_format= @@session.binlog_format;
 set @@session.binlog_format= row;
 delete from ti1 where b=1;
@@ -224,6 +228,6 @@ Last_SQL_Error
 set global slave_exec_mode='IDEMPOTENT';
 start slave sql_thread;
 SET @@global.slave_exec_mode= @old_slave_exec_mode;
-set @@session.binlog_format= @save_binlog_format;
+SET @@global.binlog_format= @old_slave_global_binlog_format;
 drop table t1,t2,ti2,ti1;
 *** end of tests

=== added file 'mysql-test/suite/rpl/r/rpl_mix_found_rows.result'
--- a/mysql-test/suite/rpl/r/rpl_mix_found_rows.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_mix_found_rows.result	2009-06-30 14:46:25 +0000
@@ -0,0 +1,138 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+==== Initialize ====
+**** On Master ****
+CREATE TABLE t1 (a INT);
+CREATE TABLE logtbl (sect INT, test INT, count INT);
+INSERT INTO t1 VALUES (1),(2),(3);
+INSERT INTO t1 SELECT 2*a+3 FROM t1;
+INSERT INTO t1 SELECT 2*a+3 FROM t1;
+INSERT INTO t1 SELECT 2*a+3 FROM t1;
+INSERT INTO t1 SELECT 2*a+3 FROM t1;
+INSERT INTO t1 SELECT 2*a+3 FROM t1;
+INSERT INTO t1 SELECT 2*a+3 FROM t1;
+==== Checking a procedure ====
+**** On Master ****
+CREATE PROCEDURE just_log(sect INT, test INT) BEGIN
+INSERT INTO logtbl VALUES (sect,test,FOUND_ROWS());
+END $$
+**** On Master 1 ****
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a > 5 ORDER BY a LIMIT 1;
+a
+7
+CALL just_log(1,1);
+**** On Master ****
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a > 5 ORDER BY a LIMIT 1;
+a
+7
+CALL just_log(1,2);
+**** On Master 1 ****
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a < 5 ORDER BY a LIMIT 1;
+a
+1
+CALL just_log(1,3);
+**** On Master ****
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a > 5 ORDER BY a LIMIT 1;
+a
+7
+CALL just_log(1,4);
+SELECT * FROM logtbl WHERE sect = 1 ORDER BY sect,test;
+sect	test	count
+1	1	183
+1	2	183
+1	3	3
+1	4	183
+**** On Slave ****
+SELECT * FROM logtbl WHERE sect = 1 ORDER BY sect,test;
+sect	test	count
+1	1	183
+1	2	183
+1	3	3
+1	4	183
+==== Checking a stored function ====
+**** On Master ****
+CREATE FUNCTION log_rows(sect INT, test INT)
+RETURNS INT
+BEGIN
+DECLARE found_rows INT;
+SELECT FOUND_ROWS() INTO found_rows;
+INSERT INTO logtbl VALUES(sect,test,found_rows);
+RETURN found_rows;
+END $$
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a < 5 ORDER BY a LIMIT 1;
+a
+1
+SELECT log_rows(2,1), log_rows(2,2);
+log_rows(2,1)	log_rows(2,2)
+3	3
+CREATE TABLE t2 (a INT, b INT);
+CREATE TRIGGER t2_tr BEFORE INSERT ON t2 FOR EACH ROW
+BEGIN
+INSERT INTO logtbl VALUES (NEW.a, NEW.b, FOUND_ROWS());
+END $$
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a < 5 ORDER BY a LIMIT 1;
+a
+1
+INSERT INTO t2 VALUES (2,3), (2,4);
+DROP TRIGGER t2_tr;
+CREATE TRIGGER t2_tr BEFORE INSERT ON t2 FOR EACH ROW
+BEGIN
+DECLARE dummy INT;
+SELECT log_rows(NEW.a, NEW.b) INTO dummy;
+END $$
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a > 5 ORDER BY a LIMIT 1;
+a
+7
+INSERT INTO t2 VALUES (2,5), (2,6);
+DROP TRIGGER t2_tr;
+CREATE PROCEDURE log_me_inner(sect INT, test INT)
+BEGIN
+DECLARE dummy INT;
+SELECT log_rows(sect, test) INTO dummy;
+SELECT log_rows(sect, test+1) INTO dummy;
+END $$
+CREATE PROCEDURE log_me(sect INT, test INT)
+BEGIN
+CALL log_me_inner(sect,test);
+END $$
+CREATE TRIGGER t2_tr BEFORE INSERT ON t2 FOR EACH ROW
+BEGIN
+CALL log_me(NEW.a, NEW.b);
+END $$
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a > 5 ORDER BY a LIMIT 1;
+a
+7
+INSERT INTO t2 VALUES (2,5), (2,6);
+SELECT * FROM logtbl WHERE sect = 2 ORDER BY sect,test;
+sect	test	count
+2	1	3
+2	2	3
+2	3	3
+2	4	3
+2	5	183
+2	5	183
+2	6	183
+2	6	0
+2	6	183
+2	7	0
+SELECT * FROM logtbl WHERE sect = 2 ORDER BY sect,test;
+sect	test	count
+2	1	3
+2	2	3
+2	3	3
+2	4	3
+2	5	183
+2	5	183
+2	6	183
+2	6	0
+2	6	183
+2	7	0
+DROP TABLE t1, t2, logtbl;
+DROP PROCEDURE just_log;
+DROP PROCEDURE log_me;
+DROP PROCEDURE log_me_inner;
+DROP FUNCTION log_rows;

=== added file 'mysql-test/suite/rpl/r/rpl_mix_insert_delayed.result'
--- a/mysql-test/suite/rpl/r/rpl_mix_insert_delayed.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_mix_insert_delayed.result	2009-06-30 14:46:25 +0000
@@ -0,0 +1,71 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE SCHEMA IF NOT EXISTS mysqlslap;
+USE mysqlslap;
+select @@global.binlog_format;
+@@global.binlog_format
+MIXED
+CREATE TABLE t1 (id INT primary key auto_increment, name VARCHAR(64));
+FLUSH TABLE t1;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+5000
+use mysqlslap;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+5000
+truncate table t1;
+insert delayed into t1 values(10, "my name");
+insert delayed into t1 values(10, "is Bond"), (20, "James Bond");
+flush table t1;
+select * from t1;
+id	name
+10	my name
+20	James Bond
+select * from t1;
+id	name
+10	my name
+20	James Bond
+delete from t1 where id!=10;
+insert delayed into t1 values(20, "is Bond"), (10, "James Bond");
+flush table t1;
+select * from t1;
+id	name
+10	my name
+20	is Bond
+select * from t1;
+id	name
+10	my name
+20	is Bond
+USE test;
+DROP SCHEMA mysqlslap;
+use test;
+FLUSH LOGS;
+FLUSH LOGS;
+CREATE TABLE t1(a int, UNIQUE(a));
+INSERT DELAYED IGNORE INTO t1 VALUES(1);
+INSERT DELAYED IGNORE INTO t1 VALUES(1);
+flush table t1;
+show binlog events in 'master-bin.000002' LIMIT 2,2;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+x	x	x	x	x	BEGIN
+x	x	x	x	x	table_id: # (test.t1)
+select * from t1;
+a
+1
+On slave
+show binlog events in 'slave-bin.000002' LIMIT 2,2;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+x	x	x	x	x	BEGIN
+x	x	x	x	x	table_id: # (test.t1)
+select * from t1;
+a
+1
+drop table t1;
+FLUSH LOGS;
+FLUSH LOGS;
+End of 5.0 tests

=== modified file 'mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result'
--- a/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result	2009-05-31 05:44:41 +0000
+++ b/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result	2009-06-30 14:46:25 +0000
@@ -4,12 +4,6 @@ reset master;
 reset slave;
 drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
 start slave;
-SET @old_binlog_format= @@global.binlog_format;
-SET BINLOG_FORMAT=MIXED;
-SET GLOBAL BINLOG_FORMAT=MIXED;
-SELECT @@GLOBAL.BINLOG_FORMAT, @@SESSION.BINLOG_FORMAT;
-@@GLOBAL.BINLOG_FORMAT	@@SESSION.BINLOG_FORMAT
-MIXED	MIXED
 **** On Master ****
 CREATE TABLE t1 (a INT, b LONG);
 INSERT INTO t1 VALUES (1,1), (2,2);
@@ -73,4 +67,3 @@ slave-bin.000001	#	Table_map	1	#	table_i
 slave-bin.000001	#	Write_rows	1	#	table_id: # flags: STMT_END_F
 slave-bin.000001	#	Query	1	#	COMMIT
 DROP TABLE IF EXISTS t1;
-SET @@global.binlog_format= @old_binlog_format;

=== modified file 'mysql-test/suite/rpl/r/rpl_row_insert_delayed.result'
--- a/mysql-test/suite/rpl/r/rpl_row_insert_delayed.result	2007-07-27 14:29:48 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_insert_delayed.result	2009-06-30 14:46:25 +0000
@@ -4,8 +4,6 @@ reset master;
 reset slave;
 drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
 start slave;
-set @old_global_binlog_format = @@global.binlog_format;
-set @@global.binlog_format = row;
 CREATE SCHEMA IF NOT EXISTS mysqlslap;
 USE mysqlslap;
 select @@global.binlog_format;
@@ -59,4 +57,3 @@ a
 1
 drop table t1;
 End of 5.0 tests
-set @@global.binlog_format = @old_global_binlog_format;

=== renamed file 'mysql-test/suite/rpl/r/rpl_found_rows.result' => 'mysql-test/suite/rpl/r/rpl_stm_found_rows.result'
--- a/mysql-test/suite/rpl/r/rpl_found_rows.result	2008-10-06 08:27:36 +0000
+++ b/mysql-test/suite/rpl/r/rpl_stm_found_rows.result	2009-06-30 14:46:25 +0000
@@ -4,8 +4,7 @@ reset master;
 reset slave;
 drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
 start slave;
-==== 0. Setting it all up ====
-SET BINLOG_FORMAT=STATEMENT;
+==== Initialize ====
 **** On Master ****
 CREATE TABLE t1 (a INT);
 CREATE TABLE logtbl (sect INT, test INT, count INT);
@@ -16,8 +15,7 @@ INSERT INTO t1 SELECT 2*a+3 FROM t1;
 INSERT INTO t1 SELECT 2*a+3 FROM t1;
 INSERT INTO t1 SELECT 2*a+3 FROM t1;
 INSERT INTO t1 SELECT 2*a+3 FROM t1;
-#### 1. Using statement mode ####
-==== 1.1. Simple test ====
+==== Simple test ====
 SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a > 5 ORDER BY a LIMIT 1;
 a
 7
@@ -37,7 +35,7 @@ SELECT * FROM logtbl WHERE sect = 1 ORDE
 sect	test	count
 1	1	183
 1	2	3
-==== 1.2. Stored procedure ====
+==== Stored procedure ====
 **** On Master ****
 CREATE PROCEDURE calc_and_log(sect INT, test INT) BEGIN
 DECLARE cnt INT;
@@ -53,6 +51,8 @@ a
 1
 a
 7
+Warnings:
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
 CREATE PROCEDURE just_log(sect INT, test INT, found_rows INT) BEGIN
 INSERT INTO logtbl VALUES (sect,test,found_rows);
 END $$
@@ -72,7 +72,7 @@ sect	test	count
 2	1	3
 2	2	183
 2	3	183
-==== 1.3. Stored functions ====
+==== Stored functions ====
 **** On Master ****
 CREATE FUNCTION log_rows(sect INT, test INT, found_rows INT)
 RETURNS INT
@@ -96,9 +96,9 @@ SELECT * FROM logtbl WHERE sect = 3 ORDE
 sect	test	count
 3	1	183
 3	2	183
-==== 1.9. Cleanup ====
+==== Cleanup ====
 **** On Master ****
-DELETE FROM logtbl;
+DROP TABLE t1, logtbl;
 DROP PROCEDURE just_log;
 DROP PROCEDURE calc_and_log;
 DROP FUNCTION log_rows;
@@ -107,127 +107,3 @@ include/stop_slave.inc
 RESET SLAVE;
 RESET MASTER;
 include/start_slave.inc
-#### 2. Using mixed mode ####
-==== 2.1. Checking a procedure ====
-**** On Master ****
-SET BINLOG_FORMAT=MIXED;
-CREATE PROCEDURE just_log(sect INT, test INT) BEGIN
-INSERT INTO logtbl VALUES (sect,test,FOUND_ROWS());
-END $$
-**** On Master 1 ****
-SET BINLOG_FORMAT=MIXED;
-SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a > 5 ORDER BY a LIMIT 1;
-a
-7
-CALL just_log(1,1);
-**** On Master ****
-SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a > 5 ORDER BY a LIMIT 1;
-a
-7
-CALL just_log(1,2);
-**** On Master 1 ****
-SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a < 5 ORDER BY a LIMIT 1;
-a
-1
-CALL just_log(1,3);
-**** On Master ****
-SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a > 5 ORDER BY a LIMIT 1;
-a
-7
-CALL just_log(1,4);
-SELECT * FROM logtbl WHERE sect = 1 ORDER BY sect,test;
-sect	test	count
-1	1	183
-1	2	183
-1	3	3
-1	4	183
-**** On Slave ****
-SELECT * FROM logtbl WHERE sect = 1 ORDER BY sect,test;
-sect	test	count
-1	1	183
-1	2	183
-1	3	3
-1	4	183
-==== 2.1. Checking a stored function ====
-**** On Master ****
-CREATE FUNCTION log_rows(sect INT, test INT)
-RETURNS INT
-BEGIN
-DECLARE found_rows INT;
-SELECT FOUND_ROWS() INTO found_rows;
-INSERT INTO logtbl VALUES(sect,test,found_rows);
-RETURN found_rows;
-END $$
-SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a < 5 ORDER BY a LIMIT 1;
-a
-1
-SELECT log_rows(2,1), log_rows(2,2);
-log_rows(2,1)	log_rows(2,2)
-3	3
-CREATE TABLE t2 (a INT, b INT);
-CREATE TRIGGER t2_tr BEFORE INSERT ON t2 FOR EACH ROW
-BEGIN
-INSERT INTO logtbl VALUES (NEW.a, NEW.b, FOUND_ROWS());
-END $$
-SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a < 5 ORDER BY a LIMIT 1;
-a
-1
-INSERT INTO t2 VALUES (2,3), (2,4);
-DROP TRIGGER t2_tr;
-CREATE TRIGGER t2_tr BEFORE INSERT ON t2 FOR EACH ROW
-BEGIN
-DECLARE dummy INT;
-SELECT log_rows(NEW.a, NEW.b) INTO dummy;
-END $$
-SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a > 5 ORDER BY a LIMIT 1;
-a
-7
-INSERT INTO t2 VALUES (2,5), (2,6);
-DROP TRIGGER t2_tr;
-CREATE PROCEDURE log_me_inner(sect INT, test INT)
-BEGIN
-DECLARE dummy INT;
-SELECT log_rows(sect, test) INTO dummy;
-SELECT log_rows(sect, test+1) INTO dummy;
-END $$
-CREATE PROCEDURE log_me(sect INT, test INT)
-BEGIN
-CALL log_me_inner(sect,test);
-END $$
-CREATE TRIGGER t2_tr BEFORE INSERT ON t2 FOR EACH ROW
-BEGIN
-CALL log_me(NEW.a, NEW.b);
-END $$
-SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a > 5 ORDER BY a LIMIT 1;
-a
-7
-INSERT INTO t2 VALUES (2,5), (2,6);
-SELECT * FROM logtbl WHERE sect = 2 ORDER BY sect,test;
-sect	test	count
-2	1	3
-2	2	3
-2	3	3
-2	4	3
-2	5	183
-2	5	183
-2	6	183
-2	6	0
-2	6	183
-2	7	0
-SELECT * FROM logtbl WHERE sect = 2 ORDER BY sect,test;
-sect	test	count
-2	1	3
-2	2	3
-2	3	3
-2	4	3
-2	5	183
-2	5	183
-2	6	183
-2	6	0
-2	6	183
-2	7	0
-DROP TABLE t1, t2, logtbl;
-DROP PROCEDURE just_log;
-DROP PROCEDURE log_me;
-DROP PROCEDURE log_me_inner;
-DROP FUNCTION log_rows;

=== modified file 'mysql-test/suite/rpl/r/rpl_stm_insert_delayed.result'
--- a/mysql-test/suite/rpl/r/rpl_stm_insert_delayed.result	2007-07-27 11:28:36 +0000
+++ b/mysql-test/suite/rpl/r/rpl_stm_insert_delayed.result	2009-06-30 14:46:25 +0000
@@ -4,8 +4,6 @@ reset master;
 reset slave;
 drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
 start slave;
-set @old_global_binlog_format = @@global.binlog_format;
-set @@global.binlog_format = statement;
 CREATE SCHEMA IF NOT EXISTS mysqlslap;
 USE mysqlslap;
 select @@global.binlog_format;
@@ -71,70 +69,3 @@ drop table t1;
 FLUSH LOGS;
 FLUSH LOGS;
 End of 5.0 tests
-set @@global.binlog_format = mixed;
-CREATE SCHEMA IF NOT EXISTS mysqlslap;
-USE mysqlslap;
-select @@global.binlog_format;
-@@global.binlog_format
-MIXED
-CREATE TABLE t1 (id INT primary key auto_increment, name VARCHAR(64));
-FLUSH TABLE t1;
-SELECT COUNT(*) FROM t1;
-COUNT(*)
-5000
-use mysqlslap;
-SELECT COUNT(*) FROM t1;
-COUNT(*)
-5000
-truncate table t1;
-insert delayed into t1 values(10, "my name");
-insert delayed into t1 values(10, "is Bond"), (20, "James Bond");
-flush table t1;
-select * from t1;
-id	name
-10	my name
-20	James Bond
-select * from t1;
-id	name
-10	my name
-20	James Bond
-delete from t1 where id!=10;
-insert delayed into t1 values(20, "is Bond"), (10, "James Bond");
-flush table t1;
-select * from t1;
-id	name
-10	my name
-20	is Bond
-select * from t1;
-id	name
-10	my name
-20	is Bond
-USE test;
-DROP SCHEMA mysqlslap;
-use test;
-FLUSH LOGS;
-FLUSH LOGS;
-CREATE TABLE t1(a int, UNIQUE(a));
-INSERT DELAYED IGNORE INTO t1 VALUES(1);
-INSERT DELAYED IGNORE INTO t1 VALUES(1);
-flush table t1;
-show binlog events in 'master-bin.000002' LIMIT 2,2;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-x	x	x	x	x	use `test`; INSERT DELAYED IGNORE INTO t1 VALUES(1)
-x	x	x	x	x	use `test`; INSERT DELAYED IGNORE INTO t1 VALUES(1)
-select * from t1;
-a
-1
-On slave
-show binlog events in 'slave-bin.000002' LIMIT 2,2;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-x	x	x	x	x	use `test`; INSERT DELAYED IGNORE INTO t1 VALUES(1)
-x	x	x	x	x	use `test`; INSERT DELAYED IGNORE INTO t1 VALUES(1)
-select * from t1;
-a
-1
-drop table t1;
-FLUSH LOGS;
-FLUSH LOGS;
-End of 5.0 tests
-set @@global.binlog_format = @old_global_binlog_format;

=== modified file 'mysql-test/suite/rpl/r/rpl_stm_loadfile.result'
--- a/mysql-test/suite/rpl/r/rpl_stm_loadfile.result	2009-05-20 10:28:43 +0000
+++ b/mysql-test/suite/rpl/r/rpl_stm_loadfile.result	2009-06-30 14:46:25 +0000
@@ -10,7 +10,7 @@ CREATE TABLE test.t1 (a INT, blob_column
 INSERT INTO test.t1  VALUES(1,'test');
 UPDATE test.t1 SET blob_column=LOAD_FILE('../../std_data/words2.dat') WHERE a=1;
 Warnings:
-Note	1592	Statement may not be safe to log in statement format.
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
 create procedure test.p1()
 begin
 INSERT INTO test.t1  VALUES(2,'test');
@@ -18,7 +18,7 @@ UPDATE test.t1 SET blob_column=LOAD_FILE
 end|
 CALL test.p1();
 Warnings:
-Note	1592	Statement may not be safe to log in statement format.
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
 SELECT * FROM test.t1 ORDER BY blob_column;
 a	blob_column
 1	abase

=== modified file 'mysql-test/suite/rpl/r/rpl_temporary_errors.result'
--- a/mysql-test/suite/rpl/r/rpl_temporary_errors.result	2008-10-13 18:33:08 +0000
+++ b/mysql-test/suite/rpl/r/rpl_temporary_errors.result	2009-06-30 14:46:25 +0000
@@ -6,7 +6,6 @@ drop table if exists t1,t2,t3,t4,t5,t6,t
 start slave;
 call mtr.add_suppression("Deadlock found");
 **** On Master ****
-SET SESSION BINLOG_FORMAT=ROW;
 CREATE TABLE t1 (a INT PRIMARY KEY, b INT);
 INSERT INTO t1 VALUES (1,1), (2,2), (3,3), (4,4);
 **** On Slave ****

=== modified file 'mysql-test/suite/rpl/r/rpl_udf.result'
--- a/mysql-test/suite/rpl/r/rpl_udf.result	2009-05-20 10:28:43 +0000
+++ b/mysql-test/suite/rpl/r/rpl_udf.result	2009-06-30 14:46:25 +0000
@@ -4,7 +4,6 @@ reset master;
 reset slave;
 drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
 start slave;
-set binlog_format=row;
 drop table if exists t1;
 "*** Test 1) Test UDFs via loadable libraries ***
 "Running on the master"
@@ -156,163 +155,3 @@ affected rows: 0
 "Running on the master"
 DROP TABLE t1;
 affected rows: 0
-set binlog_format=statement;
-drop table if exists t1;
-"*** Test 1) Test UDFs via loadable libraries ***
-"Running on the master"
-CREATE FUNCTION myfunc_double RETURNS REAL SONAME "UDF_EXAMPLE_LIB";
-affected rows: 0
-CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB";
-affected rows: 0
-CREATE FUNCTION myfunc_nonexist RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB";
-ERROR HY000: Can't find symbol 'myfunc_nonexist' in library
-SELECT * FROM mysql.func ORDER BY name;
-name	ret	dl	type
-myfunc_double	1	UDF_LIB	function
-myfunc_int	2	UDF_LIB	function
-affected rows: 2
-"Running on the slave"
-SELECT * FROM mysql.func ORDER BY name;
-name	ret	dl	type
-myfunc_double	1	UDF_LIB	function
-myfunc_int	2	UDF_LIB	function
-affected rows: 2
-"Running on the master"
-CREATE TABLE t1(sum INT, price FLOAT(24)) ENGINE=MyISAM;
-affected rows: 0
-INSERT INTO t1 VALUES(myfunc_int(100), myfunc_double(50.00));
-Warnings:
-Note	1592	Statement may not be safe to log in statement format.
-affected rows: 1
-INSERT INTO t1 VALUES(myfunc_int(10), myfunc_double(5.00));
-Warnings:
-Note	1592	Statement may not be safe to log in statement format.
-affected rows: 1
-INSERT INTO t1 VALUES(myfunc_int(200), myfunc_double(25.00));
-Warnings:
-Note	1592	Statement may not be safe to log in statement format.
-affected rows: 1
-INSERT INTO t1 VALUES(myfunc_int(1), myfunc_double(500.00));
-Warnings:
-Note	1592	Statement may not be safe to log in statement format.
-affected rows: 1
-SELECT * FROM t1 ORDER BY sum;
-sum	price
-1	48.5
-10	48.75
-100	48.6
-200	49
-affected rows: 4
-"Running on the slave"
-SELECT * FROM t1 ORDER BY sum;
-sum	price
-1	48.5
-10	48.75
-100	48.6
-200	49
-affected rows: 4
-SELECT myfunc_int(25);
-myfunc_int(25)
-25
-affected rows: 1
-SELECT myfunc_double(75.00);
-myfunc_double(75.00)
-50.00
-affected rows: 1
-"Running on the master"
-DROP FUNCTION myfunc_double;
-affected rows: 0
-DROP FUNCTION myfunc_int;
-affected rows: 0
-SELECT * FROM mysql.func ORDER BY name;
-name	ret	dl	type
-affected rows: 0
-"Running on the slave"
-SELECT * FROM mysql.func ORDER BY name;
-name	ret	dl	type
-affected rows: 0
-"Running on the master"
-DROP TABLE t1;
-affected rows: 0
-"*** Test 2) Test UDFs with SQL body ***
-"Running on the master"
-CREATE FUNCTION myfuncsql_int(i INT) RETURNS INTEGER DETERMINISTIC RETURN i;
-affected rows: 0
-CREATE FUNCTION myfuncsql_double(d DOUBLE) RETURNS INTEGER DETERMINISTIC RETURN d * 2.00;
-affected rows: 0
-SELECT db, name, type,  param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%' ORDER BY name;
-db	name	type	param_list	body	comment
-test	myfuncsql_double	FUNCTION	d DOUBLE	RETURN d * 2.00	
-test	myfuncsql_int	FUNCTION	i INT	RETURN i	
-affected rows: 2
-"Running on the slave"
-SELECT db, name, type,  param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%' ORDER BY name;
-db	name	type	param_list	body	comment
-test	myfuncsql_double	FUNCTION	d DOUBLE	RETURN d * 2.00	
-test	myfuncsql_int	FUNCTION	i INT	RETURN i	
-affected rows: 2
-"Running on the master"
-CREATE TABLE t1(sum INT, price FLOAT(24)) ENGINE=MyISAM;
-affected rows: 0
-INSERT INTO t1 VALUES(myfuncsql_int(100), myfuncsql_double(50.00));
-affected rows: 1
-INSERT INTO t1 VALUES(myfuncsql_int(10), myfuncsql_double(5.00));
-affected rows: 1
-INSERT INTO t1 VALUES(myfuncsql_int(200), myfuncsql_double(25.00));
-affected rows: 1
-INSERT INTO t1 VALUES(myfuncsql_int(1), myfuncsql_double(500.00));
-affected rows: 1
-SELECT * FROM t1 ORDER BY sum;
-sum	price
-1	1000
-10	10
-100	100
-200	50
-affected rows: 4
-"Running on the slave"
-SELECT * FROM t1 ORDER BY sum;
-sum	price
-1	1000
-10	10
-100	100
-200	50
-affected rows: 4
-"Running on the master"
-ALTER FUNCTION myfuncsql_int COMMENT "This was altered.";
-affected rows: 0
-ALTER FUNCTION myfuncsql_double COMMENT "This was altered.";
-affected rows: 0
-SELECT db, name, type,  param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%' ORDER BY name;
-db	name	type	param_list	body	comment
-test	myfuncsql_double	FUNCTION	d DOUBLE	RETURN d * 2.00	This was altered.
-test	myfuncsql_int	FUNCTION	i INT	RETURN i	This was altered.
-affected rows: 2
-"Running on the slave"
-SELECT db, name, type,  param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%' ORDER BY name;
-db	name	type	param_list	body	comment
-test	myfuncsql_double	FUNCTION	d DOUBLE	RETURN d * 2.00	This was altered.
-test	myfuncsql_int	FUNCTION	i INT	RETURN i	This was altered.
-affected rows: 2
-SELECT myfuncsql_int(25);
-myfuncsql_int(25)
-25
-affected rows: 1
-SELECT myfuncsql_double(75.00);
-myfuncsql_double(75.00)
-150
-affected rows: 1
-"Running on the master"
-DROP FUNCTION myfuncsql_double;
-affected rows: 0
-DROP FUNCTION myfuncsql_int;
-affected rows: 0
-SELECT db, name, type,  param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%' ORDER BY name;
-db	name	type	param_list	body	comment
-affected rows: 0
-"Running on the slave"
-SELECT db, name, type,  param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%' ORDER BY name;
-db	name	type	param_list	body	comment
-affected rows: 0
-"Running on the master"
-DROP TABLE t1;
-affected rows: 0

=== modified file 'mysql-test/suite/rpl/t/rpl_bug31076.test'
--- a/mysql-test/suite/rpl/t/rpl_bug31076.test	2007-12-14 18:02:02 +0000
+++ b/mysql-test/suite/rpl/t/rpl_bug31076.test	2009-06-30 14:46:25 +0000
@@ -1,4 +1,5 @@
 source include/master-slave.inc;
+source include/have_binlog_format_mixed_or_row.inc;
 
 CREATE DATABASE track;
 USE track;

=== modified file 'mysql-test/suite/rpl/t/rpl_events.test'
--- a/mysql-test/suite/rpl/t/rpl_events.test	2009-01-30 13:44:49 +0000
+++ b/mysql-test/suite/rpl/t/rpl_events.test	2009-06-30 14:46:25 +0000
@@ -5,7 +5,6 @@
 # in both row based and statement based format                   #
 ##################################################################
 
---source include/not_embedded.inc
 --source include/master-slave.inc
 
 SET @old_event_scheduler = @@global.event_scheduler;
@@ -13,14 +12,6 @@ set global event_scheduler=1;
 
 let $engine_type= MyISAM;
 
-set binlog_format=row;
-
-# Embedded server doesn't support binlogging
---source include/rpl_events.inc
-
-set binlog_format=statement;
-
-# Embedded server doesn't support binlogging
 --source include/rpl_events.inc
 
 #

=== modified file 'mysql-test/suite/rpl/t/rpl_extraColmaster_innodb.test'
--- a/mysql-test/suite/rpl/t/rpl_extraColmaster_innodb.test	2007-10-10 14:43:20 +0000
+++ b/mysql-test/suite/rpl/t/rpl_extraColmaster_innodb.test	2009-06-30 14:46:25 +0000
@@ -3,14 +3,7 @@
 #############################################################
 -- source include/master-slave.inc
 -- source include/have_innodb.inc
+source include/have_binlog_format_row.inc;
 
 let $engine_type = 'InnoDB';
-
-set binlog_format=row;
--- source extra/rpl_tests/rpl_extraMaster_Col.test
-
-set binlog_format=statement;
--- source extra/rpl_tests/rpl_extraMaster_Col.test
-
-set binlog_format=mixed;
--- source extra/rpl_tests/rpl_extraMaster_Col.test
+--source extra/rpl_tests/rpl_extraMaster_Col.test

=== modified file 'mysql-test/suite/rpl/t/rpl_extraColmaster_myisam.test'
--- a/mysql-test/suite/rpl/t/rpl_extraColmaster_myisam.test	2007-10-10 14:43:20 +0000
+++ b/mysql-test/suite/rpl/t/rpl_extraColmaster_myisam.test	2009-06-30 14:46:25 +0000
@@ -2,14 +2,7 @@
 # Purpose: To test having extra columns on the master WL#3915
 #############################################################
 -- source include/master-slave.inc
+source include/have_binlog_format_row.inc;
 
 let $engine_type = 'MyISAM';
-
-set binlog_format=row;
--- source extra/rpl_tests/rpl_extraMaster_Col.test
-
-set binlog_format=statement;
--- source extra/rpl_tests/rpl_extraMaster_Col.test
-
-set binlog_format=mixed;
--- source extra/rpl_tests/rpl_extraMaster_Col.test
+--source extra/rpl_tests/rpl_extraMaster_Col.test

=== modified file 'mysql-test/suite/rpl/t/rpl_idempotency.test'
--- a/mysql-test/suite/rpl/t/rpl_idempotency.test	2009-04-05 12:03:04 +0000
+++ b/mysql-test/suite/rpl/t/rpl_idempotency.test	2009-06-30 14:46:25 +0000
@@ -127,6 +127,13 @@ select * from ti1 order by b /* must be 
 insert into ti2 set a=1, b=1;
 select * from ti2 order by b /* must be (1,1) (2,2) */;
 
+# Set the binlog_format for the slave thread.
+connection slave;
+STOP SLAVE;
+SET @old_slave_global_binlog_format= @@global.binlog_format;
+SET global binlog_format=row;
+START SLAVE;
+ 
 connection master;
 
 # from now on checking rbr specific idempotent errors
@@ -391,11 +398,11 @@ connection master;
 sync_slave_with_master;
 #connection slave;
 SET @@global.slave_exec_mode= @old_slave_exec_mode;
+SET @@global.binlog_format= @old_slave_global_binlog_format;
 
 # cleanup for bug#31609 tests
 
 connection master;
-set @@session.binlog_format= @save_binlog_format;
 drop table t1,t2,ti2,ti1;
 
 --source include/master-slave-end.inc

=== added file 'mysql-test/suite/rpl/t/rpl_mix_found_rows.test'
--- a/mysql-test/suite/rpl/t/rpl_mix_found_rows.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_mix_found_rows.test	2009-06-30 14:46:25 +0000
@@ -0,0 +1,150 @@
+source include/master-slave.inc;
+source include/have_binlog_format_mixed.inc;
+
+--echo ==== Initialize ====
+
+--echo **** On Master ****
+connection master;
+CREATE TABLE t1 (a INT);
+CREATE TABLE logtbl (sect INT, test INT, count INT);
+
+INSERT INTO t1 VALUES (1),(2),(3);
+INSERT INTO t1 SELECT 2*a+3 FROM t1;
+INSERT INTO t1 SELECT 2*a+3 FROM t1;
+INSERT INTO t1 SELECT 2*a+3 FROM t1;
+INSERT INTO t1 SELECT 2*a+3 FROM t1;
+INSERT INTO t1 SELECT 2*a+3 FROM t1;
+INSERT INTO t1 SELECT 2*a+3 FROM t1;
+
+--echo ==== Checking a procedure ====
+
+--echo **** On Master ****
+connection master;
+
+# We will now check some stuff that will not work in statement-based
+# replication, but which should cause the binary log to switch to
+# row-based logging.
+
+--delimiter $$
+CREATE PROCEDURE just_log(sect INT, test INT) BEGIN
+  INSERT INTO logtbl VALUES (sect,test,FOUND_ROWS());
+END $$
+--delimiter ;
+sync_slave_with_master;
+
+--echo **** On Master 1 ****
+connection master1;
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a > 5 ORDER BY a LIMIT 1;
+CALL just_log(1,1);
+
+--echo **** On Master ****
+connection master;
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a > 5 ORDER BY a LIMIT 1;
+CALL just_log(1,2);
+
+--echo **** On Master 1 ****
+
+connection master1;
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a < 5 ORDER BY a LIMIT 1;
+CALL just_log(1,3);
+sync_slave_with_master;
+
+--echo **** On Master ****
+connection master;
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a > 5 ORDER BY a LIMIT 1;
+CALL just_log(1,4);
+sync_slave_with_master;
+
+connection master;
+SELECT * FROM logtbl WHERE sect = 1 ORDER BY sect,test;
+--echo **** On Slave ****
+sync_slave_with_master;
+SELECT * FROM logtbl WHERE sect = 1 ORDER BY sect,test;
+
+--echo ==== Checking a stored function ====
+--echo **** On Master ****
+connection master;
+--delimiter $$
+CREATE FUNCTION log_rows(sect INT, test INT)
+  RETURNS INT
+BEGIN
+  DECLARE found_rows INT;
+  SELECT FOUND_ROWS() INTO found_rows;
+  INSERT INTO logtbl VALUES(sect,test,found_rows);
+  RETURN found_rows;
+END $$
+--delimiter ;
+
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a < 5 ORDER BY a LIMIT 1;
+SELECT log_rows(2,1), log_rows(2,2);
+
+CREATE TABLE t2 (a INT, b INT);
+
+# Trying with referencing FOUND_ROWS() directly in the trigger.
+
+--delimiter $$
+CREATE TRIGGER t2_tr BEFORE INSERT ON t2 FOR EACH ROW
+BEGIN
+  INSERT INTO logtbl VALUES (NEW.a, NEW.b, FOUND_ROWS());
+END $$
+--delimiter ;
+
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a < 5 ORDER BY a LIMIT 1;
+INSERT INTO t2 VALUES (2,3), (2,4);
+
+# Referencing FOUND_ROWS() indirectly.
+
+DROP TRIGGER t2_tr;
+
+--delimiter $$
+CREATE TRIGGER t2_tr BEFORE INSERT ON t2 FOR EACH ROW
+BEGIN
+  DECLARE dummy INT;
+  SELECT log_rows(NEW.a, NEW.b) INTO dummy;
+END $$
+--delimiter ;
+
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a > 5 ORDER BY a LIMIT 1;
+INSERT INTO t2 VALUES (2,5), (2,6);
+
+# Putting FOUND_ROWS() even lower in the call chain.
+
+connection master;
+DROP TRIGGER t2_tr;
+
+--delimiter $$
+CREATE PROCEDURE log_me_inner(sect INT, test INT)
+BEGIN
+  DECLARE dummy INT;
+  SELECT log_rows(sect, test) INTO dummy;
+  SELECT log_rows(sect, test+1) INTO dummy;
+END $$
+
+CREATE PROCEDURE log_me(sect INT, test INT)
+BEGIN
+  CALL log_me_inner(sect,test);
+END $$
+--delimiter ;
+
+--delimiter $$
+CREATE TRIGGER t2_tr BEFORE INSERT ON t2 FOR EACH ROW
+BEGIN
+  CALL log_me(NEW.a, NEW.b);
+END $$
+--delimiter ;
+
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a > 5 ORDER BY a LIMIT 1;
+INSERT INTO t2 VALUES (2,5), (2,6);
+
+SELECT * FROM logtbl WHERE sect = 2 ORDER BY sect,test;
+sync_slave_with_master;
+SELECT * FROM logtbl WHERE sect = 2 ORDER BY sect,test;
+
+connection master;
+DROP TABLE t1, t2, logtbl;
+DROP PROCEDURE just_log;
+DROP PROCEDURE log_me;
+DROP PROCEDURE log_me_inner;
+DROP FUNCTION log_rows;
+sync_slave_with_master;
+

=== added file 'mysql-test/suite/rpl/t/rpl_mix_insert_delayed.test'
--- a/mysql-test/suite/rpl/t/rpl_mix_insert_delayed.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_mix_insert_delayed.test	2009-06-30 14:46:25 +0000
@@ -0,0 +1,5 @@
+--source include/have_binlog_format_mixed.inc
+--source include/master-slave.inc
+--source include/not_embedded.inc
+--source include/not_windows.inc
+--source extra/rpl_tests/rpl_insert_delayed.test

=== modified file 'mysql-test/suite/rpl/t/rpl_rbr_to_sbr.test'
--- a/mysql-test/suite/rpl/t/rpl_rbr_to_sbr.test	2008-07-16 09:17:10 +0000
+++ b/mysql-test/suite/rpl/t/rpl_rbr_to_sbr.test	2009-06-30 14:46:25 +0000
@@ -1,15 +1,9 @@
--- source include/have_binlog_format_mixed_or_statement.inc
+-- source include/have_binlog_format_mixed.inc
 -- source include/not_ndb_default.inc
 -- source include/master-slave.inc
 
-# Test that the slave temporarily switches to ROW when seeing binrow
-# events when it is in STATEMENT or MIXED mode
-
-SET @old_binlog_format= @@global.binlog_format;
-
-SET BINLOG_FORMAT=MIXED;
-SET GLOBAL BINLOG_FORMAT=MIXED;
-SELECT @@GLOBAL.BINLOG_FORMAT, @@SESSION.BINLOG_FORMAT;
+# Test that the slave temporarily switches to ROW when seeing row
+# events when it is in MIXED mode
 
 --echo **** On Master ****
 CREATE TABLE t1 (a INT, b LONG);
@@ -35,7 +29,6 @@ SHOW BINLOG EVENTS;
 
 connection master;
 DROP TABLE IF EXISTS t1;
-SET @@global.binlog_format= @old_binlog_format;
 
 # Let's compare. Note: If they match test will pass, if they do not match
 # the test will show that the diff statement failed and not reject file

=== modified file 'mysql-test/suite/rpl/t/rpl_row_insert_delayed.test'
--- a/mysql-test/suite/rpl/t/rpl_row_insert_delayed.test	2007-06-27 12:28:02 +0000
+++ b/mysql-test/suite/rpl/t/rpl_row_insert_delayed.test	2009-06-30 14:46:25 +0000
@@ -2,13 +2,4 @@
 --source include/master-slave.inc
 --source include/not_embedded.inc
 --source include/not_windows.inc
-
-connection master;
-set @old_global_binlog_format = @@global.binlog_format;
-
-let $binlog_format_statement=0;
-set @@global.binlog_format = row;
 --source extra/rpl_tests/rpl_insert_delayed.test
-
-connection master;
-set @@global.binlog_format = @old_global_binlog_format;

=== modified file 'mysql-test/suite/rpl/t/rpl_slave_skip.test'
--- a/mysql-test/suite/rpl/t/rpl_slave_skip.test	2009-01-23 12:22:05 +0000
+++ b/mysql-test/suite/rpl/t/rpl_slave_skip.test	2009-06-30 14:46:25 +0000
@@ -1,6 +1,12 @@
 source include/master-slave.inc;
 source include/have_innodb.inc;
 
+# Every statement in this test is either executing under ROW or
+# STATEMENT format, which requires the slave thread to be able to apply
+# both statement and row events. Hence, we only need to execute this
+# test for MIXED mode.
+source include/have_binlog_format_mixed.inc;
+
 --echo **** On Slave ****
 connection slave;
 source include/have_innodb.inc;

=== renamed file 'mysql-test/suite/rpl/t/rpl_found_rows.test' => 'mysql-test/suite/rpl/t/rpl_stm_found_rows.test'
--- a/mysql-test/suite/rpl/t/rpl_found_rows.test	2008-10-06 08:27:36 +0000
+++ b/mysql-test/suite/rpl/t/rpl_stm_found_rows.test	2009-06-30 14:46:25 +0000
@@ -1,4 +1,5 @@
 source include/master-slave.inc;
+source include/have_binlog_format_statement.inc;
 
 # It is not possible to replicate FOUND_ROWS() using statement-based
 # replication, but there is a workaround that stores the result of
@@ -8,9 +9,7 @@ source include/master-slave.inc;
 # function properly even when inside stored programs (i.e., stored
 # routines and triggers).
 
---echo ==== 0. Setting it all up ====
-
-SET BINLOG_FORMAT=STATEMENT;
+--echo ==== Initialize ====
 
 --echo **** On Master ****
 connection master;
@@ -25,9 +24,8 @@ INSERT INTO t1 SELECT 2*a+3 FROM t1;
 INSERT INTO t1 SELECT 2*a+3 FROM t1;
 INSERT INTO t1 SELECT 2*a+3 FROM t1;
 
---echo #### 1. Using statement mode ####
 
---echo ==== 1.1. Simple test ====
+--echo ==== Simple test ====
 
 SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a > 5 ORDER BY a LIMIT 1;
 
@@ -49,7 +47,8 @@ SELECT * FROM logtbl WHERE sect = 1 ORDE
 sync_slave_with_master;
 SELECT * FROM logtbl WHERE sect = 1 ORDER BY sect,test;
 
---echo ==== 1.2. Stored procedure ====
+
+--echo ==== Stored procedure ====
 
 # Here we do both the calculation and the logging. We also do it twice
 # to make sure that there are no limitations on how many times it can
@@ -86,7 +85,8 @@ SELECT * FROM logtbl WHERE sect = 2 ORDE
 sync_slave_with_master;
 SELECT * FROM logtbl WHERE sect = 2 ORDER BY sect,test;
 
---echo ==== 1.3. Stored functions ====
+
+--echo ==== Stored functions ====
 --echo **** On Master ****
 connection master;
 --delimiter $$
@@ -107,10 +107,11 @@ SELECT * FROM logtbl WHERE sect = 3 ORDE
 sync_slave_with_master;
 SELECT * FROM logtbl WHERE sect = 3 ORDER BY sect,test;
 
---echo ==== 1.9. Cleanup ====
+
+--echo ==== Cleanup ====
 --echo **** On Master ****
 connection master;
-DELETE FROM logtbl;
+DROP TABLE t1, logtbl;
 DROP PROCEDURE just_log;
 DROP PROCEDURE calc_and_log;
 DROP FUNCTION log_rows;
@@ -118,139 +119,3 @@ sync_slave_with_master;
 
 source include/reset_master_and_slave.inc;
 
---echo #### 2. Using mixed mode ####
-
---echo ==== 2.1. Checking a procedure ====
-
---echo **** On Master ****
-connection master;
-SET BINLOG_FORMAT=MIXED;
-
-# We will now check some stuff that will not work in statement-based
-# replication, but which should cause the binary log to switch to
-# row-based logging.
-
---delimiter $$
-CREATE PROCEDURE just_log(sect INT, test INT) BEGIN
-  INSERT INTO logtbl VALUES (sect,test,FOUND_ROWS());
-END $$
---delimiter ;
-sync_slave_with_master;
-
---echo **** On Master 1 ****
-connection master1;
-SET BINLOG_FORMAT=MIXED;
-SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a > 5 ORDER BY a LIMIT 1;
-CALL just_log(1,1);
-
---echo **** On Master ****
-connection master;
-SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a > 5 ORDER BY a LIMIT 1;
-CALL just_log(1,2);
-
---echo **** On Master 1 ****
-
-connection master1;
-SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a < 5 ORDER BY a LIMIT 1;
-CALL just_log(1,3);
-sync_slave_with_master;
-
---echo **** On Master ****
-connection master;
-SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a > 5 ORDER BY a LIMIT 1;
-CALL just_log(1,4);
-sync_slave_with_master;
-
-connection master;
-SELECT * FROM logtbl WHERE sect = 1 ORDER BY sect,test;
---echo **** On Slave ****
-sync_slave_with_master;
-SELECT * FROM logtbl WHERE sect = 1 ORDER BY sect,test;
-
---echo ==== 2.1. Checking a stored function ====

---echo **** On Master ****
-connection master;
---delimiter $$
-CREATE FUNCTION log_rows(sect INT, test INT)
-  RETURNS INT
-BEGIN
-  DECLARE found_rows INT;
-  SELECT FOUND_ROWS() INTO found_rows;
-  INSERT INTO logtbl VALUES(sect,test,found_rows);
-  RETURN found_rows;
-END $$
---delimiter ;
-
-SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a < 5 ORDER BY a LIMIT 1;
-SELECT log_rows(2,1), log_rows(2,2);
-
-CREATE TABLE t2 (a INT, b INT);
-
-# Trying with referencing FOUND_ROWS() directly in the trigger.
-
---delimiter $$
-CREATE TRIGGER t2_tr BEFORE INSERT ON t2 FOR EACH ROW
-BEGIN
-  INSERT INTO logtbl VALUES (NEW.a, NEW.b, FOUND_ROWS());
-END $$
---delimiter ;
-
-SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a < 5 ORDER BY a LIMIT 1;
-INSERT INTO t2 VALUES (2,3), (2,4);
-
-# Referencing FOUND_ROWS() indirectly.
-
-DROP TRIGGER t2_tr;
-
---delimiter $$
-CREATE TRIGGER t2_tr BEFORE INSERT ON t2 FOR EACH ROW
-BEGIN
-  DECLARE dummy INT;
-  SELECT log_rows(NEW.a, NEW.b) INTO dummy;
-END $$
---delimiter ;
-
-SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a > 5 ORDER BY a LIMIT 1;
-INSERT INTO t2 VALUES (2,5), (2,6);
-
-# Putting FOUND_ROWS() even lower in the call chain.
-
-connection master;
-DROP TRIGGER t2_tr;
-
---delimiter $$
-CREATE PROCEDURE log_me_inner(sect INT, test INT)
-BEGIN
-  DECLARE dummy INT;
-  SELECT log_rows(sect, test) INTO dummy;
-  SELECT log_rows(sect, test+1) INTO dummy;
-END $$
-
-CREATE PROCEDURE log_me(sect INT, test INT)
-BEGIN
-  CALL log_me_inner(sect,test);
-END $$
---delimiter ;
-
---delimiter $$
-CREATE TRIGGER t2_tr BEFORE INSERT ON t2 FOR EACH ROW
-BEGIN
-  CALL log_me(NEW.a, NEW.b);
-END $$
---delimiter ;
-
-SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a > 5 ORDER BY a LIMIT 1;
-INSERT INTO t2 VALUES (2,5), (2,6);
-
-SELECT * FROM logtbl WHERE sect = 2 ORDER BY sect,test;
-sync_slave_with_master;
-SELECT * FROM logtbl WHERE sect = 2 ORDER BY sect,test;
-
-connection master;
-DROP TABLE t1, t2, logtbl;
-DROP PROCEDURE just_log;
-DROP PROCEDURE log_me;
-DROP PROCEDURE log_me_inner;
-DROP FUNCTION log_rows;
-sync_slave_with_master;
-

=== modified file 'mysql-test/suite/rpl/t/rpl_stm_insert_delayed.test'
--- a/mysql-test/suite/rpl/t/rpl_stm_insert_delayed.test	2007-06-27 12:28:02 +0000
+++ b/mysql-test/suite/rpl/t/rpl_stm_insert_delayed.test	2009-06-30 14:46:25 +0000
@@ -1,20 +1,5 @@
-# we run first in statement-based then in mixed binlogging
-
---source include/have_binlog_format_mixed_or_statement.inc
+--source include/have_binlog_format_statement.inc
 --source include/master-slave.inc
 --source include/not_embedded.inc
 --source include/not_windows.inc
-
-connection master;
-set @old_global_binlog_format = @@global.binlog_format;
-
-let $binlog_format_statement=1;
-set @@global.binlog_format = statement;
 --source extra/rpl_tests/rpl_insert_delayed.test
-
-let $binlog_format_statement=0;
-set @@global.binlog_format = mixed;
---source extra/rpl_tests/rpl_insert_delayed.test
-
-connection master;
-set @@global.binlog_format = @old_global_binlog_format;

=== modified file 'mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test'
--- a/mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test	2008-07-03 08:27:25 +0000
+++ b/mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test	2009-06-30 14:46:25 +0000
@@ -1,17 +1,25 @@
 #
 # rpl_switch_stm_row_mixed tests covers
 #
-#   - switching explicitly between STATEMENT, ROW, and MIXED binlog format
-#     showing when it is possible and when not. 
-#   - switching from MIXED to RBR implicitly listing all use cases,
-#     e.g a query invokes UUID(), thereafter to serve as the definition
-#     of MIXED binlog format
+#   - Master is switching explicitly between STATEMENT, ROW, and MIXED
+#     binlog format showing when it is possible and when not. 
+#   - Master switching from MIXED to RBR implicitly listing all use
+#     cases, e.g a query invokes UUID(), thereafter to serve as the
+#     definition of MIXED binlog format
 #   - correctness of execution
 
 
 -- source include/not_ndb_default.inc
 -- source include/master-slave.inc
 
+# Since this test generates row-based events in the binary log, the
+# slave SQL thread cannot be in STATEMENT mode to execute this test,
+# so we only execute it for MIXED and ROW as default value of
+# BINLOG_FORMAT.
+
+connection slave;
+-- source include/have_binlog_format_mixed_or_row.inc
+
 connection master;
 --disable_warnings
 drop database if exists mysqltest1;

=== modified file 'mysql-test/suite/rpl/t/rpl_temporary_errors.test'
--- a/mysql-test/suite/rpl/t/rpl_temporary_errors.test	2008-10-13 18:33:08 +0000
+++ b/mysql-test/suite/rpl/t/rpl_temporary_errors.test	2009-06-30 14:46:25 +0000
@@ -1,10 +1,10 @@
 source include/master-slave.inc;
+source include/have_binlog_format_row.inc;
 
 call mtr.add_suppression("Deadlock found");
 
 --echo **** On Master ****
 connection master;
-SET SESSION BINLOG_FORMAT=ROW;
 CREATE TABLE t1 (a INT PRIMARY KEY, b INT);
 INSERT INTO t1 VALUES (1,1), (2,2), (3,3), (4,4);
 --echo **** On Slave ****

=== modified file 'mysql-test/suite/rpl/t/rpl_udf.test'
--- a/mysql-test/suite/rpl/t/rpl_udf.test	2007-06-27 12:28:02 +0000
+++ b/mysql-test/suite/rpl/t/rpl_udf.test	2009-06-30 14:46:25 +0000
@@ -5,18 +5,7 @@
 # statement based format. This tests work completed in WL#3629.   #
 ###################################################################
 
---source include/not_embedded.inc
 --source include/master-slave.inc
 
 let $engine_type= MyISAM;
-
-set binlog_format=row;
-
-# Embedded server doesn't support binlogging
---source include/rpl_udf.inc
-
-set binlog_format=statement;
-
-# Embedded server doesn't support binlogging
 --source include/rpl_udf.inc
-

=== modified file 'mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result'
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result	2008-03-14 20:06:01 +0000
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result	2009-06-30 14:46:25 +0000
@@ -102,3 +102,4 @@ Last_IO_Errno	#
 Last_IO_Error	#
 Last_SQL_Errno	0
 Last_SQL_Error	
+DROP TABLE t1;

=== modified file 'mysql-test/suite/rpl_ndb/r/rpl_ndb_stm_innodb.result'
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_stm_innodb.result	2009-05-31 05:44:41 +0000
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_stm_innodb.result	2009-06-30 14:46:25 +0000
@@ -98,6 +98,16 @@ ALTER TABLE branch ENGINE NDB;
 ALTER TABLE teller ENGINE NDB;
 ALTER TABLE history ENGINE NDB;
 
+Warnings:
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
+Warnings:
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
+Warnings:
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
+Warnings:
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
+Warnings:
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
 select @log_name:=log_name, @start_pos:=start_pos, @end_pos:=end_pos
 from mysql.ndb_apply_status;
 @log_name:=log_name	@start_pos:=start_pos	@end_pos:=end_pos
@@ -110,6 +120,16 @@ master-bin.000001	#	Xid	1	<end_pos>	COMM
 ** Test 3 **
 
 FLUSH LOGS;
+Warnings:
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
+Warnings:
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
+Warnings:
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
+Warnings:
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
+Warnings:
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
 
 select @log_name:=log_name, @start_pos:=start_pos, @end_pos:=end_pos
 from mysql.ndb_apply_status;
@@ -129,6 +149,16 @@ reset slave;
 drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
 start slave;
 
+Warnings:
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
+Warnings:
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
+Warnings:
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
+Warnings:
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
+Warnings:
+Note	1592	Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT.
 select @log_name:=log_name, @start_pos:=start_pos, @end_pos:=end_pos
 from mysql.ndb_apply_status;
 @log_name:=log_name	@start_pos:=start_pos	@end_pos:=end_pos

=== modified file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_2innodb.test'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2innodb.test	2008-03-06 09:16:14 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2innodb.test	2009-06-30 14:46:25 +0000
@@ -6,9 +6,14 @@
 # cluster slave. Due to limitations I have created wrappers
 # to be able to use the same code for all these different
 # test and to have control over the tests.
+#
+# Since the master generates row-based events, the slave may not be in
+# STATEMENT mode to accept the events.
+#
 ##############################################################
 -- source include/have_ndb.inc
 -- source include/master-slave.inc
+-- source include/have_binlog_format_mixed_or_row.inc
 
 -- connection slave
 -- source include/have_innodb.inc

=== modified file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_2myisam.test'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2myisam.test	2008-03-06 09:16:14 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2myisam.test	2009-06-30 14:46:25 +0000
@@ -6,9 +6,14 @@
 # cluster slave. Due to limitations I have created wrappers
 # to be able to use the same code for all these different
 # test and to have control over the tests.
+#
+# Since the master generates row-based events, the slave may not be in
+# STATEMENT mode to accept the events.
+#
 ##############################################################
 -- source include/have_ndb.inc
 -- source include/master-slave.inc
+-- source include/have_binlog_format_mixed_or_row.inc
 
 -- connection slave
 

=== modified file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test	2008-07-10 16:09:39 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test	2009-06-30 14:46:25 +0000
@@ -1,7 +1,9 @@
+# Since the master generates row-based events, the slave may not be in
+# STATEMENT mode to accept the events.
+
 --source include/have_ndb.inc
 --source include/ndb_master-slave.inc
-
-
+--source include/have_binlog_format_mixed_or_row.inc
 
 #
 # Bug #11087

=== modified file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_blob.test'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_blob.test	2007-09-05 16:44:47 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_blob.test	2009-06-30 14:46:25 +0000
@@ -1,9 +1,12 @@
 --source include/have_ndb.inc
 --source include/ndb_master-slave.inc
+--source include/have_binlog_format_mixed_or_row.inc
 
 #
 # basic test of blob replication for NDB
 #
+# Since the master generates row-based events, the slave may not be in
+# STATEMENT mode to accept the events.
 
 # easy test
 

=== modified file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_blob2.test'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_blob2.test	2007-09-05 16:44:47 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_blob2.test	2009-06-30 14:46:25 +0000
@@ -3,8 +3,13 @@
 # Using wrapper to share test   #
 # code between engine tests     #
 #################################
+#
+# Since the master generates row-based events, the slave may not be in
+# STATEMENT mode to accept the events.
+#
 -- source include/have_ndb.inc
 -- source include/ndb_master-slave.inc
 let $engine_type=NDBCLUSTER;
 -- source extra/rpl_tests/rpl_row_blob.test
+-- source include/have_binlog_format_mixed_or_row.inc
 

=== modified file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test	2008-03-14 14:42:27 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test	2009-06-30 14:46:25 +0000
@@ -1,5 +1,6 @@
 --source include/have_ndb.inc
 --source include/ndb_master-slave.inc
+source include/have_binlog_format_mixed_or_row.inc;
 
 # set up circular replication
 

=== modified file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_simplex.test'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_simplex.test	2008-03-14 20:06:01 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_simplex.test	2009-06-30 14:46:25 +0000
@@ -1,5 +1,6 @@
 --source include/have_ndb.inc
 --source include/ndb_master-slave.inc
+source include/have_binlog_format_mixed_or_row.inc;
 
 connection master;
 CREATE TABLE t1 (a int key, b int) ENGINE=NDB;
@@ -78,3 +79,7 @@ SELECT * FROM t1 ORDER BY a;
 --replace_result $MASTER_MYPORT MASTER_PORT
 --replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
 query_vertical SHOW SLAVE STATUS;
+
+connection master;
+DROP TABLE t1;
+sync_slave_with_master;

=== modified file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_commit_afterflush.test'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_commit_afterflush.test	2007-09-05 16:44:47 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_commit_afterflush.test	2009-06-30 14:46:25 +0000
@@ -4,7 +4,12 @@
 # Different engines                 #
 # By JBM 2004-02-15                 #
 #####################################
+
+# Since the master generates row-based events, the slave may not be in
+# STATEMENT mode to accept the events.
+
 -- source include/have_ndb.inc
 -- source include/ndb_master-slave.inc
 let $engine_type=NDB;
 -- source extra/rpl_tests/rpl_commit_after_flush.test
+-- source include/have_binlog_format_mixed_or_row.inc

=== modified file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_ctype_ucs2_def.test'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_ctype_ucs2_def.test	2008-11-13 19:19:00 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_ctype_ucs2_def.test	2009-06-30 14:46:25 +0000
@@ -2,6 +2,11 @@
 --source include/have_ndb.inc
 --source include/ndb_master-slave.inc
 
+# Since the master generates row-based events, the slave may not be in
+# STATEMENT mode to accept the events.
+
+--source include/have_binlog_format_mixed_or_row.inc
+
 #
 # MySQL Bug#15276: MySQL ignores collation-server
 #

=== modified file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_delete_nowhere.test'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_delete_nowhere.test	2007-09-05 16:44:47 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_delete_nowhere.test	2009-06-30 14:46:25 +0000
@@ -4,5 +4,11 @@
 #########################################
 --source include/have_ndb.inc
 -- source include/ndb_master-slave.inc
+
+# Since the master generates row-based events, the slave may not be in
+# STATEMENT mode to accept the events.
+
+--source include/have_binlog_format_mixed_or_row.inc
+
 let $engine_type=NDB;
 -- source extra/rpl_tests/rpl_delete_no_where.test

=== modified file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_do_db.test'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_do_db.test	2007-09-05 16:44:47 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_do_db.test	2009-06-30 14:46:25 +0000
@@ -8,6 +8,11 @@
 --source include/have_ndb.inc
 --source include/ndb_master-slave.inc
 
+# Since the master generates row-based events, the slave may not be in
+# STATEMENT mode to accept the events.
+
+--source include/have_binlog_format_mixed_or_row.inc
+
 --disable_warnings
 DROP DATABASE IF EXISTS replica;
 --enable_warnings

=== modified file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_do_table.test'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_do_table.test	2007-09-05 16:44:47 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_do_table.test	2009-06-30 14:46:25 +0000
@@ -8,6 +8,11 @@
 --source include/have_ndb.inc
 --source include/ndb_master-slave.inc
 
+# Since the master generates row-based events, the slave may not be in
+# STATEMENT mode to accept the events.
+
+--source include/have_binlog_format_mixed_or_row.inc
+
 --disable_warnings
 DROP TABLE IF EXISTS t1, t2;
 --enable_warnings

=== modified file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_func003.test'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_func003.test	2007-09-05 16:44:47 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_func003.test	2009-06-30 14:46:25 +0000
@@ -8,6 +8,13 @@
 ###################################
 -- source include/have_ndb.inc
 -- source include/ndb_master-slave.inc
+
+# Since the master generates row-based events, the slave may not be in
+# STATEMENT mode to accept the events.
+
+-- source include/have_binlog_format_mixed_or_row.inc
+
 let $engine_type=NDB;
 -- source extra/rpl_tests/rpl_row_func003.test
 -- source include/master-slave-end.inc
+

=== modified file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb_trans.test'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb_trans.test	2007-12-12 17:19:24 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb_trans.test	2009-06-30 14:46:25 +0000
@@ -4,6 +4,11 @@
 -- source include/have_innodb.inc
 -- source include/ndb_master-slave.inc
 
+# Since the master generates row-based events, the slave may not be in
+# STATEMENT mode to accept the events.
+
+-- source include/have_binlog_format_mixed_or_row.inc
+
 create table t1 (a int, unique(a)) engine=ndbcluster;
 create table t2 (a int, unique(a)) engine=innodb;
 

=== modified file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_insert_ignore.test'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_insert_ignore.test	2007-09-05 16:44:47 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_insert_ignore.test	2009-06-30 14:46:25 +0000
@@ -3,6 +3,12 @@
 #####################################
 -- source include/have_ndb.inc
 -- source include/ndb_master-slave.inc
+
+# Since the master generates row-based events, the slave may not be in
+# STATEMENT mode to accept the events.
+
+-- source include/have_binlog_format_mixed_or_row.inc
+
 let $engine_type=NDB;
 let $engine_type2=myisam;
 -- source extra/rpl_tests/rpl_insert_ignore.test

=== modified file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions.test'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions.test	2008-08-13 21:18:31 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions.test	2009-06-30 14:46:25 +0000
@@ -26,6 +26,11 @@ source include/have_ndb.inc;
 source include/ndb_master-slave.inc;
 source include/have_innodb.inc;
 
+# Since the master generates row-based events, the slave may not be in
+# STATEMENT mode to accept the events.
+
+-- source include/have_binlog_format_mixed_or_row.inc
+
 CREATE TABLE tmyisam (a int) ENGINE = MYISAM;
 CREATE TABLE tinnodb (a int) ENGINE = INNODB;
 CREATE TABLE tndb (a int) ENGINE = NDB;

=== modified file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_multi_update3.test'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi_update3.test	2007-09-05 16:44:47 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi_update3.test	2009-06-30 14:46:25 +0000
@@ -4,5 +4,11 @@
 ############################################################
 -- source include/have_ndb.inc
 -- source include/ndb_master-slave.inc
+
+# Since the master generates row-based events, the slave may not be in
+# STATEMENT mode to accept the events.
+
+-- source include/have_binlog_format_mixed_or_row.inc
+
 let $engine_type=NDB;
 -- source extra/rpl_tests/rpl_multi_update3.test

=== modified file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_rep_ignore.test'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_rep_ignore.test	2007-09-05 16:44:47 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_rep_ignore.test	2009-06-30 14:46:25 +0000
@@ -9,6 +9,11 @@
 --source include/have_ndb.inc
 --source include/ndb_master-slave.inc
 
+# Since the master generates row-based events, the slave may not be in
+# STATEMENT mode to accept the events.
+
+-- source include/have_binlog_format_mixed_or_row.inc
+
 --disable_warnings
 DROP DATABASE IF EXISTS replica;
 --enable_warnings

=== modified file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_row_001.test'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_row_001.test	2007-09-05 16:44:47 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_row_001.test	2009-06-30 14:46:25 +0000
@@ -3,5 +3,11 @@
 ########################################################
 --source include/have_ndb.inc
 -- source include/ndb_master-slave.inc
+
+# Since the master generates row-based events, the slave may not be in
+# STATEMENT mode to accept the events.
+
+-- source include/have_binlog_format_mixed_or_row.inc
+
 let $engine_type=NDB;
 -- source extra/rpl_tests/rpl_row_001.test

=== modified file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_sp003.test'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_sp003.test	2007-09-05 16:44:47 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_sp003.test	2009-06-30 14:46:25 +0000
@@ -6,5 +6,11 @@
 #################################
 -- source include/have_ndb.inc
 -- source include/ndb_master-slave.inc
+
+# Since the master generates row-based events, the slave may not be in
+# STATEMENT mode to accept the events.
+
+-- source include/have_binlog_format_mixed_or_row.inc
+
 let $engine_type=NDBCLUSTER;
 -- source extra/rpl_tests/rpl_row_sp003.test

=== modified file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_sp006.test'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_sp006.test	2007-09-05 16:44:47 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_sp006.test	2009-06-30 14:46:25 +0000
@@ -6,5 +6,11 @@
 #################################
 -- source include/have_ndb.inc
 -- source include/ndb_master-slave.inc
+
+# Since the master generates row-based events, the slave may not be in
+# STATEMENT mode to accept the events.
+
+-- source include/have_binlog_format_mixed_or_row.inc
+
 let $engine_type=NDBCLUSTER;
 -- source extra/rpl_tests/rpl_row_sp006.test

=== modified file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_trig004.test'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_trig004.test	2007-09-05 16:44:47 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_trig004.test	2009-06-30 14:46:25 +0000
@@ -9,6 +9,12 @@
 # Includes
 -- source include/have_ndb.inc
 -- source include/ndb_master-slave.inc
+
+# Since the master generates row-based events, the slave may not be in
+# STATEMENT mode to accept the events.
+
+-- source include/have_binlog_format_mixed_or_row.inc
+
 let $engine_type=NDB;
 -- source extra/rpl_tests/rpl_trig004.test
 

=== modified file 'sql/item_create.cc'
--- a/sql/item_create.cc	2009-03-24 18:27:33 +0000
+++ b/sql/item_create.cc	2009-06-30 14:46:25 +0000
@@ -2375,6 +2375,7 @@ Create_udf_func::create(THD *thd, udf_fu
   Item *func= NULL;
   int arg_count= 0;
 
+  DBUG_ENTER("Create_udf_func::create");
   if (item_list != NULL)
     arg_count= item_list->elements;
 
@@ -2462,7 +2463,7 @@ Create_udf_func::create(THD *thd, udf_fu
   }
   }
   thd->lex->safe_to_cache_query= 0;
-  return func;
+  DBUG_RETURN(func);
 }
 #endif
 
@@ -3363,9 +3364,10 @@ Create_func_found_rows Create_func_found
 Item*
 Create_func_found_rows::create(THD *thd)
 {
+  DBUG_ENTER("Create_func_found_rows::create");
   thd->lex->set_stmt_unsafe();
   thd->lex->safe_to_cache_query= 0;
-  return new (thd->mem_root) Item_func_found_rows();
+  DBUG_RETURN(new (thd->mem_root) Item_func_found_rows());
 }
 
 
@@ -3791,9 +3793,10 @@ Create_func_load_file Create_func_load_f
 Item*
 Create_func_load_file::create(THD *thd, Item *arg1)
 {
+  DBUG_ENTER("Create_func_load_file::create");
   thd->lex->set_stmt_unsafe();
   thd->lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
-  return new (thd->mem_root) Item_load_file(arg1);
+  DBUG_RETURN(new (thd->mem_root) Item_load_file(arg1));
 }
 
 
@@ -4260,9 +4263,10 @@ Create_func_row_count Create_func_row_co
 Item*
 Create_func_row_count::create(THD *thd)
 {
+  DBUG_ENTER("Create_func_row_count::create");
   thd->lex->set_stmt_unsafe();
   thd->lex->safe_to_cache_query= 0;
-  return new (thd->mem_root) Item_func_row_count();
+  DBUG_RETURN(new (thd->mem_root) Item_func_row_count());
 }
 
 
@@ -4569,9 +4573,10 @@ Create_func_uuid Create_func_uuid::s_sin
 Item*
 Create_func_uuid::create(THD *thd)
 {
+  DBUG_ENTER("Create_func_uuid::create");
   thd->lex->set_stmt_unsafe();
   thd->lex->safe_to_cache_query= 0;
-  return new (thd->mem_root) Item_func_uuid();
+  DBUG_RETURN(new (thd->mem_root) Item_func_uuid());
 }
 
 
@@ -4580,9 +4585,10 @@ Create_func_uuid_short Create_func_uuid_
 Item*
 Create_func_uuid_short::create(THD *thd)
 {
+  DBUG_ENTER("Create_func_uuid_short::create");
   thd->lex->set_stmt_unsafe();
   thd->lex->safe_to_cache_query= 0;
-  return new (thd->mem_root) Item_func_uuid_short();
+  DBUG_RETURN(new (thd->mem_root) Item_func_uuid_short());
 }
 
 

=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc	2009-06-09 16:44:26 +0000
+++ b/sql/log_event.cc	2009-06-30 14:46:25 +0000
@@ -7187,16 +7187,12 @@ int Rows_log_event::do_apply_event(Relay
     */
     thd->transaction.stmt.modified_non_trans_table= FALSE;
     /*
-      Check if the slave is set to use SBR.  If so, it should switch
-      to using RBR until the end of the "statement", i.e., next
-      STMT_END_F or next error.
+      This is a row injection, so we flag the "statement" as
+      such. Note that this code is called both when the slave does row
+      injections and when the BINLOG statement is used to do row
+      injections.
     */
-    if (!thd->current_stmt_binlog_row_based &&
-        mysql_bin_log.is_open() && (thd->options & OPTION_BIN_LOG))
-    {
-      thd->set_current_stmt_binlog_row_based();
-    }
-
+    thd->lex->set_stmt_row_injection();
 
     /*
       There are a few flags that are replicated with each row event.
@@ -7444,6 +7440,13 @@ int Rows_log_event::do_apply_event(Relay
     slave_rows_error_report(ERROR_LEVEL, error, rli, thd, table,
                              get_type_str(),
                              RPL_LOG_NAME, (ulong) log_pos);
+    /*
+      @todo We should probably not call
+      reset_current_stmt_binlog_row_based() from here.
+
+      Note: this applies to log_event_old.cc too.
+      /Sven
+    */
     thd->reset_current_stmt_binlog_row_based();
     const_cast<Relay_log_info*>(rli)->cleanup_context(thd, error);
     thd->is_slave_error= 1;
@@ -7545,6 +7548,16 @@ static int rows_event_stmt_cleanup(Relay
       event flushed.
     */
 
+    /*
+      @todo We should probably not call
+      reset_current_stmt_binlog_row_based() from here.
+
+      Note: this applies to log_event_old.cc too
+
+      Btw, the previous comment about transactional engines does not
+      seem related to anything that happens here.
+      /Sven
+    */
     thd->reset_current_stmt_binlog_row_based();
 
     const_cast<Relay_log_info*>(rli)->cleanup_context(thd, 0);

=== modified file 'sql/log_event_old.cc'
--- a/sql/log_event_old.cc	2009-02-13 16:41:47 +0000
+++ b/sql/log_event_old.cc	2009-06-30 14:46:25 +0000
@@ -66,15 +66,12 @@ Old_rows_log_event::do_apply_event(Old_r
     mysql_reset_thd_for_next_command(thd);
 
     /*
-      Check if the slave is set to use SBR.  If so, it should switch
-      to using RBR until the end of the "statement", i.e., next
-      STMT_END_F or next error.
+      This is a row injection, so we flag the "statement" as
+      such. Note that this code is called both when the slave does row
+      injections and when the BINLOG statement is used to do row
+      injections.
     */
-    if (!thd->current_stmt_binlog_row_based &&
-        mysql_bin_log.is_open() && (thd->options & OPTION_BIN_LOG))
-    {
-      thd->set_current_stmt_binlog_row_based();
-    }
+    thd->lex->set_stmt_row_injection();
 
     if (simple_open_n_lock_tables(thd, rli->tables_to_lock))
     {

=== modified file 'sql/mysql_priv.h'
--- a/sql/mysql_priv.h	2009-06-05 11:23:58 +0000
+++ b/sql/mysql_priv.h	2009-06-30 14:46:25 +0000
@@ -1559,7 +1559,6 @@ TABLE *open_n_lock_single_table(THD *thd
                                 thr_lock_type lock_type);
 bool open_normal_and_derived_tables(THD *thd, TABLE_LIST *tables, uint flags);
 int lock_tables(THD *thd, TABLE_LIST *tables, uint counter, bool *need_reopen);
-int decide_logging_format(THD *thd, TABLE_LIST *tables);
 TABLE *open_temporary_table(THD *thd, const char *path, const char *db,
 			    const char *table_name, bool link_in_list);
 bool rm_temporary_table(handlerton *base, char *path);

=== modified file 'sql/rpl_injector.cc'
--- a/sql/rpl_injector.cc	2008-02-19 11:43:01 +0000
+++ b/sql/rpl_injector.cc	2009-06-30 14:46:25 +0000
@@ -36,8 +36,6 @@ injector::transaction::transaction(MYSQL
   m_start_pos.m_file_pos= log_info.pos;
 
   begin_trans(m_thd);
-
-  thd->set_current_stmt_binlog_row_based();
 }
 
 injector::transaction::~transaction()

=== modified file 'sql/set_var.cc'
--- a/sql/set_var.cc	2009-06-02 08:14:41 +0000
+++ b/sql/set_var.cc	2009-06-30 14:46:25 +0000
@@ -1292,6 +1292,11 @@ bool sys_var_thd_binlog_format::is_reado
 
 void fix_binlog_format_after_update(THD *thd, enum_var_type type)
 {
+  /*
+    @todo This function should be eliminated.  We should not set the
+    current binlog format anywhere else than in decide_logging_format.
+    /Sven
+  */
   thd->reset_current_stmt_binlog_row_based();
 }
 

=== modified file 'sql/share/errmsg.txt'
--- a/sql/share/errmsg.txt	2009-06-02 09:07:17 +0000
+++ b/sql/share/errmsg.txt	2009-06-30 14:46:25 +0000
@@ -6076,8 +6076,7 @@ ER_SLAVE_INCIDENT
 ER_NO_PARTITION_FOR_GIVEN_VALUE_SILENT
         eng "Table has no partition for some existing values"
 ER_BINLOG_UNSAFE_STATEMENT
-        eng "Statement may not be safe to log in statement format."
-        swe "Detta �inte s�rt att logga i statement-format."
+        eng "Unsafe statement binlogged as statement since BINLOG_FORMAT is STATEMENT."
 ER_SLAVE_FATAL_ERROR
         eng "Fatal error: %s"
 ER_SLAVE_RELAY_LOG_READ_FAILURE
@@ -6201,3 +6200,18 @@ ER_TEMPORARY_NAME
 ER_RENAMED_NAME
   eng "Renamed"
   swe "Namn�rad"
+
+ER_BINLOG_ROW_ENGINE_AND_STMT_ENGINE
+  eng "Binary logging impossible since both row-incapable engines and statement-incapable engines are involved"
+ER_BINLOG_ROW_MODE_AND_STMT_ENGINE
+  eng "Cannot modify table that uses a storage engine limited to statement-logging when BINLOG_FORMAT = ROW"
+ER_BINLOG_UNSAFE_AND_STMT_ENGINE
+  eng "Unsafe statement binlogged as statement since storage engine is limited to statement-logging"
+ER_BINLOG_ROW_INJECTION_AND_STMT_ENGINE
+  eng "Cannot execute row injection since table uses storage engine limited to statement-logging"
+ER_BINLOG_STMT_MODE_AND_ROW_ENGINE
+  eng "Cannot modify table that uses a storage engine limited to row-logging when BINLOG_FORMAT = STATEMENT"
+ER_BINLOG_ROW_INJECTION_AND_STMT_MODE
+  eng "Cannot execute row injection since BINLOG_FORMAT = STATEMENT"
+ER_BINLOG_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE
+  eng "Statement cannot be written atomically since more than one engine is involved and at least one engine is self-logging"

=== modified file 'sql/sp.cc'
--- a/sql/sp.cc	2009-05-30 13:32:28 +0000
+++ b/sql/sp.cc	2009-06-30 14:46:25 +0000
@@ -1830,6 +1830,8 @@ sp_cache_routines_and_add_tables_for_tri
 {
   int ret= 0;
 
+  DBUG_ENTER("sp_cache_routines_and_add_tables_for_triggers");
+
   Sroutine_hash_entry **last_cached_routine_ptr=
     (Sroutine_hash_entry **)lex->sroutines_list.next;
 
@@ -1863,7 +1865,7 @@ sp_cache_routines_and_add_tables_for_tri
   ret= sp_cache_routines_and_add_tables_aux(thd, lex,
                                             *last_cached_routine_ptr,
                                             FALSE);
-  return ret;
+  DBUG_RETURN(ret);
 }
 
 

=== modified file 'sql/sp_head.h'
--- a/sql/sp_head.h	2009-04-29 02:59:10 +0000
+++ b/sql/sp_head.h	2009-06-30 14:46:25 +0000
@@ -459,6 +459,7 @@ public:
   */
   void propagate_attributes(LEX *lex)
   {
+    DBUG_ENTER("sp_head::propagate_attributes");
     /*
       If this routine needs row-based binary logging, the entire top statement
       too (we cannot switch from statement-based to row-based only for this
@@ -467,6 +468,7 @@ public:
     */
     if (m_flags & BINLOG_ROW_BASED_IF_MIXED)
       lex->set_stmt_unsafe();
+    DBUG_VOID_RETURN;
   }
 
 

=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc	2009-05-30 13:32:28 +0000
+++ b/sql/sql_base.cc	2009-06-30 14:46:25 +0000
@@ -4831,7 +4831,7 @@ static bool check_lock_and_start_stmt(TH
 
     There may be more differences between open_n_lock_single_table() and
     open_ltable(). One known difference is that open_ltable() does
-    neither call decide_logging_format() nor handle some other logging
+    neither call thd->decide_logging_format() nor handle some other logging
     and locking issues because it does not call lock_tables().
 */
 
@@ -5052,63 +5052,137 @@ static void mark_real_tables_as_free_for
 
 
 /**
-   Decide on logging format to use for the statement.
+  Decide on logging format to use for the statement and issue errors
+  or warnings as needed.  The decision depends on the following
+  parameters:
 
-   Compute the capabilities vector for the involved storage engines
-   and mask out the flags for the binary log. Right now, the binlog
-   flags only include the capabilities of the storage engines, so this
-   is safe.
+  - The logging mode, i.e., the value of binlog_format.  Can be
+    statement, mixed, or row.
 
-   We now have three alternatives that prevent the statement from
-   being loggable:
+  - The type of statement.  There are three types of statements:
+    "normal" safe statements; unsafe statements; and row injections.
+    An unsafe statement is one that, if logged in statement format,
+    might produce different results when replayed on the slave (e.g.,
+    INSERT DELAYED).  A row injection is either a BINLOG statement, or
+    a row event executed by the slave's SQL thread.
 
-   1. If there are no capabilities left (all flags are clear) it is
-      not possible to log the statement at all, so we roll back the
-      statement and report an error.
+  - The capabilities of tables modified by the statement.  The
+    *capabilities vector* for a table is a set of flags associated
+    with the table.  Currently, it only includes two flags: *row
+    capability flag* and *statement capability flag*.
 
-   2. Statement mode is set, but the capabilities indicate that
-      statement format is not possible.
+    The row capability flag is set iff the engine can handle row-based
+    logging. The statement capability flag is set iff the table can
+    handle statement-based logging.
 
-   3. Row mode is set, but the capabilities indicate that row
-      format is not possible.
+  Decision table for logging format
+  ---------------------------------
 
-   4. Statement is unsafe, but the capabilities indicate that row
-      format is not possible.
+  The following table summarizes how the format and generated
+  warning/error depends on the tables' capabilities, the statement
+  type, and the current binlog_format.
 
-   If we are in MIXED mode, we then decide what logging format to use:
+     Row capable        N NNNNNNNNN YYYYYYYYY YYYYYYYYY
+     Statement capable  N YYYYYYYYY NNNNNNNNN YYYYYYYYY
 
-   1. If the statement is unsafe, row-based logging is used.
+     Statement type     * SSSUUUIII SSSUUUIII SSSUUUIII
 
-   2. If statement-based logging is not possible, row-based logging is
-      used.
+     Mode               * SMRSMRSMR SMRSMRSMR SMRSMRSMR
 
-   3. Otherwise, statement-based logging is used.
+     Format (Row/Stmt)  - SS-SS---- -RR-RR-RR SRRSRR-RR
+     Warning/Error      1 --2332444 5--5--6-- ---7--6--
 
-   @param thd    Client thread
-   @param tables Tables involved in the query
- */
+  Legend
+  ------
 
-int decide_logging_format(THD *thd, TABLE_LIST *tables)
+  Row capable:  N - Some table not row-capable, Y - all tables row-capable
+  Stmt capable: N - Some table not stmt-capable, Y - all tables stmt-capable
+  Statement:    (S)afe, (U)nsafe, or row (I)njection
+  Mode:         (S)TATEMENT, (M)IXED, or (R)OW
+
+  Warnings/Errors
+  ---------------
+
+  1. Error: Binary logging impossible since both row-incapable engines
+     and statement-incapable engines are involved
+
+  2. Error: Cannot modify table that uses a storage engine limited to
+     statement-logging when BINLOG_FORMAT = ROW
+
+  3. Warning: Unsafe statement binlogged as statement since storage
+     engine is limited to statement-logging
+
+  4. Error: Cannot execute row injection since table uses storage
+     engine limited to statement-logging
+
+  5. Error: Cannot modify table that uses a storage engine limited to
+     row-logging when BINLOG_FORMAT = STATEMENT
+
+  6. Error: Cannot execute row injection since BINLOG_FORMAT = STATEMENT
+
+  7. Warning: Unsafe statement binlogged as statement since
+     BINLOG_FORMAT is STATEMENT
+
+  In addition, we can produce the following error (not depending on
+  the variables of the decision diagram):
+
+  8. Error: Statement cannot be written atomically since more than one
+     engine is involved and at least one engine is self-logging
+
+  For each error case above, the statement is prevented from being
+  logged, we report an error, and roll back the statement.  For
+  warnings, we set the thd->binlog_flags variable: the warning will be
+  printed only if the statement is successfully logged.
+
+  @see THD::binlog_query
+
+  @param[in] thd    Client thread
+  @param[in] tables Tables involved in the query
+
+  @retval 0 No error; statement can be logged.
+  @retval -1 One of the error conditions above applies (1, 2, 4, 5, or 6).
+*/
+
+int THD::decide_logging_format(TABLE_LIST *tables)
 {
-  if (mysql_bin_log.is_open() && (thd->options & OPTION_BIN_LOG))
+  DBUG_ENTER("THD::decide_logging_format");
+  if (mysql_bin_log.is_open() && (options & OPTION_BIN_LOG))
   {
     /*
       Compute the starting vectors for the computations by creating a
       set with all the capabilities bits set and one with no
       capabilities bits set.
-     */
+    */
     handler::Table_flags flags_some_set= 0;
     handler::Table_flags flags_all_set=
       HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE;
 
     my_bool multi_engine= FALSE;
     void* prev_ht= NULL;
+
+#ifndef DBUG_OFF
+    {
+      static const char *prelocked_mode_name[] = {
+        "NON_PRELOCKED",
+        "PRELOCKED",
+        "PRELOCKED_UNDER_LOCK_TABLES",
+      };
+      DBUG_PRINT("debug", ("prelocked_mode: %s",
+                           prelocked_mode_name[prelocked_mode]));
+    }
+#endif
+
+    /*
+      Get the capabilities vector for all involved storage engines and
+      mask out the flags for the binary log.  (Currently, the binlog
+      flags only include the capabilities of the storage engines.)
+    */
     for (TABLE_LIST *table= tables; table; table= table->next_global)
     {
       if (table->placeholder())
         continue;
       if (table->table->s->table_category == TABLE_CATEGORY_PERFORMANCE)
-        thd->lex->set_stmt_unsafe();
+        lex->set_stmt_unsafe();
       if (table->lock_type >= TL_WRITE_ALLOW_WRITE)
       {
         ulonglong const flags= table->table->file->ha_table_flags();
@@ -5130,75 +5204,116 @@ int decide_logging_format(THD *thd, TABL
     DBUG_PRINT("info", ("flags_some_set: %s%s",
                         FLAGSTR(flags_some_set, HA_BINLOG_STMT_CAPABLE),
                         FLAGSTR(flags_some_set, HA_BINLOG_ROW_CAPABLE)));
-    DBUG_PRINT("info", ("thd->variables.binlog_format: %ld",
-                        thd->variables.binlog_format));
+    DBUG_PRINT("info", ("variables.binlog_format: %ld",
+                        variables.binlog_format));
     DBUG_PRINT("info", ("multi_engine: %s",
                         multi_engine ? "TRUE" : "FALSE"));
 
     int error= 0;
-    if (flags_all_set == 0)
-    {
-      my_error((error= ER_BINLOG_LOGGING_IMPOSSIBLE), MYF(0),
-               "Statement cannot be logged to the binary log in"
-               " row-based nor statement-based format");
-    }
-    else if (thd->variables.binlog_format == BINLOG_FORMAT_STMT &&
-             (flags_all_set & HA_BINLOG_STMT_CAPABLE) == 0)
-    {
-      my_error((error= ER_BINLOG_LOGGING_IMPOSSIBLE), MYF(0),
-                "Statement-based format required for this statement,"
-                " but not allowed by this combination of engines");
-    }
-    else if ((thd->variables.binlog_format == BINLOG_FORMAT_ROW ||
-              thd->lex->is_stmt_unsafe()) &&
-             (flags_all_set & HA_BINLOG_ROW_CAPABLE) == 0)
-    {
-      my_error((error= ER_BINLOG_LOGGING_IMPOSSIBLE), MYF(0),
-                "Row-based format required for this statement,"
-                " but not allowed by this combination of engines");
-    }
 
     /*
       If more than one engine is involved in the statement and at
       least one is doing it's own logging (is *self-logging*), the
       statement cannot be logged atomically, so we generate an error
       rather than allowing the binlog to become corrupt.
-     */
+    */
     if (multi_engine &&
         (flags_some_set & HA_HAS_OWN_BINLOGGING))
     {
-      error= ER_BINLOG_LOGGING_IMPOSSIBLE;
-      my_error(error, MYF(0),
-               "Statement cannot be written atomically since more"
-               " than one engine involved and at least one engine"
-               " is self-logging");
+      my_error((error= ER_BINLOG_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE),
+               MYF(0));
     }
 
-    DBUG_PRINT("info", ("error: %d", error));
-
-    if (error)
-      return -1;
-
-    /*
-      We switch to row-based format if we are in mixed mode and one of
-      the following are true:
-
-      1. If the statement is unsafe
-      2. If statement format cannot be used
-
-      Observe that point to cannot be decided before the tables
-      involved in a statement has been checked, i.e., we cannot put
-      this code in reset_current_stmt_binlog_row_based(), it has to be
-      here.
-    */
-    if (thd->lex->is_stmt_unsafe() ||
-        (flags_all_set & HA_BINLOG_STMT_CAPABLE) == 0)
+    /* both statement-only and row-only engines involved */
+    if ((flags_all_set & (HA_BINLOG_STMT_CAPABLE | HA_BINLOG_ROW_CAPABLE)) == 0)
+    {
+      /*
+        1. Error: Binary logging impossible since both row-incapable
+           engines and statement-incapable engines are involved
+      */
+      my_error((error= ER_BINLOG_ROW_ENGINE_AND_STMT_ENGINE), MYF(0));
+    }
+    /* statement-only engines involved */
+    else if ((flags_all_set & HA_BINLOG_ROW_CAPABLE) == 0)
+    {
+      if (lex->is_stmt_row_injection())
+      {
+        /*
+          4. Error: Cannot execute row injection since table uses
+             storage engine limited to statement-logging
+        */
+        my_error((error= ER_BINLOG_ROW_INJECTION_AND_STMT_ENGINE), MYF(0));
+      }
+      else if (variables.binlog_format == BINLOG_FORMAT_ROW)
+      {
+        /*
+          2. Error: Cannot modify table that uses a storage engine
+             limited to statement-logging when BINLOG_FORMAT = ROW
+        */
+        my_error((error= ER_BINLOG_ROW_MODE_AND_STMT_ENGINE), MYF(0));
+      }
+      else if (lex->is_stmt_unsafe())
+      {
+        /*
+          3. Warning: Unsafe statement binlogged as statement since
+             storage engine is limited to statement-logging.
+        */
+        binlog_warning_flags|=
+          (1 << BINLOG_WARNING_FLAG_UNSAFE_AND_STMT_ENGINE);
+      }
+      /* log in statement format! */
+    }
+    /* no statement-only engines */
+    else
     {
-      thd->set_current_stmt_binlog_row_based_if_mixed();
+      /* binlog_format = STATEMENT */
+      if (variables.binlog_format == BINLOG_FORMAT_STMT)
+      {
+        if (lex->is_stmt_row_injection())
+        {
+          /*
+            6. Error: Cannot execute row injection since
+               BINLOG_FORMAT = STATEMENT
+          */
+          my_error((error= ER_BINLOG_ROW_INJECTION_AND_STMT_MODE), MYF(0));
+        }
+        else if ((flags_all_set & HA_BINLOG_STMT_CAPABLE) == 0)
+        {
+          /*
+            5. Error: Cannot modify table that uses a storage engine
+               limited to row-logging when binlog_format = STATEMENT
+          */
+          my_error((error= ER_BINLOG_STMT_MODE_AND_ROW_ENGINE), MYF(0));
+        }
+        else if (lex->is_stmt_unsafe())
+        {
+          /*
+            7. Warning: Unsafe statement logged as statement due to
+               binlog_format = STATEMENT
+          */
+          binlog_warning_flags|=
+            (1 << BINLOG_WARNING_FLAG_UNSAFE_AND_STMT_MODE);
+        }
+        /* log in statement format! */
+      }
+      /* No statement-only engines and binlog_format != STATEMENT.
+         I.e., nothing prevents us from row logging if needed. */
+      else
+      {
+        if (lex->is_stmt_unsafe() || lex->is_stmt_row_injection()
+            || (flags_all_set & HA_BINLOG_STMT_CAPABLE) == 0)
+        {
+          /* log in row format! */
+          set_current_stmt_binlog_row_based_if_mixed();
+        }
+      }
     }
+
+    if (error)
+      DBUG_RETURN(-1);
   }
 
-  return 0;
+  DBUG_RETURN(0);
 }
 
 /*
@@ -5242,7 +5357,7 @@ int lock_tables(THD *thd, TABLE_LIST *ta
   *need_reopen= FALSE;
 
   if (!tables && !thd->lex->requires_prelocking())
-    DBUG_RETURN(decide_logging_format(thd, tables));
+    DBUG_RETURN(thd->decide_logging_format(tables));
 
   /*
     We need this extra check for thd->prelocked_mode because we want to avoid
@@ -5402,7 +5517,7 @@ int lock_tables(THD *thd, TABLE_LIST *ta
     }
   }
 
-  DBUG_RETURN(decide_logging_format(thd, tables));
+  DBUG_RETURN(thd->decide_logging_format(tables));
 }
 
 

=== modified file 'sql/sql_class.cc'
--- a/sql/sql_class.cc	2009-06-08 22:05:24 +0000
+++ b/sql/sql_class.cc	2009-06-30 14:46:25 +0000
@@ -539,7 +539,7 @@ THD::THD()
    lock_id(&main_lock_id),
    user_time(0), in_sub_stmt(0),
    sql_log_bin_toplevel(false),
-   binlog_table_maps(0), binlog_flags(0UL),
+   binlog_warning_flags(0UL), binlog_table_maps(0),
    table_map_for_update(0),
    arg_of_last_insert_id_function(FALSE),
    first_successful_insert_id_in_prev_stmt(0),
@@ -3633,28 +3633,30 @@ show_query_type(THD::enum_binlog_query_t
 #endif
 
 
-/*
-  Member function that will log query, either row-based or
-  statement-based depending on the value of the 'current_stmt_binlog_row_based'
-  the value of the 'qtype' flag.
-
-  This function should be called after the all calls to ha_*_row()
-  functions have been issued, but before tables are unlocked and
-  closed.
-
-  OBSERVE
-    There shall be no writes to any system table after calling
-    binlog_query(), so these writes has to be moved to before the call
-    of binlog_query() for correct functioning.
-
-    This is necessesary not only for RBR, but the master might crash
-    after binlogging the query but before changing the system tables.
-    This means that the slave and the master are not in the same state
-    (after the master has restarted), so therefore we have to
-    eliminate this problem.
+/**
+  Log the current query.
 
-  RETURN VALUE
-    Error code, or 0 if no error.
+  The query will be logged in either row format or statement format
+  depending on the value of @c current_stmt_binlog_row_based field and
+  the value of the @c qtype parameter.
+
+  This function must be called:
+
+  - After the all calls to ha_*_row() functions have been issued.
+
+  - After any writes to system tables. Rationale: if system tables
+    were written after a call to this function, and the master crashes
+    after the call to this function and before writing the system
+    tables, then the master and slave get out of sync.
+
+  - Before tables are unlocked and closed.
+
+  @see decide_logging_format
+
+  @retval 0 Success
+
+  @retval nonzero If there is a failure when writing the query (e.g.,
+  write failure), then the error code is returned.
 */
 int THD::binlog_query(THD::enum_binlog_query_type qtype, char const *query_arg,
                       ulong query_len, bool is_trans, bool suppress_use,
@@ -3679,29 +3681,48 @@ int THD::binlog_query(THD::enum_binlog_q
       DBUG_RETURN(error);
 
   /*
-    If we are in statement mode and trying to log an unsafe statement,
-    we should print a warning.
-  */
-  if (sql_log_bin_toplevel && lex->is_stmt_unsafe() &&
-      variables.binlog_format == BINLOG_FORMAT_STMT)
-  {
-   /*
-     A warning can be elevated a error when STRICT sql mode.
-     But we don't want to elevate binlog warning to error here.
-   */
-    push_warning(this, MYSQL_ERROR::WARN_LEVEL_NOTE,
-                 ER_BINLOG_UNSAFE_STATEMENT,
-                 ER(ER_BINLOG_UNSAFE_STATEMENT));
-    if (!(binlog_flags & BINLOG_FLAG_UNSAFE_STMT_PRINTED))
+    Warnings for unsafe statements logged in statement format are
+    printed here instead of in decide_logging_format().  This is
+    because the warnings should be printed only if the statement is
+    actually logged. When executing decide_logging_format(), we cannot
+    know for sure if the statement will be logged.
+  */
+  if (sql_log_bin_toplevel)
+  {
+    if (binlog_warning_flags &
+        (1 << BINLOG_WARNING_FLAG_UNSAFE_AND_STMT_ENGINE))
+    {
+      if (!(binlog_warning_flags & (1 << BINLOG_WARNING_FLAG_PRINTED)))
+        push_warning(this, MYSQL_ERROR::WARN_LEVEL_NOTE,
+                     ER_BINLOG_UNSAFE_AND_STMT_ENGINE,
+                     ER(ER_BINLOG_UNSAFE_AND_STMT_ENGINE));
+      sql_print_warning("%s Statement: %.*s",
+                        ER(ER_BINLOG_UNSAFE_AND_STMT_ENGINE),
+                        MYSQL_ERRMSG_SIZE, query_arg);
+      binlog_warning_flags|= 1 << BINLOG_WARNING_FLAG_PRINTED;
+    }
+    else if (binlog_warning_flags &
+             (1 << BINLOG_WARNING_FLAG_UNSAFE_AND_STMT_MODE))
     {
+      if (!(binlog_warning_flags & (1 << BINLOG_WARNING_FLAG_PRINTED)))
+        push_warning(this, MYSQL_ERROR::WARN_LEVEL_NOTE,
+                     ER_BINLOG_UNSAFE_STATEMENT,
+                     ER(ER_BINLOG_UNSAFE_STATEMENT));
       sql_print_warning("%s Statement: %.*s",
                         ER(ER_BINLOG_UNSAFE_STATEMENT),
                         MYSQL_ERRMSG_SIZE, query_arg);
-      binlog_flags|= BINLOG_FLAG_UNSAFE_STMT_PRINTED;
+      binlog_warning_flags|= 1 << BINLOG_WARNING_FLAG_PRINTED;
     }
   }
 
   switch (qtype) {
+    /*
+      ROW_QUERY_TYPE means that the statement may be logged either in
+      row format or in statement format.  If
+      current_stmt_binlog_row_based is set, it means that the
+      statement has already been logged in row format and hence shall
+      not be logged again.
+    */
   case THD::ROW_QUERY_TYPE:
     DBUG_PRINT("debug",
                ("current_stmt_binlog_row_based: %d",
@@ -3709,8 +3730,18 @@ int THD::binlog_query(THD::enum_binlog_q
     if (current_stmt_binlog_row_based)
       DBUG_RETURN(0);
     /* Otherwise, we fall through */
+
+    /*
+      MYSQL_QUERY_TYPE is equivalent to STMT_QUERY_TYPE.  It is not
+      clear why we need it (see the following comment).
+
+      @todo We should get rid of this query type.
+    */
   case THD::MYSQL_QUERY_TYPE:
     /*
+      @note the following comment is confusing and should be removed,
+      along with MYSQL_QUERY_TYPE.
+
       Using this query type is a conveniece hack, since we have been
       moving back and forth between using RBR for replication of
       system tables and not using it.
@@ -3718,11 +3749,18 @@ int THD::binlog_query(THD::enum_binlog_q
       Make sure to change in check_table_binlog_row_based() according
       to how you treat this.
     */
+
+    /*
+      STMT_QUERY_TYPE means that the query must be logged in statement
+      format; it cannot be logged in row format.  This is typically
+      used by DDL statements.  It is an error to use this query type
+      if current_stmt_binlog_row_based is set.
+    */
   case THD::STMT_QUERY_TYPE:
     /*
       The MYSQL_LOG::write() function will set the STMT_END_F flag and
       flush the pending rows event if necessary.
-     */
+    */
     {
       Query_log_event qinfo(this, query_arg, query_len, is_trans, suppress_use,
                             errcode);

=== modified file 'sql/sql_class.h'
--- a/sql/sql_class.h	2009-06-08 22:05:24 +0000
+++ b/sql/sql_class.h	2009-06-30 14:46:25 +0000
@@ -1254,6 +1254,7 @@ public:
   /* Used to execute base64 coded binlog events in MySQL server */
   Relay_log_info* rli_fake;
 
+  void reset_for_next_command();
   /*
     Constant for THD::where initialization in the beginning of every query.
 
@@ -1422,22 +1423,32 @@ public:
   int binlog_remove_pending_rows_event(bool clear_maps);
 
 private:
+  enum enum_binlog_warning_flag {
+    /* ER_BINLOG_UNSAFE_AND_STMT_ENGINE affects current stmt */
+    BINLOG_WARNING_FLAG_UNSAFE_AND_STMT_ENGINE = 0,
+    /* ER_BINLOG_UNSAFE_AND_STMT_MODE affects current stmt */
+    BINLOG_WARNING_FLAG_UNSAFE_AND_STMT_MODE,
+    /* One of the warnings has already been printed */
+    BINLOG_WARNING_FLAG_PRINTED,
+    /* number of elements of this enum; insert new members above */
+    BINLOG_WARNING_FLAG_COUNT
+  };
+  /**
+    Flags holding the status of binlog-related warnings for the
+    current statement.  This is a binary combination of (1<<flag),
+    where flag is a member of @c enum_binlog_warning_flag.
+
+    The warnings are determined in @c THD::decide_logging_format, but
+    issued only later, after the statement has been written to the
+    binlog.  Hence it must be stored in the @c THD object.
+  */
+  uint32 binlog_warning_flags;
+
   /*
     Number of outstanding table maps, i.e., table maps in the
     transaction cache.
   */
   uint binlog_table_maps;
-
-  enum enum_binlog_flag {
-    BINLOG_FLAG_UNSAFE_STMT_PRINTED,
-    BINLOG_FLAG_COUNT
-  };
-
-  /**
-     Flags with per-thread information regarding the status of the
-     binary log.
-   */
-  uint32 binlog_flags;
 public:
   uint get_binlog_table_maps() const {
     return binlog_table_maps;
@@ -1749,7 +1760,12 @@ public:
   char	     scramble[SCRAMBLE_LENGTH+1];
 
   bool       slave_thread, one_shot_set;
-  /* tells if current statement should binlog row-based(1) or stmt-based(0) */
+  /*
+    Tells if current statement should binlog row-based(1) or stmt-based(0)
+
+    @todo Make this field private.  Only decide_logging_format should
+    modify it.  /Sven
+  */
   bool       current_stmt_binlog_row_based;
   bool	     locked, some_tables_deleted;
   bool       last_cuted_field;
@@ -2120,8 +2136,13 @@ public:
   void set_n_backup_active_arena(Query_arena *set, Query_arena *backup);
   void restore_active_arena(Query_arena *set, Query_arena *backup);
 
+  /*
+    @todo Make these methods private or remove them completely.  Only
+    decide_logging_format should call them. /Sven
+  */
   inline void set_current_stmt_binlog_row_based_if_mixed()
   {
+    DBUG_ENTER("set_current_stmt_binlog_row_based_if_mixed");
     /*
       If in a stored/function trigger, the caller should already have done the
       change. We test in_sub_stmt to prevent introducing bugs where people
@@ -2134,17 +2155,24 @@ public:
     if ((variables.binlog_format == BINLOG_FORMAT_MIXED) &&
         (in_sub_stmt == 0))
       current_stmt_binlog_row_based= TRUE;
+
+    DBUG_VOID_RETURN;
   }
   inline void set_current_stmt_binlog_row_based()
   {
+    DBUG_ENTER("set_current_stmt_binlog_row_based");
     current_stmt_binlog_row_based= TRUE;
+    DBUG_VOID_RETURN;
   }
   inline void clear_current_stmt_binlog_row_based()
   {
+    DBUG_ENTER("clear_current_stmt_binlog_row_based");
     current_stmt_binlog_row_based= FALSE;
+    DBUG_VOID_RETURN;
   }
   inline void reset_current_stmt_binlog_row_based()
   {
+    DBUG_ENTER("reset_current_stmt_binlog_row_based");
     /*
       If there are temporary tables, don't reset back to
       statement-based. Indeed it could be that:
@@ -2172,6 +2200,7 @@ public:
       current_stmt_binlog_row_based= 
         test(variables.binlog_format == BINLOG_FORMAT_ROW);
     }
+    DBUG_VOID_RETURN;
   }
 
   /**
@@ -2267,7 +2296,11 @@ public:
   */
   void pop_internal_handler();
 
+  int decide_logging_format(TABLE_LIST *tables);
+
+
 private:
+
   /** The current internal error handler for this thread, or NULL. */
   Internal_error_handler *m_internal_handler;
   /**

=== modified file 'sql/sql_delete.cc'
--- a/sql/sql_delete.cc	2009-05-30 13:32:28 +0000
+++ b/sql/sql_delete.cc	2009-06-30 14:46:25 +0000
@@ -452,19 +452,6 @@ int mysql_prepare_delete(THD *thd, TABLE
   DBUG_ENTER("mysql_prepare_delete");
   List<Item> all_fields;
 
-  /*
-    Statement-based replication of DELETE ... LIMIT is not safe as order of
-    rows is not defined, so in mixed mode we go to row-based.
-
-    Note that we may consider a statement as safe if ORDER BY primary_key
-    is present. However it may confuse users to see very similiar statements
-    replicated differently.
-  */
-  if (thd->lex->current_select->select_limit)
-  {
-    thd->lex->set_stmt_unsafe();
-    thd->set_current_stmt_binlog_row_based_if_mixed();
-  }
   thd->lex->allow_sum_func= 0;
   if (setup_tables_and_check_access(thd, &thd->lex->select_lex.context,
                                     &thd->lex->select_lex.top_join_list,

=== modified file 'sql/sql_insert.cc'
--- a/sql/sql_insert.cc	2009-06-04 23:30:08 +0000
+++ b/sql/sql_insert.cc	2009-06-30 14:46:25 +0000
@@ -1699,6 +1699,7 @@ public:
      table(0),tables_in_use(0),stacked_inserts(0), status(0), dead(0),
      group_count(0)
   {
+    DBUG_ENTER("Delayed_insert constructor");
     thd.security_ctx->user=thd.security_ctx->priv_user=(char*) delayed_user;
     thd.security_ctx->host=(char*) my_localhost;
     thd.current_tablenr=0;
@@ -1707,8 +1708,18 @@ public:
     thd.lex->current_select= 0; 		// for my_message_sql
     thd.lex->sql_command= SQLCOM_INSERT;        // For innodb::store_lock()
     /*
-      Statement-based replication of INSERT DELAYED has problems with RAND()
-      and user vars, so in mixed mode we go to row-based.
+      Statement-based replication of INSERT DELAYED has problems with
+      RAND() and user variables, so in mixed mode we go to row-based.
+      For normal commands, the unsafe flag is set at parse time.
+      However, since the flag is a member of the THD object, of which
+      the delayed_insert thread has its own copy, we must set the
+      statement to unsafe here and explicitly set row logging mode.
+
+      @todo set_current_stmt_binlog_row_based_if_mixed should not be
+      called by anything else than thd->decide_logging_format().  When
+      we call set_current_blah here, none of the checks in
+      decide_logging_format is made.  We should probably call
+      thd->decide_logging_format() directly instead.  /Sven
     */
     thd.lex->set_stmt_unsafe();
     thd.set_current_stmt_binlog_row_based_if_mixed();
@@ -1726,6 +1737,7 @@ public:
     delayed_lock= global_system_variables.low_priority_updates ?
                                           TL_WRITE_LOW_PRIORITY : TL_WRITE;
     VOID(pthread_mutex_unlock(&LOCK_thread_count));
+    DBUG_VOID_RETURN;
   }
   ~Delayed_insert()
   {
@@ -2305,12 +2317,6 @@ pthread_handler_t handle_delayed_insert(
   */
   lex_start(thd);
   thd->lex->sql_command= SQLCOM_INSERT;        // For innodb::store_lock()
-  /*
-    Statement-based replication of INSERT DELAYED has problems with RAND()
-    and user vars, so in mixed mode we go to row-based.
-  */
-  thd->lex->set_stmt_unsafe();
-  thd->set_current_stmt_binlog_row_based_if_mixed();
 
   /* Open table */
   if (!(di->table= open_n_lock_single_table(thd, &di->table_list,
@@ -2821,19 +2827,6 @@ bool mysql_insert_select_prepare(THD *th
   DBUG_ENTER("mysql_insert_select_prepare");
 
   /*
-    Statement-based replication of INSERT ... SELECT ... LIMIT is not safe
-    as order of rows is not defined, so in mixed mode we go to row-based.
-
-    Note that we may consider a statement as safe if ORDER BY primary_key
-    is present or we SELECT a constant. However it may confuse users to
-    see very similiar statements replicated differently.
-  */
-  if (lex->current_select->select_limit)
-  {
-    lex->set_stmt_unsafe();
-    thd->set_current_stmt_binlog_row_based_if_mixed();
-  }
-  /*
     SELECT_LEX do not belong to INSERT statement, so we can't add WHERE
     clause if table is VIEW
   */
@@ -3550,7 +3543,7 @@ select_create::prepare(List<Item> &value
     virtual int do_postlock(TABLE **tables, uint count)
     {
       THD *thd= const_cast<THD*>(ptr->get_thd());
-      if (int error= decide_logging_format(thd, &all_tables))
+      if (int error= thd->decide_logging_format(&all_tables))
         return error;
 
       TABLE const *const table = *tables;

=== modified file 'sql/sql_lex.h'
--- a/sql/sql_lex.h	2009-05-27 15:19:44 +0000
+++ b/sql/sql_lex.h	2009-06-30 14:46:25 +0000
@@ -1044,24 +1044,49 @@ public:
   }
 
   /**
-     Has the parser/scanner detected that this statement is unsafe?
-   */
+    Has the parser/scanner detected that this statement is unsafe?
+
+    @retval 0 if the statement is not marked as unsafe
+    @retval nonzero if the statement is marked as unsafe
+  */
   inline bool is_stmt_unsafe() const {
     return binlog_stmt_flags & (1U << BINLOG_STMT_FLAG_UNSAFE);
   }
 
   /**
-     Flag the current (top-level) statement as unsafe.
+    Is this statement actually a row injection?
 
-     The flag will be reset after the statement has finished.
+    @retval 0 if the statement is not a row injection
+    @retval nonzero if the statement is a row injection
+  */
+  inline bool is_stmt_row_injection() const {
+    return binlog_stmt_flags & (1U << BINLOG_STMT_FLAG_ROW_INJECTION);
+  }
 
+  /**
+    Flag the statement as a row injection.  (A row injection is either
+    a BINLOG statement, or a row event in the relay log executed by
+    the slave SQL thread.)
+  */
+  inline void set_stmt_row_injection() {
+    DBUG_ENTER("set_stmt_row_injection");
+    binlog_stmt_flags|= (1U << BINLOG_STMT_FLAG_ROW_INJECTION);
+    DBUG_VOID_RETURN;
+  }
+  /**
+     Flag the current (top-level) statement as unsafe.
+     The flag will be reset after the statement has finished.
    */
   inline void set_stmt_unsafe() {
+    DBUG_ENTER("set_stmt_unsafe");
     binlog_stmt_flags|= (1U << BINLOG_STMT_FLAG_UNSAFE);
+    DBUG_VOID_RETURN;
   }
 
   inline void clear_stmt_unsafe() {
+    DBUG_ENTER("clear_stmt_unsafe");
     binlog_stmt_flags&= ~(1U << BINLOG_STMT_FLAG_UNSAFE);
+    DBUG_VOID_RETURN;
   }
 
   /**
@@ -1072,16 +1097,37 @@ public:
   { return sroutines_list.elements != 0; }
 
 private:
+  /**
+    Flags indicating properties of the statement with respect to
+    logging.
+
+    These are combined in a binary manner; e.g., an unsafe statement
+    has the bit (1<<BINLOG_STMT_FLAG_UNSAFE) set.
+  */
   enum enum_binlog_stmt_flag {
-    BINLOG_STMT_FLAG_UNSAFE,
+    /** The statement is unsafe to log in statement mode. */
+    BINLOG_STMT_FLAG_UNSAFE= 0,
+    /**
+      The statement is a row injection (i.e., either a BINLOG
+      statement or a row event executed by the slave SQL thread).
+    */
+    BINLOG_STMT_FLAG_ROW_INJECTION,
+    /**
+      The last element of this enumeration type.  Insert new members
+      above.
+    */
     BINLOG_STMT_FLAG_COUNT
   };
 
-  /*
-    Tells if the parsing stage detected properties of the statement,
-    for example: that some items require row-based binlogging to give
-    a reliable binlog/replication, or if we will use stored functions
-    or triggers which themselves need require row-based binlogging.
+  /**
+    Indicates the type of statement with respect to binlogging.
+
+    This is typically zeroed before parsing a statement, set during
+    parsing (depending on the query), and read when deciding the
+    logging format of the current statement.
+
+    This is a binary combination of one or more bits (1<<flag), where
+    flag is a member of enum_binlog_stmt_flag.
   */
   uint32 binlog_stmt_flags;
 };
@@ -1891,6 +1937,7 @@ typedef struct st_lex : public Query_tab
     }
     return FALSE;
   }
+
 } LEX;
 
 

=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc	2009-06-05 11:23:58 +0000
+++ b/sql/sql_parse.cc	2009-06-30 14:46:25 +0000

@@ -5625,6 +5625,12 @@ bool my_yyoverflow(short **yyss, YYSTYPE
 
 void mysql_reset_thd_for_next_command(THD *thd)
 {
+  thd->reset_for_next_command();
+}
+
+void THD::reset_for_next_command()
+{
+  THD *thd= this;
   DBUG_ENTER("mysql_reset_thd_for_next_command");
   DBUG_ASSERT(!thd->spcont); /* not for substatements of routines */
   DBUG_ASSERT(! thd->in_sub_stmt);
@@ -5668,11 +5674,8 @@ void mysql_reset_thd_for_next_command(TH
   thd->rand_used= 0;
   thd->sent_row_count= thd->examined_row_count= 0;
 
-  /*
-    Because we come here only for start of top-statements, binlog format is
-    constant inside a complex statement (using stored functions) etc.
-  */
   thd->reset_current_stmt_binlog_row_based();
+  thd->binlog_warning_flags= 0;
 
   DBUG_PRINT("debug",
              ("current_stmt_binlog_row_based: %d",

=== modified file 'sql/sql_update.cc'
--- a/sql/sql_update.cc	2009-05-30 13:32:28 +0000
+++ b/sql/sql_update.cc	2009-06-30 14:46:25 +0000
@@ -871,19 +871,6 @@ bool mysql_prepare_update(THD *thd, TABL
   SELECT_LEX *select_lex= &thd->lex->select_lex;
   DBUG_ENTER("mysql_prepare_update");
 
-  /*
-    Statement-based replication of UPDATE ... LIMIT is not safe as order of
-    rows is not defined, so in mixed mode we go to row-based.
-
-    Note that we may consider a statement as safe if ORDER BY primary_key
-    is present. However it may confuse users to see very similiar statements
-    replicated differently.
-  */
-  if (thd->lex->current_select->select_limit)
-  {
-    thd->lex->set_stmt_unsafe();
-    thd->set_current_stmt_binlog_row_based_if_mixed();
-  }
 #ifndef NO_EMBEDDED_ACCESS_CHECKS
   table_list->grant.want_privilege= table->grant.want_privilege= 
     (SELECT_ACL & ~table->grant.privilege);

=== modified file 'sql/sql_yacc.yy'
--- a/sql/sql_yacc.yy	2009-06-01 12:43:16 +0000
+++ b/sql/sql_yacc.yy	2009-06-30 14:46:25 +0000
@@ -8939,7 +8939,7 @@ opt_limit_clause:
         ;
 
 limit_clause:
-          LIMIT limit_options {}
+          LIMIT limit_options { Lex->set_stmt_unsafe(); }
         ;
 
 limit_options:
@@ -9001,6 +9001,7 @@ delete_limit_clause:
           {
             SELECT_LEX *sel= Select;
             sel->select_limit= $2;
+            Lex->set_stmt_unsafe();
             sel->explicit_limit= 1;
           }
         ;
@@ -9454,13 +9455,21 @@ insert_lock_option:
 #endif
           }
         | LOW_PRIORITY  { $$= TL_WRITE_LOW_PRIORITY; }
-        | DELAYED_SYM   { $$= TL_WRITE_DELAYED; }
+        | DELAYED_SYM
+        {
+          $$= TL_WRITE_DELAYED;
+          Lex->set_stmt_unsafe();
+        }
         | HIGH_PRIORITY { $$= TL_WRITE; }
         ;
 
 replace_lock_option:
           opt_low_priority { $$= $1; }
-        | DELAYED_SYM { $$= TL_WRITE_DELAYED; }
+        | DELAYED_SYM
+        {
+          $$= TL_WRITE_DELAYED;
+          Lex->set_stmt_unsafe();
+        }
         ;
 
 insert2:

Attachment: [text/bzr-bundle] bzr/sven.sandberg@sun.com-20090630144625-r2lbwr5e64oayw3b.bundle
Thread
bzr commit into mysql-5.1-bugteam branch (sven.sandberg:2944) Bug#39934Sven Sandberg30 Jun
  • Re: bzr commit into mysql-5.1-bugteam branch (sven.sandberg:2944)Bug#39934Mats Kindahl30 Jun
    • Re: bzr commit into mysql-5.1-bugteam branch (sven.sandberg:2944)Bug#39934Sven Sandberg1 Jul