Commit graph

1066 commits

Author SHA1 Message Date
Alfranio Correia
4009bf1a15 BUG#46364 MyISAM transbuffer problems (NTM problem)
It is well-known that due to concurrency issues, a slave can become
inconsistent when a transaction contains updates to both transaction and
non-transactional tables.
                    
In a nutshell, the current code-base tries to preserve causality among the
statements by writing non-transactional statements to the txn-cache which
is flushed upon commit. However, modifications done to non-transactional
tables on behalf of a transaction become immediately visible to other
connections but may not immediately get into the binary log and therefore
consistency may be broken.
            
In general, it is impossible to automatically detect causality/dependency
among statements by just analyzing the statements sent to the server. This
happen because dependency may be hidden in the application code and it is
necessary to know a priori all the statements processed in the context of
a transaction such as in a procedure. Moreover, even for the few cases that
we could automatically address in the server, the computation effort
required could make the approach infeasible.
            
So, in this patch we introduce the option
      - "--binlog-direct-non-transactional-updates" that can be used to bypass
      the current behavior in order to write directly to binary log statements
      that change non-transactional tables.

Besides, it is used to enable the WL#2687 which is disabled by default.

mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test:
  Changes the result set as the STMT mode behaves as both the ROW and MIXED modes and as such uses the non-trx-cache and takes longer to fill the trx-cache up and trigger an error.
mysql-test/extra/rpl_tests/rpl_implicit_commit_binlog.test:
  Changes the result set as the STMT mode behaves as both the ROW and MIXED modes and as such uses the non-trx-cache. It also fixes comments.
mysql-test/extra/rpl_tests/rpl_mixing_engines.test:
  The STMT mode is unsafe when mixed-statements are executed thus making slaves to go out of sync. For that reason, it checks consistency if not in STMT mode.
mysql-test/include/default_mysqld.cnf:
  Makes binlog-direct-non-transactional-updates "TRUE" by default in the test
  cases.
mysql-test/r/mysqld--help-notwin.result:
  Updates the result file with the new option.
mysql-test/r/mysqld--help-win.result:
  Updates the result file with the new option.
mysql-test/suite/binlog/r/binlog_multi_engine.result:
  Updates the result file because non-trx-changes are written ahead of the
  transaction.
mysql-test/suite/binlog/r/binlog_switch_inside_trans.result:
  Verifies if the user cannot change the opion binlog_direct_non_transactional_updates
  within a transaction or a procedure/function/trigger.
mysql-test/suite/binlog/t/binlog_stm_mix_innodb_myisam-master.opt:
  Sets binlog_direct_non_transactional_updates to FALSE in order to avoid changing
  the test case and its result file.
mysql-test/suite/binlog/t/binlog_switch_inside_trans.test:
  Verifies if the user cannot change the opion binlog_direct_non_transactional_updates
  within a transaction or a procedure/function/trigger.
mysql-test/suite/ndb/r/ndb_binlog_format.result:
  Updates the result file because non-trx-changes are written ahead of the
  transaction.
mysql-test/suite/rpl/r/rpl_begin_commit_rollback.result:
  Sets binlog_direct_non_transactional_updates to FALSE in order to avoid changing the test case and its result file.
mysql-test/suite/rpl/r/rpl_concurrency_error.result:
  Updates the result file because non-trx-changes are written ahead of the
  transaction
mysql-test/suite/rpl/r/rpl_mixed_implicit_commit_binlog.result:
  Updates the result file because non-trx-changes are written ahead of the
  transaction.
mysql-test/suite/rpl/r/rpl_mixed_mixing_engines.result:
  Updates the result file because non-trx-changes are written ahead of the
  transaction.
mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result:
  Changes the result set as the STMT mode behaves as both the ROW and MIXED modes and as such uses the non-trx-cache and takes longer to fill the trx-cache up and trigger an error.
mysql-test/suite/rpl/r/rpl_stm_implicit_commit_binlog.result:
  Updates the result file because non-trx-changes are written ahead of the
  transaction.
mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result:
  Updates the result file because non-trx-changes are written ahead of the
  transaction.
mysql-test/suite/rpl/r/rpl_stm_start_stop_slave.result:
  Sets binlog_direct_non_transactional_updates to FALSE in order to avoid changing the test case and its result file.
mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result:
  Sets binlog_direct_non_transactional_updates to FALSE in order to avoid changing the test case and its result file.
mysql-test/suite/rpl/t/rpl_begin_commit_rollback.test:
  Sets binlog_direct_non_transactional_updates to FALSE in order to avoid changing the test case and its result file.
mysql-test/suite/rpl/t/rpl_stm_start_stop_slave.test:
  Sets binlog_direct_non_transactional_updates to FALSE in order to avoid changing the test case and its result file.
mysql-test/suite/rpl/t/rpl_stm_stop_middle_group.test:
  Sets binlog_direct_non_transactional_updates to FALSE in order to avoid changing the test case and its result file.
sql/log.cc:
  Verifies if changes should be written to either the trx-cache or non-trx-cache through the use of the function use_trans_cache(). It also organizes the code.
sql/log.h:
  Changes the signature of some functions by adding the modifier "const" to the thd parameter. Specifically, the following functions are changed: 
          bool trans_has_updated_trans_table(const THD* thd);
          bool stmt_has_updated_trans_table(const THD *thd);
          bool use_trans_cache(const THD*, bool is_transactional);
sql/share/errmsg-utf8.txt:
  Creates error messages to report when an user tries to change the new option
  binlog_direct_non_transactional_updates within a transaction or a procedure/
  function/trigger.
sql/share/errmsg.txt:
  Creates error messages to report when an user tries to change the new option
  binlog_direct_non_transactional_updates within a transaction or a procedure/
  function/trigger.
sql/sql_class.h:
  Adds the new option binlog_direct_non_transactional_updates.
sql/sys_vars.cc:
  Adds the new option binlog_direct_non_transactional_updates.
support-files/my-small.cnf.sh:
  Adds binlog-direct-non-transactional-updates to the example file. By default
  the option is disabled.
2010-01-21 13:10:34 +00:00
Alfranio Correia
8da3fea266 BUG#46364 MyISAM transbuffer problems (NTM problem)
It is well-known that due to concurrency issues, a slave can become
inconsistent when a transaction contains updates to both transaction and
non-transactional tables.
                    
In a nutshell, the current code-base tries to preserve causality among the
statements by writing non-transactional statements to the txn-cache which
is flushed upon commit. However, modifications done to non-transactional
tables on behalf of a transaction become immediately visible to other
connections but may not immediately get into the binary log and therefore
consistency may be broken.
            
In general, it is impossible to automatically detect causality/dependency
among statements by just analyzing the statements sent to the server. This
happen because dependency may be hidden in the application code and it is
necessary to know a priori all the statements processed in the context of
a transaction such as in a procedure. Moreover, even for the few cases that
we could automatically address in the server, the computation effort
required could make the approach infeasible.
            
So, in this patch we introduce the option
      - "--binlog-direct-non-transactional-updates" that can be used to bypass
      the current behavior in order to write directly to binary log statements
      that change non-transactional tables.

Besides, it is used to enable the WL#2687 which is disabled by default.
2010-01-21 13:10:34 +00:00
Alfranio Correia
40949a3110 merge mysql-next-mr --> mysql-5.1-rpl-merge
Conflicts:
  Text conflict in sql/log.cc
  Text conflict in sql/slave.cc
  Text conflict in sql/sql_base.cc
2010-01-13 12:22:34 +00:00
Alfranio Correia
46d1689b7c merge mysql-next-mr --> mysql-5.1-rpl-merge
Conflicts:
  Text conflict in sql/log.cc
  Text conflict in sql/slave.cc
  Text conflict in sql/sql_base.cc
