Disable XA ROLLBACK and SAVEPOINT type for QueryEvent

This commit is contained in:
BohuTANG 2020-05-14 16:21:44 +08:00 committed by zhang2014
parent ec9345785b
commit d2aa1f9a47
3 changed files with 12 additions and 6 deletions

View File

@ -97,14 +97,19 @@ namespace MySQLReplication
= header.event_size - EVENT_HEADER_LENGTH - 4 - 4 - 1 - 2 - 2 - status_len - schema_len - 1 - CHECKSUM_CRC32_SIGNATURE_LENGTH;
query.resize(len);
payload.readStrict(reinterpret_cast<char *>(query.data()), len);
if (query == "BEGIN")
if (query.rfind("BEGIN", 0) == 0)
{
typ = BEGIN;
}
else if (query == "SAVEPOINT")
else if (query.rfind("XA", 0) == 0)
{
typ = SAVEPOINT;
if (query.rfind("XA ROLLBACK", 0) == 0)
throw ReplicationError("ParseQueryEvent: Unsupported query event:" + query, ErrorCodes::UNKNOWN_EXCEPTION);
typ = XA;
}
else if (query.rfind("SAVEPOINT", 0) == 0)
{
throw ReplicationError("ParseQueryEvent: Unsupported query event:" + query, ErrorCodes::UNKNOWN_EXCEPTION);
}
}
@ -756,7 +761,7 @@ namespace MySQLReplication
switch (query->typ)
{
case BEGIN:
case SAVEPOINT: {
case XA: {
event = std::make_shared<DryRunEvent>();
break;
}

View File

@ -340,7 +340,7 @@ namespace MySQLReplication
{
DDL = 0,
BEGIN = 1,
SAVEPOINT = 2
XA = 2
};
class QueryEvent : public EventBase

View File

@ -212,6 +212,7 @@ int main(int, char **)
break;
}
default:
event->dump();
break;
}
}