Remove dryrun event to update position

This commit is contained in:
BohuTANG 2020-09-07 13:18:28 +08:00
parent 12a21cb1a4
commit 576c6e9757
2 changed files with 7 additions and 8 deletions

View File

@ -100,8 +100,7 @@ namespace MySQLReplication
payload.readStrict(reinterpret_cast<char *>(schema.data()), schema_len);
payload.ignore(1);
size_t len
= header.event_size - EVENT_HEADER_LENGTH - 4 - 4 - 1 - 2 - 2 - status_len - schema_len - 1 - CHECKSUM_CRC32_SIGNATURE_LENGTH;
size_t len = payload.available() - CHECKSUM_CRC32_SIGNATURE_LENGTH;
query.resize(len);
payload.readStrict(reinterpret_cast<char *>(query.data()), len);
if (query.starts_with("BEGIN") || query.starts_with("COMMIT"))
@ -779,11 +778,8 @@ namespace MySQLReplication
gtid_sets.update(gtid_event->gtid);
break;
}
default: {
/// DryRun event.
binlog_pos = event->header.log_pos;
break;
}
default:
throw ReplicationError("Position update with unsupport event", ErrorCodes::LOGICAL_ERROR);
}
}
@ -910,7 +906,6 @@ namespace MySQLReplication
event = std::make_shared<DryRunEvent>();
event->parseHeader(payload);
event->parseEvent(payload);
position.update(event);
break;
}
}

View File

@ -356,6 +356,10 @@ int main(int argc, char ** argv)
break;
}
default:
if (event->header.type != MySQLReplication::EventType::HEARTBEAT_EVENT)
{
event->dump(std::cerr);
}
break;
}
}