2010-01-13 12:22:34 +00:00
unknown
16e15e6952 Manual merge from next-mr. 2010-01-12 20:07:09 +08:00
b805e3d4d6 Manual merge from next-mr. 2010-01-12 20:07:09 +08:00
Alexander Nozdrin
724caa519d Auto-merge from mysql-next-mr. 2010-01-11 16:10:51 +03:00
Alexander Nozdrin
7973ab7c36 Auto-merge from mysql-next-mr. 2010-01-11 16:10:51 +03:00
Marc Alff
3d91522561 WL#2360 Performance schema
Part IV: sql instrumentation
2010-01-06 22:42:07 -07:00
Marc Alff
a4c3bc618b WL#2360 Performance schema
Part IV: sql instrumentation
2010-01-06 22:42:07 -07:00
Guilhem Bichot
125cf0d4e8 WL#5197 "Move @@engine_condition_pushdown to @@optimizer_switch"
"set engine_condition_pushdown" is deprecated, engine condition pushdown is controlled
by a new "set optimizer_switch=engine_condition_pushdown=on|off".

mysql-test/r/index_merge_myisam.result:
  @@optimizer_switch has a new flag
mysql-test/r/mysqld--help-notwin.result:
  @@optimizer_switch has a new flag
mysql-test/r/mysqld--help-win.result:
  @@optimizer_switch has a new flag
mysql-test/r/optimizer_switch_eng_cond_pushdown1.result:
  Check how --engine-condition-pushdown and --optimizer-switch influence each other when used together (last wins).
mysql-test/r/optimizer_switch_eng_cond_pushdown2.result:
  Check how --engine-condition-pushdown and --optimizer-switch influence each other when used together (last wins).
mysql-test/suite/ndb/r/ndb_condition_pushdown.result:
  @@engine_condition_pushdown is deprecated, use @@optimizer_switch instead
mysql-test/suite/ndb/r/ndb_gis.result:
  @@engine_condition_pushdown is deprecated, use @@optimizer_switch instead
mysql-test/suite/ndb/r/ndb_index_unique.result:
  @@engine_condition_pushdown is deprecated, use @@optimizer_switch instead
mysql-test/suite/ndb/t/ndb_condition_pushdown.test:
  @@engine_condition_pushdown is deprecated, use @@optimizer_switch instead
mysql-test/suite/ndb/t/ndb_gis.test:
  @@engine_condition_pushdown is deprecated, use @@optimizer_switch instead
mysql-test/suite/ndb/t/ndb_index_unique.test:
  @@engine_condition_pushdown is deprecated, use @@optimizer_switch instead
mysql-test/suite/sys_vars/r/engine_condition_pushdown_basic.result:
  Setting @@engine_condition_pushdown gives a deprecation warning now.
  We test that the engine_condition_pushdown flag of @@optimizer_switch, and @@engine_condition_pushdown
  influence each other (turning the flag on/off sets the variable on/off and vice-versa).
mysql-test/suite/sys_vars/r/optimizer_switch_basic.result:
  @@optimizer_switch has a new flag
mysql-test/suite/sys_vars/t/engine_condition_pushdown_basic.test:
  Setting @@engine_condition_pushdown gives a deprecation warning now.
  We test that the engine_condition_pushdown flag of @@optimizer_switch, and @@engine_condition_pushdown
  influence each other (turning the flag on/off sets the variable on/off and vice-versa).
mysql-test/t/optimizer_switch_eng_cond_pushdown1-master.opt:
  Check how --engine-condition-pushdown and --optimizer-switch influence each other when used together (last wins).
mysql-test/t/optimizer_switch_eng_cond_pushdown1.test:
  Check how --engine-condition-pushdown and --optimizer-switch influence each other when used together (last wins).
mysql-test/t/optimizer_switch_eng_cond_pushdown2-master.opt:
  Check how --engine-condition-pushdown and --optimizer-switch influence each other when used together (last wins).
mysql-test/t/optimizer_switch_eng_cond_pushdown2.test:
  Check how --engine-condition-pushdown and --optimizer-switch influence each other when used together (last wins).
