Commit graph

209 commits

Author SHA1 Message Date
unknown
f9c2b402f4 MDEV-26: Global transaction ID.
Implement @@gtid_binlog_state. This is the internal state of the binlog
(most recent GTID logged for every domain_id and server_id). This allows
to save the state before RESET MASTER and restore it afterwards.
2013-08-23 14:02:13 +02:00
Sergei Golubchik
97e640b9ae 5.5 merge 2013-07-17 21:24:29 +02:00
unknown
dbe2c5060e MDEV-4591:Setting gtid* values from inside a transaction might cause unexpected results
Now we give an error on attempts to set @@SESSION.gtid_domain_id or
@@SESSION.gtid_seq_no when a transaction is active.
2013-06-07 09:31:11 +02:00
Michael Widenius
5730786041 Fixed some cache variables that could be set to higher value than what the code supported (size_t)
Fixed some cases that didn't work with > 4G buffers.
Fixed compiler warnings


include/mysql_com.h:
  Avoid compiler warning with strncmp()
sql-common/client.c:
  Fixed long comment; Added ()
sql/filesort.cc:
  Fix code to get filesort to work with big buffers
sql/sys_vars.cc:
  Fixed some cache variables that could be set to higher value than the size_t
  Limit query cache to ULONG_MAX as the query cache buffer variables are ulong
storage/federatedx/ha_federatedx.cc:
  Remove not used variable
storage/maria/ha_maria.cc:
  Fix that bulk_insert() works with big buffers
storage/maria/ma_write.c:
  Fix that bulk_insert() works with big buffers
storage/myisam/ha_myisam.cc:
  Fix that bulk_insert() works with big buffers
storage/myisam/mi_write.c:
  Fix that bulk_insert() works with big buffers
storage/sphinx/snippets_udf.cc:
  Fixed compiler warnings
2013-06-06 15:14:23 +03:00
unknown
7ad47ab0e0 MDEV-4605: Failing to load GTID slave position from rpl.gtid_slave_pos
There were several cases where the slave GTID position was not loaded
correctly before being used. This caused various failures such as
corrupting the position at slave start and empty values of
@@gtid_slave_pos and @@gtid_current_pos.

Fixed by adding more checks for loaded position, and by always loading
the position at server startup.
2013-06-03 07:41:38 +02:00
unknown
3061ca2be5 Fix type-typo which caused windows build failure. 2013-05-28 16:35:05 +02:00
unknown
ee2b7db3f8 MDEV-4478: Implement GTID "strict mode"
When @@GLOBAL.gtid_strict_mode=1, then certain operations result
in error that would otherwise result in out-of-order binlog files
between servers.

GTID sequence numbers are now allocated independently per domain;
this results in less/no holes in GTID sequences, increasing the
likelyhood that diverging binlogs will be caught by the slave when
GTID strict mode is enabled.
2013-05-28 13:28:31 +02:00
unknown
1cd6eb5f94 MDEV-26: Global transaction ID.
Change of user interface to be more logical and more in line with expectations
to work similar to old-style replication.

User can now explicitly choose in CHANGE MASTER whether binlog position is
taken into account (master_gtid_pos=current_pos) or not (master_gtid_pos=
slave_pos) when slave connects to master.

@@gtid_pos is replaced by three separate variables @@gtid_slave_pos (can
be set by user, replicated GTIDs only), @@gtid_binlog_pos (read only), and
@@gtid_current_pos (a combination of the two, most recent GTID within each
domain). mysql.rpl_slave_state is renamed to mysql.gtid_slave_pos to match.

This fixes MDEV-4474.
2013-05-22 17:36:48 +02:00
unknown
2e830cfbc8 MDEV-4402 A function to visualize histograms data. 2013-04-20 23:30:21 +03:00
unknown
9441e53653 MDEV-4345
Sampling of selectivity of LIKE predicate.
2013-04-18 22:22:04 +03:00
Lixun Peng
82eedf4e97 Makeing rpl_filter for each Master_info.
Users can set different repplication filter rules for each replication connection, in my.cnf or command line.
But the rules set online will not record in master.info, it means if users restart MySQL, these rules will lose.
So if users wantn't their replication filter rules lose, they should write the rules in my.cnf.

Users can set rules by 2 ways:
1. Online SET command, "SET connection_name.replication_filter_settings = rules;".
2. In my.cnf, "connection_name.replication_filter_settings = rules".

