master
兔子 1 year ago
parent 99a7d11907
commit 6e5ce4613c

@ -44,7 +44,7 @@ type Transaction struct {
Status uint8 `json:"status"`
sqlOrigin []string `json:"sqlOrigin"`
Txs []TxDetail `json:"txs"`
matchFilterSchema bool
validSchemaCount int
}
func (t Transaction) GetSqlOrigin() []string {
@ -371,6 +371,9 @@ func parseBinlogWithFilter(r io.Reader, parse *replication.BinlogParser, filter
if len(filter.ExcludeTables) == 0 && len(filter.ExcludeTables) == 0 {
return true
}
if db == "" && tb == "" {
return true
}
if _, ok := includeMap["*.*"]; ok {
return true
}
@ -444,7 +447,7 @@ func parseBinlogWithFilter(r io.Reader, parse *replication.BinlogParser, filter
if filter.SmallThan != 0 && filter.SmallThan < tx.Size {
return true
}
if len(tx.Txs) == 0 && tx.matchFilterSchema {
if tx.validSchemaCount == 0 {
return true
}
return fn(tx)
@ -617,9 +620,9 @@ func parseBinlogWithFilter(r io.Reader, parse *replication.BinlogParser, filter
tx.Status = status
}
if !matchTbs(ev.DB, ev.TB) {
tx.matchFilterSchema = true
continue
}
tx.validSchemaCount++
tx.Txs = append(tx.Txs, TxDetail{
StartPos: startPos,
EndPos: int(h.LogPos),

Loading…
Cancel
Save