update
This commit is contained in:
parent
304b5c10a3
commit
1c838a7c1e
9
parse.go
9
parse.go
@ -321,13 +321,14 @@ type BinlogFilter struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func parseBinlogWithFilter(r io.Reader, parse *replication.BinlogParser, filter BinlogFilter, fn func(Transaction)) error {
|
func parseBinlogWithFilter(r io.Reader, parse *replication.BinlogParser, filter BinlogFilter, fn func(Transaction)) error {
|
||||||
var inGtid, exGtid *gtid.Gtid
|
var subGtid, inGtid, exGtid *gtid.Gtid
|
||||||
var err error
|
var err error
|
||||||
if filter.IncludeGtid != "" {
|
if filter.IncludeGtid != "" {
|
||||||
inGtid, err = gtid.Parse(filter.IncludeGtid)
|
inGtid, err = gtid.Parse(filter.IncludeGtid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
subGtid = inGtid.Clone()
|
||||||
}
|
}
|
||||||
if filter.ExcludeGtid != "" {
|
if filter.ExcludeGtid != "" {
|
||||||
exGtid, err = gtid.Parse(filter.ExcludeGtid)
|
exGtid, err = gtid.Parse(filter.ExcludeGtid)
|
||||||
@ -485,6 +486,12 @@ func parseBinlogWithFilter(r io.Reader, parse *replication.BinlogParser, filter
|
|||||||
}
|
}
|
||||||
tx.Size = tx.EndPos - tx.StartPos
|
tx.Size = tx.EndPos - tx.StartPos
|
||||||
callFn(tx)
|
callFn(tx)
|
||||||
|
if subGtid != nil {
|
||||||
|
subGtid.Sub(tx.GTID)
|
||||||
|
if subGtid.EventCount() == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
tx = Transaction{}
|
tx = Transaction{}
|
||||||
}
|
}
|
||||||
currentGtid = ev.Data
|
currentGtid = ev.Data
|
||||||
|
Loading…
x
Reference in New Issue
Block a user