If no connection_name in my.cnf, this rule will apply for ALL replication connection.
If no connetion_name in SET statement, this rull will apply for default_connection_name.
2013-04-16 19:43:28 +08:00
Igor Babaev
f4cd2b37b1 Merge 10.0-base -> mwl253 2013-04-15 09:16:54 -07:00
unknown
665a31af2b MDEV-26: Global transaction ID. First alpha release.
Merge of 10.0-mdev26 feature tree into 10.0-base.

Global transaction ID is prepended to each event group in the binlog.

Slave connect can request to start from GTID position instead of specifying
file name/offset of master binlog. This facilitates easy switch to a new
master.

Slave GTID state is stored in a table mysql.rpl_slave_state, which can be
InnoDB to get crash-safe slave state.

GTID includes a replication domain ID, allowing to keep track of distinct
positions for each of multiple masters.
2013-04-15 10:55:27 +02:00
Sergei Golubchik
f57ecb7786 5.5 merge 2013-04-14 10:04:07 +02:00
Michael Widenius
aa4c7deac7 Increase default value of max_binlog_cache_size and max_binlog_stmt_cache_size to ulonglong_max.
This fixes that by default LOAD DATA INFILE will not generate the error:
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage..."


mysql-test/suite/sys_vars/r/max_binlog_cache_size_basic.result:
  Updated test case
mysql-test/suite/sys_vars/r/max_binlog_stmt_cache_size_basic.result:
  Updated test case
sql/sys_vars.cc:
  Increase default value of max_binlog_cache_size and max_binlog_stmt_cache_size to ulonglong_max.
2013-04-12 13:19:00 +03:00
unknown
b7363eb4ac MDEV-26: Global transaction ID.
Replace CHANGE MASTER TO ... master_gtid_pos='xxx' with a new system
variable @@global.gtid_pos.

This is more logical; @@gtid_pos is global, not per-master, and it is not
affected by RESET SLAVE.

Also rename master_gtid_pos=AUTO to master_use_gtid=1, which again is more
logical.
2013-04-05 16:20:58 +02:00
Igor Babaev
2713bab291 Merge 10.0-base -> mwl253. 2013-03-31 09:10:01 -07:00
Igor Babaev
9e1ca1053b Added the type of histogram for mwl #253.
Introduced double precision height-balanced histograms.
2013-03-30 18:57:07 -07:00
Sergei Golubchik
993ea79f2d 5.5 merge 2013-03-27 23:41:02 +01:00
Igor Babaev
1009832c13 Added histogams for table columns. 2013-03-25 23:48:29 -07:00
unknown
f1f9c4e4e5 MDEV-26: Global transaction ID.
Fix 3 small issues reported by Pavel Ivanov.
2013-03-22 08:11:37 +01:00
Igor Babaev
fc1c8ffdad The pilot patch for mwl#253. 2013-03-11 07:44:24 -07:00
Sergei Golubchik
8161c6772d merge with mysql-5.5.30 minus few incorrect or not applicable changesets 2013-02-28 18:42:49 +01:00
unknown
e3ac306157 [NOT] EXISTS to IN transformation. 2013-02-26 01:20:17 +02:00
unknown
1f08be94bb MDEV-26: Global transaction ID
Fix lock order violation. Make sure we temporarily release
LOCK_global_system_variables before taking LOCK_active_mi.
Otherwise we get a lock dependency cycle when we use
open_tables() under LOCK_active_mi.
2013-02-25 18:03:30 +01:00
Sergei Golubchik
5205188200 cleanup:
* remove unused mysql_option
* don't allocate 5GB of memory in the mtr tests
* restore the behavior in dynamic_column_offset_byte(), put the ifdef correctly
* prefer __attribute__((unused)) to #ifdef
* prefer UNINIT_VAR to LINT_INIT
* make most Warning_info users blissfully unaware of the postponed initialization
* use my_offsetof instead of offsetof where the compiler thinks the latter is incorrect
2013-01-23 16:19:37 +01:00
Igor Babaev
f6636852c4 Merge mwl248->10.0-base. 2012-12-19 19:15:51 -08:00
Sergei Golubchik
6a742fc3b1 MDEV-3927 Add variable "have yassl"
have_openssl variable was ON even when OpenSSL was not used (but YaSSL was).
fix that, so that have_openssl really corresponds to OpenSSL

