An error occurred fetching the project authors.
  1. 19 Feb, 2013 1 commit
    • unknown's avatar
      MDEV-26: Global transaction ID, intermediate commit. · bfec9c64
      unknown authored
       - Fix that slave GTID state was updated from the wrong place in the code,
         causing random crashing and other misery.
      
       - Fix updates to mysql.rpl_slave_state to not go to binlog (this would cause
         duplicate key errors on the slave and is generally the wrong thing to do).
      bfec9c64
  2. 15 Feb, 2013 2 commits
  3. 14 Feb, 2013 1 commit
    • unknown's avatar
      MDEV-26: Global transaction ID. · cb5a5388
      unknown authored
      Slave now loads the GTID state from the master when connecting with
      old-style filename/offset position.
      
      This allows the user to use MASTER_GTID_POS=AUTO on next CHANGE MASTER
      without any other action needed.
      cb5a5388
  4. 11 Feb, 2013 1 commit
    • unknown's avatar
      MDEV-26. Intermediate commit. · 041f26d3
      unknown authored
      Implement binlog_gtid_pos() function. This will be used so that
      the slave can obtain the gtid position automatically from first
      connect with old-style position - then MASTER_GTID_POS=AUTO will
      work the next time. Can also be used by mysqldump --master-data
      to give the current gtid position directly.
      041f26d3
  5. 25 Jan, 2013 1 commit
    • unknown's avatar
      MDEV-26: Global transaction ID. · 1d357776
      unknown authored
      When starting slave, check binlog state in addition to mysql.rpl_slave.state.
      
      This allows to switch a previous master to be a slave directly
      with MASTER_GTID_POS=AUTO.
      1d357776
  6. 22 Jan, 2013 1 commit
  7. 15 Nov, 2012 1 commit
    • unknown's avatar
      MDEV-26: Global transaction id: Intermediate commit. · bdbce30d
      unknown authored
      Now slave can connect to master, sending start position as slave state
      rather than old-style binlog name/position.
      
      This enables to switch to a new master by changing just connection
      information, replication slave GTID state ensures that slave starts
      at the correct point in the new master.
      bdbce30d
  8. 07 Nov, 2012 1 commit
  9. 05 Nov, 2012 1 commit
  10. 23 Oct, 2012 2 commits
  11. 10 Jan, 2013 1 commit
    • Michael Widenius's avatar
      Fixed some race conditons and bugs related to killed queries · 6e9a48b6
      Michael Widenius authored
      KILL now breaks locks inside InnoDB
      Fixed possible deadlock when running INNODB STATUS
      Added ha_kill_query() and kill_query() to send kill signal to all storage engines
      Added reset_killed() to ensure we don't reset killed state while awake() is getting called
      
      
      include/mysql/plugin.h:
        Added thd_mark_as_hard_kill()
      include/mysql/plugin_audit.h.pp:
        Added thd_mark_as_hard_kill()
      include/mysql/plugin_auth.h.pp:
        Added thd_mark_as_hard_kill()
      include/mysql/plugin_ftparser.h.pp:
        Added thd_mark_as_hard_kill()
      sql/handler.cc:
        Added ha_kill_query() to send kill signal to all storage engines
      sql/handler.h:
        Added ha_kill_query() and kill_query() to send kill signal to all storage engines
      sql/log_event.cc:
        Use reset_killed()
      sql/mdl.cc:
        use thd->killed instead of thd_killed() to abort on soft kill
      sql/sp_rcontext.cc:
        Use reset_killed()
      sql/sql_class.cc:
        Fixed possible deadlock in INNODB STATUS by not getting thd->LOCK_thd_data if it's locked.
        Use reset_killed()
        Tell storge engines that KILL has been sent
      sql/sql_class.h:
        Added reset_killed() to ensure we don't reset killed state while awake() is getting called.
        Added mark_as_hard_kill()
      sql/sql_insert.cc:
        Use reset_killed()
      sql/sql_parse.cc:
        Simplify detection of killed queries.
        Use reset_killed()
      sql/sql_select.cc:
        Use reset_killed()
      sql/sql_union.cc:
        Use reset_killed()
      storage/innobase/handler/ha_innodb.cc:
        Added innobase_kill_query()
        Fixed error reporting for interrupted queries.
      storage/xtradb/handler/ha_innodb.cc:
        Added innobase_kill_query()
        Fixed error reporting for interrupted queries.
      6e9a48b6
  12. 21 Oct, 2012 1 commit
  13. 17 Oct, 2012 1 commit
    • unknown's avatar
      MDEV-452 Add full support for auto-initialized/updated timestamp and datetime · bc4a4567
      unknown authored
      Generalized support for auto-updated and/or auto-initialized timestamp
      and datetime columns. This patch is a reimplementation of MySQL's
      "WL#5874: CURRENT_TIMESTAMP as DEFAULT for DATETIME columns". In order to
      ease future merges, this implementation reused few function and variable
      names from MySQL's patch, however the implementation is quite different.
      
      TODO:
      The only unresolved problem in this patch is the semantics of LOAD DATA for
      TIMESTAMP and DATETIME columns in the cases when there are missing or NULL
      columns. I couldn't fully comprehend the logic behind MySQL's behavior and
      its relationship with their own documentation, so I left the results to be
      more consistent with all other LOAD cases.
      
      The problematic test cases can be seen by running the test file function_defaults,
      and observing the test case differences. Those were left on purpose for discussion.
      bc4a4567
  14. 12 Oct, 2012 1 commit
    • Nuno Carvalho's avatar
      BUG#14629727: USER_VAR_EVENT IS MISSING RANGE CHECKS · f1d3b0f1
      Nuno Carvalho authored
      This bug had two problems:
       P1) Reads out of bounds;
       P2) Writes out of bounds.
      
      PROBLEM P1
      ----------
      User_var_log_event unmarshalling from binlog was not performing range
      checks when using name_len and val_len variables to walk on event
      buffer.
      
      Added range checks to User_var_log_event unmarshalling to prevent
      unmarshalling errors.
      
      PROBLEM P2
      ----------
      User_var_log_event value was allocated on thread stack, what caused
      stack frame errors when User_var_log_event value was bigger than thread
      stack size.
      
      Currently value is allocated on heap memory.
      f1d3b0f1
  15. 08 Oct, 2012 1 commit
    • Annamalai Gurusami's avatar
      Bug #14036214 MYSQLD CRASHES WHEN EXECUTING UPDATE IN TRX WITH · 378a7d1e
      Annamalai Gurusami authored
      CONSISTENT SNAPSHOT OPTION
      
      A transaction is started with a consistent snapshot.  After 
      the transaction is started new indexes are added to the 
      table.  Now when we issue an update statement, the optimizer
      chooses an index.  When the index scan is being initialized
      via ha_innobase::change_active_index(), InnoDB reports 
      the error code HA_ERR_TABLE_DEF_CHANGED, with message 
      stating that "insufficient history for index".
      
      This error message is propagated up to the SQL layer.  But
      the my_error() api is never called.  The statement level
      diagnostics area is not updated with the correct error 
      status (it remains in Diagnostics_area::DA_EMPTY).  
      
      Hence the following check in the Protocol::end_statement()
      fails.
      
       516   case Diagnostics_area::DA_EMPTY:
       517   default:
       518     DBUG_ASSERT(0);
       519     error= send_ok(thd->server_status, 0, 0, 0, NULL);
       520     break;
      
      The fix is to backport the fix of bugs 14365043, 11761652 
      and 11746399. 
      
      14365043 PROTOCOL::END_STATEMENT(): ASSERTION `0' FAILED
      11761652 HA_RND_INIT() RESULT CODE NOT CHECKED
      11746399 RETURN VALUES OF HA_INDEX_INIT() AND INDEX_INIT() IGNORED
      
      rb://1227 approved by guilhem and mattiasj.
      378a7d1e
  16. 02 Oct, 2012 1 commit
    • Michael Widenius's avatar
      Changed SHOW_FUNC variabels that don't return SHOW_ARRAY to SHOW_SIMPLE_FUNC. · 572560f3
      Michael Widenius authored
      This allows us to avoid calculating variables (including those involving mutex) that doesn't match the given
      wildcard in SHOW STATUS LIKE '...'
      Removed all references to active_mi that could cause problems for multi-source replication.
      
      Added START|STOP ALL SLAVES
      Added SHOW ALL SLAVES STATUS
      
      
      include/mysql/plugin.h:
        Added SHOW_SIMPLE_FUNC
      include/mysql/plugin_audit.h.pp:
        Updated .pp file
      include/mysql/plugin_auth.h.pp:
        Updated .pp file
      include/mysql/plugin_ftparser.h.pp:
        Updated .pp file
      mysql-test/suite/multi_source/info_logs.result:
        New columns in SHOW ALL SLAVES STATUS
      mysql-test/suite/multi_source/info_logs.test:
        Test new syntax
      mysql-test/suite/multi_source/simple.result:
        New columns in SHOW ALL SLAVES STATUS
      mysql-test/suite/multi_source/simple.test:
        test new syntax
      mysql-test/suite/multi_source/syntax.result:
        Updated result
      mysql-test/suite/multi_source/syntax.test:
        Test new syntax
      mysql-test/suite/rpl/r/rpl_skip_replication.result:
        Updated result
      plugin/semisync/semisync_master_plugin.cc:
        SHOW_FUNC -> SHOW_SIMPLE_FUNC
      sql/item_create.cc:
        Simplify code
      sql/lex.h:
        Added SLAVES keyword
      sql/log.cc:
        Constant -> define
      sql/log_event.cc:
        Added comment
      sql/mysqld.cc:
        SHOW_FUNC -> SHOW_SIMPLE_FUNC
        Made slave_retried_trans, slave_received_heartbeats and heartbeat_period multi-source safe
        Clear variable denied_connections and slave_retried_transactions on startup
      sql/mysqld.h:
        Added slave_retried_transactions
      sql/rpl_mi.cc:
        create_signed_file_name -> create_logfile_name_with_suffix
        Added start_all_slaves() and stop_all_slaves()
      sql/rpl_mi.h:
        Added prototypes
      sql/rpl_rli.cc:
        create_signed_file_name -> create_logfile_name_with_suffix
        added executed_entries
      sql/rpl_rli.h:
        Added executed_entries
      sql/share/errmsg-utf8.txt:
        More and better error messages
      sql/slave.cc:
        Added more fields to SHOW ALL SLAVES STATUS
        Added slave_retried_transactions
        Changed constants -> defines
      sql/sql_class.h:
        Added comment
      sql/sql_insert.cc:
        active_mi.rli -> thd->rli_slave
      sql/sql_lex.h:
        Added SQLCOM_SLAVE_ALL_START & SQLCOM_SLAVE_ALL_STOP
      sql/sql_load.cc:
        active_mi.rli -> thd->rli_slave
      sql/sql_parse.cc:
        Added START|STOP ALL SLAVES
      sql/sql_prepare.cc:
        Added SQLCOM_SLAVE_ALL_START & SQLCOM_SLAVE_ALL_STOP
      sql/sql_reload.cc:
        Made REFRESH RELAY LOG multi-source safe
      sql/sql_repl.cc:
        create_signed_file_name -> create_logfile_name_with_suffix
        Don't send my_ok() from start_slave() or stop_slave() so that we can call it for all master connections
      sql/sql_show.cc:
        Compare wild cards early for all variables
      sql/sql_yacc.yy:
        Added START|STOP ALL SLAVES
        Added SHOW ALL SLAVES STATUS
      sql/sys_vars.cc:
        Made replicate_events_marked_for_skip,slave_net_timeout and rpl_filter multi-source safe.
      sql/sys_vars.h:
        Simplify Sys_var_rpl_filter
      572560f3
  17. 30 Sep, 2012 1 commit
    • Michael Widenius's avatar
      Made max_relay_log_size depending on master connection. · 8ac1b41c
      Michael Widenius authored
      Changed names of multi-source log files so that original suffixes are kept.
      
      
      include/my_sys.h:
        Added fn_ext2(), which returns pointer to last '.' in file name
      mysql-test/extra/rpl_tests/rpl_max_relay_size.test:
        Updated test
      mysql-test/suite/multi_source/info_logs-master.opt:
        Test with strange file names
      mysql-test/suite/multi_source/info_logs.result:
        Updated results
      mysql-test/suite/multi_source/info_logs.test:
        Changed to test with complex names to be able to verify the filename generator code
      mysql-test/suite/multi_source/relaylog_events.result:
        Updated results
      mysql-test/suite/multi_source/reset_slave.result:
        Updated results
      mysql-test/suite/multi_source/skip_counter.result:
        Updated results
      mysql-test/suite/multi_source/skip_counter.test:
        Added testing of max_relay_log_size
      mysql-test/suite/rpl/r/rpl_row_max_relay_size.result:
        Updated results
      mysql-test/suite/rpl/r/rpl_stm_max_relay_size.result:
        Updated results
      mysql-test/suite/sys_vars/r/max_relay_log_size_basic.result:
        Updated results
      mysql-test/suite/sys_vars/t/max_relay_log_size_basic.test:
        Updated results
      mysys/mf_fn_ext.c:
        Added fn_ext2(), which returns pointer to last '.' in file name
      sql/log.cc:
        Removed some wrong casts
      sql/log.h:
        Updated comment to reflect new code
      sql/log_event.cc:
        Updated DBUG_PRINT
      sql/mysqld.cc:
        Added that max_relay_log_size copies it's values from max_binlog_size
      sql/mysqld.h:
        Removed max_relay_log_size
      sql/rpl_mi.cc:
        Changed names of multi-source log files so that original suffixes are kept.
      sql/rpl_mi.h:
        Updated prototype
      sql/rpl_rli.cc:
        Updated comment to reflect new code
        Made max_relay_log_size depending on master connection.
      sql/rpl_rli.h:
        Made max_relay_log_size depending on master connection.
      sql/set_var.h:
        Made option global so that one can check and change min & max values (sorry Sergei)
      sql/sql_class.h:
        Made max_relay_log_size depending on master connection.
      sql/sql_repl.cc:
        Updated calls to create_signed_file_name()
      sql/sys_vars.cc:
        Made max_relay_log_size depending on master connection.
        Made old code more reusable
      sql/sys_vars.h:
        Changed Sys_var_multi_source_uint to ulong to be able to handle max_relay_log_size
        Made old code more reusable
      8ac1b41c
  18. 23 Sep, 2012 1 commit
  19. 22 Sep, 2012 1 commit
    • Rohit Kalhans's avatar
      BUG#14548159: NUMEROUS CASES OF INCORRECT IDENTIFIER · 5530c5e3
      Rohit Kalhans authored
      QUOTING IN REPLICATION 
      
      Problem: Misquoting or unquoted identifiers may lead to
      incorrect statements to be logged to the binary log.
      
      Fix: we use specialized functions to append quoted identifiers in
      the statements generated by the server.
      5530c5e3
  20. 18 Sep, 2012 1 commit
    • Michael Widenius's avatar
      Fix for MDEV-533: Confusing error code when doing auto-increment insert for out-of-range values · ae5bc059
      Michael Widenius authored
      create table t1 (a smallint primary key auto_increment);
      insert into t1 values(32767);
      insert into t1 values(NULL);
      ERROR 1062 (23000): Duplicate entry '32767' for key 'PRIMARY
      
      Now on always gets error HA_ERR_AUTOINC_RANGE=167 "Out of range value for column", independent of
      store engine, SQL Mode or number of inserted rows. This is an unique error that is easier to test for in replication.
      
      Another bug fix is that we now get an error when trying to insert a too big auto-generated value, even in non-strict mode.
      Before one get insted the max column value inserted.
      This patch also fixes some issues with inserting negative numbers in an auto-increment column.
      Fixed the ER_DUP_ENTRY and HA_ERR_AUTOINC_ERANGE are compared the same between master and slave.
      This ensures that replication works between an old server to a new slave for auto-increment overflow errors.
      Added SQLSTATE errors for handler errors
      
      Smaller bug fixes:
      * Added warnings for duplicate key errors when using INSERT IGNORE
      * Fixed bug when using --skip-log-bin followed by --log-bin, which did set log-bin to "0"
      * Allow one to see how cmake is called by using --just-print --just-configure
      
      
      BUILD/FINISH.sh:
        --just-print --just-configure now shows how cmake would be invoked. Good for understanding parameters to cmake.
      cmake/configure.pl:
        --just-print --just-configure now shows how cmake would be invoked. Good for understanding parameters to cmake.
      include/CMakeLists.txt:
        Added handler_state.h
      include/handler_state.h:
        SQLSTATE for handler error messages.
        Required for HA_ERR_AUTOINC_ERANGE, but solves also some other cases.
      mysql-test/extra/binlog_tests/binlog.test:
        Fixed old wrong behaviour
        Added more tests
      mysql-test/extra/binlog_tests/binlog_insert_delayed.test:
        Reset binary log to only print what's necessary in show_binlog_events
      mysql-test/extra/rpl_tests/rpl_auto_increment.test:
        Update to new error codes
      mysql-test/extra/rpl_tests/rpl_insert_delayed.test:
        Ignore warnings as this depends on how the test is run
      mysql-test/include/strict_autoinc.inc:
        On now gets an error on overflow
      mysql-test/r/auto_increment.result:
        Update results after fixing error message
      mysql-test/r/auto_increment_ranges_innodb.result:
        Test new behaviour
      mysql-test/r/auto_increment_ranges_myisam.result:
        Test new behaviour
      mysql-test/r/commit_1innodb.result:
        Added warnings for duplicate key error
      mysql-test/r/create.result:
        Added warnings for duplicate key error
      mysql-test/r/insert.result:
        Added warnings for duplicate key error
      mysql-test/r/insert_select.result:
        Added warnings for duplicate key error
      mysql-test/r/insert_update.result:
        Added warnings for duplicate key error
      mysql-test/r/mix2_myisam.result:
        Added warnings for duplicate key error
      mysql-test/r/myisam_mrr.result:
        Added warnings for duplicate key error
      mysql-test/r/null_key.result:
        Added warnings for duplicate key error
      mysql-test/r/replace.result:
        Update to new error codes
      mysql-test/r/strict_autoinc_1myisam.result:
        Update to new error codes
      mysql-test/r/strict_autoinc_2innodb.result:
        Update to new error codes
      mysql-test/r/strict_autoinc_3heap.result:
        Update to new error codes
      mysql-test/r/trigger.result:
        Added warnings for duplicate key error
      mysql-test/r/xtradb_mrr.result:
        Added warnings for duplicate key error
      mysql-test/suite/binlog/r/binlog_innodb_row.result:
        Updated result
      mysql-test/suite/binlog/r/binlog_row_binlog.result:
        Out of range data for auto-increment is not inserted anymore
      mysql-test/suite/binlog/r/binlog_statement_insert_delayed.result:
        Updated result
      mysql-test/suite/binlog/r/binlog_stm_binlog.result:
        Out of range data for auto-increment is not inserted anymore
      mysql-test/suite/binlog/r/binlog_unsafe.result:
        Updated result
      mysql-test/suite/innodb/r/innodb-autoinc.result:
        Update to new error codes
      mysql-test/suite/innodb/r/innodb-lock.result:
        Updated results
      mysql-test/suite/innodb/r/innodb.result:
        Updated results
      mysql-test/suite/innodb/r/innodb_bug56947.result:
        Updated results
      mysql-test/suite/innodb/r/innodb_mysql.result:
        Updated results
      mysql-test/suite/innodb/t/innodb-autoinc.test:
        Update to new error codes
      mysql-test/suite/maria/maria3.result:
        Updated result
      mysql-test/suite/maria/mrr.result:
        Updated result
      mysql-test/suite/optimizer_unfixed_bugs/r/bug43617.result:
        Updated result
      mysql-test/suite/rpl/r/rpl_auto_increment.result:
        Update to new error codes
      mysql-test/suite/rpl/r/rpl_insert_delayed,stmt.rdiff:
        Updated results
      mysql-test/suite/rpl/r/rpl_loaddatalocal.result:
        Updated results
      mysql-test/t/auto_increment.test:
        Update to new error codes
      mysql-test/t/auto_increment_ranges.inc:
        Test new behaviour
      mysql-test/t/auto_increment_ranges_innodb.test:
        Test new behaviour
      mysql-test/t/auto_increment_ranges_myisam.test:
        Test new behaviour
      mysql-test/t/replace.test:
        Update to new error codes
      mysys/my_getopt.c:
        Fixed bug when using --skip-log-bin followed by --log-bin, which did set log-bin to "0"
      sql/handler.cc:
        Ignore negative values for signed auto-increment columns
        Always give an error if we get an overflow for an auto-increment-column (instead of inserting the max value)
        Ensure that the row number is correct for the out-of-range-value error message.
        
        
        ******
        Fixed wrong printing of column namn for "Out of range value" errors
        Fixed that INSERT_ID is correctly replicated also for out-of-range autoincrement values
        Fixed that print_keydup_error() can also be used to generate warnings
        ******
        Return HA_ERR_AUTOINC_ERANGE (167) instead of ER_WARN_DATA_OUT_OF_RANGE for auto-increment overflow
      sql/handler.h:
        Allow INSERT IGNORE to continue also after out-of-range inserts.
        Fixed that print_keydup_error() can also be used to generate warnings
      sql/log_event.cc:
        Added DBUG_PRINT
        Fixed the ER_AUTOINC_READ_FAILED, ER_DUP_ENTRY and HA_ERR_AUTOINC_ERANGE are compared the same between master and slave.
        This ensures that replication works between an old server to a new slave for auto-increment overflow errors.
      sql/sql_insert.cc:
        Add warnings for duplicate key errors when using INSERT IGNORE
      sql/sql_state.c:
        Added handler errors
      sql/sql_table.cc:
        Update call to print_keydup_error()
      storage/innobase/handler/ha_innodb.cc:
        Fixed increment handling of auto-increment columns to be consistent with rest of MariaDB.
      storage/xtradb/handler/ha_innodb.cc:
        Fixed increment handling of auto-increment columns to be consistent with rest of MariaDB.
      ae5bc059
  21. 13 Sep, 2012 1 commit
    • unknown's avatar
      MDEV-232: Remove one fsync() from commit phase. · 288eeb3a
      unknown authored
      Introduce a new storage engine API method commit_checkpoint_request().
      This is used to replace the fsync() at the end of every storage engine
      commit with a single fsync() when a binlog is rotated.
      
      Binlog rotation is now done during group commit instead of being
      delayed until unlog(), removing some server stall and avoiding an
      expensive lock/unlock of LOCK_log inside unlog().
      288eeb3a
  22. 24 Aug, 2012 1 commit
    • unknown's avatar
      MDEV-382: Incorrect quoting · cdeabcfd
      unknown authored
      Various places in the server replication code was incorrectly quoting
      strings, which could lead to incorrect SQL on the slave/mysqlbinlog.
      cdeabcfd
  23. 22 Aug, 2012 1 commit
  24. 10 Jul, 2012 1 commit
    • Sujatha Sivakumar's avatar
      BUG#11762670:MY_B_WRITE RETURN VALUE IGNORED · 13f7f002
      Sujatha Sivakumar authored
      Problem:
      =======
      The return value from my_b_write is ignored by: `my_b_write_quoted',
      `my_b_write_bit',`Query_log_event::print_query_header'
      
      Most callers of `my_b_printf' ignore the return value. `log_event.cc' 
      has many calls to it. 
      
      Analysis:
      ========
      `my_b_write' is used to write data into a file. If the write fails it
      sets appropriate error number and error message through my_error()
      function call and sets the IO_CACHE::error == -1.
      `my_b_printf' function is also used to write data into a file, it
      internally invokes my_b_write to do the write operation. Upon
      success it returns number of characters written to file and on error
      it returns -1 and sets the error through my_error() and also sets
      IO_CACHE::error == -1.  Most of the event specific print functions
      for example `Create_file_log_event::print', `Execute_load_log_event::print'
      etc are the ones which make several calls to the above two functions and
      they do not check for the return value after the 'print' call. All the above 
      mentioned abuse cases deal with the client side.
      
      Fix:
      ===
      As part of bug fix a check for IO_CACHE::error == -1 has been added at 
      a very high level after the call to the 'print' function.  There are 
      few more places where the return value of "my_b_write" is ignored
      those are mentioned below.
      
      +++ mysys/mf_iocache2.c    2012-06-04 07:03:15 +0000
      @@ -430,7 +430,8 @@
                 memset(buffz, '0', minimum_width - length2);
               else
                 memset(buffz, ' ', minimum_width - length2);
      -        my_b_write(info, buffz, minimum_width - length2);
      
      +++ sql/log.cc	2012-06-08 09:04:46 +0000
      @@ -2388,7 +2388,12 @@
           {
             end= strxmov(buff, "# administrator command: ", NullS);
             buff_len= (ulong) (end - buff);
      -      my_b_write(&log_file, (uchar*) buff, buff_len);
      
      At these places appropriate return value handlers have been added.
      
      client/mysqlbinlog.cc:
        check for IO_CACHE::error == -1 has been added after the call to
        the event specific print functions
      mysys/mf_iocache2.c:
        Added handler to check the written value of `my_b_write'
      sql/log.cc:
        Added handler to check the written value of `my_b_write'
      sql/log_event.cc:
        Added error simulation statements in `Create_file_log_event::print`
        and `Execute_load_query_log_event::print'
      sql/rpl_utility.h:
        Removed the extra ';'
      13f7f002
  25. 05 Jul, 2012 1 commit
    • Andrei Elkin's avatar
      Bug#14275000 · e3c8fb4a
      Andrei Elkin authored
      Fixes for BUG11761686 left a flaw that managed to slip away from testing.
      Only effective filtering branch was actually tested with a regression test
      added to rpl_filter_tables_not_exist.
      The reason of the failure is destuction of too early mem-root-allocated memory 
      at the end of the deferred User-var's do_apply_event().
      
      Fixed with bypassing free_root() in the deferred execution branch.
      Deallocation of created in do_apply_event() items is done by the base code
      through THD::cleanup_after_query() -> free_items() that the parent Query
      can't miss.
      
      
      
      sql/log_event.cc:
        Do not call free_root() in case the deferred User-var event.
        Necessary methods to the User-var class are added, do_apply_event() refined.
      sql/log_event.h:
        Necessary methods to avoid destoying mem-root-based memory at
        User-var applying are defined.
      e3c8fb4a
  26. 22 Jun, 2012 2 commits
    • unknown's avatar
      MDEV-181: XID crash recovery across binlog boundaries · 0697ee26
      unknown authored
      Keep track of how many pending XIDs (transactions that are prepared in
      storage engine and written into binlog, but not yet durably committed
      on disk in the engine) there are in each binlog.
      
      When the count of one binlog drops to zero, write a new binlog checkpoint
      event, telling which is the oldest binlog with pending XIDs.
      
      When doing XA recovery after a crash, check the last binlog checkpoint
      event, and scan all binlog files from that point onwards for XIDs that
      must be committed if found in prepared state inside engine.
      
      Remove the code in binlog rotation that waits for all prepared XIDs to
      be committed before writing a new binlog file (this is no longer necessary
      when recovery can scan multiple binlog files).
      0697ee26
    • unknown's avatar
      MDEV-225: Replace with dummy events an event that is not understood by a slave... · 9fe317ff
      unknown authored
      MDEV-225: Replace with dummy events an event that is not understood by a slave to which it should be sent
      
      Add function to replace arbitrary event with dummy event.
      
      Add code which uses this to fix the bug that enabling row_annotate events
      on the master breaks slaves which do not request such events.
      
      Add that slaves set a variable @mariadb_slave_capability to inform the
      master in a robust way about which events it can, and cannot, handle.
      
      Add tests.
      
      9fe317ff
  27. 01 Jun, 2012 1 commit
    • unknown's avatar
      MDEV-304: Insufficient buffer allocation for Query_log_event · 4d8d7912
      unknown authored
      The constructor for Query_log_event allocated 2 bytes too few for
      extra space needed by Query cache. (Not sure if this is reproducible
      in practice, as there are often a couple of extra bytes allocated
      for unused string zero terminators, but better safe than sorry).
      4d8d7912
  28. 30 May, 2012 1 commit
  29. 29 May, 2012 1 commit
    • Rohit Kalhans's avatar
      Bug#11762667: MYSQLBINLOG IGNORES ERRORS WHILE WRITING OUTPUT · d8b2d4a0
      Rohit Kalhans authored
      Problem: mysqlbinlog exits without any error code in case of
      file write error. It is because of the fact that the calls
      to Log_event::print() method does not return a value and the
      thus any error were being ignored.
      
      Resolution: We resolve this problem by checking for the 
      IO_CACHE::error == -1 after every call to Log_event:: print()
      and terminating the further execution.
      
      client/mysqlbinlog.cc:
        - handled error conditions during event->print() calls
        - added check for error in end_io_cache()
      mysys/my_write.c:
        Added debug code to simulate file write error.
        error returned will be ENOSPC=> error no space on the disk
      sql/log_event.cc:
        Added debug code to simulate file write error, by reducing the size of io cache.
      d8b2d4a0
  30. 21 May, 2012 1 commit
    • Manish Kumar's avatar
      BUG#12400221 - 60926: BINARY LOG EVENTS LARGER THAN MAX_ALLOWED_PACKET · 1605b7f6
      Manish Kumar authored
      Problem
      ========
                  
      SQL statements close to the size of max_allowed_packet produce binary
      log events larger than max_allowed_packet.
                    
      The reason why this failure is occuring is because the event length is
      more than the total size of the max_allowed_packet + max_event_header
      length. Now since the event length exceeds this size master Dump
      thread is unable to send the packet on to the slave.
                            
      That can happen e.g with row-based replication in Update_rows event.
                  
      Fix
      ====
                
      The problem was fixed by increasing the max_allowed_packet for the
      slave's threads (IO/SQL) by increasing it to 1GB.
      This is done using the new server option included which is used to
      regulate the max_allowed_packet of the slave thread (IO/SQL).
      This causes the large packets to be received by the slave and apply
      it successfully.
      
      sql/log_event.h:
        Added the new option in the log_event.h file.
      sql/mysqld.cc:
        Added a new option to the server.
      sql/slave.cc:
        Increasing the session max_allowed_packet to a large value ,
        i.e. not taking global(max_allowed) into consideration, for the slave's threads.
      1605b7f6
  31. 18 May, 2012 1 commit
    • Rohit Kalhans's avatar
      BUG#14005409 - 64624 · 781137c0
      Rohit Kalhans authored
            
      Problem: After the fix for Bug#12589870, a new field that
      stores the length of db name was added in the buffer that
      stores the query to be executed. Unlike for the plain user
      session, the replication execution did not allocate the
      necessary chunk in Query-event constructor. This caused an
      invalid read while accessing this field.
            
      Solution: We fix this problem by allocating a necessary chunk
      in the buffer created in the Query_log_event::Query_log_event()
      and store the length of database name.
      
      sql/log_event.cc:
        Added a new field in the buffer created in the
        Query_log_event's constructor and store the length
        of database name.
      781137c0
  32. 20 Apr, 2012 1 commit
    • Andrei Elkin's avatar
      BUG#11754117 incorrect logging of INSERT into auto-increment · 49e484c8
      Andrei Elkin authored
      BUG#11761686 insert_id event is not filtered.
        
      Two issues are covered.
        
      INSERT into autoincrement field which is not the first part in the composed primary key 
      is unsafe by autoincrement logging design. The case is specific to MyISAM engine
      because Innodb does not allow such table definition.
        
      However no warnings and row-format logging in the MIXED mode was done, and
      that is fixed.
        
      Int-, Rand-, User-var log-events were not filtered along with their parent
      query that made possible them to screw up execution context of the following
      query.
        
      Fixed with deferring their execution until the parent query.
      
      ******
      Bug#11754117 
      
      Post review fixes.
      
      mysql-test/suite/rpl/r/rpl_auto_increment_bug45679.result:
        a new result file is added.
      mysql-test/suite/rpl/r/rpl_filter_tables_not_exist.result:
        results updated.
      mysql-test/suite/rpl/t/rpl_auto_increment_bug45679.test:
        regression test for BUG#11754117-45670 is added.
      mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test:
        regression test for filtering issue of BUG#11754117 - 45670 is added.
      sql/log_event.cc:
        Logics are added for deferring and executing events associated 
        with the Query event.
      sql/log_event.h:
        Interface to deferred events batch execution is added.
      sql/rpl_rli.cc:
        initialization for new RLI members is added.
      sql/rpl_rli.h:
        New members to RLI are added to facilitate deferred events gathering
        and execution control;
        two general character RLI cleanup methods are constructed.
      sql/rpl_utility.cc:
        Deferred_log_events methods are difined.
      sql/rpl_utility.h:
        A new class Deferred_log_events is defined to implement
        IRU events gathering, execution and cleanup.
      sql/slave.cc:
        Necessary changes to initialize `rli->deferred_events' and prevent
        deferred event deletion in the main read-exec branch.
      sql/sql_base.cc:
        A new safe-check function for multi-part pk with auto-increment is defined
        and deployed in lock_tables().
      sql/sql_class.cc:
        Initialization for a new member and replication cleanups are added
        to THD class.
      sql/sql_class.h:
        THD class receives a new member to hold a specific execution
        context for slave applier.
      sql/sql_parse.cc:
        Execution of the deferred event in started prior to its parent query.
      49e484c8
  33. 12 Apr, 2012 1 commit
    • Sujatha Sivakumar's avatar
      BUG#12662190:COM_COMMIT IS NOT INCREMENTED FROM THE BINARY LOGS ON SLAVE, COM_BEGIN IS · 64e74d48
      Sujatha Sivakumar authored
      PROBLEM:
      
      --------
      
      When binary log statements are replayed on the slave, BEGIN is represented
      
      in com_counters but COMMIT is not. Similarly in 'ROW' based replication
      
      'INSERT','UPDATE',and 'DELETE' com_counters are not getting incremented
      
      when the binary log statements are replayed at slave.
      
      ANALYSIS:
      ---------
      
      In 'ROW' based replication for COMMIT,INSERT,UPDATE and DELETE operations
      following special events are invoked.
      Xid_log_event,Write_rows_log_event,Update_rows_log_event,Update_rows_log_event.
      
      The above mentioned events doesn't go through the parser where the
      'COM_COUNTERS' are incremented.
      
      
      FIX:
      -----
      Increment statements are added at appropriate events.
      Respective functions are listed below.
      
      'Xid_log_event::do_apply_event'
      'Write_rows_log_event::do_before_row_operations'
      'Update_rows_log_event::do_before_row_operations'
      'Delete_rows_log_event::do_before_row_operations' 
      
      sql/log_event.cc:
        Added code to increment counts for 'COM_INSERT','COM_UPDATE',
        'COM_DELETE' and 'COM_COMMIT'during ROW based replicaiton
      64e74d48
  34. 29 Feb, 2012 1 commit
    • Praveenkumar Hulakund's avatar
      Bug#12601974 - STORED PROCEDURE SQL_MODE=NO_BACKSLASH_ESCAPES IGNORED AND BREAKS REPLICATION · c22c9270
      Praveenkumar Hulakund authored
      Analysis:
      ========================
      sql_mode "NO_BACKSLASH_ESCAPES": When user want to use backslash as character input,
      instead of escape character in a string literal then sql_mode can be set to 
      "NO_BACKSLASH_ESCAPES". With this mode enabled, backslash becomes an ordinary 
      character like any other. 
      
      SQL_MODE set applies to the current client session. And while creating the stored 
      procedure, MySQL stores the current sql_mode and always executes the stored 
      procedure in sql_mode stored with the Procedure, regardless of the server SQL 
      mode in effect when the routine is invoked.  
      
      In the scenario (for which bug is reported), the routine is created with 
      sql_mode=NO_BACKSLASH_ESCAPES. And routine is executed with the invoker sql_mode
      is "" (NOT SET) by executing statement "call testp('Axel\'s')".
      Since invoker sql_mode is "" (NOT_SET), the '\' in 'Axel\'s'(argument to function)
      is considered as escape character and column "a" (of table "t1") values are 
      updated with "Axel's". The binary log generated for above update operation is as below,
      
        set sql_mode=XXXXXX (for no_backslash_escapes)
        update test.t1 set a= NAME_CONST('var',_latin1'Axel\'s' COLLATE 'latin1_swedish_ci');
      
      While logging stored procedure statements, the local variables (params) used in
      statements are replaced with the NAME_CONST(var_name, var_value) (Internal function) 
      (http://dev.mysql.com/doc/refman/5.6/en/miscellaneous-functions.html#function_name-const)
      
      On slave, these logs are applied. NAME_CONST is parsed to get the variable and its
      value. Since, stored procedure is created with sql_mode="NO_BACKSLASH_ESCAPES", the sql_mode
      is also logged in. So that at slave this sql_mode is set before executing the statements
      of routine.  So at slave, sql_mode is set to "NO_BACKSLASH_ESCAPES" and then while
      parsing NAME_CONST of string variable, '\' is considered as NON ESCAPE character
      and parsing reported error for "'" (as we have only one "'" no backslash). 
      
      At slave, parsing was proper with sql_mode "NO_BACKSLASH_ESCAPES".
      But above error reported while writing bin log, "'" (of Axel's) is escaped with
      "\" character. Actually, all special characters (n, r, ', ", \, 0...) are escaped
      while writing NAME_CONST for string variable(param, local variable) in bin log 
      Airrespective of "NO_BACKSLASH_ESCAPES" sql_mode. So, basically, the problem is 
      that logging string parameter does not take into account sql_mode value.
      
      Fix:
      ========================
      So when sql_mode is set to "NO_BACKSLASH_ESCAPES", escaping  characters as 
      (n, r, ', ", \, 0...) should be avoided. To do so, added a check to not to
      escape such characters while writing NAME_CONST for string variables in bin 
      log. 
      And when sql_mode is set to NO_BACKSLASH_ESCAPES, quote character "'" is
      represented as ''.
      http://dev.mysql.com/doc/refman/5.6/en/string-literals.html (There are several 
      ways to include quote characters within a string: )
      
      
      
      mysql-test/r/sql_mode.result:
        Added test case for Bug#12601974.
      mysql-test/suite/binlog/r/binlog_sql_mode.result:
        Appended result of test cases added for Bug#12601974.
      mysql-test/suite/binlog/t/binlog_sql_mode.test:
        Added test case for Bug#12601974.
      mysql-test/t/sql_mode.test:
        Appended result of test cases added for Bug#12601974.
      c22c9270
  35. 24 Feb, 2012 1 commit
    • Luis Soares's avatar
      Bug#13693012: SLAVE CRASHING ON INSERT STATEMENT WITH MERGE TABLE · 580664b2
      Luis Soares authored
      PROBLEM: After WL 4144, when using MyISAM Merge tables, the routine
      open_and_lock_tables will append to the list of tables to lock, the
      base tables that make up the MERGE table. This has two side-effects in
      replication: 
      
        1. On the master side, we log additional table maps for the base
           tables, since they appear in the list of locked tables, even
           though we don't really use them at the slave.
      
        2. On the slave side, when opening a MERGE table while applying a
           ROW event, additional tables are appended to the list of tables
           to lock.
      
      Side-effect #1 is not harmful. It's just that when using MyISAM Merge
      tables a few table maps more may be logged.
      
      Side-effect #2, is harmful, because the list rli->tables_to_lock is an
      extended structure from TABLE_LIST in which the extra fields are
      filled from the table maps that are processed. Since
      open_and_lock_tables appends tables to the list after all table map
      events have been processed we end up with entries without
      replication/table map data on them. Thus when trying to access that
      info for these extra tables, the server will crash.
      
      SOLUTION: We fix side-effect #2 by making sure that we access the
      replication part of the structure for those in the list that were
      accounted for when processing the correspondent table map events. All
      in all, we never go beyond rli->tables_to_lock_count.
      
      We also deploy an assertion when clearing rli->tables_to_lock, making
      sure that the base tables are not in the list anymore (were closed in
      close_thread_tables).
      580664b2
  36. 24 Jan, 2012 1 commit
    • Michael Widenius's avatar
      Don't crash with: UPDATE performance_schema.setup_instruments SET ENABLED="NO"; · 59f5c05a
      Michael Widenius authored
      Don't log updates to performance schema in replication log.
      Ensure that we don't call ha_update after ha_index_or_rnd_end() is called on slave.
      
      
      .bzrignore:
        Ignore some generated files
      mysql-test/include/show_slave_status.inc:
        Ensure that ./ is removed from file names
      mysql-test/suite/perfschema/r/binlog_mix.result:
        Updated results
      mysql-test/suite/perfschema/r/binlog_row.result:
        Updated results
      mysql-test/suite/perfschema/r/binlog_stmt.result:
        Updated results
      mysql-test/suite/rpl/r/rpl_cant_read_event_incident.result:
        Updated results
      mysql-test/suite/rpl/r/rpl_performance_schema.result:
        Ensure that we don't crash slave when we update performance schema
      mysql-test/suite/rpl/t/rpl_performance_schema.test:
        Ensure that we don't crash slave when we update performance schema
      sql/log_event.cc:
        Ensure that we don't call ha_update after ha_index_or_rnd_end() is called.
        Remove old code that is not needed anymore (like restarting read loop over all rows if no matcing row is found)
        Simplify code
      sql/log_event_old.cc:
        Ensure that we don't call ha_update after ha_index_or_rnd_end() is called.
      storage/myisam/ha_myisam.cc:
        More DBUG_PRINT
      storage/perfschema/ha_perfschema.h:
        Don't log updates to performance schema in replication log.
      59f5c05a
  37. 14 Dec, 2011 1 commit
    • unknown's avatar
      After-merge fixes for 5.5 merge. · 79479ee9
      unknown authored
      Fix typo causing too low timeout value for wait_for_slave_param.inc.
      Fix binlog checksums following 5.5 merge.
      Make sure the rpl suite can run with --mysqld=--binlog-checksum=CRC32
      Fix a number of problems in the code when checksums are enabled.
      79479ee9