1. 09 Jul, 2006 10 commits
    • guilhem@gbichot3.local's avatar
      Merge gbichot3.local:/home/mysql_src/mysql-5.1-interval-move-next-insert-id · bca3fc78
      guilhem@gbichot3.local authored
      into  gbichot3.local:/home/mysql_src/mysql-5.1
      bca3fc78
    • guilhem@gbichot3.local's avatar
      post-merge test/result fixes. · 17efd43b
      guilhem@gbichot3.local authored
      17efd43b
    • guilhem@gbichot3.local's avatar
      Merge gbichot3.local:/home/mysql_src/mysql-5.1-new-19630 · 1bfe0bdf
      guilhem@gbichot3.local authored
      into  gbichot3.local:/home/mysql_src/mysql-5.1
      1bfe0bdf
    • guilhem@gbichot3.local's avatar
    • guilhem@gbichot3.local's avatar
      post-merge fixes · f6c996f0
      guilhem@gbichot3.local authored
      f6c996f0
    • guilhem@gbichot3.local's avatar
      Merge gbichot3.local:/home/mysql_src/mysql-5.1-new-WL3146-handler · 57ced262
      guilhem@gbichot3.local authored
      into  gbichot3.local:/home/mysql_src/mysql-5.1
      57ced262
    • guilhem@gbichot3.local's avatar
      Manual merge of test from 5.0 (needs to be manual because the test files · 87fb4fb4
      guilhem@gbichot3.local authored
      were copied/split between 5.0 and 5.1).
      87fb4fb4
    • guilhem@gbichot3.local's avatar
      Merge gbichot3.local:/home/mysql_src/mysql-5.0 · 1a506b34
      guilhem@gbichot3.local authored
      into  gbichot3.local:/home/mysql_src/mysql-5.1
      1a506b34
    • guilhem@gbichot3.local's avatar
      WL#3146 "less locking in auto_increment": · 0594e1b8
      guilhem@gbichot3.local 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.
      0594e1b8
    • guilhem@gbichot3.local's avatar
      * Mixed replication mode * : · fdb0f85a
      guilhem@gbichot3.local 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.
      fdb0f85a
  2. 08 Jul, 2006 1 commit
  3. 07 Jul, 2006 10 commits
  4. 06 Jul, 2006 8 commits
    • guilhem@gbichot3.local's avatar
      Testcase for BUG#20633 "INSERT DELAYED RAND() or @user_var does not replicate · 6ba4d22c
      guilhem@gbichot3.local authored
      statement-based" (bugfix was committed today):
      we verify that now it works in mixed mode. And a comment.
      6ba4d22c
    • guilhem@gbichot3.local's avatar
      Fix for BUG#20349 "mysql-test-run.pl needs to add --debug to · a4768e11
      guilhem@gbichot3.local authored
      mysql_client_test like mysql-test-run". Nothing to document.
      a4768e11
    • guilhem@gbichot3.local's avatar
      Merge gbichot3.local:/home/mysql_src/mysql-5.1 · 3ce7e9fc
      guilhem@gbichot3.local authored
      into  gbichot3.local:/home/mysql_src/mysql-5.1-new-WL3146-handler
      3ce7e9fc
    • guilhem@gbichot3.local's avatar
      Fix for BUG#20649 "mixed replication mode does not work with INSERT DELAYED". · a5f184d5
      guilhem@gbichot3.local authored
      The bug was that if the server was running in mixed binlogging mode,
      and an INSERT DELAYED used some needing-row-based components like UUID(),
      the server didn't binlog this row-based but statement-based, which
      thus failed to insert correct data on the slave.
      This changeset implements that when a delayed_insert thread is created,
      if the server's global binlog mode is "mixed", that thread will use row-based.
      This also fixes BUG#20633 "INSERT DELAYED RAND() or @user_var does not
      replicate statement-based": we don't fix it in statement-based mode (would
      require bookeeping of rand seeds and user variables used by each row),
      but at least it will now work in mixed mode (as row-based will be used).
      We re-enable rpl_switch_stm_row_mixed.test (so BUG#18590
      which was about re-enabling this test, will be closed) to test the fixes.
      Between when it was disabled and now, some good changes to row-based
      binlogging (no generation of table map events for non-changed tables)
      induce changes in the test's result file.
      a5f184d5
    • guilhem@gbichot3.local's avatar
      Behaviour change of mysql-test-run.pl: · fd520be8
      guilhem@gbichot3.local authored
      by default we never run disabled tests (even if they're
      explicitely listed on the command-line). We add an option --enable-disabled
      which will run tests even though they are disabled, and will print, for each
      such test, the comment explaining why it was disabled.
      The reason for the change is when you want to run "all tests which are about
      NDB" for example: mysql-test-run.pl t/*ndb*.test used to run some disabled
      NDB tests, causing failures, causing investigations.
      Code amended and approved by Kent.
      fd520be8
    • guilhem@gbichot3.local's avatar
      Merge gbichot@bk-internal.mysql.com:/home/bk/mysql-5.0-rpl · 3365337c
      guilhem@gbichot3.local authored
      into  gbichot3.local:/home/mysql_src/mysql-5.0
      3365337c
    • guilhem@gbichot3.local's avatar
      Merge gbichot3.local:/home/mysql_src/mysql-5.0-20524 · dd84ef1b
      guilhem@gbichot3.local authored
      into  gbichot3.local:/home/mysql_src/mysql-5.0
      dd84ef1b
    • guilhem@mysql.com's avatar
      Fix for BUG#20524 "auto_increment_* not observed when inserting · 140b488c
      guilhem@mysql.com authored
      a too large value": the bug was that if MySQL generated a value for an
      auto_increment column, based on auto_increment_* variables, and this value
      was bigger than the column's max possible value, then that max possible
      value was inserted (after issuing a warning). But this didn't honour
      auto_increment_* variables (and so could cause conflicts in a master-master
      replication where one master is supposed to generated only even numbers,
      and the other only odd numbers), so now we "round down" this max possible
      value to honour auto_increment_* variables, before inserting it.
      140b488c
  5. 05 Jul, 2006 4 commits
    • mats@mysql.com's avatar
    • mats@romeo.(none)'s avatar
      Merge mysql.com:/home/bkroot/mysql-5.1-new-rpl · a3ae3398
      mats@romeo.(none) authored
      into  mysql.com:/home/bk/b20821-mysql-5.1-new-rpl
      a3ae3398
    • mats@mysql.com's avatar
      BUG#20821 (INSERT DELAYED fails to write some rows to binlog): · fd92d807
      mats@mysql.com authored
      Reverting to old behaviour of writing the query before all rows
      have been written.
      fd92d807
    • guilhem@mysql.com's avatar
      Fix for BUG#20188 "REPLACE or ON DUPLICATE KEY UPDATE in · a43c4b02
      guilhem@mysql.com authored
      auto_increment breaks binlog":
      if slave's table had a higher auto_increment counter than master's (even
      though all rows of the two tables were identical), then in some cases,
      REPLACE and INSERT ON DUPLICATE KEY UPDATE failed to replicate
      statement-based (it inserted different values on slave from on master).
      write_record() contained a "thd->next_insert_id=0" to force an adjustment
      of thd->next_insert_id after the update or replacement. But it is this
      assigment introduced indeterminism of the statement on the slave, thus
      the bug. For ON DUPLICATE, we replace that assignment by a call to
      handler::adjust_next_insert_id_after_explicit_value() which is deterministic
      (does not depend on slave table's autoinc counter). For REPLACE, this
      assignment can simply be removed (as REPLACE can't insert a number larger
      than thd->next_insert_id).
      We also move a too early restore_auto_increment() down to when we really know
      that we can restore the value.
      a43c4b02
  6. 03 Jul, 2006 5 commits
  7. 01 Jul, 2006 2 commits