rename not_openssl.inc to not_ssl.inc and fix the test accordingly.
2012-12-18 11:56:00 +01:00
Igor Babaev
1b62f0f58c Merge maria-5.5-mwl248 -> 10.0-base. 2012-12-16 21:33:17 -08:00
Igor Babaev
7760efad74 Merge mariadb-5.5 -> 10.0-base. 2012-12-16 16:49:19 -08:00
Ravinder Thakur
e604bb8a03 Merging from 5.1 to 5.5 for bug#11761752 2012-12-13 20:58:09 +05:30
Nuno Carvalho
fb313032a6 BUG#15891524: RLI_FAKE MODE IS NOT UNSET AFTER BINLOG REPLAY
When a binlog is replayed into a server, e.g.:
  $ mysqlbinlog binlog.000001 | mysql
it sets a pseudo slave mode on the client connection in order to server
be able to read binlog events, there is, a format description event is
needed to correctly read following events.
Also this pseudo slave mode applies to the current connection
replication rules that are needed to correctly apply binlog events.

If a binlog dump is sourced on a connection, this pseudo slave mode will
remains after it, what will apply unexpected rules from customer
perspective to following commands.

Added a new SET statement to binlog dump that will unset pseudo slave
mode at the end of dump file.
2012-11-20 12:37:23 +00:00
Igor Babaev
8d612adf70 Merge 5.5 -> 5.5-mwl248. 2012-11-02 20:38:05 -07:00
unknown
ab8e8f4b27 MDEV-500: Session variable for server_id
MDEV-26: Global transaction id, partial commit

Change server_id to be a session variable.
User with SUPER can set it to binlog with different server_id.
Implement backward-compatible ::server_id mirror for plugins.
2012-10-23 12:46:29 +02:00
unknown
be86e44280 MDEV-26: Global transaction id. Partial commit. 2012-10-23 11:19:42 +02:00
Sergei Golubchik
68baf07dcd 5.3 merge 2012-10-18 23:33:06 +02:00
Sergei Golubchik
ee9afef271 mysql-5.5.28 2012-10-16 13:04:42 +02:00
Sergei Golubchik
3012a5d5ce MDEV-3796 various RPM problems
cmake/cpack_rpm.cmake:
  * mark all cnf files with %config(noreplace)
  * add the forgotten postun script
sql/sys_vars.cc:
  0 for a string variable means "no default. But datadir has the default value.
support-files/rpm/server-postin.sh:
  * use mysqld --help to determine the correct datadir in the presence of my.cnf files
    (better than my_print_defaults, because it considers the correct group set).
  * Only create users, and chown/chmod if it's a fresh install, not an upgrade.
  * only run mysql_install_db if datadir does not exist
2012-10-05 14:24:38 +02:00
Michael Widenius
5eccc400b1 Implementation of Multi-source replication (MDEV:253)
Documentation of the feature can be found at: http://kb.askmonty.org/en/multi-source-replication/
This code is based on code from Taobao, developed by Plinux

Other things:
- Added new commands: START ALL SLAVES, STOP ALL SLAVES and SHOW FULL SLAVE STATUS
- Almost all usage of 'active_mi' is deleted.
- Added parameter to reset_logs() so that one can specify if new logs should be created.
- Check wildcard match as early as possible for SHOW STATUS. This makes SHOW STATUS like 'xxx' a lot faster and use less mutex
- Made max_relay_log_size depending on master connection.
- Added sys_vars.default_master_connection_basic to fix a failure in sys_vars.all_vars, modified sql_slave_skip_counter_basic to allow session-level settings
- Added commands to mysqladmin: start-all-slaves & stop-all-slaves
- Removed logging of "next log '%s' is currently active | not active"
- Fixed bug in my_vsnprintf() when using positional parameters with length
- Added fn_ext2(), which returns pointer to last '.' in file name
- max_relay_log_size now acts as a normal slave specific variable
- Don't store replication position if innobase_overwrite_relay_log_info is not set
- max_relay_log_size copies it's values from max_binlog_size at startup



BUILD/SETUP.sh:
  Added -Wno-invalid-offsetof to get rid of warning of offsetof() on C++ class (safe in the contex we use it)
client/mysqladmin.cc:
  Added commands start-all-slaves & stop-all-slaves
client/mysqltest.cc:
  Added support for error names starting with 'W'
  Added connection_name support to --sync_with_master
cmake/maintainer.cmake:
  Added -Wno-invalid-offsetof to get rid of warning of offsetof() on C++ class (safe in the contex we use it)
