diff options
author | Sachin Kumar <sachin.setiya@mariadb.com> | 2021-05-27 14:45:10 +0100 |
---|---|---|
committer | Sachin Kumar <sachin.setiya@mariadb.com> | 2021-06-15 09:02:44 +0100 |
commit | 4295181f0714e8c34a56f65b2f0e8d6d2ad51be1 (patch) | |
tree | 92bfa738b1f5eb9a30e0ce66d384c8d9d0c896b9 | |
parent | 91bde0fb67e9da6cb9ee1464ad684c0f681e47c9 (diff) | |
download | mariadb-git-bb-10.2-25709.tar.gz |
MDEV-25709 Replication IO_Thread Connecting Primary server handshake call "SELECT GTID_BINLOG_POS" even when MASTER_USE_GITD=NO and GTID is disabledbb-10.2-25709
Remove the slave `SELECT binlog_gtid_pos()` call on master when it is using
MASTER_USE_GTID=NO
-rw-r--r-- | mysql-test/suite/rpl/r/rpl_gtid_stop_start.result | 6 | ||||
-rw-r--r-- | sql/slave.cc | 55 |
2 files changed, 3 insertions, 58 deletions
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 3f3b5e4344a..53af6fd8d12 100644 --- a/mysql-test/suite/rpl/r/rpl_gtid_stop_start.result +++ b/mysql-test/suite/rpl/r/rpl_gtid_stop_start.result @@ -172,7 +172,7 @@ include/start_slave.inc SELECT domain_id, COUNT(*) FROM mysql.gtid_slave_pos GROUP BY domain_id; domain_id COUNT(*) 0 2 -1 2 +1 1 connection server_1; INSERT INTO t1 VALUES (11); connection server_2; @@ -180,7 +180,7 @@ FLUSH NO_WRITE_TO_BINLOG TABLES; SELECT domain_id, COUNT(*) FROM mysql.gtid_slave_pos GROUP BY domain_id; domain_id COUNT(*) 0 2 -1 2 +1 1 include/start_slave.inc connection server_1; INSERT INTO t1 VALUES (12); @@ -190,7 +190,7 @@ FLUSH NO_WRITE_TO_BINLOG TABLES; SELECT domain_id, COUNT(*) FROM mysql.gtid_slave_pos GROUP BY domain_id; domain_id COUNT(*) 0 2 -1 2 +1 1 *** MDEV-4650: show variables; ERROR 1946 (HY000): Failed to load replication slave GTID position *** connection server_2; SET sql_log_bin=0; diff --git a/sql/slave.cc b/sql/slave.cc index 761fdbe807a..838fa081789 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -2174,61 +2174,6 @@ after_set_capability: } } } - else - { - /* - If we are not using GTID to connect this time, then instead request - the corresponding GTID position from the master, so that the user - can reconnect the next time using MASTER_GTID_POS=AUTO. - */ - char quote_buf[2*sizeof(mi->master_log_name)+1]; - char str_buf[28+2*sizeof(mi->master_log_name)+10]; - String query(str_buf, sizeof(str_buf), system_charset_info); - query.length(0); - - query.append("SELECT binlog_gtid_pos('"); - escape_quotes_for_mysql(&my_charset_bin, quote_buf, sizeof(quote_buf), - mi->master_log_name, strlen(mi->master_log_name)); - query.append(quote_buf); - query.append("',"); - query.append_ulonglong(mi->master_log_pos); - query.append(")"); - - if (!mysql_real_query(mysql, query.c_ptr_safe(), query.length()) && - (master_res= mysql_store_result(mysql)) && - (master_row= mysql_fetch_row(master_res)) && - (master_row[0] != NULL)) - { - rpl_global_gtid_slave_state->load(mi->io_thd, master_row[0], - strlen(master_row[0]), false, false); - } - else if (check_io_slave_killed(mi, NULL)) - goto slave_killed_err; - else if (is_network_error(mysql_errno(mysql))) - { - mi->report(WARNING_LEVEL, mysql_errno(mysql), NULL, - "Get master GTID position failed with error: %s", mysql_error(mysql)); - goto network_err; - } - else - { - /* - ToDo: If the master does not have the binlog_gtid_pos() function, it - just means that it is an old master with no GTID support, so we should - do nothing. - - However, if binlog_gtid_pos() exists, but fails or returns NULL, then - it means that the requested position is not valid. We could use this - to catch attempts to replicate from within the middle of an event, - avoiding strange failures or possible corruption. - */ - } - if (master_res) - { - mysql_free_result(master_res); - master_res= NULL; - } - } err: if (errmsg) |