1. 12 Jul, 2006 3 commits
    • unknown's avatar
      Merge dl145k.mysql.com:/data0/mkindahl/bkroot/mysql-5.1 · fe4ed244
      unknown authored
      into  dl145k.mysql.com:/data0/mkindahl/bk/mysql-5.1-new-rpl
      
      
      sql/ha_federated.cc:
        Auto merged
      fe4ed244
    • unknown's avatar
      Merge dl145k.mysql.com:/data0/mkindahl/bk/mysql-5.0-rpl · 22b51e25
      unknown authored
      into  dl145k.mysql.com:/data0/mkindahl/bk/mysql-5.1-new-rpl
      
      
      storage/ndb/include/kernel/GlobalSignalNumbers.h:
        Auto merged
      storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp:
        Auto merged
      storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp:
        Auto merged
      storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp:
        Auto merged
      storage/ndb/src/ndbapi/ndberror.c:
        Auto merged
      22b51e25
    • unknown's avatar
      Post-merge fixes for mysql-5.1-new-rpl · 9a111f5c
      unknown authored
      
      mysql-test/r/rpl_switch_stm_row_mixed.result:
        Result change
      sql/sql_class.h:
        Post-merge fixes.
      9a111f5c
  2. 11 Jul, 2006 5 commits
    • unknown's avatar
      Merge trift2.:/M50/tmp_merge · 2e20c5b0
      unknown authored
      into  trift2.:/M51/merge-5.1
      
      
      mysql-test/r/federated.result:
        Auto merged
      mysql-test/t/federated.test:
        Auto merged
      2e20c5b0
    • unknown's avatar
      Merge trift2.:/M50/tmp_merge · 6e053cc3
      unknown authored
      into  trift2.:/M51/merge-5.1
      
      
      configure.in:
        Auto merged
      mysql-test/t/federated.test:
        Auto merged
      sql/ha_federated.cc:
        Auto merged
      sql/mysqld.cc:
        Auto merged
      mysql-test/r/federated.result:
        SCCS merged
      sql/ha_federated.h:
        ?
        ?
        Use local.
      6e053cc3
    • unknown's avatar
      Merge dl145k.mysql.com:/data0/mkindahl/bkroot/mysql-5.1-new-rpl · c22a8981
      unknown authored
      into  dl145k.mysql.com:/data0/mkindahl/bk/MERGE/mysql-5.1-merge
      
      
      include/my_sys.h:
        Auto merged
      mysql-test/mysql-test-run.pl:
        Auto merged
      mysql-test/r/rpl_row_create_table.result:
        Auto merged
      mysql-test/t/disabled.def:
        Auto merged
      mysql-test/t/rpl_row_create_table.test:
        Auto merged
      mysys/my_malloc.c:
        Auto merged
      server-tools/instance-manager/parse.h:
        Auto merged
      sql/ha_ndbcluster.cc:
        Auto merged
      sql/handler.h:
        Auto merged
      sql/log.cc:
        Auto merged
      sql/log_event.cc:
        Auto merged
      sql/mysql_priv.h:
        Auto merged
      sql/set_var.h:
        Auto merged
      sql/sp.cc:
        Auto merged
      sql/sp_head.cc:
        Auto merged
      sql/sp_head.h:
        Auto merged
      sql/sql_base.cc:
        Auto merged
      sql/sql_class.cc:
        Auto merged
      sql/sql_insert.cc:
        Auto merged
      sql/sql_lex.h:
        Auto merged
      sql/sql_parse.cc:
        Auto merged
      sql/sql_select.cc:
        Auto merged
      sql/sql_table.cc:
        Auto merged
      sql/sql_update.cc:
        Auto merged
      sql/sql_view.cc:
        Auto merged
      sql/sql_yacc.yy:
        Auto merged
      mysys/safemalloc.c:
        Merge of mysql-5.1-new-rpl into mysql-5.1
      sql/ha_federated.cc:
        d
        Merge of mysql-5.1-new-rpl into mysql-5.1
      sql/set_var.cc:
        Merge of mysql-5.1-new-rpl with mysql-5.1
      sql/slave.cc:
        Merge of mysql-5.1-new-rpl into mysql-5.1
      sql/sql_class.h:
        Merge of mysql-5.1-new-rpl into mysql-5.1
      c22a8981
    • unknown's avatar
      Merge chilla.local:/home/mydev/mysql-5.1 · e8f8fd8d
      unknown authored
      into  chilla.local:/home/mydev/mysql-5.1-amerge
      
      
      e8f8fd8d
    • unknown's avatar
      Merge dl145k.mysql.com:/data0/mkindahl/bkroot/mysql-5.0-rpl · fabab792
      unknown authored
      into  dl145k.mysql.com:/data0/mkindahl/bk/MERGE/mysql-5.0-merge
      
      
      ndb/include/kernel/GlobalSignalNumbers.h:
        Auto merged
      ndb/src/kernel/blocks/dbdict/Dbdict.cpp:
        Auto merged
      ndb/src/kernel/blocks/dbdict/Dbdict.hpp:
        Auto merged
      ndb/src/kernel/blocks/dbdih/DbdihMain.cpp:
        Auto merged
      ndb/src/ndbapi/ndberror.c:
        Auto merged
      fabab792
  3. 10 Jul, 2006 16 commits
    • unknown's avatar
      Merge zippy.(none):/home/cmiller/work/mysql/merge/tmp_merge · a6edf110
      unknown authored
      into  zippy.(none):/home/cmiller/work/mysql/merge/mysql-5.1
      
      
      libmysqld/lib_sql.cc:
        Auto merged
      libmysqld/libmysqld.c:
        Auto merged
      mysql-test/mysql-test-run.sh:
        Auto merged
      mysql-test/r/gis.result:
        Auto merged
      mysql-test/r/information_schema.result:
        Auto merged
      mysql-test/r/sp-security.result:
        Auto merged
      mysql-test/r/variables.result:
        Auto merged
      mysql-test/t/gis.test:
        Auto merged
      mysql-test/t/sp-security.test:
        Auto merged
      mysql-test/t/variables.test:
        Auto merged
      scripts/make_binary_distribution.sh:
        Auto merged
      sql/ha_ndbcluster.cc:
        Auto merged
      sql/item_geofunc.h:
        Auto merged
      sql-common/client.c:
        Auto merged
      sql/set_var.cc:
        Auto merged
      sql/sql_acl.cc:
        Auto merged
      sql/sql_parse.cc:
        Auto merged
      storage/ndb/include/kernel/GlobalSignalNumbers.h:
        Auto merged
      storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp:
        Auto merged
      storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp:
        Auto merged
      mysql-test/t/mysqldump.test:
        Manual merge.  (Seems to need null-merging.)
      sql/mysqld.cc:
        Manual merge + formatting change.
      sql/sql_show.cc:
        Manual merge
      a6edf110
    • unknown's avatar
      4b6e8fa6
    • unknown's avatar
      Merge andrepl.(none):/home/elkin/MySQL/TEAM/BARE/5.1 · e8f1a99a
      unknown authored
      into  andrepl.(none):/home/elkin/MySQL/TEAM/FIXES/5.1/20919_temp_nlog
      
      
      mysql-test/t/rpl_openssl.test:
        Auto merged
      sql/ha_ndbcluster.cc:
        Auto merged
      sql/sql_base.cc:
        Auto merged
      e8f1a99a
    • unknown's avatar
      fixes after merge. Updates to test's results. · 20c59f9c
      unknown authored
      We now reset the THD members related to auto_increment+binlog in
      MYSQL_LOG::write(). This is better than in THD::cleanup_after_query(),
      which was not able to distinguish between SELECT myfunc1(),myfunc2()
      and INSERT INTO t SELECT myfunc1(),myfunc2() from a binlogging point
      of view.
      Rows_log_event::exec_event() now calls lex_start() instead of
      mysql_init_query() because the latter now does too much (it resets
      the binlog format).
      
      
      mysql-test/extra/rpl_tests/rpl_insert_id.test:
        fix after merge
      mysql-test/mysql-test-run.pl:
        -v does not bring useful information when running valgrind; I remove it;
        if you think it's useful add it back.
      mysql-test/r/binlog_stm_mix_innodb_myisam.result:
        Position columns of SHOW BINLOG EVENTS are replaced by # (more robust
        if the size of an event changes).
      mysql-test/r/rpl_insert_id.result:
        fix after merge
      mysql-test/r/rpl_loaddata.result:
        The binlog positions change, because one event disappeared; indeed there
        was this in the binlog (in the current 5.1!):
        SET INSERT_ID=2;
        SET INSERT_ID=1;
        SET TIMESTAMP=1152540671;
        load data LOCAL INFILE '/tmp/SQL_LOAD_MB-1-2' INTO table t1;
        Two INSERT_ID events, useless and a bug. Goes away afer cleaning up
        auto_increment handling.
      mysql-test/r/rpl_switch_stm_row_mixed.result:
        INSERT_ID=5 appears, it's a consequence of having merged the fix
        for BUG#20341
        "stored function inserting into one auto_increment puts bad data in slave".
        In mixed mode, if one substatement of a stored procedure requires row-based,
        the entire procedure uses row-based (was already true for stored functions);
        this is a consequence of not doing the resetting of binlog format inside
        lock_tables() (which didn't work with how the slave thread executes
        row-based binlog events).
      mysql-test/t/rpl_switch_stm_row_mixed.test:
        removing the multi-row delayed insert because in RBR the number of events
        which it generates, is not repeatable (probably depends on how the delayed
        thread groups rows, i.e. dependent on timing).
      sql/ha_partition.cc:
        update to new prototype
      sql/ha_partition.h:
        update to new prototype of the handler:: method.
      sql/handler.cc:
        after-merge fixes (manually merging part which was hard to merge in fmtool)
      sql/log.cc:
        When we write to the binary log, THD's parameters which influenced this
        write are reset: stmt_depends_on_first_successful_insert_id_in_prev_stmt
        and auto_inc_intervals_in_cur_stmt_for_binlog. This is so that future
        writes are not influenced by those and can write their own values.
        As a consequence, when we don't write to the binlog we do not reset.
        This is to abide by the rule that in a complex statement (using triggers etc),
        the first top- or substatement to generate auto_increment ids
        wins their writing to the binlog (that writing may be done by the statement
        itself or by the caller); so for example for
        INSERT INTO t SELECT myfunc() where myfunc() inserts into auto_increment
        and INSERT INTO t does not, myfunc() will fill
        auto_inc_intervals_in_cur_stmt_for_binlog, which will not be reset when
        myfunc() ends, then INSERT INTO t will write to the binlog and thus
        write the preserved auto_inc_intervals_in_cur_stmt_for_binlog.
      sql/log_event.cc:
        mysql_init_query() does too much now to be called in Rows_log_event::exec_event
        (it call mysql_reset_thd_for_next_command() which may switch
        the binlog format now).
        It's ok to call it in Table_map_log_event::exec_event() but its call must
        be before setting the binlog format to "row".
      sql/sql_base.cc:
        Resetting the binlog format in lock_tables() was a bad idea of mine;
        it causes problems in execution of row-based binlog events, where
        the thread sets the binlog format by itself and does not want a next
        lock_tables() to reset the binlog format.
        It is also misleading, for a function named lock_tables(), to reset
        the binlog format.
        As a consequence of this change, in mixed binlogging mode, a routine
        is logged either entirely statement-based or entirely row-based, we
        don't switch in the middle (this was already true for prelocked routines,
        now it's also true for stored procedures).
      sql/sql_class.cc:
        resetting of auto_increment variables used for binlogging is now done
        when writing to the binary log, no need to do the resetting at the end
        of the statement. It is also more correct this way; consider
        SELECT myfunc1(),myfunc2();
        where both functions insert into the same auto_increment column.
        Binlogging is done in 2 events: "SELECT myfunc1()" and "SELECT myfunc2()".
        So each of those needs to have, in binlog, the INSERT_ID which
        it inserted. But as the 2 function calls are executed under prelocked mode,
        the old code didn't reset auto_inc_intervals_in_cur_stmt_for_binlog
        after the first SELECT was binlogged, and so the INSERT_ID of the first
        SELECT was binlogged for the first SELECT and (wrong) also for the 2nd
        SELECT event.
        stmt_depends_on_first_... has the same logic.
      sql/sql_class.h:
        clearer comment
      sql/sql_delete.cc:
        unneeded #ifdef. As we temporarily change the binlog format to "statement"
        before calling mysql_delete(), we must restore it afterwards.
      sql/sql_insert.cc:
        after-merge fixes.
        No need to reset auto_inc_intervals_in_cur_stmt_for_binlog for every
        row in the delayed insert system thread, because we already reset it
        when writing to the binlog.
      sql/sql_parse.cc:
        unneeded #ifdef
      20c59f9c
    • unknown's avatar
      Merge andrepl.(none):/net/koti/usr_rh9/home/elkin.rh9/MySQL/TEAM/BARE/5.0 · 950f95e3
      unknown authored
      into  andrepl.(none):/home/elkin/MySQL/TEAM/FIXES/5.1/20919_temp_nlog
      
      
      mysql-test/t/rpl_openssl.test:
        Auto merged
      sql/ha_ndbcluster.cc:
        Auto merged
      sql/sql_base.cc:
        manual merge
      950f95e3
    • unknown's avatar
      Merge gbichot@bk-internal.mysql.com:/home/bk/mysql-5.0-rpl · 4ce8ca64
      unknown authored
      into  gbichot3.local:/home/mysql_src/mysql-5.0
      
      
      4ce8ca64
    • unknown's avatar
      ndb - debug stuff in LQH · 8154ca61
      unknown authored
      
      storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp:
        dont mess up signal log, also changed w+ to a
      8154ca61
    • unknown's avatar
      Merge orca.ndb.mysql.com:/space_old/pekka/ndb/version/my50-1.2167.1.2 · c1d9764c
      unknown authored
      into  orca.ndb.mysql.com:/space_old/pekka/ndb/version/my51-bug18781
      
      
      storage/ndb/src/kernel/blocks/dbdict/DictLock.txt:
        SCCS merged
      storage/ndb/src/kernel/blocks/dbdih/Dbdih.hpp:
        manual
      storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp:
        SCCS merged
      storage/ndb/src/kernel/vm/SimulatedBlock.cpp:
        manual
      storage/ndb/src/kernel/vm/SimulatedBlock.hpp:
        manual
      storage/ndb/test/run-test/daily-basic-tests.txt:
        SCCS merged
      c1d9764c
    • unknown's avatar
      ndb - bug#18781: close a tiny window (re-commit, try to by-pass merge jam) · 001c7f5f
      unknown authored
      
      ndb/src/kernel/blocks/dbdict/DictLock.txt:
        wait until SL_STARTED before sending DICT_UNLOCK_ORD
      ndb/src/kernel/blocks/dbdih/Dbdih.hpp:
        wait until SL_STARTED before sending DICT_UNLOCK_ORD
      ndb/src/kernel/blocks/dbdih/DbdihMain.cpp:
        wait until SL_STARTED before sending DICT_UNLOCK_ORD
      ndb/src/kernel/vm/SimulatedBlock.cpp:
        wait until SL_STARTED before sending DICT_UNLOCK_ORD
      ndb/src/kernel/vm/SimulatedBlock.hpp:
        wait until SL_STARTED before sending DICT_UNLOCK_ORD
      ndb/test/run-test/daily-basic-tests.txt:
        wait until SL_STARTED before sending DICT_UNLOCK_ORD
      001c7f5f
    • unknown's avatar
      Merge orca.ndb.mysql.com:/space_old/pekka/ndb/version/my50-1.2167.1.2 · 3a12a1a9
      unknown authored
      into  orca.ndb.mysql.com:/space_old/pekka/ndb/version/my51-bug18781
      
      
      storage/ndb/include/kernel/GlobalSignalNumbers.h:
        auto
      storage/ndb/src/common/debugger/signaldata/SignalNames.cpp:
        SCCS merged
      storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp:
        auto
      storage/ndb/src/kernel/vm/SimulatedBlock.cpp:
        auto
      storage/ndb/src/kernel/vm/SimulatedBlock.hpp:
        manual
      3a12a1a9
    • unknown's avatar
      ndb - bug#18781 : 5.0 : add NODE_START_REP from 5.1 (re-commit, try to by-pass merge jam) · f98f5d63
      unknown authored
      
      ndb/include/kernel/GlobalSignalNumbers.h:
        5.0 : add NODE_START_REP from 5.1
      ndb/src/common/debugger/signaldata/SignalNames.cpp:
        5.0 : add NODE_START_REP from 5.1
      ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp:
        5.0 : add NODE_START_REP from 5.1
      ndb/src/kernel/vm/SimulatedBlock.cpp:
        5.0 : add NODE_START_REP from 5.1
      ndb/src/kernel/vm/SimulatedBlock.hpp:
        5.0 : add NODE_START_REP from 5.1
      f98f5d63
    • unknown's avatar
      Merge gbichot@bk-internal.mysql.com:/home/bk/mysql-5.1-rpl · 3a3a5622
      unknown authored
      into  gbichot3.local:/home/mysql_src/mysql-5.1
      
      
      mysql-test/mysql-test-run.pl:
        Auto merged
      sql/sql_base.cc:
        Auto merged
      3a3a5622
    • unknown's avatar
      Merge romeo.(none):/home/bkroot/mysql-5.1-new-rpl · 45f56813
      unknown authored
      into  romeo.(none):/home/bk/b20821-mysql-5.1-new-rpl
      
      
      45f56813
    • unknown's avatar
      Merge chilla.local:/home/mydev/mysql-5.1-amerge · de02f176
      unknown authored
      into  chilla.local:/home/mydev/mysql-5.1-aid
      
      
      sql/ha_federated.cc:
        Auto merged
      de02f176
    • unknown's avatar
      Merge dsl-hkigw8-feb1fb00-100.dhcp.inet.fi:/usr_rh9/home/elkin.rh9/MySQL/TEAM/BARE/4.1 · bd0f363d
      unknown authored
      into  dsl-hkigw8-feb1fb00-100.dhcp.inet.fi:/usr_rh9/home/elkin.rh9/MySQL/TEAM/FIXES/5.0/20919_temp_nlog
      
      
      sql/sql_base.cc:
        Manual merge
      bd0f363d
    • unknown's avatar
      Fixing problem where the command line for MYSQL_DUMP_SLAVE was not · 00abe212
      unknown authored
      set properly.
      
      
      00abe212
  4. 09 Jul, 2006 11 commits
    • unknown's avatar
      BUG#20919 temp tables closing fails when binlog is off · 868fee4d
      unknown authored
      closing temp tables through end_thread
      had a flaw in binlog-off branch of close_temporary_tables where
      next table to close was reset via table->next
       for (table= thd->temporary_tables; table; table= table->next)
      which was wrong since the current table instance got destoyed at
      	close_temporary(table, 1);
      
      The fix adapts binlog-on branch method to engage the loop's internal 'next' variable which holds table->next prior table's destoying.
      
      
      
      sql/sql_base.cc:
        no-binlog branch is fixed: scanning across temporary_tables must be careful to save next table since the current is being destroyed inside of close_temporary. 
        binlog-is-open case is ok.
      868fee4d
    • unknown's avatar
      Merge gbichot3.local:/home/mysql_src/mysql-5.1-interval-move-next-insert-id · 9939a66b
      unknown authored
      into  gbichot3.local:/home/mysql_src/mysql-5.1
      
      
      sql/ha_federated.cc:
        Auto merged
      sql/ha_ndbcluster.cc:
        Auto merged
      sql/handler.h:
        Auto merged
      sql/log_event.cc:
        Auto merged
      sql/set_var.cc:
        Auto merged
      sql/sql_class.cc:
        Auto merged
      sql/sql_class.h:
        Auto merged
      sql/sql_parse.cc:
        Auto merged
      sql/sql_select.cc:
        Auto merged
      sql/sql_table.cc:
        Auto merged
      sql/sql_update.cc:
        Auto merged
      sql/handler.cc:
        will fix by hand
      mysql-test/extra/rpl_tests/rpl_insert_id.test:
        merge
      mysql-test/r/rpl_insert_id.result:
        merge
      sql/sql_insert.cc:
        merge
      9939a66b
    • unknown's avatar
      post-merge test/result fixes. · e0ef4b1e
      unknown authored
      
      mysql-test/r/rpl_switch_stm_row_mixed.result:
        post-merge fix
      mysql-test/t/rpl_switch_stm_row_mixed.test:
        post-merge fix (and no need to use a table t12 in some place).
      e0ef4b1e
    • unknown's avatar
      Merge gbichot3.local:/home/mysql_src/mysql-5.1-new-19630 · 53641471
      unknown authored
      into  gbichot3.local:/home/mysql_src/mysql-5.1
      
      
      mysql-test/t/disabled.def:
        Auto merged
      sql/set_var.cc:
        Auto merged
      sql/sql_class.h:
        Auto merged
      mysql-test/r/rpl_switch_stm_row_mixed.result:
        manual merge (will fix)
      mysql-test/t/rpl_switch_stm_row_mixed.test:
        manual merge (will fix)
      53641471
    • unknown's avatar
      fixes in test results (using # for positions in SHOW BINLOG EVENTS). · f94e8d78
      unknown authored
      
      mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test:
        As in other tests, we should replace both position columns of SHOW BINLOG
        EVENTS; otherwise a small change (like here, the fact that CREATE TEMPORARY
        TABLE is not binlogged in RBR as a consequence of the bugfix for BUG#20522)
        causes a large diff in the result file.
      mysql-test/r/binlog_row_mix_innodb_myisam.result:
        result update: positions in SHOW BINLOG EVENTS become #, and
        the CREATE TEMPORARY TABLE disappear from binlog (consequence of fix for
        BUG#20522 "RBR: CREATE TEMPORARY TABLE SELECT writes to binlog though
        unneeded").
      f94e8d78
    • unknown's avatar
      post-merge fixes · 15c321f6
      unknown authored
      
      mysql-test/r/rpl_switch_stm_row_mixed.result:
        result update.
        I noticed the appearance of an additional table_map+rows in the binlog
        when INSERT DELAYED, since I pulled the latest fixes to RBR of 
        INSERT DELAYED. This is ok, I put the reason why into sql_insert.cc.
      sql/sql_insert.cc:
        A comment about the new row-based binlogging of INSERT DELAYED.
        Removing duplicate MY_HOOKS (from a wrong merge of the past??).
      15c321f6
    • unknown's avatar
      Merge gbichot3.local:/home/mysql_src/mysql-5.1-new-WL3146-handler · 9fe33acb
      unknown authored
      into  gbichot3.local:/home/mysql_src/mysql-5.1
      
      
      sql/sql_insert.cc:
        Auto merged
      9fe33acb
    • unknown's avatar
      Manual merge of test from 5.0 (needs to be manual because the test files · 94201860
      unknown authored
      were copied/split between 5.0 and 5.1).
      
      
      mysql-test/extra/rpl_tests/rpl_auto_increment.test:
        manual merge of test from 5.0
      mysql-test/extra/rpl_tests/rpl_insert_id.test:
        manuel merge of test from 5.0
      mysql-test/r/rpl_auto_increment.result:
        error messages changed compared to 5.0
      94201860
    • unknown's avatar
      Merge gbichot3.local:/home/mysql_src/mysql-5.0 · f85f9ac2
      unknown authored
      into  gbichot3.local:/home/mysql_src/mysql-5.1
      
      
      mysql-test/r/rpl_auto_increment.result:
        Auto merged
      mysql-test/r/rpl_insert_id.result:
        Auto merged
      mysql-test/t/rpl_openssl.test:
        Auto merged
      sql/ha_ndbcluster.cc:
        Auto merged
      mysql-test/t/rpl_auto_increment.test:
        will fix by hand
      mysql-test/t/rpl_insert_id.test:
        will fix by hand
      sql/handler.cc:
        comment
      sql/handler.h:
        manual merge
      sql/sql_insert.cc:
        manual merge
      f85f9ac2
    • unknown's avatar
      WL#3146 "less locking in auto_increment": · 60272e75
      unknown authored
      this is a cleanup patch for our current auto_increment handling:
      new names for auto_increment variables in THD, new methods to manipulate them
      (see sql_class.h), some move into handler::, causing less backup/restore
      work when executing substatements. 
      This makes the logic hopefully clearer, less work is is needed in
      mysql_insert().
      By cleaning up, using different variables for different purposes (instead
      of one for 3 things...), we fix those bugs, which someone may want to fix
      in 5.0 too:
      BUG#20339 "stored procedure using LAST_INSERT_ID() does not replicate
      statement-based"
      BUG#20341 "stored function inserting into one auto_increment puts bad
      data in slave"
      BUG#19243 "wrong LAST_INSERT_ID() after ON DUPLICATE KEY UPDATE"
      (now if a row is updated, LAST_INSERT_ID() will return its id)
      and re-fixes:
      BUG#6880 "LAST_INSERT_ID() value changes during multi-row INSERT"
      (already fixed differently by Ramil in 4.1)
      Test of documented behaviour of mysql_insert_id() (there was no test).
      The behaviour changes introduced are:
      - LAST_INSERT_ID() now returns "the first autogenerated auto_increment value
      successfully inserted", instead of "the first autogenerated auto_increment
      value if any row was successfully inserted", see auto_increment.test.
      Same for mysql_insert_id(), see mysql_client_test.c.
      - LAST_INSERT_ID() returns the id of the updated row if ON DUPLICATE KEY
      UPDATE, see auto_increment.test. Same for mysql_insert_id(), see
      mysql_client_test.c.
      - LAST_INSERT_ID() does not change if no autogenerated value was successfully 
      inserted (it used to then be 0), see auto_increment.test.
      - if in INSERT SELECT no autogenerated value was successfully inserted,
      mysql_insert_id() now returns the id of the last inserted row (it already
      did this for INSERT VALUES), see mysql_client_test.c.
      - if INSERT SELECT uses LAST_INSERT_ID(X), mysql_insert_id() now returns X
      (it already did this for INSERT VALUES), see mysql_client_test.c.
      - NDB now behaves like other engines wrt SET INSERT_ID: with INSERT IGNORE,
      the id passed in SET INSERT_ID is re-used until a row succeeds; SET INSERT_ID
      influences not only the first row now.
      
      Additionally, when unlocking a table we check that the thread is not keeping
      a next_insert_id (as the table is unlocked that id is potentially out-of-date);
      forgetting about this next_insert_id is done in a new
      handler::ha_release_auto_increment().
      
      Finally we prepare for engines capable of reserving finite-length intervals
      of auto_increment values: we store such intervals in THD. The next step
      (to be done by the replication team in 5.1) is to read those intervals from
      THD and actually store them in the statement-based binary log. NDB
      will be a good engine to test that.
      
      
      mysql-test/extra/binlog_tests/binlog.test:
        Testing that if INSERT_ID is set to a value too big for the
        column's type, the binlogged INSERT_ID is the truncated value
        (important if slave has a column of a "wider" numeric type).
        Testing binlogging of INSERT_ID with INSERT DELAYED, to be sure that 
        we binlog an INSERT_ID event only for the delayed rows which use one.
      mysql-test/extra/rpl_tests/rpl_insert_id.test:
        Testcase for BUG#20339 "stored procedure using
        LAST_INSERT_ID() does not replicate statement-based".
        Testcase for BUG#20341 "stored function inserting into one
        auto_increment puts bad data in slave".
      mysql-test/extra/rpl_tests/rpl_loaddata.test:
        Test that LOAD DATA INFILE sets a value for a future LAST_INSERT_ID().
      mysql-test/r/auto_increment.result:
        behaviour change: when INSERT totally fails (not even succeeds
        partially and then rolls back), don't change last_insert_id().
        Behaviour change: LAST_INSERT_ID() is now the first successfully inserted,
        autogenerated, id.
        Behaviour change: if INSERT ON DUPLICATE KEY UPDATE, if the table has auto_increment
        and a row is updated, then LAST_INSERT_ID() returns the id of this row.
      mysql-test/r/binlog_row_binlog.result:
        result update
      mysql-test/r/binlog_stm_binlog.result:
        result update
      mysql-test/r/insert.result:
        result update
      mysql-test/r/rpl_insert_id.result:
        result update
      mysql-test/r/rpl_loaddata.result:
        result update
      mysql-test/r/rpl_ndb_auto_inc.result:
        ndb's behaviour is now like other engines wrt SET INSERT_ID
        in a multi-row INSERT:
        - with INSERT IGNORE: the id passed in SET INSERT_ID is re-used until
        a row succeeds.
        - generally, SET INSERT_ID sets the first value and other values are
        simply computed from this first value, instead of previously where
        the 2nd and subsequent values where not influenced by SET INSERT_ID;
        this good change is due to the removal of "thd->next_insert_id=0"
        from ha_ndbcluster.
      mysql-test/t/auto_increment.test:
        A testcase of BUG#19243: if ON DUPLICATE KEY UPDATE updates a row,
        LAST_INSERT_ID() now returns the id of the row.
        Test of new behaviour of last_insert_id() when no autogenerated value was
        inserted, or when only some autogenerated value (not the first of them) was
        inserted.
      mysql-test/t/insert.test:
        testing INSERT IGNORE re-using generated values
      sql/ha_federated.cc:
        update for new variables.
      sql/ha_ndbcluster.cc:
        handler::auto_increment_column_changed not needed, equivalent to
        (insert_id_for_cur_row > 0).
        thd->next_insert_id=0 not needed anymore; it was used to force
        handler::update_auto_increment() to call ha_ndbcluster::get_auto_increment()
        for each row of a multi-row INSERT, now this happens naturally
        because NDB says "I have reserved you *one* value" in get_auto_increment(),
        so handler::update_auto_increment() calls again for next row.
      sql/handler.cc:
        More comments, use of new methods and variables. Hopes to be clearer
        than current code.
        thd->prev_insert_id not in THD anymore: it is managed locally by inserters
        (like mysql_insert()).
        THD::clear_next_insert_id is now equivalent to
        handler::next_insert_id > 0.
        get_auto_increment() reserves an interval of values from the engine,
        uses this interval for next rows of the statement, until interval
        is exhausted then it asks for another interval (of a bigger size
        than the first one; size doubles until reaching 65535 then it stays constant).
        If doing statement-based binlogging, intervals are remembered in a list
        for storage in the binlog.
        For "forced" insert_id values (SET INSERT_ID or replication slave),
        forced_auto_inc_intervals is non-empty and the handler takes its intervals
        from there, without calling get_auto_increment().
        ha_release_auto_increment() resets the handler's auto_increment variables;
        it calls release_auto_increment() which is handler-dependent and
        serves to return to the engine any unused tail of the last used
        interval.
        If ending a statement, next_insert_id>0 means that autoinc values have been
        generated or taken from the master's binlog (in a replication slave) so
        we clear those values read from binlog, so that next top- or sub-
        statement does not use them.
      sql/handler.h:
        handler::auto_increment_changed can be replaced by
        (handler::insert_id_for_cur_row > 0).
        THD::next_insert_id moves into handler (more natural, and prepares
        for the day when we'll support a single statement inserting into
        two tables - "multi-table INSERT" like we have UPDATE - will this
        happen?).
        This move makes the backup/restore of THD::next_insert_id when entering
        a substatement unneeded, as each substatement has its own handler
        objects.
      sql/item_func.cc:
        new names for variables.
        For the setting of what mysql_insert_id() will return to the client,
        LAST_INSERT_ID(X) used to simply pretend that the generated autoinc
        value for the current row was X, but this led to having no reliable
        way to know the really generated value, so we now have a bool:
        thd->arg_of_last_insert_id_function which enables us to know that
        LAST_INSERT_ID(X) was called (and then X can be found in
        thd->first_successful_insert_id_in_prev_stmt).
      sql/log.cc:
        new variable names for insert_ids. Removing some unused variables in the slow
        log.
      sql/log_event.cc:
        new variable names, comments. Preparing for when master's won't binlog
        LAST_INSERT_ID if it was 0.
      sql/set_var.cc:
        new variable names.
        The last change repeats how Bar fixed BUG#20392
        "INSERT_ID session variable has weird value" in 5.0.
      sql/sql_class.cc:
        new variables for insert_id. In THD::cleanup_after_query() we fix
        BUG#20339 "stored procedure using LAST_INSERT_ID() does not replicate
        statement-based" (will one want to fix it in 5.0?). Many comments
        about what stored functions do to auto_increment.
        In reset|restore_sub_statement_state(), we need to backup less
        auto_inc variables as some of them have moved to the handler;
        we backup/restore those which are about the current top- or sub-
        statement, *not* those about the statement-based binlog
        (which evolve as the top- and sub-statement execute).
        Because we split THD::last_insert_id into 
        THD::first_successful_insert_id_in_prev_stmt and
        THD::auto_inc_intervals_for_binlog (among others), we fix
        BUG#20341 "stored function inserting into one auto_increment
        puts bad data in slave": indeed we can afford to not backup/restore
        THD::auto_inc_intervals_for_binlog (which fixes the bug) while still
        backing up / restoring THD::first_successful_insert_id_in_prev_stmt
        (ensuring that the top-level LAST_INSERT_ID() is not affected by INSERTs
        done by sub-statements, as is desirable and tested in rpl_insert_id.test).
      sql/sql_class.h:
        new variables and methods for auto_increment.
        Some THD members move into handler (those which are really about
        the table being inserted), some stay in THD (those which are
        about what a future LAST_INSERT_ID() should return, or about
        what should be stored into the statement-based binlog).
        THD::next_insert_id moves to handler::.
        THD::clear_next_insert_id removed (had become equivalent
        to next_insert_id > 0).
        THD::last_insert_id becomes four:
        THD::first_successful_insert_id_in_cur_stmt,
        THD::auto_inc_intervals_for_binlog,
        handler::insert_id_for_cur_row,
        THD::first_successful_insert_id_in_prev_stmt.
        THD::current_insert_id becomes:
        THD::first_successful_insert_id_in_prev_stmt_for_binlog
        THD::prev_insert_id is removed, handler can just use
        handler::insert_id_for_cur_row instead (which is more accurate:
        for the first row, prev_insert_id was set before get_auto_increment
        was called, so was 0, causing a call to
        get_auto_increment() for the 2nd row if the 1st row fails;
        here we don't need the call as insert_id_for_cur_row has
        the value of the first row).
        THD::last_insert_id_used becomes: stmt_depends_on_first_row_in_prev_stmt
        THD::insert_id_used is removed (equivalent to
        auto_inc_intervals_for_binlog non empty).
        The interval returned by get_auto_increment() and currently being
        consumed is handler::auto_inc_interval_for_cur_row.
        Comments to explain each of them.
        select_insert::last_insert_id becomes autoinc_value_of_last_inserted_row.
      sql/sql_insert.cc:
        the "id" variable is not changed for each row now; it used to compensate for
        this contradiction:
        - thd->last_insert_id supposed job was to keep the id of the first row
        - but it was updated for every row
        - so mysql_insert() made sure to catch its first value and restore it at the end of stmt.
        Now THD keeps the first value in first_successful_insert_id_in_cur_stmt,
        and value of the row in insert_id_for_cur_row. So "id" only serves to fill
        mysql_insert_id(), as depending on some conditions, "id" must be different
        values.
        Prev_insert_id moves from THD to write_record().
        We now set LAST_INSERT_ID() in ON DUPLICATE KEY UPDATE too (BUG#19243).
        In an INSERT DELAYED, we still "reset auto-increment caching" but differently
        (by calling ha_release_auto_increment()).
      sql/sql_load.cc:
        no need to fiddle with "id", THD maintains
        THD::first_successful_insert_id_in_cur_stmt by itself and correctly now.
        ha_release_auto_increment() is now (logically) called before we unlock
        the table.
      sql/sql_parse.cc:
        update to new variable names.
        Assertion that reset_thd_for_next_command() is not called for every
        substatement of a routine (I'm not against it, but if we do this change,
        statement-based binlogging needs some adjustments).
      sql/sql_select.cc:
        update for new variable names
      sql/sql_table.cc:
        next_insert_id not needed in mysql_alter_table(), THD manages.
      sql/sql_update.cc:
        update for new variable names.
        Even though this is UPDATE, an insert id can be generated (by
        LAST_INSERT_ID(X)) and should be recorded because mysql_insert_id() wants
        to know about it.
      sql/structs.h:
        A class for "discrete" intervals (intervals of integer numbers with a certain
        increment between them): Discrete_interval, and a class for a list of such
        intervals: Discrete_intervals_list
      tests/mysql_client_test.c:
        tests of behaviour of mysql_insert_id(): there were no such tests, while in
        our manual we document its behaviour. In comments you'll notice the behaviour
        changes introduced (there are 5).
      60272e75
    • unknown's avatar
      * Mixed replication mode * : · 81a80049
      unknown authored
      1) Fix for BUG#19630 "stored function inserting into two auto_increment breaks
      statement-based binlog":
      a stored function inserting into two such tables may fail to replicate
      (inserting wrong data in the slave's copy of the second table) if the slave's
      second table had an internal auto_increment counter different from master's.
      Because the auto_increment value autogenerated by master for the 2nd table
      does not go into binlog, only the first does, so the slave lacks information.
      To fix this, if running in mixed binlogging mode, if the stored function or
      trigger plans to update two different tables both having auto_increment
      columns, we switch to row-based for the whole function.
      We don't have a simple solution for statement-based binlogging mode, there
      the bug remains and will be documented as a known problem.
      Re-enabling rpl_switch_stm_row_mixed.
      2) Fix for BUG#20630 "Mixed binlogging mode does not work with stored
      functions, triggers, views", which was a documented limitation (in mixed
      mode, we didn't detect that a stored function's execution needed row-based
      binlogging (due to some UUID() call for example); same for
      triggers, same for views (a view created from a SELECT UUID(), and doing
      INSERT INTO sometable SELECT theview; would not replicate row-based).
      This is implemented by, after parsing a routine's body, remembering in sp_head
      that this routine needs row-based binlogging. Then when this routine is used,
      the caller is marked to require row-based binlogging too.
      Same for views: when we parse a view and detect that its SELECT needs
      row-based binary logging, we mark the calling LEX as such.
      3) Fix for BUG#20499 "mixed mode with temporary table breaks binlog":
      a temporary table containing e.g. UUID has its changes not binlogged,
      so any query updating a permanent table with data from the temporary table
      will run wrongly on slave. Solution: in mixed mode we don't switch back
      from row-based to statement-based when there exists temporary tables.
      4) Attempt to test mysqlbinlog on a binlog generated by mysqlbinlog;
      impossible due to BUG#11312 and BUG#20329, but test is in place for when
      they are fixed.
      
      
      mysql-test/r/rpl_switch_stm_row_mixed.result:
        testing BUG#19630 "stored function inserting into two auto_increment breaks
        statement-based binlog",
        testing BUG#20930 "Mixed binlogging mode does not work with stored functions,
        triggers, views.
        testing BUG#20499 "mixed mode with temporary table breaks binlog".
        I have carefully checked this big result file, it is correct.
      mysql-test/t/disabled.def:
        re-enabling test
      mysql-test/t/rpl_switch_stm_row_mixed.test:
        Test for BUG#19630 "stored function inserting into two auto_increment breaks
        statement-based binlog":
        we test that it goes row-based, but only when needed;
        without the bugfix, master and slave's data differed.
        Test for BUG#20499 "mixed mode with temporary table breaks binlog":
        without the bugfix, slave had 2 rows, not 3.
        Test for BUG#20930 "Mixed binlogging mode does not work with stored
        functions, triggers, views".
        Making strings used more different, for easier tracking of "by which routine
        was this binlog line generated".
        Towards the end, an attempt to test mysqlbinlog on a binlog generated by
        the mixed mode; attempt failed because of BUG#11312 and BUG#20929.
      sql/item_create.cc:
        fix for build without row-based replication
      sql/set_var.cc:
        cosmetic: in_sub_stmt is exactly meant to say if we are in stored
        function/trigger, so better use it.
      sql/sp.cc:
        When a routine adds its tables to the top statement's tables, if this routine
        needs row-based binlogging, mark the entire top statement as well.
        Same for triggers.
        Needed for making the mixed replication mode work with stored functions
        and triggers.
      sql/sp_head.cc:
        new enum value for sp_head::m_flags, remembers if, when parsing the 
        routine, we found at least one element (UUID(), UDF) requiring row-based
        binlogging.
      sql/sp_head.h:
        new enum value for sp_head::m_flags (see sp_head.cc).
        An utility method, intended for attributes of a routine which need
        to propagate upwards to the caller; so far only used for binlogging
        information, but open to any other attribute.
      sql/sql_base.cc:
        For BUG#19630 "stored function inserting into two auto_increment
        breaks statement-based binlog":
        When we come to locking tables, we have collected all tables used by
        functions, views and triggers, we detect if we're going to update two tables
        having auto_increment columns. If yes, statement-based binlogging won't work
        (Intvar_log_event records only one insert_id) so, if in mixed binlogging
        mode, switch to row-based.
        For making mixed mode work with stored functions using UUID/UDF:
        when we come to locking tables, we have parsed the whole body so know if
        some elements need row-based. Generation of row-based binlog events
        depends on locked tables, so this is the good place to decide of the binlog
        format.
      sql/sql_class.h:
        Fix for BUG#20499 "mixed mode with temporary table breaks binlog".
        Making mixed mode work with stored functions/triggers: don't reset
        back to statement-based if in executing a stored function/trigger.
      sql/sql_lex.cc:
        fix for build without row-based replication.
        binlog_row_based_if_mixed moves from st_lex to Query_tables_list, because
        that boolean should not be affected when a SELECT reads the INFORMATION_SCHEMA
        and thus implicitely parses a view or routine's body: this body may
        contain needing-row-based components like UUID() but the SELECT on
        INFORMATION_SCHEMA should not be affected by that and should not use
        row-based; as Query_tables_list is backed-up/reset/restored when parsing
        the view/routine's body, so does binlog_row_based_if_mixed and the
        top SELECT is not affected.
      sql/sql_lex.h:
        fix for build without row-based replication.
        binlog_row_based_if_mixed moves from st_lex to Query_tables_list
        (see sql_lex.cc)
      sql/sql_parse.cc:
        For the mixed mode to work with stored functions using UUID and UDF, we need
        to move the switch-back-from-row-to-statement out of
        mysql_execute_command() (which is executed for each statement, causing
        the binlogging mode to change in the middle of the function, which would
        not work)
        The switch to row-based is now done in lock_tables(), no need to keep it
        in mysql_execute_command(); in lock_tables() we also switch back from 
        row-based to statement-based (so in a stored procedure, all statements
        have their binlogging mode). We must however keep a resetting in
        mysql_reset_thd_for_next_command() as e.g. CREATE PROCEDURE does not call
        lock_tables().
      sql/sql_view.cc:
        When a view's body needs row-based binlogging (e.g. the view is created
        from SELECT UUID()), propagate this fact to the top st_lex.
      sql/sql_yacc.yy:
        use TRUE instead of 1, for binlog_row_based_if_mixed.
      81a80049
  5. 08 Jul, 2006 5 commits
    • unknown's avatar
      BUG#19188 incorrect temporary table name of DROP query in replication · b94d70a6
      unknown authored
      manual merge of 5.0 patch and fixing an issue with closing temp tables when no binlog or RBR.
      Note, that despite temporary_tables is indeed double-linked list in 5.1 (patch for bug #19881) it is still enough to use only 'next' reference, as it was done for 5.0, when the list is sorted and 
      destoyed after.
      
      
      mysql-test/r/rpl_temporary.result:
        results changed
      mysql-test/t/rpl_temporary.test:
        fixing kill stmt for a thread with temp tables. Restoring check of temp table with accent char.
      sql/sql_base.cc:
        manual merge part 2. Leaving only extensively refactored close_temporary_tables from local rep.
      b94d70a6
    • unknown's avatar
      Merge chilla.local:/home/mydev/mysql-5.1--main · 619d8b2c
      unknown authored
      into  chilla.local:/home/mydev/mysql-5.1-amerge
      
      
      sql/sql_insert.cc:
        Auto merged
      sql/sql_parse.cc:
        Auto merged
      sql/sql_trigger.cc:
        Auto merged
      619d8b2c
    • unknown's avatar
      Merge dsl-hkigw8-feb1fb00-100.dhcp.inet.fi:/usr_rh9/home/elkin.rh9/MySQL/TEAM/BARE/5.1 · 1730c0c7
      unknown authored
      into  dsl-hkigw8-feb1fb00-100.dhcp.inet.fi:/usr_rh9/home/elkin.rh9/MySQL/TEAM/FIXES/5.1/bug19188_graved_temp
      
      
      1730c0c7
    • unknown's avatar
      BUG#20821 (INSERT DELAYED failes to write some rows to binlog): · a92e1c4a
      unknown authored
      Fixing typo and potential memory problem.
      Reducing number of concurrent mysqlslap threads since tests fail
      in pushbuild due to too many threads.
      
      
      mysql-test/r/rpl_insert.result:
        Result change.
      mysql-test/t/rpl_insert.test:
        Reducing number of threads since it doesn't pass pushbuild.
      sql/sql_insert.cc:
        Fixing typo and potential memory problem.
      a92e1c4a
    • unknown's avatar
      Bug #20843 tests fails randomly with assertion in completeClusterFailed · d0baba61
      unknown authored
      Bug #20902 Alter table invalid schema version with statement-based binlogging
      (latter caused by the above)
      
      
      d0baba61