sql/mysql_priv.h:
  new "engine_condition_pushdown" switch in @@optimizer_switch, on by default, like
  @@engine_condition_pushdown is on by default. Constants are ULL because optimizer_switch
  is stored in a ulonglong.
sql/mysqld.cc:
  Making --engine-condition-pushdown and --optimizer-switch (command-line options)
  influence each other (last wins)
sql/records.cc:
  @@engine_condition_pushdown is deprecated, use @@optimizer_switch instead
sql/sql_select.cc:
  @@engine_condition_pushdown is deprecated, use @@optimizer_switch instead
sql/sys_vars.cc:
  Setting @@engine_condition_pushdown now issues a deprecation message. The version for removal
  is unknown at this point so I copied it from other deprecation warnings in this file.
  Turning on/off the engine_condition_pushdown flag of @@optimizer_switch (with SET) turns on/off the @@engine_condition_pushdown variable, and vice-versa, thanks to fix_* functions.
2010-01-06 11:54:45 +01:00
Guilhem Bichot
716c1bce83 WL#5197 "Move @@engine_condition_pushdown to @@optimizer_switch"
"set engine_condition_pushdown" is deprecated, engine condition pushdown is controlled
by a new "set optimizer_switch=engine_condition_pushdown=on|off".
2010-01-06 11:54:45 +01:00
Sergei Golubchik
bd05ac9a6b don't show --ssl* option if ssl is not compiled in 2009-12-25 22:36:59 +01:00
Sergei Golubchik
28056ba204 don't show --ssl* option if ssl is not compiled in 2009-12-25 22:36:59 +01:00
Sergei Golubchik
1ad5bb1a69 WL#4738 streamline/simplify @@variable creation process
Bug#16565 mysqld --help --verbose does not order variablesBug#20413 sql_slave_skip_counter is not shown in show variables
Bug#20415 Output of mysqld --help --verbose is incomplete
Bug#25430 variable not found in SELECT @@global.ft_max_word_len;
Bug#32902 plugin variables don't know their names
Bug#34599 MySQLD Option and Variable Reference need to be consistent in formatting!
Bug#34829 No default value for variable and setting default does not raise error
Bug#34834 ? Is accepted as a valid sql mode
Bug#34878 Few variables have default value according to documentation but error occurs  
Bug#34883 ft_boolean_syntax cant be assigned from user variable to global var.
Bug#37187 `INFORMATION_SCHEMA`.`GLOBAL_VARIABLES`: inconsistent status
Bug#40988 log_output_basic.test succeeded though syntactically false.
Bug#41010 enum-style command-line options are not honoured (maria.maria-recover fails)
Bug#42103 Setting key_buffer_size to a negative value may lead to very large allocations 
Bug#44691 Some plugins configured as MYSQL_PLUGIN_MANDATORY in can be disabled
Bug#44797 plugins w/o command-line options have no disabling option in --help
Bug#46314 string system variables don't support expressions
Bug#46470 sys_vars.max_binlog_cache_size_basic_32 is broken
Bug#46586 When using the plugin interface the type "set" for options caused a crash.
Bug#47212 Crash in DBUG_PRINT in mysqltest.cc when trying to print octal number
Bug#48758 mysqltest crashes on sys_vars.collation_server_basic in gcov builds
Bug#49417 some complaints about mysqld --help --verbose output
Bug#49540 DEFAULT value of binlog_format isn't the default value
Bug#49640 ambiguous option '--skip-skip-myisam' (double skip prefix)
Bug#49644 init_connect and \0
Bug#49645 init_slave and multi-byte characters
Bug#49646 mysql --show-warnings crashes when server dies


CMakeLists.txt:
  Bug#44691 Some plugins configured as MYSQL_PLUGIN_MANDATORY in can be disabled
client/mysql.cc:
  don't crash with --show-warnings when mysqld dies
config/ac-macros/plugins.m4:
  Bug#44691 Some plugins configured as MYSQL_PLUGIN_MANDATORY in can be disabled
include/my_getopt.h:
  comments
