diff options
author | Michael Widenius <monty@askmonty.org> | 2012-09-28 02:06:56 +0300 |
---|---|---|
committer | Michael Widenius <monty@askmonty.org> | 2012-09-28 02:06:56 +0300 |
commit | 1864d9596d9531427f1d63f86ada9e0cb21b51db (patch) | |
tree | 89ad647a849fea26b336faf565573a8d226ca7a9 /mysql-test | |
parent | 620d14f8c3521f9ec7283b8690e0e16434739d33 (diff) | |
download | mariadb-git-1864d9596d9531427f1d63f86ada9e0cb21b51db.tar.gz |
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).
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/mysqltest.result | 2 | ||||
-rw-r--r-- | mysql-test/r/parser.result | 2 | ||||
-rw-r--r-- | mysql-test/suite/multi_source/my.cnf | 22 | ||||
-rw-r--r-- | mysql-test/suite/multi_source/simple.result | 64 | ||||
-rw-r--r-- | mysql-test/suite/multi_source/simple.test | 38 | ||||
-rw-r--r-- | mysql-test/suite/multi_source/skip_counter.result | 81 | ||||
-rw-r--r-- | mysql-test/suite/multi_source/skip_counter.test | 126 | ||||
-rw-r--r-- | mysql-test/suite/multi_source/syntax.result | 89 | ||||
-rw-r--r-- | mysql-test/suite/multi_source/syntax.test | 77 | ||||
-rw-r--r-- | mysql-test/suite/rpl/r/rpl_rotate_logs.result | 4 | ||||
-rw-r--r-- | mysql-test/t/parser.test | 2 |
11 files changed, 502 insertions, 5 deletions
diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result index fdb3029059f..d08ffd96a04 100644 --- a/mysql-test/r/mysqltest.result +++ b/mysql-test/r/mysqltest.result @@ -232,7 +232,7 @@ mysqltest: At line 2: Spurious text after `query` expression mysqltest: At line 1: Missing argument(s) to 'error' mysqltest: At line 1: Missing argument(s) to 'error' mysqltest: At line 1: The sqlstate definition must start with an uppercase S -mysqltest: At line 1: The error name definition must start with an uppercase E +mysqltest: At line 1: The error name definition must start with an uppercase E or W mysqltest: At line 1: Invalid argument to error: '9eeeee' - the errno may only consist of digits[0-9] mysqltest: At line 1: Invalid argument to error: '1sssss' - the errno may only consist of digits[0-9] mysqltest: At line 1: The sqlstate must be exactly 5 chars long diff --git a/mysql-test/r/parser.result b/mysql-test/r/parser.result index 10700d0ba73..54378f16d49 100644 --- a/mysql-test/r/parser.result +++ b/mysql-test/r/parser.result @@ -441,7 +441,7 @@ select master_pos_wait(); ERROR 42000: Incorrect parameter count in the call to native function 'master_pos_wait' select master_pos_wait(1); ERROR 42000: Incorrect parameter count in the call to native function 'master_pos_wait' -select master_pos_wait(1, 2, 3, 4); +select master_pos_wait(1, 2, 3, 4, 5); ERROR 42000: Incorrect parameter count in the call to native function 'master_pos_wait' select rand(1, 2, 3); ERROR 42000: Incorrect parameter count in the call to native function 'rand' diff --git a/mysql-test/suite/multi_source/my.cnf b/mysql-test/suite/multi_source/my.cnf new file mode 100644 index 00000000000..dd57fd2199f --- /dev/null +++ b/mysql-test/suite/multi_source/my.cnf @@ -0,0 +1,22 @@ +# cat t/multisource1.cnf +!include include/default_mysqld.cnf +!include include/default_client.cnf + +[mysqld.1] +server-id=1 +log-bin=master-bin + +[mysqld.2] +server-id=2 +log-bin=master-bin + +[mysqld.3] +server-id=3 + +[ENV] +SERVER_MYPORT_1= @mysqld.1.port +SERVER_MYSOCK_1= @mysqld.1.socket +SERVER_MYPORT_2= @mysqld.2.port +SERVER_MYSOCK_2= @mysqld.2.socket +SERVER_MYPORT_3= @mysqld.3.port +SERVER_MYSOCK_3= @mysqld.3.socket diff --git a/mysql-test/suite/multi_source/simple.result b/mysql-test/suite/multi_source/simple.result new file mode 100644 index 00000000000..7448e0a0113 --- /dev/null +++ b/mysql-test/suite/multi_source/simple.result @@ -0,0 +1,64 @@ +change master 'slave1' to master_port=MYPORT_1, master_host='127.0.0.1', master_user='root'; +change master 'slave2' to master_port=MYPORT_2, master_host='127.0.0.1', master_user='root'; +start slave 'slave1'; +start slave 'slave2'; +show full slave status; +Connection_name Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id +slave1 Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 286 mysqld-relay-bin-slave1.000002 572 master-bin.000001 Yes Yes 0 0 286 875 None 0 No 0 No 0 0 1 +slave2 Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 286 mysqld-relay-bin-slave2.000002 572 master-bin.000001 Yes Yes 0 0 286 875 None 0 No 0 No 0 0 2 +stop slave 'slave1'; +show slave 'slave1' status; +Slave_IO_State +Master_Host 127.0.0.1 +Master_User root +Master_Port MYPORT_1 +Connect_Retry 60 +Master_Log_File master-bin.000001 +Read_Master_Log_Pos 286 +Relay_Log_File mysqld-relay-bin-slave1.000002 +Relay_Log_Pos 572 +Relay_Master_Log_File master-bin.000001 +Slave_IO_Running No +Slave_SQL_Running No +Replicate_Do_DB +Replicate_Ignore_DB +Replicate_Do_Table +Replicate_Ignore_Table +Replicate_Wild_Do_Table +Replicate_Wild_Ignore_Table +Last_Errno 0 +Last_Error +Skip_Counter 0 +Exec_Master_Log_Pos 286 +Relay_Log_Space 875 +Until_Condition None +Until_Log_File +Until_Log_Pos 0 +Master_SSL_Allowed No +Master_SSL_CA_File +Master_SSL_CA_Path +Master_SSL_Cert +Master_SSL_Cipher +Master_SSL_Key +Seconds_Behind_Master NULL +Master_SSL_Verify_Server_Cert No +Last_IO_Errno 0 +Last_IO_Error +Last_SQL_Errno 0 +Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 +reset slave 'slave1'; +show full slave status; +Connection_name Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id +slave1 127.0.0.1 root MYPORT_1 60 4 mysqld-relay-bin-slave1.000001 4 No No 0 0 0 265 None 0 No NULL No 0 0 1 +slave2 Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 286 mysqld-relay-bin-slave2.000002 572 master-bin.000001 Yes Yes 0 0 286 875 None 0 No 0 No 0 0 2 +reset slave 'slave1' all; +show full slave status; +Connection_name Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id +slave2 Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 286 mysqld-relay-bin-slave2.000002 572 master-bin.000001 Yes Yes 0 0 286 875 None 0 No 0 No 0 0 2 +stop slave 'slave2'; +show full slave status; +Connection_name Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id +slave2 127.0.0.1 root MYPORT_2 60 master-bin.000001 286 mysqld-relay-bin-slave2.000002 572 master-bin.000001 No No 0 0 286 875 None 0 No NULL No 0 0 2 +reset slave 'slave2' all; diff --git a/mysql-test/suite/multi_source/simple.test b/mysql-test/suite/multi_source/simple.test new file mode 100644 index 00000000000..97696c6e75f --- /dev/null +++ b/mysql-test/suite/multi_source/simple.test @@ -0,0 +1,38 @@ +# +# Simple multi-master test +# + +--connect (slave,127.0.0.1,root,,,$SERVER_MYPORT_3) + +--replace_result $SERVER_MYPORT_1 MYPORT_1 +eval change master 'slave1' to master_port=$SERVER_MYPORT_1, master_host='127.0.0.1', master_user='root'; +--replace_result $SERVER_MYPORT_2 MYPORT_2 +eval change master 'slave2' to master_port=$SERVER_MYPORT_2, master_host='127.0.0.1', master_user='root'; +start slave 'slave1'; +start slave 'slave2'; +--sleep 5 + +--replace_result $SERVER_MYPORT_1 MYPORT_1 $SERVER_MYPORT_2 MYPORT_2 +show full slave status; + +stop slave 'slave1'; + +--replace_result $SERVER_MYPORT_1 MYPORT_1 $SERVER_MYPORT_2 MYPORT_2 +query_vertical show slave 'slave1' status; + +reset slave 'slave1'; +--replace_result $SERVER_MYPORT_1 MYPORT_1 $SERVER_MYPORT_2 MYPORT_2 +show full slave status; + +reset slave 'slave1' all; +--replace_result $SERVER_MYPORT_1 MYPORT_1 $SERVER_MYPORT_2 MYPORT_2 +show full slave status; + +stop slave 'slave2'; +--replace_result $SERVER_MYPORT_1 MYPORT_1 $SERVER_MYPORT_2 MYPORT_2 +show full slave status; + +# +# clean up +# +reset slave 'slave2' all; diff --git a/mysql-test/suite/multi_source/skip_counter.result b/mysql-test/suite/multi_source/skip_counter.result new file mode 100644 index 00000000000..1fb1c255d80 --- /dev/null +++ b/mysql-test/suite/multi_source/skip_counter.result @@ -0,0 +1,81 @@ +connect master1,127.0.0.1,root,,,$SERVER_MYPORT_1; +drop database if exists db; +create database db; +create table db.t1 (i int) engine=MyISAM; +connect master2,127.0.0.1,root,,,$SERVER_MYPORT_2; +drop database if exists db; +create database db; +create table db.t2 (i int) engine=MyISAM; +connect slave,127.0.0.1,root,,,$SERVER_MYPORT_3; +change master 'master1' to +master_port=MYPORT_1, +master_host='127.0.0.1', +master_user='root'; +start slave 'master1'; +set default_master_connection = 'master1'; +include/wait_for_slave_to_start.inc +set default_master_connection = 'master2'; +change master 'master2' to +master_port=MYPORT_2, +master_host='127.0.0.1', +master_user='root'; +set global sql_slave_skip_counter = 2; +select @@global.sql_slave_skip_counter; +@@global.sql_slave_skip_counter +2 +select @@session.sql_slave_skip_counter; +@@session.sql_slave_skip_counter +2 +set session sql_slave_skip_counter = 3; +select @@global.sql_slave_skip_counter; +@@global.sql_slave_skip_counter +3 +select @@session.sql_slave_skip_counter; +@@session.sql_slave_skip_counter +3 +set global sql_slave_skip_counter= default; +select @@global.sql_slave_skip_counter; +@@global.sql_slave_skip_counter +0 +select @@session.sql_slave_skip_counter; +@@session.sql_slave_skip_counter +0 +set global sql_slave_skip_counter= 3; +set default_master_connection = 'master1'; +select @@session.sql_slave_skip_counter; +@@session.sql_slave_skip_counter +0 +set default_master_connection = 'qqq'; +select @@session.sql_slave_skip_counter; +@@session.sql_slave_skip_counter +0 +Warnings: +Warning 1617 There is no master connection 'qqq' +set default_master_connection = 'master2'; +select @@session.sql_slave_skip_counter; +@@session.sql_slave_skip_counter +3 +start slave 'master2'; +include/wait_for_slave_to_start.inc +set default_master_connection = ''; +connection master2; +connection slave; +show tables in db; +Tables_in_db +t1 +t2 +drop database db; +set default_master_connection = 'master1'; +stop slave; +include/wait_for_slave_to_stop.inc +set default_master_connection = 'master2'; +stop slave; +include/wait_for_slave_to_stop.inc +set global sql_slave_skip_counter = 0; +disconnect slave; +connection master1; +drop database db; +disconnect master1; +connection master2; +drop database db; +disconnect master2; diff --git a/mysql-test/suite/multi_source/skip_counter.test b/mysql-test/suite/multi_source/skip_counter.test new file mode 100644 index 00000000000..fe5df69097a --- /dev/null +++ b/mysql-test/suite/multi_source/skip_counter.test @@ -0,0 +1,126 @@ +# +# Test of sql_slave_skip_counter +# + +--enable_connect_log + +# Create a schema and a table i +# on the 1st master + +--connect (master1,127.0.0.1,root,,,$SERVER_MYPORT_1) + +--disable_warnings +drop database if exists db; +--enable_warnings +create database db; +create table db.t1 (i int) engine=MyISAM; +--save_master_pos + + +# Create the same schema and another table +# on the 2nd master + +--connect (master2,127.0.0.1,root,,,$SERVER_MYPORT_2) + +--disable_warnings +drop database if exists db; +--enable_warnings +create database db; +create table db.t2 (i int) engine=MyISAM; + +--connect (slave,127.0.0.1,root,,,$SERVER_MYPORT_3) +--disable_connect_log + +# Start replication from the first master + +--replace_result $SERVER_MYPORT_1 MYPORT_1 +eval change master 'master1' to +master_port=$SERVER_MYPORT_1, +master_host='127.0.0.1', +master_user='root'; + +start slave 'master1'; +set default_master_connection = 'master1'; +--source include/wait_for_slave_to_start.inc +--sync_with_master 0,'master1' + +# Start replication from the second master + +set default_master_connection = 'master2'; + +--replace_result $SERVER_MYPORT_2 MYPORT_2 +eval change master 'master2' to +master_port=$SERVER_MYPORT_2, +master_host='127.0.0.1', +master_user='root'; + +# the schema creation will be replicated from the 1st master, +# so we want to skip it in the second replication connection. + +# Normally it should have been 2 events, but +# currently Binlog_checkpoint also counts. Maybe we'll need +# to modify the test later + +--let $skip_counter_saved = `select @@global.sql_slave_skip_counter` +set global sql_slave_skip_counter = 2; +select @@global.sql_slave_skip_counter; +select @@session.sql_slave_skip_counter; +set session sql_slave_skip_counter = 3; +select @@global.sql_slave_skip_counter; +select @@session.sql_slave_skip_counter; +set global sql_slave_skip_counter= default; +select @@global.sql_slave_skip_counter; +select @@session.sql_slave_skip_counter; +set global sql_slave_skip_counter= 3; +set default_master_connection = 'master1'; +select @@session.sql_slave_skip_counter; +set default_master_connection = 'qqq'; +select @@session.sql_slave_skip_counter; +set default_master_connection = 'master2'; +select @@session.sql_slave_skip_counter; + +start slave 'master2'; +--source include/wait_for_slave_to_start.inc +set default_master_connection = ''; + +--enable_connect_log + +--connection master2 +--save_master_pos + +--connection slave + +--disable_connect_log +--sync_with_master 0,'master2' + +# If the skip_counter worked as expected, we should +# get here (replication shouldn't have broken) +# and should see both tables here +# (drop database which came from master2 shoudn't have been executed +# so t1 should still exist) + +show tables in db; + +# Cleanup + +drop database db; +set default_master_connection = 'master1'; +stop slave; + +--source include/wait_for_slave_to_stop.inc +set default_master_connection = 'master2'; +stop slave; + +--source include/wait_for_slave_to_stop.inc +--eval set global sql_slave_skip_counter = $skip_counter_saved + +--enable_connect_log +--disconnect slave + +--connection master1 +drop database db; +--disconnect master1 + +--connection master2 +drop database db; +--disconnect master2 diff --git a/mysql-test/suite/multi_source/syntax.result b/mysql-test/suite/multi_source/syntax.result new file mode 100644 index 00000000000..23ea4d9fd3d --- /dev/null +++ b/mysql-test/suite/multi_source/syntax.result @@ -0,0 +1,89 @@ +include/master-slave.inc +[connection master] +show slave status; +Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id +show slave '' status; +Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id +show full slave status; +Connection_name Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id +# +# Check error handling +# +show slave 'qqq' status; +ERROR HY000: There is no master connection 'qqq' +show slave 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc' status; +ERROR HY000: There is no master connection 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc' +show slave 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc' status; +ERROR HY000: Incorrect arguments to MASTER_CONNECTION_NAME +change master 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc' to master_host='dummy'; +ERROR HY000: Incorrect arguments to MASTER_CONNECTION_NAME +start slave 'qqq'; +ERROR HY000: There is no master connection 'qqq' +stop slave 'qqq'; +ERROR HY000: There is no master connection 'qqq' +slave 'qqq' start; +ERROR HY000: There is no master connection 'qqq' +slave 'qqq' stop; +ERROR HY000: There is no master connection 'qqq' +flush slave 'qqq'; +ERROR HY000: There is no master connection 'qqq' +reset slave 'qqq'; +ERROR HY000: There is no master connection 'qqq' +select master_pos_wait('master-bin.999999',0,2,'qqq'); +master_pos_wait('master-bin.999999',0,2,'qqq') +NULL +Warnings: +Warning 1617 There is no master connection 'qqq' +select master_pos_wait('master-bin.999999',0,2,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'); +master_pos_wait('master-bin.999999',0,2,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc') +NULL +Warnings: +Warning 1210 Incorrect arguments to MASTER_CONNECTION_NAME +# +# checking usage of default_master_connection; +# +select @@default_master_connection; +@@default_master_connection + +select @@global.default_master_connection; +ERROR HY000: Variable 'default_master_connection' is a SESSION variable +set @@global.default_master_connection='qqq'; +ERROR HY000: Variable 'default_master_connection' is a SESSION variable and can't be used with SET GLOBAL +set @@default_master_connection='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'; +ERROR 42000: Variable 'default_master_connection' can't be set to the value of 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc' +select @@default_master_connection; +@@default_master_connection + +set @@default_master_connection='qqq'; +select @@default_master_connection; +@@default_master_connection +qqq +show variables like "default_master_connection"; +Variable_name Value +default_master_connection qqq +show slave status; +ERROR HY000: There is no master connection 'qqq' +select master_pos_wait('master-bin.999999',0,2); +master_pos_wait('master-bin.999999',0,2) +NULL +Warnings: +Warning 1617 There is no master connection 'qqq' +set @@default_master_connection=''; +select master_pos_wait('master-bin.999999',0,2); +master_pos_wait('master-bin.999999',0,2) +-1 +set @@default_master_connection=''; +# +# checking variables +# +show status like "Slave_running"; +Variable_name Value +Slave_running ON +set @@default_master_connection='qqq'; +show status like "Slave_running"; +Variable_name Value +Slave_running OFF +Warnings: +Warning 1617 There is no master connection 'qqq' +set @@default_master_connection=''; +include/rpl_end.inc diff --git a/mysql-test/suite/multi_source/syntax.test b/mysql-test/suite/multi_source/syntax.test new file mode 100644 index 00000000000..af793fe6100 --- /dev/null +++ b/mysql-test/suite/multi_source/syntax.test @@ -0,0 +1,77 @@ +# Test multi master syntax +source include/master-slave.inc; + +# Check syntax of multi source replication + +show slave status; +show slave '' status; +show full slave status; + +--echo # +--echo # Check error handling +--echo # + +--error WARN_NO_MASTER_INFO +show slave 'qqq' status; +--error WARN_NO_MASTER_INFO +show slave 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc' status; +--error ER_WRONG_ARGUMENTS +show slave 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc' status; +--error ER_WRONG_ARGUMENTS +change master 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc' to master_host='dummy'; + +--error WARN_NO_MASTER_INFO +start slave 'qqq'; +--error WARN_NO_MASTER_INFO +stop slave 'qqq'; +--error WARN_NO_MASTER_INFO +slave 'qqq' start; +--error WARN_NO_MASTER_INFO +slave 'qqq' stop; +--error WARN_NO_MASTER_INFO +flush slave 'qqq'; +--error WARN_NO_MASTER_INFO +reset slave 'qqq'; + +select master_pos_wait('master-bin.999999',0,2,'qqq'); +select master_pos_wait('master-bin.999999',0,2,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'); + +save_master_pos; +connection slave; +sync_with_master 0,''; +sync_with_master 0 ,''; +sync_with_master 0, ''; + +--echo # +--echo # checking usage of default_master_connection; +--echo # +select @@default_master_connection; + +--error 1238 +select @@global.default_master_connection; +--error 1228 +set @@global.default_master_connection='qqq'; +--error 1231 +set @@default_master_connection='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'; +select @@default_master_connection; +set @@default_master_connection='qqq'; +select @@default_master_connection; +show variables like "default_master_connection"; + +--error WARN_NO_MASTER_INFO +show slave status; +select master_pos_wait('master-bin.999999',0,2); +set @@default_master_connection=''; +select master_pos_wait('master-bin.999999',0,2); + +set @@default_master_connection=''; + +--echo # +--echo # checking variables +--echo # +show status like "Slave_running"; +set @@default_master_connection='qqq'; +show status like "Slave_running"; +set @@default_master_connection=''; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_rotate_logs.result b/mysql-test/suite/rpl/r/rpl_rotate_logs.result index f10e30c698d..783c02b961c 100644 --- a/mysql-test/suite/rpl/r/rpl_rotate_logs.result +++ b/mysql-test/suite/rpl/r/rpl_rotate_logs.result @@ -2,9 +2,9 @@ CALL mtr.add_suppression("Unsafe statement written to the binary log using state start slave; Got one of the listed errors start slave; -ERROR HY000: Could not initialize master info structure; more error messages can be found in the MariaDB error log +ERROR HY000: Could not initialize master info structure for ''; more error messages can be found in the MariaDB error log change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root'; -ERROR HY000: Could not initialize master info structure; more error messages can be found in the MariaDB error log +ERROR HY000: Could not initialize master info structure for ''; more error messages can be found in the MariaDB error log reset slave; change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root'; reset master; diff --git a/mysql-test/t/parser.test b/mysql-test/t/parser.test index d477843b22b..2c8cfafb90a 100644 --- a/mysql-test/t/parser.test +++ b/mysql-test/t/parser.test @@ -553,7 +553,7 @@ select master_pos_wait(); -- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT select master_pos_wait(1); -- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT -select master_pos_wait(1, 2, 3, 4); +select master_pos_wait(1, 2, 3, 4, 5); -- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT select rand(1, 2, 3); |