include/my_sys.h:
  Added fn_ext2(), which returns pointer to last '.' in file name
include/mysql/plugin.h:
  Added SHOW_SIMPLE_FUNC
include/mysql/plugin_audit.h.pp:
  Updated signature file
include/mysql/plugin_auth.h.pp:
  Updated signature file
include/mysql/plugin_ftparser.h.pp:
  Updated signature file
mysql-test/extra/rpl_tests/rpl_max_relay_size.test:
  Updated test
mysql-test/include/setup_fake_relay_log.inc:
  There is no orphan relay log files anymore
mysql-test/mysql-test-run.pl:
  Added multi_source to test suite
mysql-test/r/flush.result:
  Added test for new syntax of flush relay logs (can't repeat relay logs or slave)
mysql-test/r/mysqld--help.result:
  Updated result
mysql-test/r/mysqltest.result:
  Updated result
mysql-test/r/parser.result:
  Updated result
mysql-test/r/signal_code.result:
  Updated result after introducing new commands
mysql-test/r/sp-code.result:
  Updated result after introducing new commands
mysql-test/suite/multi_source:
  Tests for multi-source
mysql-test/suite/multi_source/info_logs-master.opt:
  Test with strange file names
mysql-test/suite/multi_source/info_logs.result:
  Test of logs
mysql-test/suite/multi_source/info_logs.test:
  Test of logs
mysql-test/suite/multi_source/my.cnf:
  Setup of multi-master tests
  Added log-warnings to get more information to the log files
mysql-test/suite/multi_source/relaylog_events.result:
  Test relay log handling
mysql-test/suite/multi_source/relaylog_events.test:
  Test relay log handling
mysql-test/suite/multi_source/reset_slave.result:
  Test RESET SLAVE
mysql-test/suite/multi_source/reset_slave.test:
  Test RESET SLAVE
mysql-test/suite/multi_source/simple.result:
  Simple basic test of multi-source functionality
mysql-test/suite/multi_source/simple.test:
  Simple basic test of multi-source functionality
mysql-test/suite/multi_source/skip_counter.result:
  Testing skip_counter and max_relay_log_size
mysql-test/suite/multi_source/skip_counter.test:
  Testing skip_counter and max_relay_log_size
mysql-test/suite/multi_source/syntax.result:
  Test of multi-source syntax
mysql-test/suite/multi_source/syntax.test:
  Test of multi-source syntax
mysql-test/suite/rpl/r/rpl_deadlock_innodb.result:
  New warnings
mysql-test/suite/rpl/r/rpl_filter_dbs_dynamic.result:
  Improved error texts
mysql-test/suite/rpl/r/rpl_filter_tables_dynamic.result:
  Improved error texts
mysql-test/suite/rpl/r/rpl_filter_wild_tables_dynamic.result:
  Improved error texts
mysql-test/suite/rpl/r/rpl_flush_logs.result:
  Update results
mysql-test/suite/rpl/r/rpl_heartbeat.result:
  Warning was removed
mysql-test/suite/rpl/r/rpl_heartbeat_basic.result:
  Warning was removed
mysql-test/suite/rpl/r/rpl_rotate_logs.result:
  Updated results because of new error messages
mysql-test/suite/rpl/r/rpl_row_max_relay_size.result:
  Updated results
mysql-test/suite/rpl/r/rpl_row_show_relaylog_events.result:
  Updated results after improved RESET SLAVE (we now use less relay log files)
mysql-test/suite/rpl/r/rpl_skip_replication.result:
  New error message
mysql-test/suite/rpl/r/rpl_start_slave_deadlock_sys_vars.result:
  Test removed as the old DBUG_SYNC entries doesn't exist anymore
mysql-test/suite/rpl/r/rpl_stm_max_relay_size.result:
  Updated results
mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result:
  Updated results after improved RESET SLAVE (we now use less relay log files)
mysql-test/suite/rpl/t/rpl_flush_logs.test:
  Updated tests as relay log files is created a bit differently than before
mysql-test/suite/rpl/t/rpl_start_slave_deadlock_sys_vars.test:
  Test removed as the old DBUG_SYNC entries doesn't exist anymore
mysql-test/suite/sys_vars/r/default_master_connection_basic.result:
  New test to test usage of default_master_connection
mysql-test/suite/sys_vars/r/max_relay_log_size_basic.result:
  Updated results
mysql-test/suite/sys_vars/r/sql_slave_skip_counter_basic.result:
  Updated usage of sql_slave_skip_counter
mysql-test/suite/sys_vars/t/default_master_connection_basic.test:
  New test to test usage of default_master_connection
mysql-test/suite/sys_vars/t/max_relay_log_size_basic.test:
  Updated results
mysql-test/suite/sys_vars/t/sql_slave_skip_counter_basic.test:
  Updated test for multi-source
mysql-test/t/flush.test:
  Added test for new syntax of flush relay logs (can't repeat relay logs or slave)
mysql-test/t/parser.test:
  Updated test as master_pos_wait() now takes more arguments than before
mysys/mf_fn_ext.c:
  Added fn_ext2(), which returns pointer to last '.' in file name
plugin/semisync/semisync_master_plugin.cc:
  Use SHOW_SIMPLE_FUNC to optimize SHOW STATUS
sql/event_scheduler.cc:
  No reason to initialize slave_thread (it's guaranteed to be zero here)
sql/item_create.cc:
  Added connection_name argument to master_pos_wait()
  Simplified code
sql/item_func.cc:
  Added connection_name argument to master_pos_wait()
sql/item_func.h:
  Added connection_name argument to master_pos_wait()
sql/lex.h:
  Added SLAVES keyword
sql/log.cc:
  Added tag "Master 'connection_name'" to slave errors that has a connection name.
  Added parameter to reset_logs() so that one can specify if new logs should be created.
  Removed some wrong casts
  Changed some constants to defines
sql/log.h:
  Added parameter to reset_logs()
  Updated comment to reflect new code
sql/log_event.cc:
  Updated DBUG_PRINT
sql/mysqld.cc:
  Added variable mysqld_server_initialized so that other functions can test if server is fully initialized.
  Free all slave data in one place (fewer ifdef's)
  Removed not needed call to close_active_mi()
  Initialize slaves() later in startup to ensure that everthing is really initialized when slaves start.
  Made status variable slave_running multi-source safe
  max_relay_log_size copies it's values from max_binlog_size at startup
  SHOW_FUNC -> SHOW_SIMPLE_FUNC
sql/mysqld.h:
  Added mysqld_server_initialized
  Removed max_relay_log_size
sql/rpl_mi.cc:
  Store connection name and cmp_connection_name (only used for show full slave status) in Master_info
  Added code for Master_info_index, which handles storage of multi-master information
  Don't write the empty "" connection_name to multi-master.info file. This is handled by the original code.
  Create Master_info_index::index_file_names once at init
  More DBUG_PRINT
  Give error if Master_info_index::check_duplicate_master_info fails
  Added start|stop all slaves
sql/rpl_mi.h:
  Added connection_name and Master_info_index
  Updated prototypes
sql/rpl_rli.cc:
  Added connection_name to relay log files.
  If we do a full reset, don't create any new relay log files.
  Updated comment to reflect new code
  Made max_relay_log_size depending on master connection.
sql/rpl_rli.h:
  Fixed type of slave_skip_counter as we now access it directly in sys_vars.cc, so it must be ulong
  Made executed_entries and max_relay_log_size depending on master connection.
sql/set_var.cc:
  Fixed that one can get variable name also when one uses DEFAULT
sql/set_var.h:
  Made option global so that one can check and change min & max values (sorry Sergei)
sql/share/errmsg-utf8.txt:
  Added new error messages needed for multi-source
  Added multi-source name to error ER_MASTER_INFO and WARN_NO_MASTER_INFO
  Improved error message if connection exists
sql/slave.cc:
  Moved things a bit around to make it easier to handle error conditions.
  Create a global master_info_index and add the "" connection to it
  Ensure that new Master_info doesn't fail.
  Don't call terminate_slave_threads(active_mi..) on end_slave() as this is now done automaticly when deleting master_info_index.
  Delete not needed function close_active_mi(). One can achive same thing by calling end_slave().
  Added support for SHOW FULL SLAVE STATUS (show status for all master connections with connection_name as first column)
  Removed logging of "next log '%s' is currently active | not active"
  Added Slave_received_heartbeats and Slave_heartbeat_period
sql/slave.h:
  Added new defines and prototypes
sql/sql_base.cc:
  More DBUG_PRINT
sql/sql_class.cc:
  Reset thd->connection_name and thd-->default_master_connection
sql/sql_class.h:
  Added thd->connection_name and thd-->default_master_connection
  Made slave_skip_count and max_relay_log_size depending on master connection. These variables are in THD to make changing them thread safe.
sql/sql_const.h:
  Added MAX_CONNECTION_NAME
sql/sql_insert.cc:
  thd->slave_thread -> thd->rli_slave
  Removed usage of active_mi
sql/sql_lex.cc:
  Reset 'lex->verbose' (to simplify some sql_yacc.yy code)
sql/sql_lex.h:
  Added connection_name, relay_log_connection_name, SQLCOM_SLAVE_ALL_START and SQLCOM_SLAVE_ALL_STOP
sql/sql_load.cc:
  thd->slave_thread -> thd->rli_slave
  Removed usage of active_mi
sql/sql_parse.cc:
  Added support for connection_name to all SLAVE commands.
  - Instead of using active_mi, we now get the current Master_info from master_info_index.
  - Create new replication threads with CHANGE MASTER
  - Added support for show_all_master_info()-
sql/sql_prepare.cc:
  Added SQLCOM_SLAVE_ALL_START and SQLCOM_SLAVE_ALL_STOP
sql/sql_reload.cc:
  Made reset/full slave use master_info_index->get_master_info() instead of active_mi.
  If one uses 'RESET SLAVE "connection_name" all' the connection is removed from master_info_index.
  Fixed issues with FLUSH RELAY LOGS
sql/sql_repl.cc:
  sql_slave_skip_counter is moved to thd->variables to make it thread safe and fix some bugs with it
  Add connection name to relay log files.
  Added connection name to errors.
  Added some logging for multi-master if log_warnings > 1
  stop_slave():
  - Don't check if thd is set. It's guaranteed to always be set.
  change_master():
  - Check for duplicate connection names in change_master()
  - Check for wrong arguments first in file (to simplify error handling)
  - Register new connections in master_info_index
  
  
  
  
  
  
  ******
  Added multi-source support to show relaylog events
  ******
  check_duplicate_master_info() now generates an error
  Added parameter to reset_logs()
  ******
  Updated calls to create_signed_file_name()
sql/sql_show.cc:
  Check wildcard match as early as possible for SHOW STATUS. This makes SHOW STATUS like 'xxx' a lot faster and use less mutex
sql/sql_yacc.yy:
  Added optional connection_name to a all relevant master/slave commands
  Added multi-source support to show relaylog events
  Added new commands START ALL SLAVES, STOP ALL SLAVES and SHOW FULL SLAVE STATUS
sql/strfunc.cc:
  my_global.h shoud always be included first.
sql/sys_vars.cc:
  Added variable default_master_connection
  Made variable sql_slave_skip_counter multi-source safe
  Made max_relay_log_size depending on master connection.
  Made old code more reusable
sql/sys_vars.h:
  Added Sys_var_session_lexstring (needed for default_master_connection)
  Added Sys_var_multi_source_uint (needed for sql_slave_skip_counter).
  Changed Sys_var_multi_source_uint to ulong to be able to handle max_relay_log_size
  Made old code more reusable
storage/example/ha_example.cc:
  Use SHOW_SIMPLE_FUNC to optimize SHOW STATUS
storage/sphinx/ha_sphinx.cc:
  Use SHOW_SIMPLE_FUNC to optimize SHOW STATUS
storage/xtradb/handler/ha_innodb.cc:
  Don't store replication position if innobase_overwrite_relay_log_info is not set
strings/my_vsnprintf.c:
  Fixed bug when using positional parameters with length
2012-10-04 01:37:58 +03:00
Michael Widenius
572560f38c Changed SHOW_FUNC variabels that don't return SHOW_ARRAY to SHOW_SIMPLE_FUNC.
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
2012-10-03 01:44:54 +03:00
Michael Widenius
8ac1b41cf3 Made max_relay_log_size depending on master connection.
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
2012-10-01 02:30:44 +03:00
Michael Widenius
1864d9596d Implementation of Multi-source replication (MDEV:253)
Documentation of the feature can be found at: http://kb.askmonty.org/en/multi-source-replication/
This code is based on code from Taobao, developed by Plinux

BUILD/SETUP.sh:
  Added -Wno-invalid-offsetof to get rid of warning of offsetof() on C++ class (safe in the contex we use it)
client/mysqltest.cc:
  Added support for error names starting with 'W'
  Added connection_name support to --sync_with_master
cmake/maintainer.cmake:
  Added -Wno-invalid-offsetof to get rid of warning of offsetof() on C++ class (safe in the contex we use it)
mysql-test/r/mysqltest.result:
  Updated results
mysql-test/r/parser.result:
  Updated results
mysql-test/suite/multi_source/my.cnf:
  Setup of multi-master tests
mysql-test/suite/multi_source/simple.result:
  Simple basic test of multi-source functionality
mysql-test/suite/multi_source/simple.test:
  Simple basic test of multi-source functionality
mysql-test/suite/multi_source/syntax.result:
  Test of multi-source syntax
mysql-test/suite/multi_source/syntax.test:
  Test of multi-source syntax
mysql-test/suite/rpl/r/rpl_rotate_logs.result:
  Updated results because of new error messages
mysql-test/t/parser.test:
  Updated test as master_pos_wait() now takes more arguments than before
sql/event_scheduler.cc:
  No reason to initialize slave_thread (it's guaranteed to be zero here)
sql/item_create.cc:
  Added connection_name argument to master_pos_wait()
  Simplified code
sql/item_func.cc:
  Added connection_name argument to master_pos_wait()
sql/item_func.h:
  Added connection_name argument to master_pos_wait()
sql/log.cc:
  Added tag "Master 'connection_name'" to slave errors that has a connection name.
sql/mysqld.cc:
  Added variable mysqld_server_initialized so that other functions can test if server is fully initialized.
  Free all slave data in one place (fewer ifdef's)
  Removed not needed call to close_active_mi()
  Initialize slaves() later in startup to ensure that everthing is really initialized when slaves start.
  Made status variable slave_running multi-source safe
sql/mysqld.h:
  Added mysqld_server_initialized
sql/rpl_mi.cc:
  Store connection name and cmp_connection_name (only used for show full slave status) in Master_info
  Added code for Master_info_index, which handles storage of multi-master information
  Don't write the empty "" connection_name to multi-master.info file. This is handled by the original code.
sql/rpl_mi.h:
  Added connection_name and Master_info_index
sql/rpl_rli.cc:
  Added connection_name to relay log files.
sql/rpl_rli.h:
  Fixed type of slave_skip_counter as we now access it directly in sys_vars.cc, so it must be uint
sql/share/errmsg-utf8.txt:
  Added new error messages needed for multi-source
  Added multi-source name to error ER_MASTER_INFO and WARN_NO_MASTER_INFO
sql/slave.cc:
  Moved things a bit around to make it easier to handle error conditions.
  Create a global master_info_index and add the "" connection to it
  Ensure that new Master_info doesn't fail.
  Don't call terminate_slave_threads(active_mi..) on end_slave() as this is now done automaticly when deleting master_info_index.
  Delete not needed function close_active_mi(). One can achive same thing by calling end_slave().
  Added support for SHOW FULL SLAVE STATUS (show status for all master connections with connection_name as first column)
sql/slave.h:
  Added new prototypes
sql/sql_base.cc:
  More DBUG_PRINT
sql/sql_class.cc:
  Reset thd->connection_name and thd-->default_master_connection
sql/sql_class.h:
  Added thd->connection_name and thd-->default_master_connection
  Added slave_skip_count to variables to make changing the @@sql_slave_skip_count variable thread safe
sql/sql_const.h:
  Added MAX_CONNECTION_NAME
sql/sql_lex.cc:
  Reset 'lex->verbose' (to simplify some sql_yacc.yy code)
sql/sql_lex.h:
  Added connection_name
sql/sql_parse.cc:
  Added support for connection_name to all SLAVE commands.
  - Instead of using active_mi, we now get the current Master_info from master_info_index.
  - Create new replication threads with CHANGE MASTER
  - Added support for show_all_master_info()
sql/sql_reload.cc:
  Made reset/full slave use master_info_index->get_master_info() instead of active_mi.
  If one uses 'RESET SLAVE "connection_name" all' the connection is removed from master_info_index.
sql/sql_repl.cc:
  sql_slave_skip_counter is moved to thd->variables to make it thread safe and fix some bugs with it
  Add connection name to relay log files.
  Added connection name to errors.
  Added some logging for multi-master if log_warnings > 1
  stop_slave():
  - Don't check if thd is set. It's guaranteed to always be set.
  change_master():
  - Check for duplicate connection names in change_master()
  - Check for wrong arguments first in file (to simplify error handling)
  - Register new connections in master_info_index
sql/sql_yacc.yy:
  Added optional connection_name to a all relevant master/slave commands
sql/strfunc.cc:
  my_global.h shoud always be included first.
sql/sys_vars.cc:
  Added variable default_master_connection
  Made variable sql_slave_skip_counter multi-source safe
sql/sys_vars.h:
  Added Sys_var_session_lexstring (needed for default_master_connection)
  Added Sys_var_multi_source_uint (needed for sql_slave_skip_counter).
2012-09-28 02:06:56 +03:00
Michael Widenius
3e83c4e8f9 Automatic merge 2012-09-22 15:30:24 +03:00
Michael Widenius
3a793b9d4d Added new status variables:
feature_dynamic_columns,feature_fulltext,feature_gis,feature_locale,feature_subquery,feature_timezone,feature_trigger,feature_xml
Opened_views, Executed_triggers, Executed_events
Added new process status 'updating status' as part of 'freeing items'

mysql-test/r/features.result:
  Test of feature_xxx status variables
mysql-test/r/mysqld--help.result:
  Removed duplicated 'language' variable.
mysql-test/r/view.result:
  Test of opened_views
mysql-test/suite/rpl/t/rpl_start_stop_slave.test:
  Write more information on failure
mysql-test/t/features.test:
  Test of feature_xxx status variables
mysql-test/t/view.test:
  Test of opened_views
sql/event_scheduler.cc:
  Increment executed_events status variable
sql/field.cc:
  Increment status variable
sql/item_func.cc:
  Increment status variable
sql/item_strfunc.cc:
  Increment status variable
sql/item_subselect.cc:
  Increment status variable
sql/item_xmlfunc.cc:
  Increment status variable
sql/mysqld.cc:
  Add new status variables to 'show status'
sql/mysqld.h:
  Added executed_events
sql/sql_base.cc:
  Increment status variable
sql/sql_class.h:
  Add new status variables
sql/sql_parse.cc:
  Added new process status 'updating status' as part of 'freeing items'
sql/sql_trigger.cc:
  Increment status variable
sql/sys_vars.cc:
  Increment status variable
sql/tztime.cc:
  Increment status variable
2012-09-09 01:22:06 +03:00
Michael Widenius
1999be8d4e Automatic merge with 5.5 2012-09-01 00:54:54 +03:00
Igor Babaev
98f239a849 Merge 5.5->5.5-mwl248. 2012-08-29 18:50:38 -07:00
Martin Hansson
df2bdd6063 Bug#14498355: DEPRECATION WARNINGS SHOULD NOT CONTAIN MYSQL VERSION
NUMBERS

If a system variable was declared as deprecated without mention of an
alternative, the message would look funny, e.g. for @@delayed_insert_limit:

Warning 1287 '@@delayed_insert_limit' is deprecated and
will be removed in MySQL .

The message was meant to display the version number, but it's not
possible to give one when declaring a system variable.

The fix does two things:

1) The definition of the message
ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT is changed so that it does
not display a version number. I.e. in English the message now reads:

Warning 1287 The syntax '@@delayed_insert_limit' is deprecated and
will be removed in a future version.

2) The message ER_WARN_DEPRECATED_SYNTAX_WITH_VER is discontinued in
favor of ER_WARN_DEPRECATED_SYNTAX for system variables. This change
was already done in versions 5.6 and above as part of wl#5265. This
part is simply back-ported from the worklog.
2012-08-24 10:17:08 +02:00
Igor Babaev
822e5da0d0 Merge 5.5->5.5-mwl248 2012-08-14 12:42:14 -07:00
unknown
47929af5e0 MDEV-450: Deadlock between starting a slave and reading system variables
Starting the SQL thread might deadlock with reading the values of the
replication filtering options.

The deadlock is due to a lock order violation when the variables are
read or set. For example, reading replicate_ignore_table first
acquires LOCK_global_system_variables in sys_var::value_ptr and later
acquires LOCK_active_mi in Sys_var_rpl_filter::global_value_ptr. This
violates the order established when starting a SQL thread, where
LOCK_active_mi is acquired before start_slave, and ends up creating a
thread (handle_slave_sql) that allocates a THD handle whose
constructor acquires LOCK_global_system_variables in THD::init.

The solution is to unlock LOCK_global_system_variables before the
replication filtering options are set or read. This way the lock
order is preserved and the data being read/set is still protected
given that it acquires LOCK_active_mi.
2012-08-14 12:40:40 +02:00
Sergei Golubchik
d11829654c merge with MySQL 5.5.27
manually checked every change, reverted incorrect or stupid changes.
2012-08-09 17:22:00 +02:00