include/my_pthread.h:
  fix double #define
mysql-test/mysql-test-run.pl:
  run sys_vars suite by default
  properly recognize envirinment variables (e.g. MTR_MAX_SAVE_CORE) set to 0
  escape gdb command line arguments
mysql-test/suite/sys_vars/r/rpl_init_slave_func.result:
  init_slave+utf8 bug
mysql-test/suite/sys_vars/t/rpl_init_slave_func.test:
  init_slave+utf8 bug
mysys/my_getopt.c:
  Bug#34599 MySQLD Option and Variable Reference need to be consistent in formatting!
  Bug#46586 When using the plugin interface the type "set" for options caused a crash.
  Bug#49640 ambiguous option '--skip-skip-myisam' (double skip prefix)
mysys/typelib.c:
  support for flagset
sql/ha_ndbcluster.cc:
  backport from telco tree
sql/item_func.cc:
  Bug#49644 init_connect and \0
  Bug#49645 init_slave and multi-byte characters
sql/sql_builtin.cc.in:
  Bug#44691 Some plugins configured as MYSQL_PLUGIN_MANDATORY in can be disabled
sql/sql_plugin.cc:
  Bug#44691 Some plugins configured as MYSQL_PLUGIN_MANDATORY in can be disabled
  Bug#32902 plugin variables don't know their names
  Bug#44797 plugins w/o command-line options have no disabling option in --help
sql/sys_vars.cc:
  all server variables are defined here
storage/myisam/ft_parser.c:
  remove unnecessary updates of param->quot
storage/myisam/ha_myisam.cc:
  myisam_* variables belong here
strings/my_vsnprintf.c:
  %o and %llx
unittest/mysys/my_vsnprintf-t.c:
  %o and %llx tests
vio/viosocket.c:
  bugfix: fix @@wait_timeout to work with socket timeouts (vs. alarm thread)
2009-12-22 10:35:56 +01:00
Sergei Golubchik
ae2768ce9c WL#4738 streamline/simplify @@variable creation process
Bug#16565 mysqld --help --verbose does not order variablesBug#20413 sql_slave_skip_counter is not shown in show variables
Bug#20415 Output of mysqld --help --verbose is incomplete
Bug#25430 variable not found in SELECT @@global.ft_max_word_len;
Bug#32902 plugin variables don't know their names
Bug#34599 MySQLD Option and Variable Reference need to be consistent in formatting!
Bug#34829 No default value for variable and setting default does not raise error
Bug#34834 ? Is accepted as a valid sql mode
Bug#34878 Few variables have default value according to documentation but error occurs  
Bug#34883 ft_boolean_syntax cant be assigned from user variable to global var.
Bug#37187 `INFORMATION_SCHEMA`.`GLOBAL_VARIABLES`: inconsistent status
Bug#40988 log_output_basic.test succeeded though syntactically false.
Bug#41010 enum-style command-line options are not honoured (maria.maria-recover fails)
Bug#42103 Setting key_buffer_size to a negative value may lead to very large allocations 
Bug#44691 Some plugins configured as MYSQL_PLUGIN_MANDATORY in can be disabled
Bug#44797 plugins w/o command-line options have no disabling option in --help
Bug#46314 string system variables don't support expressions
Bug#46470 sys_vars.max_binlog_cache_size_basic_32 is broken
Bug#46586 When using the plugin interface the type "set" for options caused a crash.
Bug#47212 Crash in DBUG_PRINT in mysqltest.cc when trying to print octal number
Bug#48758 mysqltest crashes on sys_vars.collation_server_basic in gcov builds
Bug#49417 some complaints about mysqld --help --verbose output
Bug#49540 DEFAULT value of binlog_format isn't the default value
Bug#49640 ambiguous option '--skip-skip-myisam' (double skip prefix)
Bug#49644 init_connect and \0
Bug#49645 init_slave and multi-byte characters
Bug#49646 mysql --show-warnings crashes when server dies
2009-12-22 10:35:56 +01:00