Documentation ¶
Index ¶
- Constants
- func TimeStringFromInt64TimePacked(tm int64) string
- type Event
- type EventHeader
- type EventSet
- type FormatDescriptionEvent
- type GTIDEvent
- type HeartbeatEvent
- type IPayload
- type MariadbGTIDEvent
- type Parser
- type QueryEvent
- type RotateEvent
- type Row
- type RowsEvent
- type RowsQueryEvent
- type TableMapEvent
- type XidEvent
Constants ¶
const ( // A start event is the first event of a binlog for binlog-version 1 to 3. StartEventV3Type QueryEventType StopEventType RotateEventType IntvarEventType LoadEventType SlaveEventType CreateFileEventType AppendBlockEventType ExecLoadEventType DeleteFileEventType NewLoadEventType RandEventType UserVarEventType // A format description event is the first event of a binlog for binlog-version 4. // It describes how the other events are layed out. FormatDescriptionEventType XidEventType BeginLoadQueryEventType ExecuteLoadQueryEventType TableMapEventType WriteRowsEventV0Type UpdateRowsEventV0Type DeleteRowsEventV0Type WriteRowsEventV1Type UpdateRowsEventV1Type DeleteRowsEventV1Type IncidentEventType HeartbeatEventType IgnoreableEventType RowsQueryEventType WriteRowsEventV2Type UpdateRowsEventV2Type DeleteRowsEventV2Type GTIDEventType AnonymousGtidEventType PreviousGtidsEventType )
Event type of binlog event https://dev.mysql.com/doc/internals/en/binlog-event-type.html
const ( MariadbAnnotateRowsEventType = 160 + iota MariadbBinlogCheckpointEventType MariadbGTIDEventType MariadbGTIDListEventType )
MariaDB binlog events
const ( LogEventBinlogInUseFlag = 1 << iota LogEventForcedRotateFlag LogEventThreadSpecificFlag LogEventSuppressUseFlag LogEventUpdateTableMapVersionFlag LogEventArtificialFlag LogEventRelayLogFlag LogEventIgnorableFlag LogEventNoFilterFlag LogEventMtsIsolateFlag )
Flags of binlog event header's flag https://dev.mysql.com/doc/internals/en/binlog-event-flag.html
const ( ChecksumAlgOff = 0x00 ChecksumAlgCRC32 = 0x01 ChecksumAlgUndef = 0xff )
Binlog checksum
const ( RowWrite = iota RowUpdate RowDelete )
Specify the rows event action
const (
RowsEventFlagStmtEnd = 0x01
)
Rows event flags
Variables ¶
This section is empty.
Functions ¶
func TimeStringFromInt64TimePacked ¶
TimeStringFromInt64TimePacked see log_event.cc TIME_from_longlong_time_packed
Types ¶
type Event ¶
type Event struct { // Data is the original binlog data Data []byte Header EventHeader Payload EventSet }
Event is a binlog event send from mysql
type EventHeader ¶
type EventHeader struct { // Timestamp seconds since unix epoch Timestamp uint32 // EventType https://dev.mysql.com/doc/internals/en/binlog-event-type.html EventType uint8 // ServerID // server-id of the originating mysql-server. Used to filter out events in circular replication. ServerID uint32 // EventSize size of the event (header, post-header, body) EventSize uint32 // LogPos position of the next event LogPos uint32 // Flags // https://dev.mysql.com/doc/internals/en/binlog-event-flag.html Flags uint16 }
EventHeader is the header of a binlog event https://dev.mysql.com/doc/internals/en/binlog-event-header.html
type EventSet ¶
type EventSet struct { // Parsed is true when the event is parsed Parsed bool // FormatDescription event FormatDescription *FormatDescriptionEvent // Rotate event Rotate *RotateEvent // Query event Query *QueryEvent // Xid event Xid *XidEvent // Table map event TableMap *TableMapEvent // Rows event Rows *RowsEvent // Rows query event RowsQuery *RowsQueryEvent // Gtid event GTID *GTIDEvent // Mariadb gtid event MariadbGTID *MariadbGTIDEvent // Heartbeat event Heartbeat *HeartbeatEvent }
EventSet has all event type
type FormatDescriptionEvent ¶
type FormatDescriptionEvent struct { BinlogVersion uint16 MysqlServerVersion [50]byte CreateTimestamp uint32 EventHeaderLength uint8 EventTypeHeaderLengths []byte }
FormatDescriptionEvent see below https://dev.mysql.com/doc/internals/en/format-description-event.html
func (*FormatDescriptionEvent) Decode ¶
func (e *FormatDescriptionEvent) Decode(data []byte) error
Decode decodes the binary data into payload
type GTIDEvent ¶
GTIDEvent sees below rpl_gtid.h
type HeartbeatEvent ¶
type HeartbeatEvent struct {
LogIdent string
}
HeartbeatEvent is sent by master if no more binlog produce See control_events.h
func (*HeartbeatEvent) Decode ¶
func (e *HeartbeatEvent) Decode(data []byte) error
Decode decodes the binary data into payload
type MariadbGTIDEvent ¶
MariadbGTIDEvent no document ...
func (*MariadbGTIDEvent) Decode ¶
func (e *MariadbGTIDEvent) Decode(data []byte) error
Decode decodes the binary data into payload
func (*MariadbGTIDEvent) String ¶
func (e *MariadbGTIDEvent) String() string
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser parse the binlog event
func (*Parser) SetChecksum ¶
SetChecksum set the checksum of server binlog
func (*Parser) SetSyncRule ¶
SetSyncRule set the sync rule for the parser Sync rule only effect rows event, ddl (query event) won't be effected
type QueryEvent ¶
type QueryEvent struct { // Post header SlaveProxyID uint32 ExecutionTime uint32 SchemaLength uint8 ErrorCode uint16 StatusVarsLength uint16 // Payload StatusVars string Schema string Query string // contains filtered or unexported fields }
QueryEvent sees below https://dev.mysql.com/doc/internals/en/query-event.html
func (*QueryEvent) Decode ¶
func (e *QueryEvent) Decode(data []byte) error
Decode decodes the binary data into payload
type RotateEvent ¶
RotateEvent see below https://dev.mysql.com/doc/internals/en/rotate-event.html
func (*RotateEvent) Decode ¶
func (e *RotateEvent) Decode(data []byte) error
Decode decodes the binary data into payload
type RowsEvent ¶
type RowsEvent struct { Action int TableID uint64 Table *TableMapEvent Flags uint16 ExtraData []byte ColumnCount uint64 Bitmap1 []byte Bitmap2 []byte Rows []*Row // Sync desc Rule *rule.SyncDesc // contains filtered or unexported fields }
RowsEvent see below https://dev.mysql.com/doc/internals/en/rows-event.html
type RowsQueryEvent ¶
type RowsQueryEvent struct {
QueryText string
}
RowsQueryEvent sees below https://dev.mysql.com/doc/internals/en/rows-query-event.html
func (*RowsQueryEvent) Decode ¶
func (e *RowsQueryEvent) Decode(data []byte) error
Decode decodes the binary data into payload
type TableMapEvent ¶
type TableMapEvent struct { TableID uint64 Flags uint16 SchemaName string TableName string ColumnCount uint64 ColumnDefine []byte ColumnMeta []uint16 NullBitmask []byte // contains filtered or unexported fields }
TableMapEvent event of TableMapEvent https://dev.mysql.com/doc/internals/en/table-map-event.html
func (*TableMapEvent) Decode ¶
func (e *TableMapEvent) Decode(data []byte) error
Decode decodes the binary data into payload