Skip to content

Commit 0f719d3

Browse files
authored
Merge pull request #5240 from sysown/v3.0-5062
Improve fast forward replication CLIENT_DEPRECATE_EOF validation (closes #5062)
2 parents 3c4e09f + 5485bb0 commit 0f719d3

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

lib/mysql_connection.cpp

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -738,8 +738,29 @@ bool MySQL_Connection::match_ff_req_options(const MySQL_Connection *c) {
738738

739739
// Only required to be checked for fast_forward sessions
740740
if (frontend->myds && frontend->myds->sess->session_fast_forward) {
741-
return (frontend->options.client_flag & CLIENT_DEPRECATE_EOF) ==
741+
bool ret = (frontend->options.client_flag & CLIENT_DEPRECATE_EOF) ==
742742
(backend->mysql->server_capabilities & CLIENT_DEPRECATE_EOF);
743+
if (ret == false) {
744+
if (frontend->myds && frontend->myds->PSarrayIN) {
745+
PtrSizeArray * PSarrayIN = frontend->myds->PSarrayIN;
746+
if (PSarrayIN->len == 1) {
747+
PtrSize_t pkt = PSarrayIN->pdata[0];
748+
if (pkt.size >= 5) {
749+
unsigned char c = *reinterpret_cast<unsigned char*>(static_cast<char*>(pkt.ptr) + 4);
750+
switch ((enum_mysql_command)c) {
751+
case _MYSQL_COM_BINLOG_DUMP:
752+
case _MYSQL_COM_BINLOG_DUMP_GTID:
753+
case _MYSQL_COM_REGISTER_SLAVE:
754+
ret = true;
755+
break;
756+
default:
757+
break;
758+
};
759+
}
760+
}
761+
}
762+
}
763+
return ret;
743764
} else {
744765
return true;
745766
}

0 commit comments

Comments
 (0)