diff options
author | unknown <knielsen@knielsen-hq.org> | 2013-05-22 17:36:48 +0200 |
---|---|---|
committer | unknown <knielsen@knielsen-hq.org> | 2013-05-22 17:36:48 +0200 |
commit | 1cd6eb5f942ca3e94e86a48512d992fbb3aeecd9 (patch) | |
tree | a23bba541fbfbc0fc92f9666d29340320b9be428 | |
parent | d795bc9ff8d4a4e17f249a0eb9ac01f25d53a259 (diff) | |
download | mariadb-git-1cd6eb5f942ca3e94e86a48512d992fbb3aeecd9.tar.gz |
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.
84 files changed, 996 insertions, 513 deletions
diff --git a/mysql-test/include/check-testcase.test b/mysql-test/include/check-testcase.test index b25c6945023..d4db37e6621 100644 --- a/mysql-test/include/check-testcase.test +++ b/mysql-test/include/check-testcase.test @@ -60,7 +60,7 @@ if ($tmp) --echo Last_SQL_Error --echo Replicate_Ignore_Server_Ids --echo Master_Server_Id # - --echo Using_Gtid 0 + --echo Using_Gtid No } if (!$tmp) { # Note: after WL#5177, fields 13-18 shall not be filtered-out. diff --git a/mysql-test/include/mtr_check.sql b/mysql-test/include/mtr_check.sql index c66a7fea938..467a3f973c7 100644 --- a/mysql-test/include/mtr_check.sql +++ b/mysql-test/include/mtr_check.sql @@ -31,7 +31,7 @@ BEGIN AND variable_name not like "Last_IO_Err*" AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND variable_name != 'INNODB_USE_NATIVE_AIO' - AND variable_name != 'GTID_POS' + AND variable_name not like 'GTID%POS' ORDER BY variable_name; -- Dump all databases, there should be none diff --git a/mysql-test/include/rpl_init.inc b/mysql-test/include/rpl_init.inc index 98e3c468253..dbe93adbec3 100644 --- a/mysql-test/include/rpl_init.inc +++ b/mysql-test/include/rpl_init.inc @@ -177,7 +177,7 @@ while ($_rpl_server) if (!$rpl_skip_reset_master_and_slave) { RESET MASTER; - SET GLOBAL gtid_pos= ""; + SET GLOBAL gtid_slave_pos= ""; RESET SLAVE; } eval SET auto_increment_increment= $rpl_server_count; diff --git a/mysql-test/r/1st.result b/mysql-test/r/1st.result index e37bca20f0c..e847be49a91 100644 --- a/mysql-test/r/1st.result +++ b/mysql-test/r/1st.result @@ -13,6 +13,7 @@ db event func general_log +gtid_slave_pos help_category help_keyword help_relation @@ -24,7 +25,6 @@ plugin proc procs_priv proxies_priv -rpl_slave_state servers slow_log table_stats diff --git a/mysql-test/r/connect.result b/mysql-test/r/connect.result index a533b495267..b90e558cfaa 100644 --- a/mysql-test/r/connect.result +++ b/mysql-test/r/connect.result @@ -7,6 +7,7 @@ db event func general_log +gtid_slave_pos help_category help_keyword help_relation @@ -18,7 +19,6 @@ plugin proc procs_priv proxies_priv -rpl_slave_state servers slow_log table_stats @@ -45,6 +45,7 @@ db event func general_log +gtid_slave_pos help_category help_keyword help_relation @@ -56,7 +57,6 @@ plugin proc procs_priv proxies_priv -rpl_slave_state servers slow_log table_stats @@ -91,6 +91,7 @@ db event func general_log +gtid_slave_pos help_category help_keyword help_relation @@ -102,7 +103,6 @@ plugin proc procs_priv proxies_priv -rpl_slave_state servers slow_log table_stats diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index 8e1d4856645..ce962a96f29 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -88,6 +88,7 @@ db event func general_log +gtid_slave_pos help_category help_keyword help_relation @@ -98,7 +99,6 @@ plugin proc procs_priv proxies_priv -rpl_slave_state servers slow_log t1 diff --git a/mysql-test/r/log_tables_upgrade.result b/mysql-test/r/log_tables_upgrade.result index 978b4b7b314..abae156ac5e 100644 --- a/mysql-test/r/log_tables_upgrade.result +++ b/mysql-test/r/log_tables_upgrade.result @@ -24,6 +24,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK mysql.help_relation OK @@ -36,7 +37,6 @@ mysql.proc OK mysql.procs_priv OK mysql.proxies_priv OK mysql.renamed_general_log OK -mysql.rpl_slave_state OK mysql.servers OK mysql.table_stats OK mysql.tables_priv OK diff --git a/mysql-test/r/mysql_upgrade.result b/mysql-test/r/mysql_upgrade.result index 871646d18a8..bb91d4f23c4 100644 --- a/mysql-test/r/mysql_upgrade.result +++ b/mysql-test/r/mysql_upgrade.result @@ -12,6 +12,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK mysql.help_relation OK @@ -23,7 +24,6 @@ mysql.plugin OK mysql.proc OK mysql.procs_priv OK mysql.proxies_priv OK -mysql.rpl_slave_state OK mysql.servers OK mysql.table_stats OK mysql.tables_priv OK @@ -53,6 +53,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK mysql.help_relation OK @@ -64,7 +65,6 @@ mysql.plugin OK mysql.proc OK mysql.procs_priv OK mysql.proxies_priv OK -mysql.rpl_slave_state OK mysql.servers OK mysql.table_stats OK mysql.tables_priv OK @@ -94,6 +94,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK mysql.help_relation OK @@ -105,7 +106,6 @@ mysql.plugin OK mysql.proc OK mysql.procs_priv OK mysql.proxies_priv OK -mysql.rpl_slave_state OK mysql.servers OK mysql.table_stats OK mysql.tables_priv OK @@ -138,6 +138,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK mysql.help_relation OK @@ -149,7 +150,6 @@ mysql.plugin OK mysql.proc OK mysql.procs_priv OK mysql.proxies_priv OK -mysql.rpl_slave_state OK mysql.servers OK mysql.table_stats OK mysql.tables_priv OK @@ -185,6 +185,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK mysql.help_relation OK @@ -196,7 +197,6 @@ mysql.plugin OK mysql.proc OK mysql.procs_priv OK mysql.proxies_priv OK -mysql.rpl_slave_state OK mysql.servers OK mysql.table_stats OK mysql.tables_priv OK @@ -235,6 +235,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK mysql.help_relation OK @@ -246,7 +247,6 @@ mysql.plugin OK mysql.proc OK mysql.procs_priv OK mysql.proxies_priv OK -mysql.rpl_slave_state OK mysql.servers OK mysql.table_stats OK mysql.tables_priv OK @@ -288,6 +288,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK mysql.help_relation OK @@ -299,7 +300,6 @@ mysql.plugin OK mysql.proc OK mysql.procs_priv OK mysql.proxies_priv OK -mysql.rpl_slave_state OK mysql.servers OK mysql.table_stats OK mysql.tables_priv OK diff --git a/mysql-test/r/mysql_upgrade_ssl.result b/mysql-test/r/mysql_upgrade_ssl.result index 05316de317d..3b84664708c 100644 --- a/mysql-test/r/mysql_upgrade_ssl.result +++ b/mysql-test/r/mysql_upgrade_ssl.result @@ -14,6 +14,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK mysql.help_relation OK @@ -25,7 +26,6 @@ mysql.plugin OK mysql.proc OK mysql.procs_priv OK mysql.proxies_priv OK -mysql.rpl_slave_state OK mysql.servers OK mysql.table_stats OK mysql.tables_priv OK diff --git a/mysql-test/r/mysqlcheck.result b/mysql-test/r/mysqlcheck.result index 38bff3e8254..b25a9be8872 100644 --- a/mysql-test/r/mysqlcheck.result +++ b/mysql-test/r/mysqlcheck.result @@ -8,6 +8,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK mysql.help_relation OK @@ -19,7 +20,6 @@ mysql.plugin OK mysql.proc OK mysql.procs_priv OK mysql.proxies_priv OK -mysql.rpl_slave_state OK mysql.servers OK mysql.table_stats OK mysql.tables_priv OK @@ -36,6 +36,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK mysql.help_relation OK @@ -47,7 +48,6 @@ mysql.plugin OK mysql.proc OK mysql.procs_priv OK mysql.proxies_priv OK -mysql.rpl_slave_state OK mysql.servers OK mysql.table_stats OK mysql.tables_priv OK @@ -62,6 +62,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK mysql.help_relation OK @@ -73,7 +74,6 @@ mysql.plugin OK mysql.proc OK mysql.procs_priv OK mysql.proxies_priv OK -mysql.rpl_slave_state OK mysql.servers OK mysql.table_stats OK mysql.tables_priv OK @@ -88,6 +88,7 @@ mysql.columns_priv Table is already up to date mysql.db Table is already up to date mysql.event Table is already up to date mysql.func Table is already up to date +mysql.gtid_slave_pos Table is already up to date mysql.help_category Table is already up to date mysql.help_keyword Table is already up to date mysql.help_relation Table is already up to date @@ -99,7 +100,6 @@ mysql.plugin Table is already up to date mysql.proc Table is already up to date mysql.procs_priv Table is already up to date mysql.proxies_priv Table is already up to date -mysql.rpl_slave_state Table is already up to date mysql.servers Table is already up to date mysql.table_stats Table is already up to date mysql.tables_priv Table is already up to date diff --git a/mysql-test/r/system_mysql_db.result b/mysql-test/r/system_mysql_db.result index 6a6e5d4179a..a92decefbc8 100644 --- a/mysql-test/r/system_mysql_db.result +++ b/mysql-test/r/system_mysql_db.result @@ -6,6 +6,7 @@ db event func general_log +gtid_slave_pos help_category help_keyword help_relation @@ -17,7 +18,6 @@ plugin proc procs_priv proxies_priv -rpl_slave_state servers slow_log table_stats diff --git a/mysql-test/r/system_mysql_db_fix40123.result b/mysql-test/r/system_mysql_db_fix40123.result index 94cf57d370d..04b20c42af3 100644 --- a/mysql-test/r/system_mysql_db_fix40123.result +++ b/mysql-test/r/system_mysql_db_fix40123.result @@ -6,6 +6,7 @@ db event func general_log +gtid_slave_pos help_category help_keyword help_relation @@ -17,7 +18,6 @@ plugin proc procs_priv proxies_priv -rpl_slave_state servers slow_log table_stats diff --git a/mysql-test/r/system_mysql_db_fix50030.result b/mysql-test/r/system_mysql_db_fix50030.result index 94cf57d370d..04b20c42af3 100644 --- a/mysql-test/r/system_mysql_db_fix50030.result +++ b/mysql-test/r/system_mysql_db_fix50030.result @@ -6,6 +6,7 @@ db event func general_log +gtid_slave_pos help_category help_keyword help_relation @@ -17,7 +18,6 @@ plugin proc procs_priv proxies_priv -rpl_slave_state servers slow_log table_stats diff --git a/mysql-test/r/system_mysql_db_fix50117.result b/mysql-test/r/system_mysql_db_fix50117.result index 94cf57d370d..04b20c42af3 100644 --- a/mysql-test/r/system_mysql_db_fix50117.result +++ b/mysql-test/r/system_mysql_db_fix50117.result @@ -6,6 +6,7 @@ db event func general_log +gtid_slave_pos help_category help_keyword help_relation @@ -17,7 +18,6 @@ plugin proc procs_priv proxies_priv -rpl_slave_state servers slow_log table_stats diff --git a/mysql-test/suite/funcs_1/r/is_columns_mysql.result b/mysql-test/suite/funcs_1/r/is_columns_mysql.result index 3ca0cefa84a..36c11c15c95 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_mysql.result +++ b/mysql-test/suite/funcs_1/r/is_columns_mysql.result @@ -74,6 +74,10 @@ def mysql general_log event_time 1 CURRENT_TIMESTAMP(6) NO timestamp NULL NULL N def mysql general_log server_id 4 NULL NO int NULL NULL 10 0 NULL NULL NULL int(10) unsigned select,insert,update,references def mysql general_log thread_id 3 NULL NO int NULL NULL 10 0 NULL NULL NULL int(11) select,insert,update,references def mysql general_log user_host 2 NULL NO mediumtext 16777215 16777215 NULL NULL NULL utf8 utf8_general_ci mediumtext select,insert,update,references +def mysql gtid_slave_pos domain_id 1 NULL NO int NULL NULL 10 0 NULL NULL NULL int(10) unsigned PRI select,insert,update,references +def mysql gtid_slave_pos seq_no 4 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references +def mysql gtid_slave_pos server_id 3 NULL NO int NULL NULL 10 0 NULL NULL NULL int(10) unsigned select,insert,update,references +def mysql gtid_slave_pos sub_id 2 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned PRI select,insert,update,references def mysql help_category help_category_id 1 NULL NO smallint NULL NULL 5 0 NULL NULL NULL smallint(5) unsigned PRI select,insert,update,references def mysql help_category name 2 NULL NO char 64 192 NULL NULL NULL utf8 utf8_general_ci char(64) UNI select,insert,update,references def mysql help_category parent_category_id 3 NULL YES smallint NULL NULL 5 0 NULL NULL NULL smallint(5) unsigned select,insert,update,references @@ -157,10 +161,6 @@ def mysql proxies_priv Proxied_user 4 NO char 16 48 NULL NULL NULL utf8 utf8_bi def mysql proxies_priv Timestamp 7 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update CURRENT_TIMESTAMP select,insert,update,references def mysql proxies_priv User 2 NO char 16 48 NULL NULL NULL utf8 utf8_bin char(16) PRI select,insert,update,references def mysql proxies_priv With_grant 5 0 NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(1) select,insert,update,references -def mysql rpl_slave_state domain_id 1 NULL NO int NULL NULL 10 0 NULL NULL NULL int(10) unsigned PRI select,insert,update,references -def mysql rpl_slave_state seq_no 4 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references -def mysql rpl_slave_state server_id 3 NULL NO int NULL NULL 10 0 NULL NULL NULL int(10) unsigned select,insert,update,references -def mysql rpl_slave_state sub_id 2 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned PRI select,insert,update,references def mysql servers Db 3 NO char 64 192 NULL NULL NULL utf8 utf8_general_ci char(64) select,insert,update,references def mysql servers Host 2 NO char 64 192 NULL NULL NULL utf8 utf8_general_ci char(64) select,insert,update,references def mysql servers Owner 9 NO char 64 192 NULL NULL NULL utf8 utf8_general_ci char(64) select,insert,update,references @@ -393,6 +393,10 @@ NULL mysql general_log thread_id int NULL NULL NULL NULL int(11) NULL mysql general_log server_id int NULL NULL NULL NULL int(10) unsigned 3.0000 mysql general_log command_type varchar 64 192 utf8 utf8_general_ci varchar(64) 1.0000 mysql general_log argument mediumtext 16777215 16777215 utf8 utf8_general_ci mediumtext +NULL mysql gtid_slave_pos domain_id int NULL NULL NULL NULL int(10) unsigned +NULL mysql gtid_slave_pos sub_id bigint NULL NULL NULL NULL bigint(20) unsigned +NULL mysql gtid_slave_pos server_id int NULL NULL NULL NULL int(10) unsigned +NULL mysql gtid_slave_pos seq_no bigint NULL NULL NULL NULL bigint(20) unsigned NULL mysql help_category help_category_id smallint NULL NULL NULL NULL smallint(5) unsigned 3.0000 mysql help_category name char 64 192 utf8 utf8_general_ci char(64) NULL mysql help_category parent_category_id smallint NULL NULL NULL NULL smallint(5) unsigned @@ -476,10 +480,6 @@ NULL mysql procs_priv Timestamp timestamp NULL NULL NULL NULL timestamp NULL mysql proxies_priv With_grant tinyint NULL NULL NULL NULL tinyint(1) 3.0000 mysql proxies_priv Grantor char 77 231 utf8 utf8_bin char(77) NULL mysql proxies_priv Timestamp timestamp NULL NULL NULL NULL timestamp -NULL mysql rpl_slave_state domain_id int NULL NULL NULL NULL int(10) unsigned -NULL mysql rpl_slave_state sub_id bigint NULL NULL NULL NULL bigint(20) unsigned -NULL mysql rpl_slave_state server_id int NULL NULL NULL NULL int(10) unsigned -NULL mysql rpl_slave_state seq_no bigint NULL NULL NULL NULL bigint(20) unsigned 3.0000 mysql servers Server_name char 64 192 utf8 utf8_general_ci char(64) 3.0000 mysql servers Host char 64 192 utf8 utf8_general_ci char(64) 3.0000 mysql servers Db char 64 192 utf8 utf8_general_ci char(64) diff --git a/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result b/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result index 0d9fe322c6f..badf5a6811c 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result @@ -74,6 +74,10 @@ def mysql general_log event_time 1 CURRENT_TIMESTAMP(6) NO timestamp NULL NULL N def mysql general_log server_id 4 NULL NO int NULL NULL 10 0 NULL NULL NULL int(10) unsigned def mysql general_log thread_id 3 NULL NO int NULL NULL 10 0 NULL NULL NULL int(11) def mysql general_log user_host 2 NULL NO mediumtext 16777215 16777215 NULL NULL NULL utf8 utf8_general_ci mediumtext +def mysql gtid_slave_pos domain_id 1 NULL NO int NULL NULL 10 0 NULL NULL NULL int(10) unsigned PRI +def mysql gtid_slave_pos seq_no 4 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned +def mysql gtid_slave_pos server_id 3 NULL NO int NULL NULL 10 0 NULL NULL NULL int(10) unsigned +def mysql gtid_slave_pos sub_id 2 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned PRI def mysql help_category help_category_id 1 NULL NO smallint NULL NULL 5 0 NULL NULL NULL smallint(5) unsigned PRI def mysql help_category name 2 NULL NO char 64 192 NULL NULL NULL utf8 utf8_general_ci char(64) UNI def mysql help_category parent_category_id 3 NULL YES smallint NULL NULL 5 0 NULL NULL NULL smallint(5) unsigned @@ -157,10 +161,6 @@ def mysql proxies_priv Proxied_user 4 NO char 16 48 NULL NULL NULL utf8 utf8_bi def mysql proxies_priv Timestamp 7 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update CURRENT_TIMESTAMP def mysql proxies_priv User 2 NO char 16 48 NULL NULL NULL utf8 utf8_bin char(16) PRI def mysql proxies_priv With_grant 5 0 NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(1) -def mysql rpl_slave_state domain_id 1 NULL NO int NULL NULL 10 0 NULL NULL NULL int(10) unsigned PRI -def mysql rpl_slave_state seq_no 4 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned -def mysql rpl_slave_state server_id 3 NULL NO int NULL NULL 10 0 NULL NULL NULL int(10) unsigned -def mysql rpl_slave_state sub_id 2 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned PRI def mysql servers Db 3 NO char 64 192 NULL NULL NULL utf8 utf8_general_ci char(64) def mysql servers Host 2 NO char 64 192 NULL NULL NULL utf8 utf8_general_ci char(64) def mysql servers Owner 9 NO char 64 192 NULL NULL NULL utf8 utf8_general_ci char(64) @@ -393,6 +393,10 @@ NULL mysql general_log thread_id int NULL NULL NULL NULL int(11) NULL mysql general_log server_id int NULL NULL NULL NULL int(10) unsigned 3.0000 mysql general_log command_type varchar 64 192 utf8 utf8_general_ci varchar(64) 1.0000 mysql general_log argument mediumtext 16777215 16777215 utf8 utf8_general_ci mediumtext +NULL mysql gtid_slave_pos domain_id int NULL NULL NULL NULL int(10) unsigned +NULL mysql gtid_slave_pos sub_id bigint NULL NULL NULL NULL bigint(20) unsigned +NULL mysql gtid_slave_pos server_id int NULL NULL NULL NULL int(10) unsigned +NULL mysql gtid_slave_pos seq_no bigint NULL NULL NULL NULL bigint(20) unsigned NULL mysql help_category help_category_id smallint NULL NULL NULL NULL smallint(5) unsigned 3.0000 mysql help_category name char 64 192 utf8 utf8_general_ci char(64) NULL mysql help_category parent_category_id smallint NULL NULL NULL NULL smallint(5) unsigned @@ -476,10 +480,6 @@ NULL mysql procs_priv Timestamp timestamp NULL NULL NULL NULL timestamp NULL mysql proxies_priv With_grant tinyint NULL NULL NULL NULL tinyint(1) 3.0000 mysql proxies_priv Grantor char 77 231 utf8 utf8_bin char(77) NULL mysql proxies_priv Timestamp timestamp NULL NULL NULL NULL timestamp -NULL mysql rpl_slave_state domain_id int NULL NULL NULL NULL int(10) unsigned -NULL mysql rpl_slave_state sub_id bigint NULL NULL NULL NULL bigint(20) unsigned -NULL mysql rpl_slave_state server_id int NULL NULL NULL NULL int(10) unsigned -NULL mysql rpl_slave_state seq_no bigint NULL NULL NULL NULL bigint(20) unsigned 3.0000 mysql servers Server_name char 64 192 utf8 utf8_general_ci char(64) 3.0000 mysql servers Host char 64 192 utf8 utf8_general_ci char(64) 3.0000 mysql servers Db char 64 192 utf8 utf8_general_ci char(64) diff --git a/mysql-test/suite/funcs_1/r/is_key_column_usage.result b/mysql-test/suite/funcs_1/r/is_key_column_usage.result index f54e7216296..1bc72a883ea 100644 --- a/mysql-test/suite/funcs_1/r/is_key_column_usage.result +++ b/mysql-test/suite/funcs_1/r/is_key_column_usage.result @@ -89,6 +89,8 @@ def mysql PRIMARY def mysql db User def mysql PRIMARY def mysql event db def mysql PRIMARY def mysql event name def mysql PRIMARY def mysql func name +def mysql PRIMARY def mysql gtid_slave_pos domain_id +def mysql PRIMARY def mysql gtid_slave_pos sub_id def mysql PRIMARY def mysql help_category help_category_id def mysql name def mysql help_category name def mysql PRIMARY def mysql help_keyword help_keyword_id @@ -117,8 +119,6 @@ def mysql PRIMARY def mysql proxies_priv Host def mysql PRIMARY def mysql proxies_priv User def mysql PRIMARY def mysql proxies_priv Proxied_host def mysql PRIMARY def mysql proxies_priv Proxied_user -def mysql PRIMARY def mysql rpl_slave_state domain_id -def mysql PRIMARY def mysql rpl_slave_state sub_id def mysql PRIMARY def mysql servers Server_name def mysql PRIMARY def mysql table_stats db_name def mysql PRIMARY def mysql table_stats table_name diff --git a/mysql-test/suite/funcs_1/r/is_statistics.result b/mysql-test/suite/funcs_1/r/is_statistics.result index b9731f3a613..c8717cc60d1 100644 --- a/mysql-test/suite/funcs_1/r/is_statistics.result +++ b/mysql-test/suite/funcs_1/r/is_statistics.result @@ -100,6 +100,8 @@ def mysql db mysql User def mysql event mysql PRIMARY def mysql event mysql PRIMARY def mysql func mysql PRIMARY +def mysql gtid_slave_pos mysql PRIMARY +def mysql gtid_slave_pos mysql PRIMARY def mysql help_category mysql PRIMARY def mysql help_category mysql name def mysql help_keyword mysql PRIMARY @@ -130,8 +132,6 @@ def mysql proxies_priv mysql PRIMARY def mysql proxies_priv mysql PRIMARY def mysql proxies_priv mysql PRIMARY def mysql proxies_priv mysql Grantor -def mysql rpl_slave_state mysql PRIMARY -def mysql rpl_slave_state mysql PRIMARY def mysql servers mysql PRIMARY def mysql table_stats mysql PRIMARY def mysql table_stats mysql PRIMARY diff --git a/mysql-test/suite/funcs_1/r/is_statistics_mysql.result b/mysql-test/suite/funcs_1/r/is_statistics_mysql.result index d8c75373dbc..64a69104aba 100644 --- a/mysql-test/suite/funcs_1/r/is_statistics_mysql.result +++ b/mysql-test/suite/funcs_1/r/is_statistics_mysql.result @@ -22,6 +22,8 @@ def mysql db 1 mysql User 1 User A #CARD# NULL NULL BTREE def mysql event 0 mysql PRIMARY 1 db A #CARD# NULL NULL BTREE def mysql event 0 mysql PRIMARY 2 name A #CARD# NULL NULL BTREE def mysql func 0 mysql PRIMARY 1 name A #CARD# NULL NULL BTREE +def mysql gtid_slave_pos 0 mysql PRIMARY 1 domain_id A #CARD# NULL NULL BTREE +def mysql gtid_slave_pos 0 mysql PRIMARY 2 sub_id A #CARD# NULL NULL BTREE def mysql help_category 0 mysql name 1 name A #CARD# NULL NULL BTREE def mysql help_category 0 mysql PRIMARY 1 help_category_id A #CARD# NULL NULL BTREE def mysql help_keyword 0 mysql name 1 name A #CARD# NULL NULL BTREE @@ -52,8 +54,6 @@ def mysql proxies_priv 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE def mysql proxies_priv 0 mysql PRIMARY 2 User A #CARD# NULL NULL BTREE def mysql proxies_priv 0 mysql PRIMARY 3 Proxied_host A #CARD# NULL NULL BTREE def mysql proxies_priv 0 mysql PRIMARY 4 Proxied_user A #CARD# NULL NULL BTREE -def mysql rpl_slave_state 0 mysql PRIMARY 1 domain_id A #CARD# NULL NULL BTREE -def mysql rpl_slave_state 0 mysql PRIMARY 2 sub_id A #CARD# NULL NULL BTREE def mysql servers 0 mysql PRIMARY 1 Server_name A #CARD# NULL NULL BTREE def mysql tables_priv 1 mysql Grantor 1 Grantor A #CARD# NULL NULL BTREE def mysql tables_priv 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE diff --git a/mysql-test/suite/funcs_1/r/is_statistics_mysql_embedded.result b/mysql-test/suite/funcs_1/r/is_statistics_mysql_embedded.result index ac5d79f1d1a..904777a9c54 100644 --- a/mysql-test/suite/funcs_1/r/is_statistics_mysql_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_statistics_mysql_embedded.result @@ -22,6 +22,8 @@ def mysql db 1 mysql User 1 User A #CARD# NULL NULL BTREE def mysql event 0 mysql PRIMARY 1 db A #CARD# NULL NULL BTREE def mysql event 0 mysql PRIMARY 2 name A #CARD# NULL NULL BTREE def mysql func 0 mysql PRIMARY 1 name A #CARD# NULL NULL BTREE +def mysql gtid_slave_pos 0 mysql PRIMARY 1 domain_id A #CARD# NULL NULL BTREE +def mysql gtid_slave_pos 0 mysql PRIMARY 2 sub_id A #CARD# NULL NULL BTREE def mysql help_category 0 mysql name 1 name A #CARD# NULL NULL BTREE def mysql help_category 0 mysql PRIMARY 1 help_category_id A #CARD# NULL NULL BTREE def mysql help_keyword 0 mysql name 1 name A #CARD# NULL NULL BTREE @@ -52,8 +54,6 @@ def mysql proxies_priv 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE def mysql proxies_priv 0 mysql PRIMARY 2 User A #CARD# NULL NULL BTREE def mysql proxies_priv 0 mysql PRIMARY 3 Proxied_host A #CARD# NULL NULL BTREE def mysql proxies_priv 0 mysql PRIMARY 4 Proxied_user A #CARD# NULL NULL BTREE -def mysql rpl_slave_state 0 mysql PRIMARY 1 domain_id A #CARD# NULL NULL BTREE -def mysql rpl_slave_state 0 mysql PRIMARY 2 sub_id A #CARD# NULL NULL BTREE def mysql servers 0 mysql PRIMARY 1 Server_name A #CARD# NULL NULL BTREE def mysql tables_priv 1 mysql Grantor 1 Grantor A #CARD# NULL NULL BTREE def mysql tables_priv 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE @@ -91,6 +91,8 @@ def mysql db 1 mysql User 1 User A #CARD# NULL NULL BTREE def mysql event 0 mysql PRIMARY 1 db A #CARD# NULL NULL BTREE def mysql event 0 mysql PRIMARY 2 name A #CARD# NULL NULL BTREE def mysql func 0 mysql PRIMARY 1 name A #CARD# NULL NULL BTREE +def mysql gtid_slave_pos 0 mysql PRIMARY 1 domain_id A #CARD# NULL NULL BTREE +def mysql gtid_slave_pos 0 mysql PRIMARY 2 sub_id A #CARD# NULL NULL BTREE def mysql help_category 0 mysql name 1 name A #CARD# NULL NULL BTREE def mysql help_category 0 mysql PRIMARY 1 help_category_id A #CARD# NULL NULL BTREE def mysql help_keyword 0 mysql name 1 name A #CARD# NULL NULL BTREE @@ -121,8 +123,6 @@ def mysql proxies_priv 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE def mysql proxies_priv 0 mysql PRIMARY 2 User A #CARD# NULL NULL BTREE def mysql proxies_priv 0 mysql PRIMARY 3 Proxied_host A #CARD# NULL NULL BTREE def mysql proxies_priv 0 mysql PRIMARY 4 Proxied_user A #CARD# NULL NULL BTREE -def mysql rpl_slave_state 0 mysql PRIMARY 1 domain_id A #CARD# NULL NULL BTREE -def mysql rpl_slave_state 0 mysql PRIMARY 2 sub_id A #CARD# NULL NULL BTREE def mysql servers 0 mysql PRIMARY 1 Server_name A #CARD# NULL NULL BTREE def mysql tables_priv 1 mysql Grantor 1 Grantor A #CARD# NULL NULL BTREE def mysql tables_priv 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE diff --git a/mysql-test/suite/funcs_1/r/is_table_constraints.result b/mysql-test/suite/funcs_1/r/is_table_constraints.result index 67ab8bc5e25..b158c4863df 100644 --- a/mysql-test/suite/funcs_1/r/is_table_constraints.result +++ b/mysql-test/suite/funcs_1/r/is_table_constraints.result @@ -62,6 +62,7 @@ def mysql PRIMARY mysql columns_priv def mysql PRIMARY mysql db def mysql PRIMARY mysql event def mysql PRIMARY mysql func +def mysql PRIMARY mysql gtid_slave_pos def mysql PRIMARY mysql help_category def mysql name mysql help_category def mysql PRIMARY mysql help_keyword @@ -76,7 +77,6 @@ def mysql PRIMARY mysql plugin def mysql PRIMARY mysql proc def mysql PRIMARY mysql procs_priv def mysql PRIMARY mysql proxies_priv -def mysql PRIMARY mysql rpl_slave_state def mysql PRIMARY mysql servers def mysql PRIMARY mysql table_stats def mysql PRIMARY mysql tables_priv diff --git a/mysql-test/suite/funcs_1/r/is_table_constraints_mysql.result b/mysql-test/suite/funcs_1/r/is_table_constraints_mysql.result index 37a3465dc72..e9862caba3a 100644 --- a/mysql-test/suite/funcs_1/r/is_table_constraints_mysql.result +++ b/mysql-test/suite/funcs_1/r/is_table_constraints_mysql.result @@ -12,6 +12,7 @@ def mysql PRIMARY mysql column_stats PRIMARY KEY def mysql PRIMARY mysql db PRIMARY KEY def mysql PRIMARY mysql event PRIMARY KEY def mysql PRIMARY mysql func PRIMARY KEY +def mysql PRIMARY mysql gtid_slave_pos PRIMARY KEY def mysql name mysql help_category UNIQUE def mysql PRIMARY mysql help_category PRIMARY KEY def mysql name mysql help_keyword UNIQUE @@ -26,7 +27,6 @@ def mysql PRIMARY mysql plugin PRIMARY KEY def mysql PRIMARY mysql proc PRIMARY KEY def mysql PRIMARY mysql procs_priv PRIMARY KEY def mysql PRIMARY mysql proxies_priv PRIMARY KEY -def mysql PRIMARY mysql rpl_slave_state PRIMARY KEY def mysql PRIMARY mysql servers PRIMARY KEY def mysql PRIMARY mysql tables_priv PRIMARY KEY def mysql PRIMARY mysql table_stats PRIMARY KEY diff --git a/mysql-test/suite/funcs_1/r/is_table_constraints_mysql_embedded.result b/mysql-test/suite/funcs_1/r/is_table_constraints_mysql_embedded.result index 453a6e9bd1a..add26d13224 100644 --- a/mysql-test/suite/funcs_1/r/is_table_constraints_mysql_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_table_constraints_mysql_embedded.result @@ -12,6 +12,7 @@ def mysql PRIMARY mysql column_stats PRIMARY KEY def mysql PRIMARY mysql db PRIMARY KEY def mysql PRIMARY mysql event PRIMARY KEY def mysql PRIMARY mysql func PRIMARY KEY +def mysql PRIMARY mysql gtid_slave_pos PRIMARY KEY def mysql name mysql help_category UNIQUE def mysql PRIMARY mysql help_category PRIMARY KEY def mysql name mysql help_keyword UNIQUE @@ -26,7 +27,6 @@ def mysql PRIMARY mysql plugin PRIMARY KEY def mysql PRIMARY mysql proc PRIMARY KEY def mysql PRIMARY mysql procs_priv PRIMARY KEY def mysql PRIMARY mysql proxies_priv PRIMARY KEY -def mysql PRIMARY mysql rpl_slave_state PRIMARY KEY def mysql PRIMARY mysql servers PRIMARY KEY def mysql PRIMARY mysql tables_priv PRIMARY KEY def mysql PRIMARY mysql table_stats PRIMARY KEY @@ -46,6 +46,7 @@ def mysql PRIMARY mysql column_stats PRIMARY KEY def mysql PRIMARY mysql db PRIMARY KEY def mysql PRIMARY mysql event PRIMARY KEY def mysql PRIMARY mysql func PRIMARY KEY +def mysql PRIMARY mysql gtid_slave_pos PRIMARY KEY def mysql name mysql help_category UNIQUE def mysql PRIMARY mysql help_category PRIMARY KEY def mysql name mysql help_keyword UNIQUE @@ -60,7 +61,6 @@ def mysql PRIMARY mysql plugin PRIMARY KEY def mysql PRIMARY mysql proc PRIMARY KEY def mysql PRIMARY mysql procs_priv PRIMARY KEY def mysql PRIMARY mysql proxies_priv PRIMARY KEY -def mysql PRIMARY mysql rpl_slave_state PRIMARY KEY def mysql PRIMARY mysql servers PRIMARY KEY def mysql PRIMARY mysql tables_priv PRIMARY KEY def mysql PRIMARY mysql table_stats PRIMARY KEY diff --git a/mysql-test/suite/funcs_1/r/is_tables_mysql.result b/mysql-test/suite/funcs_1/r/is_tables_mysql.result index c486ff070cd..d6d3d4f629e 100644 --- a/mysql-test/suite/funcs_1/r/is_tables_mysql.result +++ b/mysql-test/suite/funcs_1/r/is_tables_mysql.result @@ -152,6 +152,29 @@ user_comment General log Separator ----------------------------------------------------- TABLE_CATALOG def TABLE_SCHEMA mysql +TABLE_NAME gtid_slave_pos +TABLE_TYPE BASE TABLE +ENGINE MYISAM_OR_MARIA +VERSION 10 +ROW_FORMAT Fixed +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION latin1_swedish_ci +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment Replication slave GTID state +Separator ----------------------------------------------------- +TABLE_CATALOG def +TABLE_SCHEMA mysql TABLE_NAME help_category TABLE_TYPE BASE TABLE ENGINE MYISAM_OR_MARIA @@ -405,29 +428,6 @@ user_comment User proxy privileges Separator ----------------------------------------------------- TABLE_CATALOG def TABLE_SCHEMA mysql -TABLE_NAME rpl_slave_state -TABLE_TYPE BASE TABLE -ENGINE MYISAM_OR_MARIA -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment Replication slave GTID state -Separator ----------------------------------------------------- -TABLE_CATALOG def -TABLE_SCHEMA mysql TABLE_NAME servers TABLE_TYPE BASE TABLE ENGINE MYISAM_OR_MARIA diff --git a/mysql-test/suite/funcs_1/r/is_tables_mysql_embedded.result b/mysql-test/suite/funcs_1/r/is_tables_mysql_embedded.result index 2f9083aeb63..504be66a597 100644 --- a/mysql-test/suite/funcs_1/r/is_tables_mysql_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_tables_mysql_embedded.result @@ -152,6 +152,29 @@ user_comment General log Separator ----------------------------------------------------- TABLE_CATALOG def TABLE_SCHEMA mysql +TABLE_NAME gtid_slave_pos +TABLE_TYPE BASE TABLE +ENGINE MYISAM_OR_MARIA +VERSION 10 +ROW_FORMAT Fixed +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION latin1_swedish_ci +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment Replication slave GTID state +Separator ----------------------------------------------------- +TABLE_CATALOG def +TABLE_SCHEMA mysql TABLE_NAME help_category TABLE_TYPE BASE TABLE ENGINE MYISAM_OR_MARIA @@ -405,29 +428,6 @@ user_comment User proxy privileges Separator ----------------------------------------------------- TABLE_CATALOG def TABLE_SCHEMA mysql -TABLE_NAME rpl_slave_state -TABLE_TYPE BASE TABLE -ENGINE MYISAM_OR_MARIA -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment Replication slave GTID state -Separator ----------------------------------------------------- -TABLE_CATALOG def -TABLE_SCHEMA mysql TABLE_NAME servers TABLE_TYPE BASE TABLE ENGINE MYISAM_OR_MARIA @@ -812,6 +812,29 @@ user_comment General log Separator ----------------------------------------------------- TABLE_CATALOG def TABLE_SCHEMA mysql +TABLE_NAME gtid_slave_pos +TABLE_TYPE BASE TABLE +ENGINE MYISAM_OR_MARIA +VERSION 10 +ROW_FORMAT Fixed +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION latin1_swedish_ci +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +user_comment Replication slave GTID state +Separator ----------------------------------------------------- +TABLE_CATALOG def +TABLE_SCHEMA mysql TABLE_NAME help_category TABLE_TYPE BASE TABLE ENGINE MYISAM_OR_MARIA @@ -1065,29 +1088,6 @@ user_comment User proxy privileges Separator ----------------------------------------------------- TABLE_CATALOG def TABLE_SCHEMA mysql -TABLE_NAME rpl_slave_state -TABLE_TYPE BASE TABLE -ENGINE MYISAM_OR_MARIA -VERSION 10 -ROW_FORMAT Fixed -TABLE_ROWS #TBLR# -AVG_ROW_LENGTH #ARL# -DATA_LENGTH #DL# -MAX_DATA_LENGTH #MDL# -INDEX_LENGTH #IL# -DATA_FREE #DF# -AUTO_INCREMENT NULL -CREATE_TIME #CRT# -UPDATE_TIME #UT# -CHECK_TIME #CT# -TABLE_COLLATION latin1_swedish_ci -CHECKSUM NULL -CREATE_OPTIONS #CO# -TABLE_COMMENT #TC# -user_comment Replication slave GTID state -Separator ----------------------------------------------------- -TABLE_CATALOG def -TABLE_SCHEMA mysql TABLE_NAME servers TABLE_TYPE BASE TABLE ENGINE MYISAM_OR_MARIA diff --git a/mysql-test/suite/multi_source/gtid.result b/mysql-test/suite/multi_source/gtid.result index 2aeec5835f7..651b9873369 100644 --- a/mysql-test/suite/multi_source/gtid.result +++ b/mysql-test/suite/multi_source/gtid.result @@ -69,13 +69,13 @@ Last_SQL_Errno 0 Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id 3 -Using_Gtid 0 +Using_Gtid No Retried_transactions 0 Max_relay_log_size 1073741824 Executed_log_entries 25 Slave_received_heartbeats 0 Slave_heartbeat_period 60.000 -Gtid_Pos 1-1-4,2-2-3 +Gtid_Slave_Pos 1-1-4,2-2-3 *** Now move slave2 to replicate from both master1 and master2 instead of just slave1 *** STOP ALL SLAVES; Warnings: @@ -84,8 +84,8 @@ INSERT INTO t1 VALUES (2, "switch1"); INSERT INTO t3 VALUES (102, "switch1 a"); INSERT INTO t2 VALUES (2, "switch1"); INSERT INTO t3 VALUES (202, "switch1 b"); -CHANGE MASTER 'slave1' TO master_port=MYPORT_1, master_host='127.0.0.1', master_user='root', master_use_gtid=1; -CHANGE MASTER 'slave2' TO master_port=MYPORT_2, master_host='127.0.0.1', master_user='root', master_use_gtid=1; +CHANGE MASTER 'slave1' TO master_port=MYPORT_1, master_host='127.0.0.1', master_user='root', master_use_gtid=current_pos; +CHANGE MASTER 'slave2' TO master_port=MYPORT_2, master_host='127.0.0.1', master_user='root', master_use_gtid=current_pos; SET default_master_connection = 'slave1'; START SLAVE; include/wait_for_slave_to_start.inc @@ -102,7 +102,7 @@ INSERT INTO t3 VALUES (203, "switch 2 b"); STOP SLAVE 'slave2'; INSERT INTO t2 VALUES (4, "switch 3"); INSERT INTO t3 VALUES (204, "switch 3 b"); -CHANGE MASTER TO master_port=MYPORT_4, master_host='127.0.0.1', master_user='root', master_use_gtid=1; +CHANGE MASTER TO master_port=MYPORT_4, master_host='127.0.0.1', master_user='root', master_use_gtid=current_pos; START SLAVE; SELECT * FROM t1 ORDER BY a; a b diff --git a/mysql-test/suite/multi_source/gtid.test b/mysql-test/suite/multi_source/gtid.test index d6b84fb7f3e..0ab486b1f41 100644 --- a/mysql-test/suite/multi_source/gtid.test +++ b/mysql-test/suite/multi_source/gtid.test @@ -75,9 +75,9 @@ INSERT INTO t3 VALUES (202, "switch1 b"); --connection slave2 --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', master_use_gtid=1; +eval CHANGE MASTER 'slave1' TO master_port=$SERVER_MYPORT_1, master_host='127.0.0.1', master_user='root', master_use_gtid=current_pos; --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', master_use_gtid=1; +eval CHANGE MASTER 'slave2' TO master_port=$SERVER_MYPORT_2, master_host='127.0.0.1', master_user='root', master_use_gtid=current_pos; SET default_master_connection = 'slave1'; START SLAVE; --source include/wait_for_slave_to_start.inc @@ -118,7 +118,7 @@ INSERT INTO t3 VALUES (204, "switch 3 b"); --connection slave1 --replace_result $SERVER_MYPORT_4 MYPORT_4 -eval CHANGE MASTER TO master_port=$SERVER_MYPORT_4, master_host='127.0.0.1', master_user='root', master_use_gtid=1; +eval CHANGE MASTER TO master_port=$SERVER_MYPORT_4, master_host='127.0.0.1', master_user='root', master_use_gtid=current_pos; START SLAVE; --let $wait_condition= SELECT (SELECT COUNT(*) FROM t1)=3 AND (SELECT COUNT(*) FROM t2)=4 AND (SELECT COUNT(*) FROM t3)=7 --source include/wait_condition.inc diff --git a/mysql-test/suite/multi_source/info_logs.result b/mysql-test/suite/multi_source/info_logs.result index b5b887b0626..d2144cb8a1b 100644 --- a/mysql-test/suite/multi_source/info_logs.result +++ b/mysql-test/suite/multi_source/info_logs.result @@ -84,17 +84,17 @@ MASTER 2.2 # EOF # show all slaves status; -Connection_name Slave_SQL_State 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 Using_Gtid Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Pos - Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 311 relay.000002 599 master-bin.000001 Yes Yes 0 0 311 886 None 0 No 0 No 0 0 1 0 0 1073741824 7 0 60.000 -MASTER 2.2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 311 relay-master@00202@002e2.000002 599 master-bin.000001 Yes Yes 0 0 311 905 None 0 No 0 No 0 0 2 0 0 1073741824 7 0 60.000 +Connection_name Slave_SQL_State 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 Using_Gtid Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos + Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 311 relay.000002 599 master-bin.000001 Yes Yes 0 0 311 886 None 0 No 0 No 0 0 1 No 0 1073741824 7 0 60.000 +MASTER 2.2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 311 relay-master@00202@002e2.000002 599 master-bin.000001 Yes Yes 0 0 311 905 None 0 No 0 No 0 0 2 No 0 1073741824 7 0 60.000 include/wait_for_slave_to_start.inc set default_master_connection = 'MASTER 2.2'; include/wait_for_slave_to_start.inc set default_master_connection = ''; show all slaves status; -Connection_name Slave_SQL_State 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 Using_Gtid Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Pos - Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 311 relay.000004 536 master-bin.000001 Yes Yes 0 0 311 823 None 0 No 0 No 0 0 1 0 0 1073741824 6 0 60.000 -MASTER 2.2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 311 relay-master@00202@002e2.000004 536 master-bin.000001 Yes Yes 0 0 311 842 None 0 No 0 No 0 0 2 0 0 1073741824 6 0 60.000 +Connection_name Slave_SQL_State 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 Using_Gtid Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos + Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 311 relay.000004 536 master-bin.000001 Yes Yes 0 0 311 823 None 0 No 0 No 0 0 1 No 0 1073741824 6 0 60.000 +MASTER 2.2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 311 relay-master@00202@002e2.000004 536 master-bin.000001 Yes Yes 0 0 311 842 None 0 No 0 No 0 0 2 No 0 1073741824 6 0 60.000 # # List of files matching '*info*' pattern # after slave server restart diff --git a/mysql-test/suite/multi_source/multisource.result b/mysql-test/suite/multi_source/multisource.result index 6aa90109d4e..dfa3b1e1bed 100644 --- a/mysql-test/suite/multi_source/multisource.result +++ b/mysql-test/suite/multi_source/multisource.result @@ -11,13 +11,13 @@ set default_master_connection = 'master1'; include/wait_for_slave_to_start.inc show slave 'master1' 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 Using_Gtid -Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 311 mysqld-relay-bin-master1.000002 599 master-bin.000001 Yes Yes 0 0 311 905 None 0 No 0 No 0 0 1 0 +Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 311 mysqld-relay-bin-master1.000002 599 master-bin.000001 Yes Yes 0 0 311 905 None 0 No 0 No 0 0 1 No 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 Using_Gtid -Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 311 mysqld-relay-bin-master1.000002 599 master-bin.000001 Yes Yes 0 0 311 905 None 0 No 0 No 0 0 1 0 +Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 311 mysqld-relay-bin-master1.000002 599 master-bin.000001 Yes Yes 0 0 311 905 None 0 No 0 No 0 0 1 No show all slaves status; -Connection_name Slave_SQL_State 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 Using_Gtid Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Pos -master1 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 311 mysqld-relay-bin-master1.000002 599 master-bin.000001 Yes Yes 0 0 311 905 None 0 No 0 No 0 0 1 0 0 1073741824 7 0 60.000 +Connection_name Slave_SQL_State 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 Using_Gtid Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos +master1 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 311 mysqld-relay-bin-master1.000002 599 master-bin.000001 Yes Yes 0 0 311 905 None 0 No 0 No 0 0 1 No 0 1073741824 7 0 60.000 drop database if exists db1; create database db1; use db1; @@ -75,9 +75,9 @@ master_user='root'; start slave; include/wait_for_slave_to_start.inc show all slaves status; -Connection_name Slave_SQL_State 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 Using_Gtid Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Pos - Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 311 mysqld-relay-bin.000002 599 master-bin.000001 Yes Yes 0 0 311 897 None 0 No 0 No 0 0 2 0 0 1073741824 7 0 60.000 0-1-4 -master1 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 986 mysqld-relay-bin-master1.000002 1274 master-bin.000001 Yes Yes 0 0 986 1580 None 0 No 0 No 0 0 1 0 0 1073741824 17 0 60.000 0-1-4 +Connection_name Slave_SQL_State 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 Using_Gtid Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos + Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 311 mysqld-relay-bin.000002 599 master-bin.000001 Yes Yes 0 0 311 897 None 0 No 0 No 0 0 2 No 0 1073741824 7 0 60.000 0-1-4 +master1 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 986 mysqld-relay-bin-master1.000002 1274 master-bin.000001 Yes Yes 0 0 986 1580 None 0 No 0 No 0 0 1 No 0 1073741824 17 0 60.000 0-1-4 insert into t1 (f1) values ('three'); drop database if exists db2; create database db2; @@ -105,9 +105,9 @@ master-bin.000002 367 insert into t1 (f1) values ('four'); create table db1.t3 (f1 int) engine=InnoDB; show all slaves status; -Connection_name Slave_SQL_State 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 Using_Gtid Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Pos - Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 919 mysqld-relay-bin.000002 1207 master-bin.000001 Yes Yes 0 0 919 1505 None 0 No 0 No 0 0 2 0 0 1073741824 17 0 60.000 0-1-7 -master1 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000002 740 mysqld-relay-bin-master1.000004 1028 master-bin.000002 Yes Yes 0 0 740 1378 None 0 No 0 No 0 0 1 0 0 1073741824 37 0 60.000 0-1-7 +Connection_name Slave_SQL_State 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 Using_Gtid Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos + Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 919 mysqld-relay-bin.000002 1207 master-bin.000001 Yes Yes 0 0 919 1505 None 0 No 0 No 0 0 2 No 0 1073741824 17 0 60.000 0-1-7 +master1 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000002 740 mysqld-relay-bin-master1.000004 1028 master-bin.000002 Yes Yes 0 0 740 1378 None 0 No 0 No 0 0 1 No 0 1073741824 37 0 60.000 0-1-7 select * from db1.t1; i f1 1 one diff --git a/mysql-test/suite/multi_source/reset_master_slave.inc b/mysql-test/suite/multi_source/reset_master_slave.inc index 2678602291f..375f1678ab3 100644 --- a/mysql-test/suite/multi_source/reset_master_slave.inc +++ b/mysql-test/suite/multi_source/reset_master_slave.inc @@ -23,7 +23,7 @@ while ($con_name != 'No such row') --error 0,ER_FLUSH_MASTER_BINLOG_CLOSED reset master; -set global gtid_pos=''; +set global gtid_slave_pos=''; eval set default_master_connection = '$default_master'; --source include/end_include_file.inc diff --git a/mysql-test/suite/multi_source/reset_slave.result b/mysql-test/suite/multi_source/reset_slave.result index 7d2152a43f2..88bc934afaf 100644 --- a/mysql-test/suite/multi_source/reset_slave.result +++ b/mysql-test/suite/multi_source/reset_slave.result @@ -11,14 +11,14 @@ insert into t1 values (1),(2); stop slave 'master1'; show slave 'master1' 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 Using_Gtid - 127.0.0.1 root MYPORT_1 60 master-bin.000001 800 mysqld-relay-bin-master1.000002 1088 master-bin.000001 No No 0 0 800 1394 None 0 No NULL No 0 0 1 0 + 127.0.0.1 root MYPORT_1 60 master-bin.000001 800 mysqld-relay-bin-master1.000002 1088 master-bin.000001 No No 0 0 800 1394 None 0 No NULL No 0 0 1 No mysqld-relay-bin-master1.000001 mysqld-relay-bin-master1.000002 mysqld-relay-bin-master1.index reset slave 'master1'; show slave 'master1' 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 Using_Gtid - 127.0.0.1 root MYPORT_1 60 4 1088 No No 0 0 0 1394 None 0 No NULL No 0 0 1 0 + 127.0.0.1 root MYPORT_1 60 4 1088 No No 0 0 0 1394 None 0 No NULL No 0 0 1 No reset slave 'master1' all; show slave 'master1' status; ERROR HY000: There is no master connection 'master1' diff --git a/mysql-test/suite/multi_source/simple.result b/mysql-test/suite/multi_source/simple.result index fa738fbf712..525aaa4b0cc 100644 --- a/mysql-test/suite/multi_source/simple.result +++ b/mysql-test/suite/multi_source/simple.result @@ -10,9 +10,9 @@ Note 1937 SLAVE 'slave2' started include/wait_for_slave_to_start.inc set default_master_connection = ''; show all slaves status; -Connection_name Slave_SQL_State 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 Using_Gtid Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Pos -slave1 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 311 mysqld-relay-bin-slave1.000002 599 master-bin.000001 Yes Yes 0 0 311 904 None 0 No 0 No 0 0 1 0 0 1073741824 7 0 60.000 -slave2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 311 mysqld-relay-bin-slave2.000002 599 master-bin.000001 Yes Yes 0 0 311 904 None 0 No 0 No 0 0 2 0 0 1073741824 7 0 60.000 +Connection_name Slave_SQL_State 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 Using_Gtid Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos +slave1 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 311 mysqld-relay-bin-slave1.000002 599 master-bin.000001 Yes Yes 0 0 311 904 None 0 No 0 No 0 0 1 No 0 1073741824 7 0 60.000 +slave2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 311 mysqld-relay-bin-slave2.000002 599 master-bin.000001 Yes Yes 0 0 311 904 None 0 No 0 No 0 0 2 No 0 1073741824 7 0 60.000 start all slaves; stop slave 'slave1'; show slave 'slave1' status; @@ -56,22 +56,22 @@ Last_SQL_Errno 0 Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id 1 -Using_Gtid 0 +Using_Gtid No reset slave 'slave1'; show all slaves status; -Connection_name Slave_SQL_State 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 Using_Gtid Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Pos -slave1 127.0.0.1 root MYPORT_1 60 4 599 No No 0 0 0 904 None 0 No NULL No 0 0 1 0 0 1073741824 7 0 60.000 -slave2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 311 mysqld-relay-bin-slave2.000002 599 master-bin.000001 Yes Yes 0 0 311 904 None 0 No 0 No 0 0 2 0 0 1073741824 7 0 60.000 +Connection_name Slave_SQL_State 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 Using_Gtid Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos +slave1 127.0.0.1 root MYPORT_1 60 4 599 No No 0 0 0 904 None 0 No NULL No 0 0 1 No 0 1073741824 7 0 60.000 +slave2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 311 mysqld-relay-bin-slave2.000002 599 master-bin.000001 Yes Yes 0 0 311 904 None 0 No 0 No 0 0 2 No 0 1073741824 7 0 60.000 reset slave 'slave1' all; show all slaves status; -Connection_name Slave_SQL_State 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 Using_Gtid Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Pos -slave2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 311 mysqld-relay-bin-slave2.000002 599 master-bin.000001 Yes Yes 0 0 311 904 None 0 No 0 No 0 0 2 0 0 1073741824 7 0 60.000 +Connection_name Slave_SQL_State 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 Using_Gtid Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos +slave2 Slave has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 311 mysqld-relay-bin-slave2.000002 599 master-bin.000001 Yes Yes 0 0 311 904 None 0 No 0 No 0 0 2 No 0 1073741824 7 0 60.000 stop all slaves; Warnings: Note 1938 SLAVE 'slave2' stopped show all slaves status; -Connection_name Slave_SQL_State 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 Using_Gtid Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Pos -slave2 127.0.0.1 root MYPORT_2 60 master-bin.000001 311 mysqld-relay-bin-slave2.000002 599 master-bin.000001 No No 0 0 311 904 None 0 No NULL No 0 0 2 0 0 1073741824 7 0 60.000 +Connection_name Slave_SQL_State 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 Using_Gtid Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos +slave2 127.0.0.1 root MYPORT_2 60 master-bin.000001 311 mysqld-relay-bin-slave2.000002 599 master-bin.000001 No No 0 0 311 904 None 0 No NULL No 0 0 2 No 0 1073741824 7 0 60.000 stop all slaves; include/reset_master_slave.inc include/reset_master_slave.inc diff --git a/mysql-test/suite/multi_source/syntax.result b/mysql-test/suite/multi_source/syntax.result index 000fcad1283..2b63db714ef 100644 --- a/mysql-test/suite/multi_source/syntax.result +++ b/mysql-test/suite/multi_source/syntax.result @@ -5,7 +5,7 @@ Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File 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 Using_Gtid show all slaves status; -Connection_name Slave_SQL_State 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 Using_Gtid Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Pos +Connection_name Slave_SQL_State 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 Using_Gtid Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos # # Check error handling # diff --git a/mysql-test/suite/rpl/r/rpl_gtid_basic.result b/mysql-test/suite/rpl/r/rpl_gtid_basic.result index b1e53a4a0b5..f98a3bf322d 100644 --- a/mysql-test/suite/rpl/r/rpl_gtid_basic.result +++ b/mysql-test/suite/rpl/r/rpl_gtid_basic.result @@ -49,7 +49,7 @@ include/stop_slave.inc INSERT INTO t1 VALUES (5, "m1a"); INSERT INTO t2 VALUES (5, "i1a"); CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT, -MASTER_USE_GTID=1; +MASTER_USE_GTID=CURRENT_POS; include/start_slave.inc SELECT * FROM t1 ORDER BY a; a b @@ -68,7 +68,7 @@ a b *** Now move B to D (C is still replicating from B) *** include/stop_slave.inc CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_4, -MASTER_USE_GTID=1; +MASTER_USE_GTID=CURRENT_POS; include/start_slave.inc UPDATE t2 SET b="j1a" WHERE a=5; SELECT * FROM t1 ORDER BY a; @@ -92,7 +92,7 @@ INSERT INTO t2 VALUES (6, "i6b"); INSERT INTO t2 VALUES (7, "i7b"); COMMIT; CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_4, -MASTER_USE_GTID=1; +MASTER_USE_GTID=CURRENT_POS; include/start_slave.inc SELECT * FROM t2 ORDER BY a; a b diff --git a/mysql-test/suite/rpl/r/rpl_gtid_crash.result b/mysql-test/suite/rpl/r/rpl_gtid_crash.result index b4c2056f45a..ccc64b70803 100644 --- a/mysql-test/suite/rpl/r/rpl_gtid_crash.result +++ b/mysql-test/suite/rpl/r/rpl_gtid_crash.result @@ -3,12 +3,12 @@ include/rpl_init.inc [topology=1->2] call mtr.add_suppression("Checking table:"); call mtr.add_suppression("client is using or hasn't closed the table properly"); call mtr.add_suppression("Table .* is marked as crashed and should be repaired"); -ALTER TABLE mysql.rpl_slave_state ENGINE=InnoDB; +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; INSERT INTO t1 VALUES (1, 0); include/stop_slave.inc CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT, -MASTER_USE_GTID=1; +MASTER_USE_GTID=CURRENT_POS; INSERT INTO t1 VALUES (2,1); INSERT INTO t1 VALUES (3,1); include/start_slave.inc @@ -20,7 +20,7 @@ DROP TABLE t1; *** Test crashing the master mysqld and check that binlog state is recovered. *** include/stop_slave.inc RESET MASTER; -SET GLOBAL gtid_pos=''; +SET GLOBAL gtid_slave_pos=''; RESET MASTER; SHOW BINLOG EVENTS IN 'master-bin.000001' LIMIT 1,1; Log_name Pos Event_type Server_id End_log_pos Info diff --git a/mysql-test/suite/rpl/r/rpl_gtid_errorhandling.result b/mysql-test/suite/rpl/r/rpl_gtid_errorhandling.result index 0882f8e1872..fe69c83615e 100644 --- a/mysql-test/suite/rpl/r/rpl_gtid_errorhandling.result +++ b/mysql-test/suite/rpl/r/rpl_gtid_errorhandling.result @@ -1,30 +1,30 @@ include/master-slave.inc [connection master] -*** Test that we check against incorrect table definition for mysql.rpl_slave_state *** +*** Test that we check against incorrect table definition for mysql.gtid_slave_pos *** CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB; include/stop_slave.inc -ALTER TABLE mysql.rpl_slave_state CHANGE seq_no seq_no VARCHAR(20); +ALTER TABLE mysql.gtid_slave_pos CHANGE seq_no seq_no VARCHAR(20); START SLAVE; INSERT INTO t1 VALUES (1); -CALL mtr.add_suppression("Slave: Failed to open mysql.rpl_slave_state"); +CALL mtr.add_suppression("Slave: Failed to open mysql.gtid_slave_pos"); include/wait_for_slave_sql_error.inc [errno=1942] include/stop_slave.inc -ALTER TABLE mysql.rpl_slave_state CHANGE seq_no seq_no BIGINT UNSIGNED NOT NULL; -ALTER TABLE mysql.rpl_slave_state DROP PRIMARY KEY; -ALTER TABLE mysql.rpl_slave_state ADD PRIMARY KEY (sub_id, domain_id); +ALTER TABLE mysql.gtid_slave_pos CHANGE seq_no seq_no BIGINT UNSIGNED NOT NULL; +ALTER TABLE mysql.gtid_slave_pos DROP PRIMARY KEY; +ALTER TABLE mysql.gtid_slave_pos ADD PRIMARY KEY (sub_id, domain_id); START SLAVE; include/wait_for_slave_sql_error.inc [errno=1942] include/stop_slave.inc -ALTER TABLE mysql.rpl_slave_state DROP PRIMARY KEY; +ALTER TABLE mysql.gtid_slave_pos DROP PRIMARY KEY; START SLAVE; include/wait_for_slave_sql_error.inc [errno=1942] include/stop_slave.inc -ALTER TABLE mysql.rpl_slave_state ADD PRIMARY KEY (sub_id); +ALTER TABLE mysql.gtid_slave_pos ADD PRIMARY KEY (sub_id); START SLAVE; include/wait_for_slave_sql_error.inc [errno=1942] include/stop_slave.inc -ALTER TABLE mysql.rpl_slave_state DROP PRIMARY KEY; -ALTER TABLE mysql.rpl_slave_state ADD PRIMARY KEY (domain_id, sub_id); +ALTER TABLE mysql.gtid_slave_pos DROP PRIMARY KEY; +ALTER TABLE mysql.gtid_slave_pos ADD PRIMARY KEY (domain_id, sub_id); include/start_slave.inc SELECT * FROM t1; a @@ -38,13 +38,22 @@ SET sql_log_bin = 0; INSERT INTO t1 VALUES (2); SET sql_log_bin = 1; INSERT INTO t1 VALUES (3); -CHANGE MASTER TO master_use_gtid=1; -SET GLOBAL gtid_pos = "0-1-1"; -ERROR HY000: Requested GTID_POS 0-1-1 conflicts with the binary log which contains a more recent GTID 0-2-11. To use the requested GTID_POS, the old binlog must be removed with RESET MASTER to avoid out-of-order binlog -SET GLOBAL gtid_pos = ""; -ERROR HY000: Requested GTID_POS contains no value for replication domain 0. This conflicts with the binary log which contains GTID 0-2-11. To use the requested GTID_POS, the old binlog must be removed with RESET MASTER to avoid out-of-order binlog +CHANGE MASTER TO master_use_gtid=current_pos; +BEGIN; +SET GLOBAL gtid_slave_pos = "100-100-100"; +ERROR 25000: You are not allowed to execute this command in a transaction +INSERT INTO t1 VALUES (100); +SET GLOBAL gtid_slave_pos = "100-100-100"; +ERROR 25000: You are not allowed to execute this command in a transaction +ROLLBACK; +SET GLOBAL gtid_slave_pos = "0-1-1"; +Warnings: +Warning 1947 Specified GTID 0-1-1 conflicts with the binary log which contains a more recent GTID 0-2-11. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos. +SET GLOBAL gtid_slave_pos = ""; +Warnings: +Warning 1948 Specified value for @@gtid_slave_pos contains no value for replication domain 0. This conflicts with the binary log which contains GTID 0-2-11. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos. RESET MASTER; -SET GLOBAL gtid_pos = "0-1-1"; +SET GLOBAL gtid_slave_pos = "0-1-1"; START SLAVE; SELECT * FROM t1 ORDER BY a; a @@ -54,7 +63,7 @@ a 4 *** Test slave requesting a GTID that is not present in the master's binlog *** include/stop_slave.inc -SET GLOBAL gtid_pos = "0-1-3"; +SET GLOBAL gtid_slave_pos = "0-1-3"; START SLAVE; SET sql_log_bin=0; CALL mtr.add_suppression("Got fatal error .* from master when reading data from binary log: 'Error: connecting slave requested to start from GTID .*, which is not in the master's binlog'"); @@ -63,9 +72,9 @@ include/wait_for_slave_io_error.inc [errno=1236] Slave_IO_State = '' Last_IO_Errno = '1236' Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'Error: connecting slave requested to start from GTID 0-1-3, which is not in the master's binlog'' -Using_Gtid = '1' +Using_Gtid = 'Current_Pos' include/stop_slave.inc -SET GLOBAL gtid_pos = "0-1-2"; +SET GLOBAL gtid_slave_pos = "0-1-2"; START SLAVE; include/wait_for_slave_to_start.inc INSERT INTO t1 VALUES (5); diff --git a/mysql-test/suite/rpl/r/rpl_gtid_master_promote.result b/mysql-test/suite/rpl/r/rpl_gtid_master_promote.result index 1f600b2a536..0a55fe5a026 100644 --- a/mysql-test/suite/rpl/r/rpl_gtid_master_promote.result +++ b/mysql-test/suite/rpl/r/rpl_gtid_master_promote.result @@ -1,5 +1,5 @@ include/rpl_init.inc [topology=1->2, 1->3, 1->4, 1->5] -ALTER TABLE mysql.rpl_slave_state ENGINE=InnoDB; +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; CREATE TABLE t4 (a INT, b INT, PRIMARY KEY (a,b)) Engine=InnoDB; CREATE FUNCTION extract_gtid(d VARCHAR(100), s VARCHAR(100)) RETURNS VARCHAR(100) DETERMINISTIC @@ -10,13 +10,13 @@ SET s= SUBSTR(s FROM 1 FOR LOCATE(",", s) - 1); RETURN s; END| include/stop_slave.inc -CHANGE MASTER TO master_use_gtid=1; +CHANGE MASTER TO master_use_gtid=current_pos; include/stop_slave.inc -CHANGE MASTER TO master_use_gtid=1; +CHANGE MASTER TO master_use_gtid=current_pos; include/stop_slave.inc -CHANGE MASTER TO master_use_gtid=1; +CHANGE MASTER TO master_use_gtid=current_pos; include/stop_slave.inc -CHANGE MASTER TO master_use_gtid=1; +CHANGE MASTER TO master_use_gtid=current_pos; SET gtid_domain_id= 1; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; INSERT INTO t1 VALUES (1); @@ -310,7 +310,7 @@ a b 3 5 *** Now let the old master join up as slave. *** CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_2, -master_user = "root", master_use_gtid = 1; +master_user = "root", master_use_gtid = current_pos; include/start_slave.inc SELECT * FROM t1 ORDER BY a; a diff --git a/mysql-test/suite/rpl/r/rpl_gtid_mdev4473.result b/mysql-test/suite/rpl/r/rpl_gtid_mdev4473.result index 1289bbb7e20..f5baa3284f3 100644 --- a/mysql-test/suite/rpl/r/rpl_gtid_mdev4473.result +++ b/mysql-test/suite/rpl/r/rpl_gtid_mdev4473.result @@ -8,7 +8,7 @@ include/stop_slave.inc include/wait_for_slave_to_stop.inc reset slave all; CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_2, -master_user='root', MASTER_USE_GTID=1; +master_user='root', MASTER_USE_GTID=CURRENT_POS; include/start_slave.inc include/wait_for_slave_to_start.inc flush logs; @@ -16,7 +16,7 @@ insert into t1 values (3); insert into t1 values (4); flush logs; CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_2, -MASTER_USE_GTID=1; +MASTER_USE_GTID=CURRENT_POS; include/start_slave.inc select * from t1 order by n; n @@ -47,11 +47,11 @@ include/stop_slave.inc include/wait_for_slave_to_stop.inc reset slave all; CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_1, -master_user = 'root', MASTER_USE_GTID=1; +master_user = 'root', MASTER_USE_GTID=CURRENT_POS; include/start_slave.inc include/stop_slave.inc CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_1, -MASTER_USE_GTID=1; +MASTER_USE_GTID=CURRENT_POS; include/start_slave.inc drop table t1; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_gtid_mdev4474.result b/mysql-test/suite/rpl/r/rpl_gtid_mdev4474.result new file mode 100644 index 00000000000..37b5ac7ca9a --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_gtid_mdev4474.result @@ -0,0 +1,63 @@ +include/rpl_init.inc [topology=1->2->1] +# +# For now we'll only have 1->2 running +# +# Server 1 +# Stop replication 2->1 +include/stop_slave.inc +# +# Server 2 +# Use GTID for replication 1->2 +include/stop_slave.inc +change master to master_use_gtid=slave_pos; +include/start_slave.inc +# +# Create some 0-1-* and 0-2-* events in binlog of server 2 +connection server_1; +create table t1 (i int) engine=InnoDB; +insert into t1 values (1); +connection server_2; +create table t2 (i int) engine=InnoDB; +connection server_1; +insert into t1 values (2); +connection server_2; +insert into t2 values (1); +# +# All events are present in the binlog of server 2 +show binlog events from <binlog_start>; +Log_name Pos Event_type Server_id End_log_pos Info +slave-bin.000001 # Gtid # # GTID #-#-# +slave-bin.000001 # Query # # use `test`; create table t1 (i int) engine=InnoDB +slave-bin.000001 # Gtid # # BEGIN GTID #-#-# +slave-bin.000001 # Query # # use `test`; insert into t1 values (1) +slave-bin.000001 # Xid # # COMMIT /* XID */ +slave-bin.000001 # Gtid # # GTID #-#-# +slave-bin.000001 # Query # # use `test`; create table t2 (i int) engine=InnoDB +slave-bin.000001 # Gtid # # BEGIN GTID #-#-# +slave-bin.000001 # Query # # use `test`; insert into t1 values (2) +slave-bin.000001 # Xid # # COMMIT /* XID */ +slave-bin.000001 # Gtid # # BEGIN GTID #-#-# +slave-bin.000001 # Query # # use `test`; insert into t2 values (1) +slave-bin.000001 # Xid # # COMMIT /* XID */ +# +# Server 1 +# Start replication 2->1 using GTID, +change master to master_use_gtid=slave_pos; +include/start_slave.inc +select * from t1 order by i; +i +1 +2 +select * from t2 order by i; +i +1 +select * from t1 order by i; +i +1 +2 +select * from t2 order by i; +i +1 +drop table t1; +drop table t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_gtid_nobinlog.result b/mysql-test/suite/rpl/r/rpl_gtid_nobinlog.result index 265d0ca185c..bc7be2a30b7 100644 --- a/mysql-test/suite/rpl/r/rpl_gtid_nobinlog.result +++ b/mysql-test/suite/rpl/r/rpl_gtid_nobinlog.result @@ -24,7 +24,7 @@ slave-bin.000001 # Gtid # # BEGIN GTID #-#-# slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (4, 2) slave-bin.000001 # Query # # COMMIT CHANGE MASTER TO master_host = '127.0.0.1', master_port = SLAVE_PORT, -master_user = 'root', master_use_gtid = 1; +master_user = 'root', master_use_gtid = current_pos; START SLAVE; SELECT * FROM t1 ORDER BY a; a b @@ -37,7 +37,7 @@ RESET SLAVE; INSERT INTO t1 VALUES (5, 1); INSERT INTO t1 VALUES (6, 1); CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT, -master_use_gtid = 1; +master_use_gtid = current_pos; START SLAVE; SELECT * FROM t1 ORDER BY a; a b diff --git a/mysql-test/suite/rpl/r/rpl_gtid_startpos.result b/mysql-test/suite/rpl/r/rpl_gtid_startpos.result index 4530542f080..d226ffa68f7 100644 --- a/mysql-test/suite/rpl/r/rpl_gtid_startpos.result +++ b/mysql-test/suite/rpl/r/rpl_gtid_startpos.result @@ -6,9 +6,9 @@ RESET SLAVE; RESET MASTER; FLUSH LOGS; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; -SET GLOBAL gtid_pos=""; +SET GLOBAL gtid_slave_pos=""; CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT, -MASTER_USE_GTID=1; +MASTER_USE_GTID=CURRENT_POS; include/start_slave.inc SELECT * FROM t1; a @@ -24,9 +24,9 @@ include/wait_for_purge.inc "master-bin.000003" show binary logs; Log_name File_size master-bin.000003 # -SET GLOBAL gtid_pos=""; +SET GLOBAL gtid_slave_pos=""; CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT, -MASTER_USE_GTID=1; +MASTER_USE_GTID=CURRENT_POS; START SLAVE; include/wait_for_slave_io_error.inc [errno=1236] include/stop_slave.inc @@ -40,12 +40,12 @@ a SET sql_log_bin=0; call mtr.add_suppression('Could not find GTID state requested by slave in any binlog files'); SET sql_log_bin=1; -*** Test that we give error when explict @@gtid_pos=xxx that conflicts with what is in our binary log *** +*** Test that we give warning when explict @@gtid_slave_pos=xxx that conflicts with what is in our binary log *** include/stop_slave.inc INSERT INTO t1 VALUES(3); -SET GLOBAL gtid_pos='0-1-3'; +SET GLOBAL gtid_slave_pos='0-1-3'; CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT, -MASTER_USE_GTID=1; +MASTER_USE_GTID=CURRENT_POS; include/start_slave.inc SELECT * FROM t1 ORDER by a; a @@ -56,10 +56,11 @@ include/stop_slave.inc INSERT INTO t1 VALUES (4); INSERT INTO t1 VALUES (10); DELETE FROM t1 WHERE a=10; -SET GLOBAL gtid_pos='0-1-4'; -ERROR HY000: Requested GTID_POS 0-1-4 conflicts with the binary log which contains a more recent GTID 0-2-6. To use the requested GTID_POS, the old binlog must be removed with RESET MASTER to avoid out-of-order binlog +SET GLOBAL gtid_slave_pos='0-1-4'; +Warnings: +Warning 1947 Specified GTID 0-1-4 conflicts with the binary log which contains a more recent GTID 0-2-6. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos. RESET MASTER; -SET GLOBAL gtid_pos='0-1-4'; +SET GLOBAL gtid_slave_pos='0-1-4'; START SLAVE; SELECT * FROM t1 ORDER by a; a @@ -73,8 +74,8 @@ include/stop_slave.inc RESET SLAVE ALL; RESET MASTER; RESET MASTER; -SET GLOBAL gtid_pos=''; -CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=1; +SET GLOBAL gtid_slave_pos=''; +CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=current_pos; include/start_slave.inc CREATE TABLE t1 (a INT PRIMARY KEY); INSERT INTO t1 VALUES (1); @@ -89,14 +90,15 @@ SELECT * FROM t1 ORDER BY a; a 1 2 -*** MDEV-4329: GTID_POS='' is not checked for conflicts with binlog *** +*** MDEV-4329: GTID_SLAVE_POS='' is not checked for conflicts with binlog *** include/stop_slave.inc DROP TABLE t1; RESET SLAVE; -SET GLOBAL gtid_pos=""; -ERROR HY000: Requested GTID_POS contains no value for replication domain 0. This conflicts with the binary log which contains GTID 0-2-4. To use the requested GTID_POS, the old binlog must be removed with RESET MASTER to avoid out-of-order binlog +SET GLOBAL gtid_slave_pos=""; +Warnings: +Warning 1948 Specified value for @@gtid_slave_pos contains no value for replication domain 0. This conflicts with the binary log which contains GTID 0-2-4. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos. RESET MASTER; -SET GLOBAL gtid_pos=""; +SET GLOBAL gtid_slave_pos=""; include/start_slave.inc SELECT * FROM t1 ORDER BY a; a @@ -107,7 +109,7 @@ SET SQL_LOG_BIN=0; DROP TABLE t1; SET SQL_LOG_BIN=1; RESET SLAVE; -SET GLOBAL gtid_pos=""; +SET GLOBAL gtid_slave_pos=""; include/start_slave.inc SELECT * FROM t1 ORDER BY a; a @@ -116,11 +118,11 @@ a *** Test that RESET SLAVE clears the Using_Gtid flag. *** include/stop_slave.inc RESET SLAVE; -Using_Gtid = '0' +Using_Gtid = 'No' START SLAVE; include/wait_for_slave_sql_error.inc [errno=1050] STOP SLAVE IO_THREAD; -CHANGE MASTER TO MASTER_USE_GTID=1; +CHANGE MASTER TO MASTER_USE_GTID=CURRENT_POS; include/start_slave.inc INSERT INTO t1 VALUES(3); SELECT * FROM t1 ORDER BY a; @@ -154,7 +156,7 @@ a *** Test modifying binlog on slave and the effect on GTID state. *** include/stop_slave.inc RESET MASTER; -SET GLOBAL gtid_pos=""; +SET GLOBAL gtid_slave_pos=""; RESET MASTER; TRUNCATE TABLE t1; INSERT INTO t1 VALUES (10); @@ -162,28 +164,29 @@ include/start_slave.inc SELECT * FROM t1; a 10 -SELECT '1' AS Using_Gtid; +SELECT 'Current_Pos' AS Using_Gtid; Using_Gtid -1 -SELECT '0-1-2' AS Gtid_Pos; -Gtid_Pos +Current_Pos +SELECT '0-1-2' AS Gtid_Slave_Pos; +Gtid_Slave_Pos 0-1-2 UPDATE t1 SET a=9 WHERE a=10; UPDATE t1 SET a=10 WHERE a=9; -SELECT '0-2-4' AS Gtid_Pos; -Gtid_Pos +SELECT '0-2-4' AS Gtid_Slave_Pos; +Gtid_Slave_Pos 0-2-4 include/stop_slave.inc -SET GLOBAL gtid_pos='0-1-2'; -ERROR HY000: Requested GTID_POS 0-1-2 conflicts with the binary log which contains a more recent GTID 0-2-4. To use the requested GTID_POS, the old binlog must be removed with RESET MASTER to avoid out-of-order binlog +SET GLOBAL gtid_slave_pos='0-1-2'; +Warnings: +Warning 1947 Specified GTID 0-1-2 conflicts with the binary log which contains a more recent GTID 0-2-4. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos. RESET MASTER; -SELECT '0-1-2' AS Gtid_Pos; -Gtid_Pos +SELECT '0-1-2' AS Gtid_Slave_Pos; +Gtid_Slave_Pos 0-1-2 -SET GLOBAL gtid_pos='0-1-2'; +SET GLOBAL gtid_slave_pos='0-1-2'; include/start_slave.inc -SELECT '0-1-2' AS Gtid_Pos; -Gtid_Pos +SELECT '0-1-2' AS Gtid_Slave_Pos; +Gtid_Slave_Pos 0-1-2 DROP TABLE t1; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_gtid_stop_start.result b/mysql-test/suite/rpl/r/rpl_gtid_stop_start.result index 0bb963cc2ab..50a7195a288 100644 --- a/mysql-test/suite/rpl/r/rpl_gtid_stop_start.result +++ b/mysql-test/suite/rpl/r/rpl_gtid_stop_start.result @@ -4,8 +4,8 @@ CREATE TABLE t1 (a INT PRIMARY KEY); INSERT INTO t1 VALUES (1); include/stop_slave.inc Master_Log_File = 'master-bin.000001' -Using_Gtid = '0' -CHANGE MASTER TO master_use_gtid=1; +Using_Gtid = 'No' +CHANGE MASTER TO master_use_gtid=current_pos; FLUSH LOGS; include/wait_for_purge.inc "master-bin.000002" show binary logs; diff --git a/mysql-test/suite/rpl/r/rpl_gtid_until.result b/mysql-test/suite/rpl/r/rpl_gtid_until.result index 382da1b3844..44573a29794 100644 --- a/mysql-test/suite/rpl/r/rpl_gtid_until.result +++ b/mysql-test/suite/rpl/r/rpl_gtid_until.result @@ -1,5 +1,5 @@ include/rpl_init.inc [topology=1->2] -ALTER TABLE mysql.rpl_slave_state ENGINE=InnoDB; +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; CREATE FUNCTION extract_gtid(d VARCHAR(100), s VARCHAR(100)) RETURNS VARCHAR(100) DETERMINISTIC BEGIN @@ -21,7 +21,7 @@ ERROR HY000: Slave is already running include/stop_slave_io.inc START SLAVE UNTIL master_gtid_pos = ""; ERROR HY000: START SLAVE UNTIL master_gtid_pos requires that slave is using GTID -CHANGE MASTER TO master_use_gtid=1; +CHANGE MASTER TO master_use_gtid=current_pos; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; INSERT INTO t1 VALUES(1); INSERT INTO t1 VALUES(2); @@ -46,7 +46,7 @@ a include/stop_slave.inc START SLAVE UNTIL master_gtid_pos = "1-10-100,2-20-200"; include/wait_for_slave_to_start.inc -Using_Gtid = '1' +Using_Gtid = 'Current_Pos' Until_Condition = 'Gtid' include/stop_slave.inc include/start_slave.inc @@ -168,7 +168,7 @@ a include/stop_slave.inc CREATE TABLE t3 (a INT); DROP TABLE t3; -START SLAVE UNTIL master_gtid_pos='1-1-15,0-1-16,2-1-14'; +START SLAVE UNTIL master_gtid_pos='1-1-15,2-1-14,0-1-16'; include/wait_for_slave_to_stop.inc SHOW CREATE TABLE t3; Table Create Table @@ -180,7 +180,7 @@ include/start_slave.inc include/stop_slave.inc RESET SLAVE ALL; RESET MASTER; -SET GLOBAL gtid_pos=''; +SET GLOBAL gtid_slave_pos=''; RESET MASTER; INSERT INTO t1 VALUES (10); INSERT INTO t1 VALUES (11); @@ -189,7 +189,7 @@ DELETE FROM t1 WHERE a >= 10; RESET MASTER; INSERT INTO t1 VALUES (10); CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_1, -master_user = "root", master_use_gtid = 1; +master_user = "root", master_use_gtid = current_pos; START SLAVE UNTIL master_gtid_pos = '0-1-2'; include/wait_for_slave_to_start.inc INSERT INTO t1 VALUES (11); diff --git a/mysql-test/suite/rpl/r/rpl_sync.result b/mysql-test/suite/rpl/r/rpl_sync.result index 3e825a111aa..84c100970e4 100644 --- a/mysql-test/suite/rpl/r/rpl_sync.result +++ b/mysql-test/suite/rpl/r/rpl_sync.result @@ -3,7 +3,7 @@ include/master-slave.inc [connection master] call mtr.add_suppression('Attempting backtrace'); call mtr.add_suppression("Recovery from master pos .* and file master-bin.000001"); -ALTER TABLE mysql.rpl_slave_state ENGINE=InnoDB; +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; flush tables; CREATE TABLE t1(a INT, PRIMARY KEY(a)) engine=innodb; insert into t1(a) values(1); diff --git a/mysql-test/suite/rpl/t/rpl_gtid_basic.test b/mysql-test/suite/rpl/t/rpl_gtid_basic.test index 9513acb17b6..070e0daa403 100644 --- a/mysql-test/suite/rpl/t/rpl_gtid_basic.test +++ b/mysql-test/suite/rpl/t/rpl_gtid_basic.test @@ -49,7 +49,7 @@ save_master_pos; connection server_4; --replace_result $MASTER_MYPORT MASTER_PORT eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $MASTER_MYPORT, - MASTER_USE_GTID=1; + MASTER_USE_GTID=CURRENT_POS; --source include/start_slave.inc sync_with_master; SELECT * FROM t1 ORDER BY a; @@ -60,7 +60,7 @@ connection server_2; --source include/stop_slave.inc --replace_result $SERVER_MYPORT_4 SERVER_MYPORT_4 eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_4, - MASTER_USE_GTID=1; + MASTER_USE_GTID=CURRENT_POS; --source include/start_slave.inc connection server_4; @@ -85,7 +85,7 @@ COMMIT; connection server_3; --replace_result $SERVER_MYPORT_4 SERVER_MYPORT_4 eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_4, - MASTER_USE_GTID=1; + MASTER_USE_GTID=CURRENT_POS; --source include/start_slave.inc # This time, let's sync up without reference to binlog on D. --let $wait_condition= SELECT COUNT(*) = 7 FROM t2 @@ -93,7 +93,7 @@ eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_4, SELECT * FROM t2 ORDER BY a; --echo *** Now change everything back to what it was, to make rpl_end.inc happy -# Also check that MASTER_USE_GTID=1 is still enabled. +# Also check that MASTER_USE_GTID=CURRENT_POS is still enabled. connection server_2; # We need to sync up server_2 before switching. If it happened to have reached # the point 'UPDATE t2 SET b="j1a" WHERE a=5' it will fail to connect to diff --git a/mysql-test/suite/rpl/t/rpl_gtid_crash.test b/mysql-test/suite/rpl/t/rpl_gtid_crash.test index d78001aa69b..804aae1114d 100644 --- a/mysql-test/suite/rpl/t/rpl_gtid_crash.test +++ b/mysql-test/suite/rpl/t/rpl_gtid_crash.test @@ -13,7 +13,7 @@ call mtr.add_suppression("Checking table:"); call mtr.add_suppression("client is using or hasn't closed the table properly"); call mtr.add_suppression("Table .* is marked as crashed and should be repaired"); -ALTER TABLE mysql.rpl_slave_state ENGINE=InnoDB; +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; INSERT INTO t1 VALUES (1, 0); --save_master_pos @@ -23,7 +23,7 @@ INSERT INTO t1 VALUES (1, 0); --source include/stop_slave.inc --replace_result $MASTER_MYPORT MASTER_PORT eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $MASTER_MYPORT, - MASTER_USE_GTID=1; + MASTER_USE_GTID=CURRENT_POS; --connection server_1 INSERT INTO t1 VALUES (2,1); @@ -79,7 +79,7 @@ DROP TABLE t1; --sync_with_master --source include/stop_slave.inc RESET MASTER; -SET GLOBAL gtid_pos=''; +SET GLOBAL gtid_slave_pos=''; --connection server_1 RESET MASTER; @@ -130,7 +130,7 @@ SELECT * FROM t1 ORDER BY a; --echo *** Test crashing slave at various points and check that it recovers crash-safe. *** -# Crash the slave just before updating mysql.rpl_slave_state table. +# Crash the slave just before updating mysql.gtid_slave_pos table. --source include/stop_slave.inc --write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect wait diff --git a/mysql-test/suite/rpl/t/rpl_gtid_errorhandling.test b/mysql-test/suite/rpl/t/rpl_gtid_errorhandling.test index 98b9e8373d5..c5f695fd5a1 100644 --- a/mysql-test/suite/rpl/t/rpl_gtid_errorhandling.test +++ b/mysql-test/suite/rpl/t/rpl_gtid_errorhandling.test @@ -2,47 +2,47 @@ --source include/have_debug.inc --source include/master-slave.inc ---echo *** Test that we check against incorrect table definition for mysql.rpl_slave_state *** +--echo *** Test that we check against incorrect table definition for mysql.gtid_slave_pos *** --connection master CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB; --sync_slave_with_master --connection slave --source include/stop_slave.inc -ALTER TABLE mysql.rpl_slave_state CHANGE seq_no seq_no VARCHAR(20); +ALTER TABLE mysql.gtid_slave_pos CHANGE seq_no seq_no VARCHAR(20); START SLAVE; --connection master INSERT INTO t1 VALUES (1); --connection slave -CALL mtr.add_suppression("Slave: Failed to open mysql.rpl_slave_state"); +CALL mtr.add_suppression("Slave: Failed to open mysql.gtid_slave_pos"); --let $slave_sql_errno=1942 --source include/wait_for_slave_sql_error.inc --source include/stop_slave.inc -ALTER TABLE mysql.rpl_slave_state CHANGE seq_no seq_no BIGINT UNSIGNED NOT NULL; -ALTER TABLE mysql.rpl_slave_state DROP PRIMARY KEY; -ALTER TABLE mysql.rpl_slave_state ADD PRIMARY KEY (sub_id, domain_id); +ALTER TABLE mysql.gtid_slave_pos CHANGE seq_no seq_no BIGINT UNSIGNED NOT NULL; +ALTER TABLE mysql.gtid_slave_pos DROP PRIMARY KEY; +ALTER TABLE mysql.gtid_slave_pos ADD PRIMARY KEY (sub_id, domain_id); START SLAVE; --let $slave_sql_errno=1942 --source include/wait_for_slave_sql_error.inc --source include/stop_slave.inc -ALTER TABLE mysql.rpl_slave_state DROP PRIMARY KEY; +ALTER TABLE mysql.gtid_slave_pos DROP PRIMARY KEY; START SLAVE; --let $slave_sql_errno=1942 --source include/wait_for_slave_sql_error.inc --source include/stop_slave.inc -ALTER TABLE mysql.rpl_slave_state ADD PRIMARY KEY (sub_id); +ALTER TABLE mysql.gtid_slave_pos ADD PRIMARY KEY (sub_id); START SLAVE; --let $slave_sql_errno=1942 --source include/wait_for_slave_sql_error.inc --source include/stop_slave.inc -ALTER TABLE mysql.rpl_slave_state DROP PRIMARY KEY; -ALTER TABLE mysql.rpl_slave_state ADD PRIMARY KEY (domain_id, sub_id); +ALTER TABLE mysql.gtid_slave_pos DROP PRIMARY KEY; +ALTER TABLE mysql.gtid_slave_pos ADD PRIMARY KEY (domain_id, sub_id); --source include/start_slave.inc --connection master @@ -69,13 +69,22 @@ INSERT INTO t1 VALUES (2); SET sql_log_bin = 1; INSERT INTO t1 VALUES (3); -CHANGE MASTER TO master_use_gtid=1; ---error ER_MASTER_GTID_POS_CONFLICTS_WITH_BINLOG -SET GLOBAL gtid_pos = "0-1-1"; ---error ER_MASTER_GTID_POS_MISSING_DOMAIN -SET GLOBAL gtid_pos = ""; +CHANGE MASTER TO master_use_gtid=current_pos; +# Most not change @@GLOBAL.gtid_slave_pos in the middle of a transaction. +BEGIN; +--error ER_CANT_DO_THIS_DURING_AN_TRANSACTION +SET GLOBAL gtid_slave_pos = "100-100-100"; +INSERT INTO t1 VALUES (100); +--error ER_CANT_DO_THIS_DURING_AN_TRANSACTION +SET GLOBAL gtid_slave_pos = "100-100-100"; +ROLLBACK; + +# In gtid non-strict mode, we get warnings for setting @@gtid_slave_pos back +# to earlier than what is in the binlog. +SET GLOBAL gtid_slave_pos = "0-1-1"; +SET GLOBAL gtid_slave_pos = ""; RESET MASTER; -SET GLOBAL gtid_pos = "0-1-1"; +SET GLOBAL gtid_slave_pos = "0-1-1"; START SLAVE; --let $wait_condition= SELECT COUNT(*) = 4 FROM t1 @@ -85,7 +94,7 @@ SELECT * FROM t1 ORDER BY a; --echo *** Test slave requesting a GTID that is not present in the master's binlog *** --source include/stop_slave.inc -SET GLOBAL gtid_pos = "0-1-3"; +SET GLOBAL gtid_slave_pos = "0-1-3"; START SLAVE; SET sql_log_bin=0; @@ -98,7 +107,7 @@ SET sql_log_bin=1; --let $rpl_only_running_threads= 1 --source include/stop_slave.inc -SET GLOBAL gtid_pos = "0-1-2"; +SET GLOBAL gtid_slave_pos = "0-1-2"; START SLAVE; --source include/wait_for_slave_to_start.inc diff --git a/mysql-test/suite/rpl/t/rpl_gtid_master_promote.test b/mysql-test/suite/rpl/t/rpl_gtid_master_promote.test index 68935011c20..f3cc4aca135 100644 --- a/mysql-test/suite/rpl/t/rpl_gtid_master_promote.test +++ b/mysql-test/suite/rpl/t/rpl_gtid_master_promote.test @@ -11,7 +11,7 @@ # using START SLAVE UNTIL master_gtid_pos. --connection server_1 -ALTER TABLE mysql.rpl_slave_state ENGINE=InnoDB; +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; CREATE TABLE t4 (a INT, b INT, PRIMARY KEY (a,b)) Engine=InnoDB; # Function to extract one GTID from a list. @@ -31,22 +31,22 @@ delimiter ;| --connection server_2 --sync_with_master --source include/stop_slave.inc -CHANGE MASTER TO master_use_gtid=1; +CHANGE MASTER TO master_use_gtid=current_pos; --connection server_3 --sync_with_master --source include/stop_slave.inc -CHANGE MASTER TO master_use_gtid=1; +CHANGE MASTER TO master_use_gtid=current_pos; --connection server_4 --sync_with_master --source include/stop_slave.inc -CHANGE MASTER TO master_use_gtid=1; +CHANGE MASTER TO master_use_gtid=current_pos; --connection server_5 --sync_with_master --source include/stop_slave.inc -CHANGE MASTER TO master_use_gtid=1; +CHANGE MASTER TO master_use_gtid=current_pos; # Create three separate replication streams on master server_1. @@ -59,39 +59,39 @@ CHANGE MASTER TO master_use_gtid=1; SET gtid_domain_id= 1; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; ---let $d1_begin= `SELECT extract_gtid("1", @@GLOBAL.gtid_pos)` +--let $d1_begin= `SELECT extract_gtid("1", @@GLOBAL.gtid_binlog_pos)` INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (2); INSERT INTO t4 VALUES (1, 1); ---let $d1_mid= `SELECT extract_gtid("1", @@GLOBAL.gtid_pos)` +--let $d1_mid= `SELECT extract_gtid("1", @@GLOBAL.gtid_binlog_pos)` INSERT INTO t1 VALUES (3); INSERT INTO t1 VALUES (4); INSERT INTO t4 VALUES (1, 3); ---let $d1_end= `SELECT extract_gtid("1", @@GLOBAL.gtid_pos)` +--let $d1_end= `SELECT extract_gtid("1", @@GLOBAL.gtid_binlog_pos)` SET gtid_domain_id= 2; CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=InnoDB; ---let $d2_begin= `SELECT extract_gtid("2", @@GLOBAL.gtid_pos)` +--let $d2_begin= `SELECT extract_gtid("2", @@GLOBAL.gtid_binlog_pos)` INSERT INTO t2 VALUES (1); INSERT INTO t2 VALUES (2); INSERT INTO t4 VALUES (2, 1); ---let $d2_mid= `SELECT extract_gtid("2", @@GLOBAL.gtid_pos)` +--let $d2_mid= `SELECT extract_gtid("2", @@GLOBAL.gtid_binlog_pos)` INSERT INTO t2 VALUES (3); INSERT INTO t2 VALUES (4); INSERT INTO t4 VALUES (2, 3); ---let $d2_end= `SELECT extract_gtid("2", @@GLOBAL.gtid_pos)` +--let $d2_end= `SELECT extract_gtid("2", @@GLOBAL.gtid_binlog_pos)` SET gtid_domain_id= 3; CREATE TABLE t3 (a INT PRIMARY KEY) ENGINE=InnoDB; ---let $d3_begin= `SELECT extract_gtid("3", @@GLOBAL.gtid_pos)` +--let $d3_begin= `SELECT extract_gtid("3", @@GLOBAL.gtid_binlog_pos)` INSERT INTO t3 VALUES (1); INSERT INTO t3 VALUES (2); INSERT INTO t4 VALUES (3, 1); ---let $d3_mid= `SELECT extract_gtid("3", @@GLOBAL.gtid_pos)` +--let $d3_mid= `SELECT extract_gtid("3", @@GLOBAL.gtid_binlog_pos)` INSERT INTO t3 VALUES (3); INSERT INTO t3 VALUES (4); INSERT INTO t4 VALUES (3, 3); ---let $d3_end= `SELECT extract_gtid("3", @@GLOBAL.gtid_pos)` +--let $d3_end= `SELECT extract_gtid("3", @@GLOBAL.gtid_binlog_pos)` # Slave server_2 (that will be promoted to master) is in the middle @@ -135,7 +135,7 @@ SELECT * FROM t4 ORDER BY a,b; --echo *** Now replicate all extra changes from 3,4,5 to 2, in preparation for making 2 the new master. *** --connection server_3 ---let $server3_pos= `SELECT @@GLOBAL.gtid_pos` +--let $server3_pos= `SELECT @@GLOBAL.gtid_slave_pos` --connection server_2 --replace_result $SERVER_MYPORT_3 SERVER_MYPORT_3 eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_3; @@ -147,7 +147,7 @@ SELECT * FROM t3 ORDER BY a; SELECT * FROM t4 ORDER BY a,b; --connection server_4 ---let $server4_pos= `SELECT @@GLOBAL.gtid_pos` +--let $server4_pos= `SELECT @@GLOBAL.gtid_slave_pos` --connection server_2 --replace_result $SERVER_MYPORT_4 SERVER_MYPORT_4 eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_4; @@ -159,7 +159,7 @@ SELECT * FROM t3 ORDER BY a; SELECT * FROM t4 ORDER BY a,b; --connection server_5 ---let $server5_pos= `SELECT @@GLOBAL.gtid_pos` +--let $server5_pos= `SELECT @@GLOBAL.gtid_slave_pos` --connection server_2 --replace_result $SERVER_MYPORT_5 SERVER_MYPORT_5 eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_5; @@ -222,7 +222,7 @@ SELECT * FROM t4 ORDER BY a,b; --connection server_1 --replace_result $SERVER_MYPORT_2 SERVER_MYPORT_2 eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_2, - master_user = "root", master_use_gtid = 1; + master_user = "root", master_use_gtid = current_pos; --source include/start_slave.inc --sync_with_master SELECT * FROM t1 ORDER BY a; diff --git a/mysql-test/suite/rpl/t/rpl_gtid_mdev4473.test b/mysql-test/suite/rpl/t/rpl_gtid_mdev4473.test index 57f1975ed77..01259eb5765 100644 --- a/mysql-test/suite/rpl/t/rpl_gtid_mdev4473.test +++ b/mysql-test/suite/rpl/t/rpl_gtid_mdev4473.test @@ -24,7 +24,7 @@ reset slave all; connection server_1; --replace_result $SERVER_MYPORT_2 SERVER_MYPORT_2 eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_2, - master_user='root', MASTER_USE_GTID=1; + master_user='root', MASTER_USE_GTID=CURRENT_POS; source include/start_slave.inc; source include/wait_for_slave_to_start.inc; @@ -38,7 +38,7 @@ save_master_pos; connection server_3; --replace_result $SERVER_MYPORT_2 SERVER_MYPORT_2 eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_2, - MASTER_USE_GTID=1; + MASTER_USE_GTID=CURRENT_POS; source include/start_slave.inc; sync_with_master; @@ -56,14 +56,14 @@ reset slave all; connection server_2; --replace_result $SERVER_MYPORT_1 SERVER_MYPORT_1 eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_1, - master_user = 'root', MASTER_USE_GTID=1; + master_user = 'root', MASTER_USE_GTID=CURRENT_POS; source include/start_slave.inc; connection server_3; source include/stop_slave.inc; --replace_result $SERVER_MYPORT_1 SERVER_MYPORT_1 eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_1, - MASTER_USE_GTID=1; + MASTER_USE_GTID=CURRENT_POS; source include/start_slave.inc; connection server_1; diff --git a/mysql-test/suite/rpl/t/rpl_gtid_mdev4474.cnf b/mysql-test/suite/rpl/t/rpl_gtid_mdev4474.cnf new file mode 100644 index 00000000000..2b9e70c59bc --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_gtid_mdev4474.cnf @@ -0,0 +1,11 @@ +!include suite/rpl/rpl_1slave_base.cnf +!include include/default_client.cnf + + +[mysqld.1] +log-slave-updates +loose-innodb + +[mysqld.2] +log-slave-updates +loose-innodb diff --git a/mysql-test/suite/rpl/t/rpl_gtid_mdev4474.test b/mysql-test/suite/rpl/t/rpl_gtid_mdev4474.test new file mode 100644 index 00000000000..e6016b17717 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_gtid_mdev4474.test @@ -0,0 +1,76 @@ +--source include/have_innodb.inc +--source include/have_binlog_format_mixed_or_statement.inc +--let $rpl_topology=1->2->1 +--source include/rpl_init.inc + +--echo # +--echo # For now we'll only have 1->2 running + +--echo # +--echo # Server 1 +--echo # Stop replication 2->1 +--connection server_1 +--source include/stop_slave.inc + +--echo # +--echo # Server 2 +--echo # Use GTID for replication 1->2 +--connection server_2 +--source include/stop_slave.inc +change master to master_use_gtid=slave_pos; +--source include/start_slave.inc + +--echo # +--echo # Create some 0-1-* and 0-2-* events in binlog of server 2 + +--enable_connect_log + +--connection server_1 +create table t1 (i int) engine=InnoDB; +insert into t1 values (1); +--save_master_pos + +--connection server_2 +--sync_with_master +create table t2 (i int) engine=InnoDB; +--save_master_pos + +--connection server_1 +insert into t1 values (2); +--save_master_pos + +--connection server_2 +--sync_with_master +insert into t2 values (1); +--save_master_pos + +--disable_connect_log + +--echo # +--echo # All events are present in the binlog of server 2 + +--source include/show_binlog_events.inc + +--echo # +--echo # Server 1 +--echo # Start replication 2->1 using GTID, + +--connection server_1 +change master to master_use_gtid=slave_pos; +--source include/start_slave.inc +--sync_with_master + +select * from t1 order by i; +select * from t2 order by i; + +--connection server_2 +select * from t1 order by i; +select * from t2 order by i; + +--connection server_1 +drop table t1; + +--connection server_2 +drop table t2; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_gtid_nobinlog.test b/mysql-test/suite/rpl/t/rpl_gtid_nobinlog.test index d8073e19fb0..9c9c8090eba 100644 --- a/mysql-test/suite/rpl/t/rpl_gtid_nobinlog.test +++ b/mysql-test/suite/rpl/t/rpl_gtid_nobinlog.test @@ -26,7 +26,7 @@ INSERT INTO t1 VALUES (4, 2); --connection server_1 --replace_result $SLAVE_MYPORT SLAVE_PORT eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SLAVE_MYPORT, - master_user = 'root', master_use_gtid = 1; + master_user = 'root', master_use_gtid = current_pos; START SLAVE; --let $wait_condition= SELECT COUNT(*) = 4 FROM t1 --source include/wait_condition.inc @@ -41,7 +41,7 @@ INSERT INTO t1 VALUES (6, 1); --connection server_2 --replace_result $MASTER_MYPORT MASTER_PORT eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $MASTER_MYPORT, - master_use_gtid = 1; + master_use_gtid = current_pos; START SLAVE; --let $wait_condition= SELECT COUNT(*) = 6 FROM t1 --source include/wait_condition.inc diff --git a/mysql-test/suite/rpl/t/rpl_gtid_startpos.test b/mysql-test/suite/rpl/t/rpl_gtid_startpos.test index c4390d3fccc..8dfb60b1b56 100644 --- a/mysql-test/suite/rpl/t/rpl_gtid_startpos.test +++ b/mysql-test/suite/rpl/t/rpl_gtid_startpos.test @@ -16,10 +16,10 @@ CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; --save_master_pos --connection server_2 -SET GLOBAL gtid_pos=""; +SET GLOBAL gtid_slave_pos=""; --replace_result $MASTER_MYPORT MASTER_PORT eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $MASTER_MYPORT, - MASTER_USE_GTID=1; + MASTER_USE_GTID=CURRENT_POS; --source include/start_slave.inc --sync_with_master SELECT * FROM t1; @@ -43,10 +43,10 @@ INSERT INTO t1 VALUES (2); --source include/show_binary_logs.inc --connection server_2 -SET GLOBAL gtid_pos=""; +SET GLOBAL gtid_slave_pos=""; --replace_result $MASTER_MYPORT MASTER_PORT eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $MASTER_MYPORT, - MASTER_USE_GTID=1; + MASTER_USE_GTID=CURRENT_POS; START SLAVE; --let $slave_io_errno= 1236 --source include/wait_for_slave_io_error.inc @@ -62,17 +62,17 @@ SET sql_log_bin=0; call mtr.add_suppression('Could not find GTID state requested by slave in any binlog files'); SET sql_log_bin=1; ---echo *** Test that we give error when explict @@gtid_pos=xxx that conflicts with what is in our binary log *** +--echo *** Test that we give warning when explict @@gtid_slave_pos=xxx that conflicts with what is in our binary log *** --source include/stop_slave.inc --connection server_1 INSERT INTO t1 VALUES(3); --connection server_2 -SET GLOBAL gtid_pos='0-1-3'; +SET GLOBAL gtid_slave_pos='0-1-3'; --replace_result $MASTER_MYPORT MASTER_PORT eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $MASTER_MYPORT, - MASTER_USE_GTID=1; + MASTER_USE_GTID=CURRENT_POS; --source include/start_slave.inc --let $wait_condition= SELECT COUNT(*) = 3 FROM t1 --source include/wait_condition.inc @@ -84,15 +84,14 @@ INSERT INTO t1 VALUES (4); --connection server_2 # Now add some local transactions that conflict with the GTID position -# being set for GTID_POS. +# being set for @@gtid_slave_pos. INSERT INTO t1 VALUES (10); DELETE FROM t1 WHERE a=10; ---error ER_MASTER_GTID_POS_CONFLICTS_WITH_BINLOG -SET GLOBAL gtid_pos='0-1-4'; +SET GLOBAL gtid_slave_pos='0-1-4'; # Try again after RESET MASTER to remove the conflicting binlog. RESET MASTER; -SET GLOBAL gtid_pos='0-1-4'; +SET GLOBAL gtid_slave_pos='0-1-4'; START SLAVE; --let $wait_condition= SELECT COUNT(*) = 4 FROM t1 --source include/wait_condition.inc @@ -117,9 +116,9 @@ RESET MASTER; RESET MASTER; --connection server_2 -SET GLOBAL gtid_pos=''; +SET GLOBAL gtid_slave_pos=''; --replace_result $MASTER_MYPORT MASTER_PORT -eval CHANGE MASTER TO master_host='127.0.0.1', master_port=$MASTER_MYPORT, master_user='root', master_use_gtid=1; +eval CHANGE MASTER TO master_host='127.0.0.1', master_port=$MASTER_MYPORT, master_user='root', master_use_gtid=current_pos; --source include/start_slave.inc --connection server_1 @@ -145,22 +144,21 @@ INSERT INTO t1 VALUES (2); SELECT * FROM t1 ORDER BY a; ---echo *** MDEV-4329: GTID_POS='' is not checked for conflicts with binlog *** +--echo *** MDEV-4329: GTID_SLAVE_POS='' is not checked for conflicts with binlog *** # Test starting the slave completely from scratch, deleting all tables and # replicating from the start of the master's binlog. This requires RESET # MASTER is run on the slave to avoid old junk in the binlog. The bug was # that the code did not catch the error of missing RESET MASTER when an -# empty GTID_POS='' was specified. +# empty GTID_SLAVE_POS='' was specified. --connection server_2 --source include/stop_slave.inc DROP TABLE t1; RESET SLAVE; ---error ER_MASTER_GTID_POS_MISSING_DOMAIN -SET GLOBAL gtid_pos=""; +SET GLOBAL gtid_slave_pos=""; RESET MASTER; -SET GLOBAL gtid_pos=""; +SET GLOBAL gtid_slave_pos=""; --source include/start_slave.inc --sync_with_master @@ -176,7 +174,7 @@ SET SQL_LOG_BIN=0; DROP TABLE t1; SET SQL_LOG_BIN=1; RESET SLAVE; -SET GLOBAL gtid_pos=""; +SET GLOBAL gtid_slave_pos=""; --source include/start_slave.inc --sync_with_master @@ -197,7 +195,7 @@ START SLAVE; # Going back to using GTID should fix things. STOP SLAVE IO_THREAD; -CHANGE MASTER TO MASTER_USE_GTID=1; +CHANGE MASTER TO MASTER_USE_GTID=CURRENT_POS; --source include/start_slave.inc --connection server_1 @@ -245,7 +243,7 @@ SELECT * FROM t1 ORDER BY a; --connection server_2 --source include/stop_slave.inc RESET MASTER; -SET GLOBAL gtid_pos=""; +SET GLOBAL gtid_slave_pos=""; --connection server_1 RESET MASTER; @@ -260,25 +258,24 @@ INSERT INTO t1 VALUES (10); # Will be GTID 0-1-2 SELECT * FROM t1; --let $value= query_get_value(SHOW SLAVE STATUS, "Using_Gtid", 1) eval SELECT '$value' AS Using_Gtid; ---let $value= query_get_value(SHOW ALL SLAVES STATUS, "Gtid_Pos", 1) -eval SELECT '$value' AS Gtid_Pos; +--let $value= query_get_value(SHOW ALL SLAVES STATUS, "Gtid_Slave_Pos", 1) +eval SELECT '$value' AS Gtid_Slave_Pos; UPDATE t1 SET a=9 WHERE a=10; UPDATE t1 SET a=10 WHERE a=9; ---let $value= query_get_value(SHOW ALL SLAVES STATUS, "Gtid_Pos", 1) -eval SELECT '$value' AS Gtid_Pos; +--let $value= query_get_value(SHOW ALL SLAVES STATUS, "Gtid_Slave_Pos", 1) +eval SELECT '$value' AS Gtid_Slave_Pos; --source include/stop_slave.inc ---error ER_MASTER_GTID_POS_CONFLICTS_WITH_BINLOG -SET GLOBAL gtid_pos='0-1-2'; +SET GLOBAL gtid_slave_pos='0-1-2'; RESET MASTER; ---let $value= query_get_value(SHOW ALL SLAVES STATUS, "Gtid_Pos", 1) -eval SELECT '$value' AS Gtid_Pos; -SET GLOBAL gtid_pos='0-1-2'; +--let $value= query_get_value(SHOW ALL SLAVES STATUS, "Gtid_Slave_Pos", 1) +eval SELECT '$value' AS Gtid_Slave_Pos; +SET GLOBAL gtid_slave_pos='0-1-2'; --source include/start_slave.inc ---let $value= query_get_value(SHOW ALL SLAVES STATUS, "Gtid_Pos", 1) -eval SELECT '$value' AS Gtid_Pos; +--let $value= query_get_value(SHOW ALL SLAVES STATUS, "Gtid_Slave_Pos", 1) +eval SELECT '$value' AS Gtid_Slave_Pos; # Clean up. --connection server_1 diff --git a/mysql-test/suite/rpl/t/rpl_gtid_stop_start.test b/mysql-test/suite/rpl/t/rpl_gtid_stop_start.test index 262d86a294e..0833dfe1224 100644 --- a/mysql-test/suite/rpl/t/rpl_gtid_stop_start.test +++ b/mysql-test/suite/rpl/t/rpl_gtid_stop_start.test @@ -15,7 +15,7 @@ INSERT INTO t1 VALUES (1); --let $status_items= Master_Log_File,Using_Gtid --source include/show_slave_status.inc -CHANGE MASTER TO master_use_gtid=1; +CHANGE MASTER TO master_use_gtid=current_pos; # Now try to restart the slave mysqld server without starting the slave first # threads after the CHANGE MASTER. diff --git a/mysql-test/suite/rpl/t/rpl_gtid_until.test b/mysql-test/suite/rpl/t/rpl_gtid_until.test index 3b6e238f225..68ebd464fd1 100644 --- a/mysql-test/suite/rpl/t/rpl_gtid_until.test +++ b/mysql-test/suite/rpl/t/rpl_gtid_until.test @@ -3,7 +3,7 @@ --source include/rpl_init.inc --connection server_1 -ALTER TABLE mysql.rpl_slave_state ENGINE=InnoDB; +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; # Function to extract one GTID from a list. delimiter |; CREATE FUNCTION extract_gtid(d VARCHAR(100), s VARCHAR(100)) @@ -37,12 +37,12 @@ START SLAVE UNTIL master_gtid_pos = ""; --error ER_UNTIL_REQUIRES_USING_GTID START SLAVE UNTIL master_gtid_pos = ""; -CHANGE MASTER TO master_use_gtid=1; +CHANGE MASTER TO master_use_gtid=current_pos; --connection server_1 CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; INSERT INTO t1 VALUES(1); ---let $gtid_pos=`SELECT @@GLOBAL.gtid_pos` +--let $gtid_pos=`SELECT @@GLOBAL.gtid_binlog_pos` INSERT INTO t1 VALUES(2); --connection server_2 @@ -93,8 +93,8 @@ INSERT INTO t1 VALUES (3); SET gtid_domain_id = 2; CREATE TABLE t2 (a INT); INSERT INTO t2 VALUES (3); ---let $d1_point1= `SELECT extract_gtid("1", @@GLOBAL.gtid_pos)` ---let $d2_point1= `SELECT extract_gtid("2", @@GLOBAL.gtid_pos)` +--let $d1_point1= `SELECT extract_gtid("1", @@GLOBAL.gtid_binlog_pos)` +--let $d2_point1= `SELECT extract_gtid("2", @@GLOBAL.gtid_binlog_pos)` FLUSH LOGS; SET gtid_domain_id = 1; INSERT INTO t1 VALUES (4); @@ -103,15 +103,15 @@ INSERT INTO t2 VALUES (4); FLUSH LOGS; SET gtid_domain_id = 1; INSERT INTO t1 VALUES (5); ---let $d1_point2= `SELECT extract_gtid("1", @@GLOBAL.gtid_pos)` ---let $d2_point2= `SELECT extract_gtid("2", @@GLOBAL.gtid_pos)` +--let $d1_point2= `SELECT extract_gtid("1", @@GLOBAL.gtid_binlog_pos)` +--let $d2_point2= `SELECT extract_gtid("2", @@GLOBAL.gtid_binlog_pos)` SET gtid_domain_id = 2; INSERT INTO t2 VALUES (5); FLUSH LOGS; SET gtid_domain_id = 1; INSERT INTO t1 VALUES (6); ---let $d1_point3= `SELECT extract_gtid("1", @@GLOBAL.gtid_pos)` ---let $d2_point3= `SELECT extract_gtid("2", @@GLOBAL.gtid_pos)` +--let $d1_point3= `SELECT extract_gtid("1", @@GLOBAL.gtid_binlog_pos)` +--let $d2_point3= `SELECT extract_gtid("2", @@GLOBAL.gtid_binlog_pos)` SET gtid_domain_id = 2; INSERT INTO t2 VALUES (6); SET gtid_domain_id = 0; @@ -170,7 +170,7 @@ SELECT * FROM t1 ORDER BY a; --connection server_1 CREATE TABLE t3 (a INT); ---let $until_condition=`SELECT @@GLOBAL.gtid_pos` +--let $until_condition=`SELECT @@GLOBAL.gtid_binlog_pos` DROP TABLE t3; --save_master_pos @@ -187,7 +187,7 @@ SHOW CREATE TABLE t3; --source include/stop_slave.inc RESET SLAVE ALL; RESET MASTER; -SET GLOBAL gtid_pos=''; +SET GLOBAL gtid_slave_pos=''; --connection server_1 # Do it once to compute the right GTID, then throw it away and do it again @@ -195,7 +195,7 @@ SET GLOBAL gtid_pos=''; RESET MASTER; INSERT INTO t1 VALUES (10); INSERT INTO t1 VALUES (11); ---let $until_condition=`SELECT @@GLOBAL.gtid_pos` +--let $until_condition=`SELECT @@GLOBAL.gtid_binlog_pos` INSERT INTO t1 VALUES (12); DELETE FROM t1 WHERE a >= 10; @@ -205,7 +205,7 @@ INSERT INTO t1 VALUES (10); --connection server_2 --replace_result $SERVER_MYPORT_1 SERVER_MYPORT_1 eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_1, - master_user = "root", master_use_gtid = 1; + master_user = "root", master_use_gtid = current_pos; eval START SLAVE UNTIL master_gtid_pos = '$until_condition'; --source include/wait_for_slave_to_start.inc diff --git a/mysql-test/suite/rpl/t/rpl_sync.test b/mysql-test/suite/rpl/t/rpl_sync.test index f2f73d59086..820ec19925f 100644 --- a/mysql-test/suite/rpl/t/rpl_sync.test +++ b/mysql-test/suite/rpl/t/rpl_sync.test @@ -36,7 +36,7 @@ call mtr.add_suppression('Attempting backtrace'); call mtr.add_suppression("Recovery from master pos .* and file master-bin.000001"); # Use innodb so we do not get "table should be repaired" issues. -ALTER TABLE mysql.rpl_slave_state ENGINE=InnoDB; +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; flush tables; CREATE TABLE t1(a INT, PRIMARY KEY(a)) engine=innodb; diff --git a/mysql-test/suite/sys_vars/r/gtid_binlog_pos_basic.result b/mysql-test/suite/sys_vars/r/gtid_binlog_pos_basic.result new file mode 100644 index 00000000000..6d9d0ec449d --- /dev/null +++ b/mysql-test/suite/sys_vars/r/gtid_binlog_pos_basic.result @@ -0,0 +1,9 @@ +SET GLOBAL gtid_binlog_pos= ''; +ERROR HY000: Variable 'gtid_binlog_pos' is a read only variable +SELECT variable_name FROM information_schema.global_variables +WHERE variable_name='gtid_binlog_pos'; +variable_name +GTID_BINLOG_POS +SELECT @@gtid_binlog_pos; +SELECT @@session.gtid_binlog_pos; +ERROR HY000: Variable 'gtid_binlog_pos' is a GLOBAL variable diff --git a/mysql-test/suite/sys_vars/r/gtid_current_pos_basic.result b/mysql-test/suite/sys_vars/r/gtid_current_pos_basic.result new file mode 100644 index 00000000000..3ddc20d9b8c --- /dev/null +++ b/mysql-test/suite/sys_vars/r/gtid_current_pos_basic.result @@ -0,0 +1,9 @@ +SET GLOBAL gtid_current_pos= ''; +ERROR HY000: Variable 'gtid_current_pos' is a read only variable +SELECT variable_name FROM information_schema.global_variables +WHERE variable_name='gtid_current_pos'; +variable_name +GTID_CURRENT_POS +SELECT @@gtid_current_pos; +SELECT @@session.gtid_current_pos; +ERROR HY000: Variable 'gtid_current_pos' is a GLOBAL variable diff --git a/mysql-test/suite/sys_vars/r/gtid_pos_basic.result b/mysql-test/suite/sys_vars/r/gtid_pos_basic.result deleted file mode 100644 index b97db1b657e..00000000000 --- a/mysql-test/suite/sys_vars/r/gtid_pos_basic.result +++ /dev/null @@ -1,47 +0,0 @@ -SET @old_gtid_pos= @@gtid_pos; -SET GLOBAL gtid_pos= ''; -SELECT @@gtid_pos; -@@gtid_pos - -SET GLOBAL gtid_pos= '1-2-3'; -SELECT variable_value FROM information_schema.global_variables -WHERE variable_name='gtid_pos'; -variable_value -1-2-3 -SET @@global.gtid_pos= '1-2-4'; -SELECT @@gtid_pos; -@@gtid_pos -1-2-4 -SET GLOBAL gtid_pos= ' 1-2-3'; -SELECT @@gtid_pos; -@@gtid_pos -1-2-3 -SET GLOBAL gtid_pos= '1-2-3, 2-4-6'; -SELECT @@gtid_pos; -@@gtid_pos -1-2-3,2-4-6 -SET GLOBAL gtid_pos= '-1-2-3'; -ERROR HY000: Could not parse GTID list for GTID_POS -SET GLOBAL gtid_pos= '1-2 -3'; -ERROR HY000: Could not parse GTID list for GTID_POS -SET GLOBAL gtid_pos= '1-2-3 '; -ERROR HY000: Could not parse GTID list for GTID_POS -SET GLOBAL gtid_pos= '1-2-3,2-4'; -ERROR HY000: Could not parse GTID list for GTID_POS -SET GLOBAL gtid_pos= '0-1-10,0-2-20'; -ERROR HY000: GTID 0-2-20 and 0-1-10 conflict (duplicate domain id 0) -SET GLOBAL gtid_pos= '0-1-10,1-2-20,2-3-30,1-20-200,3-4-1'; -ERROR HY000: GTID 1-20-200 and 1-2-20 conflict (duplicate domain id 1) -SET gtid_pos= ''; -ERROR HY000: Variable 'gtid_pos' is a GLOBAL variable and should be set with SET GLOBAL -SET SESSION gtid_pos= ''; -ERROR HY000: Variable 'gtid_pos' is a GLOBAL variable and should be set with SET GLOBAL -SET GLOBAL gtid_pos= '1-2-3,2-4-6'; -SELECT @@gtid_pos; -@@gtid_pos -1-2-3,2-4-6 -SET GLOBAL gtid_pos= DEFAULT; -ERROR 42000: Variable 'gtid_pos' doesn't have a default value -SELECT @@session.gtid_pos; -ERROR HY000: Variable 'gtid_pos' is a GLOBAL variable -SET GLOBAL gtid_pos= @old_gtid_pos; diff --git a/mysql-test/suite/sys_vars/r/gtid_slave_pos_basic.result b/mysql-test/suite/sys_vars/r/gtid_slave_pos_basic.result new file mode 100644 index 00000000000..e3ef59b7e30 --- /dev/null +++ b/mysql-test/suite/sys_vars/r/gtid_slave_pos_basic.result @@ -0,0 +1,47 @@ +SET @old_gtid_slave_pos= @@gtid_slave_pos; +SET GLOBAL gtid_slave_pos= ''; +SELECT @@gtid_slave_pos; +@@gtid_slave_pos + +SET GLOBAL gtid_slave_pos= '1-2-3'; +SELECT variable_value FROM information_schema.global_variables +WHERE variable_name='gtid_slave_pos'; +variable_value +1-2-3 +SET @@global.gtid_slave_pos= '1-2-4'; +SELECT @@gtid_slave_pos; +@@gtid_slave_pos +1-2-4 +SET GLOBAL gtid_slave_pos= ' 1-2-3'; +SELECT @@gtid_slave_pos; +@@gtid_slave_pos +1-2-3 +SET GLOBAL gtid_slave_pos= '1-2-3, 2-4-6'; +SELECT @@gtid_slave_pos; +@@gtid_slave_pos +1-2-3,2-4-6 +SET GLOBAL gtid_slave_pos= '-1-2-3'; +ERROR HY000: Could not parse GTID list for GTID_POS +SET GLOBAL gtid_slave_pos= '1-2 -3'; +ERROR HY000: Could not parse GTID list for GTID_POS +SET GLOBAL gtid_slave_pos= '1-2-3 '; +ERROR HY000: Could not parse GTID list for GTID_POS +SET GLOBAL gtid_slave_pos= '1-2-3,2-4'; +ERROR HY000: Could not parse GTID list for GTID_POS +SET GLOBAL gtid_slave_pos= '0-1-10,0-2-20'; +ERROR HY000: GTID 0-2-20 and 0-1-10 conflict (duplicate domain id 0) +SET GLOBAL gtid_slave_pos= '0-1-10,1-2-20,2-3-30,1-20-200,3-4-1'; +ERROR HY000: GTID 1-20-200 and 1-2-20 conflict (duplicate domain id 1) +SET gtid_slave_pos= ''; +ERROR HY000: Variable 'gtid_slave_pos' is a GLOBAL variable and should be set with SET GLOBAL +SET SESSION gtid_slave_pos= ''; +ERROR HY000: Variable 'gtid_slave_pos' is a GLOBAL variable and should be set with SET GLOBAL +SET GLOBAL gtid_slave_pos= '1-2-3,2-4-6'; +SELECT @@gtid_slave_pos; +@@gtid_slave_pos +1-2-3,2-4-6 +SET GLOBAL gtid_slave_pos= DEFAULT; +ERROR 42000: Variable 'gtid_slave_pos' doesn't have a default value +SELECT @@session.gtid_slave_pos; +ERROR HY000: Variable 'gtid_slave_pos' is a GLOBAL variable +SET GLOBAL gtid_slave_pos= @old_gtid_slave_pos; diff --git a/mysql-test/suite/sys_vars/t/gtid_binlog_pos_basic.test b/mysql-test/suite/sys_vars/t/gtid_binlog_pos_basic.test new file mode 100644 index 00000000000..452132653fc --- /dev/null +++ b/mysql-test/suite/sys_vars/t/gtid_binlog_pos_basic.test @@ -0,0 +1,15 @@ +--source include/not_embedded.inc + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET GLOBAL gtid_binlog_pos= ''; +SELECT variable_name FROM information_schema.global_variables + WHERE variable_name='gtid_binlog_pos'; + +# The value of the variable depends on the binary log, this is tested extensively +# elsewhere in rpl.rpl_gtid*.test +--disable_result_log +SELECT @@gtid_binlog_pos; +--enable_result_log + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.gtid_binlog_pos; diff --git a/mysql-test/suite/sys_vars/t/gtid_current_pos_basic.test b/mysql-test/suite/sys_vars/t/gtid_current_pos_basic.test new file mode 100644 index 00000000000..9aac7ad7c10 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/gtid_current_pos_basic.test @@ -0,0 +1,15 @@ +--source include/not_embedded.inc + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET GLOBAL gtid_current_pos= ''; +SELECT variable_name FROM information_schema.global_variables + WHERE variable_name='gtid_current_pos'; + +# The value of the variable depends on the binary log, this is tested extensively +# elsewhere in rpl.rpl_gtid*.test +--disable_result_log +SELECT @@gtid_current_pos; +--enable_result_log + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.gtid_current_pos; diff --git a/mysql-test/suite/sys_vars/t/gtid_pos_basic.test b/mysql-test/suite/sys_vars/t/gtid_pos_basic.test deleted file mode 100644 index 929fdebed20..00000000000 --- a/mysql-test/suite/sys_vars/t/gtid_pos_basic.test +++ /dev/null @@ -1,46 +0,0 @@ ---source include/not_embedded.inc - -SET @old_gtid_pos= @@gtid_pos; - -SET GLOBAL gtid_pos= ''; -SELECT @@gtid_pos; -SET GLOBAL gtid_pos= '1-2-3'; -SELECT variable_value FROM information_schema.global_variables - WHERE variable_name='gtid_pos'; -SET @@global.gtid_pos= '1-2-4'; -SELECT @@gtid_pos; - -SET GLOBAL gtid_pos= ' 1-2-3'; -SELECT @@gtid_pos; -SET GLOBAL gtid_pos= '1-2-3, 2-4-6'; -SELECT @@gtid_pos; - ---error ER_INCORRECT_GTID_STATE -SET GLOBAL gtid_pos= '-1-2-3'; ---error ER_INCORRECT_GTID_STATE -SET GLOBAL gtid_pos= '1-2 -3'; ---error ER_INCORRECT_GTID_STATE -SET GLOBAL gtid_pos= '1-2-3 '; ---error ER_INCORRECT_GTID_STATE -SET GLOBAL gtid_pos= '1-2-3,2-4'; - ---error ER_DUPLICATE_GTID_DOMAIN -SET GLOBAL gtid_pos= '0-1-10,0-2-20'; ---error ER_DUPLICATE_GTID_DOMAIN -SET GLOBAL gtid_pos= '0-1-10,1-2-20,2-3-30,1-20-200,3-4-1'; - ---error ER_GLOBAL_VARIABLE -SET gtid_pos= ''; ---error ER_GLOBAL_VARIABLE -SET SESSION gtid_pos= ''; - -SET GLOBAL gtid_pos= '1-2-3,2-4-6'; -SELECT @@gtid_pos; - ---error ER_NO_DEFAULT -SET GLOBAL gtid_pos= DEFAULT; - ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -SELECT @@session.gtid_pos; - -SET GLOBAL gtid_pos= @old_gtid_pos; diff --git a/mysql-test/suite/sys_vars/t/gtid_slave_pos_basic.test b/mysql-test/suite/sys_vars/t/gtid_slave_pos_basic.test new file mode 100644 index 00000000000..d021e335b86 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/gtid_slave_pos_basic.test @@ -0,0 +1,46 @@ +--source include/not_embedded.inc + +SET @old_gtid_slave_pos= @@gtid_slave_pos; + +SET GLOBAL gtid_slave_pos= ''; +SELECT @@gtid_slave_pos; +SET GLOBAL gtid_slave_pos= '1-2-3'; +SELECT variable_value FROM information_schema.global_variables + WHERE variable_name='gtid_slave_pos'; +SET @@global.gtid_slave_pos= '1-2-4'; +SELECT @@gtid_slave_pos; + +SET GLOBAL gtid_slave_pos= ' 1-2-3'; +SELECT @@gtid_slave_pos; +SET GLOBAL gtid_slave_pos= '1-2-3, 2-4-6'; +SELECT @@gtid_slave_pos; + +--error ER_INCORRECT_GTID_STATE +SET GLOBAL gtid_slave_pos= '-1-2-3'; +--error ER_INCORRECT_GTID_STATE +SET GLOBAL gtid_slave_pos= '1-2 -3'; +--error ER_INCORRECT_GTID_STATE +SET GLOBAL gtid_slave_pos= '1-2-3 '; +--error ER_INCORRECT_GTID_STATE +SET GLOBAL gtid_slave_pos= '1-2-3,2-4'; + +--error ER_DUPLICATE_GTID_DOMAIN +SET GLOBAL gtid_slave_pos= '0-1-10,0-2-20'; +--error ER_DUPLICATE_GTID_DOMAIN +SET GLOBAL gtid_slave_pos= '0-1-10,1-2-20,2-3-30,1-20-200,3-4-1'; + +--error ER_GLOBAL_VARIABLE +SET gtid_slave_pos= ''; +--error ER_GLOBAL_VARIABLE +SET SESSION gtid_slave_pos= ''; + +SET GLOBAL gtid_slave_pos= '1-2-3,2-4-6'; +SELECT @@gtid_slave_pos; + +--error ER_NO_DEFAULT +SET GLOBAL gtid_slave_pos= DEFAULT; + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.gtid_slave_pos; + +SET GLOBAL gtid_slave_pos= @old_gtid_slave_pos; diff --git a/mysql-test/t/system_mysql_db_fix40123.test b/mysql-test/t/system_mysql_db_fix40123.test index d013ca5d0d9..adb223a9e50 100644 --- a/mysql-test/t/system_mysql_db_fix40123.test +++ b/mysql-test/t/system_mysql_db_fix40123.test @@ -77,7 +77,7 @@ CREATE TABLE index_stats (db_name varchar(64) NOT NULL, table_name varchar(64) N -- disable_query_log # Drop all tables created by this test -DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, rpl_slave_state, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, ndb_binlog_index, proxies_priv, table_stats, column_stats, index_stats; +DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, gtid_slave_pos, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, ndb_binlog_index, proxies_priv, table_stats, column_stats, index_stats; -- enable_query_log diff --git a/mysql-test/t/system_mysql_db_fix50030.test b/mysql-test/t/system_mysql_db_fix50030.test index 26eceec96dc..a4718c91c26 100644 --- a/mysql-test/t/system_mysql_db_fix50030.test +++ b/mysql-test/t/system_mysql_db_fix50030.test @@ -84,7 +84,7 @@ CREATE TABLE index_stats (db_name varchar(64) NOT NULL, table_name varchar(64) N -- disable_query_log # Drop all tables created by this test -DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, rpl_slave_state, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, ndb_binlog_index, proxies_priv, table_stats, column_stats, index_stats; +DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, gtid_slave_pos, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, ndb_binlog_index, proxies_priv, table_stats, column_stats, index_stats; -- enable_query_log diff --git a/mysql-test/t/system_mysql_db_fix50117.test b/mysql-test/t/system_mysql_db_fix50117.test index 9e5ffb8c2cb..5677d6337f0 100644 --- a/mysql-test/t/system_mysql_db_fix50117.test +++ b/mysql-test/t/system_mysql_db_fix50117.test @@ -103,7 +103,7 @@ CREATE TABLE index_stats (db_name varchar(64) NOT NULL, table_name varchar(64) N -- disable_query_log # Drop all tables created by this test -DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, rpl_slave_state, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, ndb_binlog_index, proxies_priv, table_stats, column_stats, index_stats; +DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, gtid_slave_pos, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, ndb_binlog_index, proxies_priv, table_stats, column_stats, index_stats; -- enable_query_log diff --git a/scripts/mysql_system_tables.sql b/scripts/mysql_system_tables.sql index 95f2741f90d..75e4de9373c 100644 --- a/scripts/mysql_system_tables.sql +++ b/scripts/mysql_system_tables.sql @@ -24,7 +24,7 @@ set sql_mode=''; -- We want this to be created with the default storage engine. -- This way, if InnoDB is used we get crash safety, and if MyISAM is used -- we avoid mixed-engine transactions. -CREATE TABLE IF NOT EXISTS rpl_slave_state (domain_id INT UNSIGNED NOT NULL, sub_id BIGINT UNSIGNED NOT NULL, server_id INT UNSIGNED NOT NULL, seq_no BIGINT UNSIGNED NOT NULL, PRIMARY KEY (domain_id, sub_id)) comment='Replication slave GTID state'; +CREATE TABLE IF NOT EXISTS gtid_slave_pos (domain_id INT UNSIGNED NOT NULL, sub_id BIGINT UNSIGNED NOT NULL, server_id INT UNSIGNED NOT NULL, seq_no BIGINT UNSIGNED NOT NULL, PRIMARY KEY (domain_id, sub_id)) comment='Replication slave GTID state'; set storage_engine=myisam; flush tables; diff --git a/sql/lex.h b/sql/lex.h index 756e7e80f7e..e269c3e4040 100644 --- a/sql/lex.h +++ b/sql/lex.h @@ -152,6 +152,7 @@ static SYMBOL symbols[] = { { "CROSS", SYM(CROSS)}, { "CUBE", SYM(CUBE_SYM)}, { "CURRENT_DATE", SYM(CURDATE)}, + { "CURRENT_POS", SYM(CURRENT_POS_SYM)}, { "CURRENT_TIME", SYM(CURTIME)}, { "CURRENT_TIMESTAMP", SYM(NOW_SYM)}, { "CURRENT_USER", SYM(CURRENT_USER)}, @@ -517,6 +518,7 @@ static SYMBOL symbols[] = { { "SIMPLE", SYM(SIMPLE_SYM)}, { "SLAVE", SYM(SLAVE)}, { "SLAVES", SYM(SLAVES)}, + { "SLAVE_POS", SYM(SLAVE_POS_SYM)}, { "SLOW", SYM(SLOW)}, { "SNAPSHOT", SYM(SNAPSHOT_SYM)}, { "SMALLINT", SYM(SMALLINT)}, diff --git a/sql/log.cc b/sql/log.cc index 3266934beda..238452070ff 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -5521,6 +5521,18 @@ MYSQL_BIN_LOG::get_most_recent_gtid_list(rpl_gtid **list, uint32 *size) bool +MYSQL_BIN_LOG::append_state_pos(String *str) +{ + bool err; + + mysql_mutex_lock(&rpl_global_gtid_binlog_state.LOCK_binlog_state); + err= rpl_global_gtid_binlog_state.append_pos(str); + mysql_mutex_unlock(&rpl_global_gtid_binlog_state.LOCK_binlog_state); + return err; +} + + +bool MYSQL_BIN_LOG::find_in_binlog_state(uint32 domain_id, uint32 server_id, rpl_gtid *out_gtid) { @@ -8508,7 +8520,7 @@ binlog_background_thread(void *arg __attribute__((unused))) thd->store_globals(); /* - Load the slave replication GTID state from the mysql.rpl_slave_state + Load the slave replication GTID state from the mysql.gtid_slave_pos table. This is mostly so that we can start our seq_no counter from the highest diff --git a/sql/log.h b/sql/log.h index bd20c8aee09..f41b48eba7c 100644 --- a/sql/log.h +++ b/sql/log.h @@ -779,6 +779,7 @@ public: int read_state_from_file(); int write_state_to_file(); int get_most_recent_gtid_list(rpl_gtid **list, uint32 *size); + bool append_state_pos(String *str); bool find_in_binlog_state(uint32 domain_id, uint32 server_id, rpl_gtid *out_gtid); bool lookup_domain_in_binlog_state(uint32 domain_id, rpl_gtid *out_gtid); diff --git a/sql/log_event.cc b/sql/log_event.cc index 9fbcbb68145..f896d3521de 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -4004,7 +4004,7 @@ int Query_log_event::do_apply_event(Relay_log_info const *rli, const_cast<Relay_log_info*>(rli)->gtid_sub_id= 0; gtid= rli->current_gtid; - if (rpl_global_gtid_slave_state.record_gtid(thd, >id, sub_id, true)) + if (rpl_global_gtid_slave_state.record_gtid(thd, >id, sub_id, true, false)) { rli->report(ERROR_LEVEL, ER_CANNOT_UPDATE_GTID_STATE, "Error during COMMIT: failed to update GTID state in " @@ -6895,7 +6895,7 @@ int Xid_log_event::do_apply_event(Relay_log_info const *rli) const_cast<Relay_log_info*>(rli)->gtid_sub_id= 0; gtid= rli->current_gtid; - err= rpl_global_gtid_slave_state.record_gtid(thd, >id, sub_id, true); + err= rpl_global_gtid_slave_state.record_gtid(thd, >id, sub_id, true, false); if (err) { rli->report(ERROR_LEVEL, ER_CANNOT_UPDATE_GTID_STATE, diff --git a/sql/rpl_gtid.cc b/sql/rpl_gtid.cc index a4bdeb9932b..01502c5b0f1 100644 --- a/sql/rpl_gtid.cc +++ b/sql/rpl_gtid.cc @@ -29,7 +29,7 @@ const LEX_STRING rpl_gtid_slave_state_table_name= - { C_STRING_WITH_LEN("rpl_slave_state") }; + { C_STRING_WITH_LEN("gtid_slave_pos") }; void @@ -73,7 +73,7 @@ rpl_slave_state::record_and_update_gtid(THD *thd, Relay_log_info *rli) if ((sub_id= rli->gtid_sub_id)) { rli->gtid_sub_id= 0; - if (record_gtid(thd, &rli->current_gtid, sub_id, false)) + if (record_gtid(thd, &rli->current_gtid, sub_id, false, false)) return 1; update_state_hash(sub_id, &rli->current_gtid); } @@ -186,8 +186,6 @@ rpl_slave_state::truncate_state_table(THD *thd) int err= 0; TABLE *table; - mysql_reset_thd_for_next_command(thd, 0); - tlist.init_one_table(STRING_WITH_LEN("mysql"), rpl_gtid_slave_state_table_name.str, rpl_gtid_slave_state_table_name.length, @@ -234,7 +232,7 @@ static const TABLE_FIELD_TYPE mysql_rpl_slave_state_coltypes[4]= { static const uint mysql_rpl_slave_state_pk_parts[]= {0, 1}; -static const TABLE_FIELD_DEF mysql_rpl_slave_state_tabledef= { +static const TABLE_FIELD_DEF mysql_gtid_slave_pos_tabledef= { array_elements(mysql_rpl_slave_state_coltypes), mysql_rpl_slave_state_coltypes, array_elements(mysql_rpl_slave_state_pk_parts), @@ -256,14 +254,14 @@ protected: static Gtid_db_intact gtid_table_intact; /* - Check that the mysql.rpl_slave_state table has the correct definition. + Check that the mysql.gtid_slave_pos table has the correct definition. */ int gtid_check_rpl_slave_state_table(TABLE *table) { int err; - if ((err= gtid_table_intact.check(table, &mysql_rpl_slave_state_tabledef))) + if ((err= gtid_table_intact.check(table, &mysql_gtid_slave_pos_tabledef))) my_error(ER_GTID_OPEN_TABLE_FAILED, MYF(0), "mysql", rpl_gtid_slave_state_table_name.str); return err; @@ -286,7 +284,7 @@ gtid_check_rpl_slave_state_table(TABLE *table) */ int rpl_slave_state::record_gtid(THD *thd, const rpl_gtid *gtid, uint64 sub_id, - bool in_transaction) + bool in_transaction, bool in_statement) { TABLE_LIST tlist; int err= 0; @@ -297,7 +295,8 @@ rpl_slave_state::record_gtid(THD *thd, const rpl_gtid *gtid, uint64 sub_id, ulonglong thd_saved_option= thd->variables.option_bits; Query_tables_list lex_backup; - mysql_reset_thd_for_next_command(thd, 0); + if (!in_statement) + mysql_reset_thd_for_next_command(thd, 0); DBUG_EXECUTE_IF("gtid_inject_record_gtid", { @@ -626,7 +625,7 @@ gtid_parser_helper(char **ptr, char *end, rpl_gtid *out_gtid) */ int rpl_slave_state::load(THD *thd, char *state_from_master, size_t len, - bool reset) + bool reset, bool in_statement) { char *end= state_from_master + len; @@ -645,7 +644,7 @@ rpl_slave_state::load(THD *thd, char *state_from_master, size_t len, if (gtid_parser_helper(&state_from_master, end, >id) || !(sub_id= next_subid(gtid.domain_id)) || - record_gtid(thd, >id, sub_id, false) || + record_gtid(thd, >id, sub_id, false, in_statement) || update(gtid.domain_id, gtid.server_id, sub_id, gtid.seq_no)) return 1; if (state_from_master == end) @@ -980,6 +979,23 @@ rpl_binlog_state::get_most_recent_gtid_list(rpl_gtid **list, uint32 *size) } +bool +rpl_binlog_state::append_pos(String *str) +{ + uint32 i; + bool first= true; + + for (i= 0; i < hash.records; ++i) + { + element *e= (element *)my_hash_element(&hash, i); + if (rpl_slave_state_tostring_helper(str, e->last_gtid, &first)) + return true; + } + + return false; +} + + slave_connection_state::slave_connection_state() { my_hash_init(&hash, &my_charset_bin, 32, diff --git a/sql/rpl_gtid.h b/sql/rpl_gtid.h index bd6663c0659..cc3c99f40b7 100644 --- a/sql/rpl_gtid.h +++ b/sql/rpl_gtid.h @@ -91,11 +91,12 @@ struct rpl_slave_state int update(uint32 domain_id, uint32 server_id, uint64 sub_id, uint64 seq_no); int truncate_state_table(THD *thd); int record_gtid(THD *thd, const rpl_gtid *gtid, uint64 sub_id, - bool in_transaction); + bool in_transaction, bool in_statement); uint64 next_subid(uint32 domain_id); int tostring(String *dest, rpl_gtid *extra_gtids, uint32 num_extra); bool domain_to_gtid(uint32 domain_id, rpl_gtid *out_gtid); - int load(THD *thd, char *state_from_master, size_t len, bool reset); + int load(THD *thd, char *state_from_master, size_t len, bool reset, + bool in_statement); bool is_empty(); void lock() { DBUG_ASSERT(inited); mysql_mutex_lock(&LOCK_slave_state); } @@ -150,6 +151,7 @@ struct rpl_binlog_state uint32 count(); int get_gtid_list(rpl_gtid *gtid_list, uint32 list_size); int get_most_recent_gtid_list(rpl_gtid **list, uint32 *size); + bool append_pos(String *str); rpl_gtid *find(uint32 domain_id, uint32 server_id); }; diff --git a/sql/rpl_mi.cc b/sql/rpl_mi.cc index 92dbf68d7a2..4ffe4f37cac 100644 --- a/sql/rpl_mi.cc +++ b/sql/rpl_mi.cc @@ -37,7 +37,8 @@ Master_info::Master_info(LEX_STRING *connection_name_arg, checksum_alg_before_fd(BINLOG_CHECKSUM_ALG_UNDEF), connect_retry(DEFAULT_CONNECT_RETRY), inited(0), abort_slave(0), slave_running(0), slave_run_id(0), sync_counter(0), - heartbeat_period(0), received_heartbeats(0), master_id(0), using_gtid(0) + heartbeat_period(0), received_heartbeats(0), master_id(0), + using_gtid(USE_GTID_NO) { host[0] = 0; user[0] = 0; password[0] = 0; ssl_ca[0]= 0; ssl_capath[0]= 0; ssl_cert[0]= 0; @@ -152,7 +153,7 @@ void init_master_log_pos(Master_info* mi) mi->master_log_name[0] = 0; mi->master_log_pos = BIN_LOG_HEADER_SIZE; // skip magic number - mi->using_gtid= false; + mi->using_gtid= Master_info::USE_GTID_NO; /* Intentionally init ssl_verify_server_cert to 0, no option available */ mi->ssl_verify_server_cert= 0; @@ -447,7 +448,15 @@ file '%s')", fname); while (!init_strvar_from_file(buf, sizeof(buf), &mi->file, 0)) { if (0 == strncmp(buf, STRING_WITH_LEN("using_gtid="))) - mi->using_gtid= (0 != atoi(buf + sizeof("using_gtid"))); + { + int val= atoi(buf + sizeof("using_gtid")); + if (val == Master_info::USE_GTID_CURRENT_POS) + mi->using_gtid= Master_info::USE_GTID_CURRENT_POS; + else if (val == Master_info::USE_GTID_SLAVE_POS) + mi->using_gtid= Master_info::USE_GTID_SLAVE_POS; + else + mi->using_gtid= Master_info::USE_GTID_NO; + } } } } diff --git a/sql/rpl_mi.h b/sql/rpl_mi.h index 64501e96f00..916bd0dae02 100644 --- a/sql/rpl_mi.h +++ b/sql/rpl_mi.h @@ -130,10 +130,14 @@ class Master_info : public Slave_reporting_capability DYNAMIC_ARRAY ignore_server_ids; ulong master_id; /* - True if slave position is set using GTID state rather than old-style - file/offset binlog position. + Which kind of GTID position (if any) is used when connecting to master. + + Note that you can not change the numeric values of these, they are used + in master.info. */ - bool using_gtid; + enum { + USE_GTID_NO= 0, USE_GTID_CURRENT_POS= 1, USE_GTID_SLAVE_POS= 2 + } using_gtid; }; int init_master_info(Master_info* mi, const char* master_info_fname, const char* slave_info_fname, diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index d7d5710b048..539e90d7cb5 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -6540,8 +6540,8 @@ ER_GTID_POSITION_NOT_FOUND_IN_BINLOG ER_CANNOT_LOAD_SLAVE_GTID_STATE eng "Failed to load replication slave GTID state from table %s.%s" ER_MASTER_GTID_POS_CONFLICTS_WITH_BINLOG - eng "Requested GTID_POS %u-%u-%llu conflicts with the binary log which contains a more recent GTID %u-%u-%llu. To use the requested GTID_POS, the old binlog must be removed with RESET MASTER to avoid out-of-order binlog" + eng "Specified GTID %u-%u-%llu conflicts with the binary log which contains a more recent GTID %u-%u-%llu. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos." ER_MASTER_GTID_POS_MISSING_DOMAIN - eng "Requested GTID_POS contains no value for replication domain %u. This conflicts with the binary log which contains GTID %u-%u-%llu. To use the requested GTID_POS, the old binlog must be removed with RESET MASTER to avoid out-of-order binlog" + eng "Specified value for @@gtid_slave_pos contains no value for replication domain %u. This conflicts with the binary log which contains GTID %u-%u-%llu. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos." ER_UNTIL_REQUIRES_USING_GTID eng "START SLAVE UNTIL master_gtid_pos requires that slave is using GTID" diff --git a/sql/slave.cc b/sql/slave.cc index 1b3154e20ab..bf7e81edf71 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -810,7 +810,8 @@ int start_slave_threads(bool need_slave_mutex, bool wait_for_start, while one of the threads is running, they are in use and cannot be removed. */ - if (mi->using_gtid && !mi->slave_running && !mi->rli.slave_running) + if (mi->using_gtid != Master_info::USE_GTID_NO && + !mi->slave_running && !mi->rli.slave_running) { purge_relay_logs(&mi->rli, NULL, 0, &errmsg); mi->master_log_name[0]= 0; @@ -1819,7 +1820,7 @@ after_set_capability: restart or reconnect, we might end up re-fetching and hence re-applying the same event(s) again. */ - if (mi->using_gtid && !mi->master_log_name[0]) + if (mi->using_gtid != Master_info::USE_GTID_NO && !mi->master_log_name[0]) { int rc; char str_buf[256]; @@ -1849,7 +1850,9 @@ after_set_capability: connect_state.append(STRING_WITH_LEN("SET @slave_connect_state='"), system_charset_info); - if (rpl_append_gtid_state(&connect_state, true)) + if (rpl_append_gtid_state(&connect_state, + mi->using_gtid == + Master_info::USE_GTID_CURRENT_POS)) { err_code= ER_OUTOFMEMORY; errmsg= "The slave I/O thread stops because a fatal out-of-memory " @@ -1917,7 +1920,7 @@ after_set_capability: } } } - if (!mi->using_gtid) + if (mi->using_gtid == Master_info::USE_GTID_NO) { /* If we are not using GTID to connect this time, then instead request @@ -1943,7 +1946,7 @@ after_set_capability: (master_row[0] != NULL)) { rpl_global_gtid_slave_state.load(mi->io_thd, master_row[0], - strlen(master_row[0]), false); + strlen(master_row[0]), false, false); } else if (check_io_slave_killed(mi->io_thd, mi, NULL)) goto slave_killed_err; @@ -2307,8 +2310,8 @@ static bool send_show_master_info_header(THD *thd, bool full, FN_REFLEN)); field_list.push_back(new Item_return_int("Master_Server_Id", sizeof(ulong), MYSQL_TYPE_LONG)); - field_list.push_back(new Item_return_int("Using_Gtid", sizeof(ulong), - MYSQL_TYPE_LONG)); + field_list.push_back(new Item_empty_string("Using_Gtid", + sizeof("Current_Pos")-1)); if (full) { field_list.push_back(new Item_return_int("Retried_transactions", @@ -2321,7 +2324,8 @@ static bool send_show_master_info_header(THD *thd, bool full, 10, MYSQL_TYPE_LONG)); field_list.push_back(new Item_float("Slave_heartbeat_period", 0.0, 3, 10)); - field_list.push_back(new Item_empty_string("Gtid_Pos", gtid_pos_length)); + field_list.push_back(new Item_empty_string("Gtid_Slave_Pos", + gtid_pos_length)); } if (protocol->send_result_set_metadata(&field_list, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) @@ -2488,7 +2492,10 @@ static bool send_show_master_info_data(THD *thd, Master_info *mi, bool full, } // Master_Server_id protocol->store((uint32) mi->master_id); - protocol->store((uint32) (mi->using_gtid != 0)); + protocol->store((mi->using_gtid==Master_info::USE_GTID_NO ? "No" : + (mi->using_gtid==Master_info::USE_GTID_SLAVE_POS ? + "Slave_Pos" : "Current_Pos")), + &my_charset_bin); if (full) { protocol->store((uint32) mi->rli.retried_trans); diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 4c1d917aeae..f654c00810e 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -301,8 +301,10 @@ struct LEX_MASTER_INFO changed variable or if it should be left at old value */ enum {LEX_MI_UNCHANGED, LEX_MI_DISABLE, LEX_MI_ENABLE} - ssl, ssl_verify_server_cert, heartbeat_opt, repl_ignore_server_ids_opt, - use_gtid_opt; + ssl, ssl_verify_server_cert, heartbeat_opt, repl_ignore_server_ids_opt; + enum { + LEX_GTID_UNCHANGED, LEX_GTID_NO, LEX_GTID_CURRENT_POS, LEX_GTID_SLAVE_POS + } use_gtid_opt; void init() { @@ -318,9 +320,10 @@ struct LEX_MASTER_INFO pos= relay_log_pos= server_id= port= connect_retry= 0; heartbeat_period= 0; ssl= ssl_verify_server_cert= heartbeat_opt= - repl_ignore_server_ids_opt= use_gtid_opt= LEX_MI_UNCHANGED; + repl_ignore_server_ids_opt= LEX_MI_UNCHANGED; gtid_pos_str.length= 0; gtid_pos_str.str= NULL; + use_gtid_opt= LEX_GTID_UNCHANGED; } }; diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 2e10af0aa8c..82f471d5ddf 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -2511,7 +2511,7 @@ int start_slave(THD* thd , Master_info* mi, bool net_report) slave_errno= ER_BAD_SLAVE_UNTIL_COND; goto err; } - if (!mi->using_gtid) + if (mi->using_gtid == Master_info::USE_GTID_NO) { slave_errno= ER_UNTIL_REQUIRES_USING_GTID; goto err; @@ -3112,12 +3112,14 @@ bool change_master(THD* thd, Master_info* mi, bool *master_info_added) mi->rli.group_relay_log_pos= mi->rli.event_relay_log_pos= lex_mi->relay_log_pos; } - if (lex_mi->use_gtid_opt == LEX_MASTER_INFO::LEX_MI_ENABLE) - mi->using_gtid= true; - else if (lex_mi->use_gtid_opt == LEX_MASTER_INFO::LEX_MI_DISABLE || + if (lex_mi->use_gtid_opt == LEX_MASTER_INFO::LEX_GTID_SLAVE_POS) + mi->using_gtid= Master_info::USE_GTID_SLAVE_POS; + else if (lex_mi->use_gtid_opt == LEX_MASTER_INFO::LEX_GTID_CURRENT_POS) + mi->using_gtid= Master_info::USE_GTID_CURRENT_POS; + else if (lex_mi->use_gtid_opt == LEX_MASTER_INFO::LEX_GTID_NO || lex_mi->log_file_name || lex_mi->pos || lex_mi->relay_log_name || lex_mi->relay_log_pos) - mi->using_gtid= false; + mi->using_gtid= Master_info::USE_GTID_NO; /* If user did specify neither host nor port nor any log name nor any log @@ -3173,7 +3175,7 @@ bool change_master(THD* thd, Master_info* mi, bool *master_info_added) goto err; } - if (mi->using_gtid) + if (mi->using_gtid != Master_info::USE_GTID_NO) { /* Clear the position in the master binlogs, so that we request the @@ -3657,7 +3659,7 @@ int log_loaded_block(IO_CACHE* file) /** - Initialise the slave replication state from the mysql.rpl_slave_state table. + Initialise the slave replication state from the mysql.gtid_slave_pos table. This is called each time an SQL thread starts, but the data is only actually loaded on the first call. @@ -3669,7 +3671,7 @@ int log_loaded_block(IO_CACHE* file) The one containing the current slave state is the one with the maximal sub_id value, within each domain_id. - CREATE TABLE mysql.rpl_slave_state ( + CREATE TABLE mysql.gtid_slave_pos ( domain_id INT UNSIGNED NOT NULL, sub_id BIGINT UNSIGNED NOT NULL, server_id INT UNSIGNED NOT NULL, @@ -3705,7 +3707,7 @@ rpl_append_gtid_state(String *dest, bool use_binlog) rpl_gtid *gtid_list= NULL; uint32 num_gtids= 0; - if (opt_bin_log && + if (use_binlog && opt_bin_log && (err= mysql_bin_log.get_most_recent_gtid_list(>id_list, &num_gtids))) return err; @@ -3717,9 +3719,12 @@ rpl_append_gtid_state(String *dest, bool use_binlog) bool -rpl_gtid_pos_check(char *str, size_t len) +rpl_gtid_pos_check(THD *thd, char *str, size_t len) { + /* ToDo: Use gtid_strict_mode sysvar, when implemented. */ + static const bool gtid_strict_mode= false; slave_connection_state tmp_slave_state; + bool gave_conflict_warning= false, gave_missing_warning= false; /* Check that we can parse the supplied string. */ if (tmp_slave_state.load(str, len)) @@ -3754,18 +3759,43 @@ rpl_gtid_pos_check(char *str, size_t len) continue; if (!(slave_gtid= tmp_slave_state.find(binlog_gtid->domain_id))) { - my_error(ER_MASTER_GTID_POS_MISSING_DOMAIN, MYF(0), - binlog_gtid->domain_id, binlog_gtid->domain_id, - binlog_gtid->server_id, binlog_gtid->seq_no); - break; + if (gtid_strict_mode) + { + my_error(ER_MASTER_GTID_POS_MISSING_DOMAIN, MYF(0), + binlog_gtid->domain_id, binlog_gtid->domain_id, + binlog_gtid->server_id, binlog_gtid->seq_no); + break; + } + else if (!gave_missing_warning) + { + push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_MASTER_GTID_POS_MISSING_DOMAIN, + ER(ER_MASTER_GTID_POS_MISSING_DOMAIN), + binlog_gtid->domain_id, binlog_gtid->domain_id, + binlog_gtid->server_id, binlog_gtid->seq_no); + gave_missing_warning= true; + } } - if (slave_gtid->seq_no < binlog_gtid->seq_no) + else if (slave_gtid->seq_no < binlog_gtid->seq_no) { - my_error(ER_MASTER_GTID_POS_CONFLICTS_WITH_BINLOG, MYF(0), - slave_gtid->domain_id, slave_gtid->server_id, - slave_gtid->seq_no, binlog_gtid->domain_id, - binlog_gtid->server_id, binlog_gtid->seq_no); - break; + if (gtid_strict_mode) + { + my_error(ER_MASTER_GTID_POS_CONFLICTS_WITH_BINLOG, MYF(0), + slave_gtid->domain_id, slave_gtid->server_id, + slave_gtid->seq_no, binlog_gtid->domain_id, + binlog_gtid->server_id, binlog_gtid->seq_no); + break; + } + else if (!gave_conflict_warning) + { + push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_MASTER_GTID_POS_CONFLICTS_WITH_BINLOG, + ER(ER_MASTER_GTID_POS_CONFLICTS_WITH_BINLOG), + slave_gtid->domain_id, slave_gtid->server_id, + slave_gtid->seq_no, binlog_gtid->domain_id, + binlog_gtid->server_id, binlog_gtid->seq_no); + gave_conflict_warning= true; + } } } my_free(binlog_gtid_list); @@ -3780,7 +3810,7 @@ rpl_gtid_pos_check(char *str, size_t len) bool rpl_gtid_pos_update(THD *thd, char *str, size_t len) { - if (rpl_global_gtid_slave_state.load(thd, str, len, true)) + if (rpl_global_gtid_slave_state.load(thd, str, len, true, true)) { my_error(ER_FAILED_GTID_STATE_INIT, MYF(0)); return true; diff --git a/sql/sql_repl.h b/sql/sql_repl.h index 3af8f721bd7..820ffed0928 100644 --- a/sql/sql_repl.h +++ b/sql/sql_repl.h @@ -70,7 +70,7 @@ void rpl_init_gtid_slave_state(); void rpl_deinit_gtid_slave_state(); int gtid_state_from_binlog_pos(const char *name, uint32 pos, String *out_str); int rpl_append_gtid_state(String *dest, bool use_binlog); -bool rpl_gtid_pos_check(char *str, size_t len); +bool rpl_gtid_pos_check(THD *thd, char *str, size_t len); bool rpl_gtid_pos_update(THD *thd, char *str, size_t len); #endif /* HAVE_REPLICATION */ diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index e995b410a85..d02f87c6bab 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -916,6 +916,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); %token CUBE_SYM /* SQL-2003-R */ %token CURDATE /* MYSQL-FUNC */ %token CURRENT_USER /* SQL-2003-R */ +%token CURRENT_POS_SYM %token CURSOR_SYM /* SQL-2003-R */ %token CURSOR_NAME_SYM /* SQL-2003-N */ %token CURTIME /* MYSQL-FUNC */ @@ -1295,6 +1296,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); %token SIMPLE_SYM /* SQL-2003-N */ %token SLAVE %token SLAVES +%token SLAVE_POS_SYM %token SLOW %token SMALLINT /* SQL-2003-R */ %token SNAPSHOT_SYM @@ -2065,15 +2067,34 @@ master_file_def: /* Adjust if < BIN_LOG_HEADER_SIZE (same comment as Lex->mi.pos) */ Lex->mi.relay_log_pos = max(BIN_LOG_HEADER_SIZE, Lex->mi.relay_log_pos); } - | MASTER_USE_GTID_SYM EQ ulong_num + | MASTER_USE_GTID_SYM EQ CURRENT_POS_SYM { - if (Lex->mi.use_gtid_opt != LEX_MASTER_INFO::LEX_MI_UNCHANGED) + if (Lex->mi.use_gtid_opt != LEX_MASTER_INFO::LEX_GTID_UNCHANGED) { my_error(ER_DUP_ARGUMENT, MYF(0), "MASTER_use_gtid"); MYSQL_YYABORT; } - Lex->mi.use_gtid_opt= $3 ? - LEX_MASTER_INFO::LEX_MI_ENABLE : LEX_MASTER_INFO::LEX_MI_DISABLE; + Lex->mi.use_gtid_opt= LEX_MASTER_INFO::LEX_GTID_CURRENT_POS; + } + ; + | MASTER_USE_GTID_SYM EQ SLAVE_POS_SYM + { + if (Lex->mi.use_gtid_opt != LEX_MASTER_INFO::LEX_GTID_UNCHANGED) + { + my_error(ER_DUP_ARGUMENT, MYF(0), "MASTER_use_gtid"); + MYSQL_YYABORT; + } + Lex->mi.use_gtid_opt= LEX_MASTER_INFO::LEX_GTID_SLAVE_POS; + } + ; + | MASTER_USE_GTID_SYM EQ NO_SYM + { + if (Lex->mi.use_gtid_opt != LEX_MASTER_INFO::LEX_GTID_UNCHANGED) + { + my_error(ER_DUP_ARGUMENT, MYF(0), "MASTER_use_gtid"); + MYSQL_YYABORT; + } + Lex->mi.use_gtid_opt= LEX_MASTER_INFO::LEX_GTID_NO; } ; @@ -13254,6 +13275,7 @@ keyword_sp: | CONSTRAINT_NAME_SYM {} | CONTEXT_SYM {} | CONTRIBUTORS_SYM {} + | CURRENT_POS_SYM {} | CPU_SYM {} | CUBE_SYM {} | CURSOR_NAME_SYM {} @@ -13440,6 +13462,7 @@ keyword_sp: | SIMPLE_SYM {} | SHARE_SYM {} | SHUTDOWN {} + | SLAVE_POS_SYM {} | SLOW {} | SNAPSHOT_SYM {} | SOFT_SYM {} diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index e51fd1cc11c..9edbe789196 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -1228,8 +1228,61 @@ static Sys_var_ulonglong Sys_gtid_seq_no( #ifdef HAVE_REPLICATION +static unsigned char opt_gtid_binlog_pos_dummy; +static Sys_var_gtid_binlog_pos Sys_gtid_binlog_pos( + "gtid_binlog_pos", "Last GTID logged to the binary log, per replication" + "domain", + READ_ONLY GLOBAL_VAR(opt_gtid_binlog_pos_dummy), NO_CMD_LINE); + + +uchar * +Sys_var_gtid_binlog_pos::global_value_ptr(THD *thd, LEX_STRING *base) +{ + char buf[128]; + String str(buf, sizeof(buf), system_charset_info); + char *p; + + str.length(0); + if ((opt_bin_log && mysql_bin_log.append_state_pos(&str)) || + !(p= thd->strmake(str.ptr(), str.length()))) + { + my_error(ER_OUT_OF_RESOURCES, MYF(0)); + return NULL; + } + + return (uchar *)p; +} + + +static unsigned char opt_gtid_current_pos_dummy; +static Sys_var_gtid_current_pos Sys_gtid_current_pos( + "gtid_current_pos", "Current GTID position of the server. Per " + "replication domain, this is either the last GTID replicated by a " + "slave thread, or the GTID logged to the binary log, whichever is " + "most recent.", + READ_ONLY GLOBAL_VAR(opt_gtid_current_pos_dummy), NO_CMD_LINE); + + +uchar * +Sys_var_gtid_current_pos::global_value_ptr(THD *thd, LEX_STRING *base) +{ + String str; + char *p; + + str.length(0); + if (rpl_append_gtid_state(&str, true) || + !(p= thd->strmake(str.ptr(), str.length()))) + { + my_error(ER_OUT_OF_RESOURCES, MYF(0)); + return NULL; + } + + return (uchar *)p; +} + + bool -Sys_var_gtid_pos::do_check(THD *thd, set_var *var) +Sys_var_gtid_slave_pos::do_check(THD *thd, set_var *var) { String str, *res; bool running; @@ -1242,7 +1295,12 @@ Sys_var_gtid_pos::do_check(THD *thd, set_var *var) return true; if (!(res= var->value->val_str(&str))) return true; - if (rpl_gtid_pos_check(&((*res)[0]), res->length())) + if (thd->in_active_multi_stmt_transaction()) + { + my_error(ER_CANT_DO_THIS_DURING_AN_TRANSACTION, MYF(0)); + return true; + } + if (rpl_gtid_pos_check(thd, &((*res)[0]), res->length())) return true; if (!(var->save_result.string_value.str= @@ -1257,7 +1315,7 @@ Sys_var_gtid_pos::do_check(THD *thd, set_var *var) bool -Sys_var_gtid_pos::global_update(THD *thd, set_var *var) +Sys_var_gtid_slave_pos::global_update(THD *thd, set_var *var) { bool err; @@ -1283,13 +1341,13 @@ Sys_var_gtid_pos::global_update(THD *thd, set_var *var) uchar * -Sys_var_gtid_pos::global_value_ptr(THD *thd, LEX_STRING *base) +Sys_var_gtid_slave_pos::global_value_ptr(THD *thd, LEX_STRING *base) { String str; char *p; str.length(0); - if (rpl_append_gtid_state(&str, true) || + if (rpl_append_gtid_state(&str, false) || !(p= thd->strmake(str.ptr(), str.length()))) { my_error(ER_OUT_OF_RESOURCES, MYF(0)); @@ -1300,14 +1358,12 @@ Sys_var_gtid_pos::global_value_ptr(THD *thd, LEX_STRING *base) } -static unsigned char opt_gtid_pos_dummy; -static Sys_var_gtid_pos Sys_gtid_pos( - "gtid_pos", +static unsigned char opt_gtid_slave_pos_dummy; +static Sys_var_gtid_slave_pos Sys_gtid_slave_pos( + "gtid_slave_pos", "The list of global transaction IDs that were last replicated on the " - "server, one for each replication domain. This defines where a slave " - "starts replicating from on a master when connecting with global " - "transaction ID.", - GLOBAL_VAR(opt_gtid_pos_dummy), NO_CMD_LINE); + "server, one for each replication domain.", + GLOBAL_VAR(opt_gtid_slave_pos_dummy), NO_CMD_LINE); #endif diff --git a/sql/sys_vars.h b/sql/sys_vars.h index 8a92f22f3c2..d68761d91ca 100644 --- a/sql/sys_vars.h +++ b/sql/sys_vars.h @@ -2024,12 +2024,114 @@ public: /** - Class for @@global.gtid_pos. + Class for @@global.gtid_current_pos. */ -class Sys_var_gtid_pos: public sys_var +class Sys_var_gtid_current_pos: public sys_var { public: - Sys_var_gtid_pos(const char *name_arg, + Sys_var_gtid_current_pos(const char *name_arg, + const char *comment, int flag_args, ptrdiff_t off, size_t size, + CMD_LINE getopt) + : sys_var(&all_sys_vars, name_arg, comment, flag_args, off, getopt.id, + getopt.arg_type, SHOW_CHAR, 0, NULL, VARIABLE_NOT_IN_BINLOG, + NULL, NULL, NULL) + { + option.var_type= GET_STR; + } + bool do_check(THD *thd, set_var *var) + { + DBUG_ASSERT(false); + return true; + } + bool session_update(THD *thd, set_var *var) + { + DBUG_ASSERT(false); + return true; + } + bool global_update(THD *thd, set_var *var) + { + DBUG_ASSERT(false); + return true; + } + bool check_update_type(Item_result type) { + DBUG_ASSERT(false); + return false; + } + void session_save_default(THD *thd, set_var *var) + { + DBUG_ASSERT(false); + } + void global_save_default(THD *thd, set_var *var) + { + DBUG_ASSERT(false); + } + uchar *session_value_ptr(THD *thd, LEX_STRING *base) + { + DBUG_ASSERT(false); + return NULL; + } + uchar *global_value_ptr(THD *thd, LEX_STRING *base); +}; + + +/** + Class for @@global.gtid_binlog_pos. +*/ +class Sys_var_gtid_binlog_pos: public sys_var +{ +public: + Sys_var_gtid_binlog_pos(const char *name_arg, + const char *comment, int flag_args, ptrdiff_t off, size_t size, + CMD_LINE getopt) + : sys_var(&all_sys_vars, name_arg, comment, flag_args, off, getopt.id, + getopt.arg_type, SHOW_CHAR, 0, NULL, VARIABLE_NOT_IN_BINLOG, + NULL, NULL, NULL) + { + option.var_type= GET_STR; + } + bool do_check(THD *thd, set_var *var) + { + DBUG_ASSERT(false); + return true; + } + bool session_update(THD *thd, set_var *var) + { + DBUG_ASSERT(false); + return true; + } + bool global_update(THD *thd, set_var *var) + { + DBUG_ASSERT(false); + return true; + } + bool check_update_type(Item_result type) { + DBUG_ASSERT(false); + return false; + } + void session_save_default(THD *thd, set_var *var) + { + DBUG_ASSERT(false); + } + void global_save_default(THD *thd, set_var *var) + { + DBUG_ASSERT(false); + } + uchar *session_value_ptr(THD *thd, LEX_STRING *base) + { + DBUG_ASSERT(false); + return NULL; + } + uchar *global_value_ptr(THD *thd, LEX_STRING *base); +}; + + +/** + Class for @@global.gtid_slave_pos. +*/ +class Sys_var_gtid_slave_pos: public sys_var +{ +public: + Sys_var_gtid_slave_pos(const char *name_arg, const char *comment, int flag_args, ptrdiff_t off, size_t size, CMD_LINE getopt) : sys_var(&all_sys_vars, name_arg, comment, flag_args, off, getopt.id, |