update
This commit is contained in:
parent
6a7e5fc485
commit
d0dad74b18
12
parse.go
12
parse.go
@ -8,6 +8,7 @@ import (
|
||||
"github.com/starainrt/go-mysql/replication"
|
||||
"io"
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
||||
type TxDetail struct {
|
||||
@ -21,11 +22,12 @@ type TxDetail struct {
|
||||
|
||||
type Transaction struct {
|
||||
GTID string
|
||||
Timestamp int64
|
||||
Time time.Time
|
||||
StartPos int
|
||||
EndPos int
|
||||
Size int
|
||||
SQLOrigin string
|
||||
Timestamp int64
|
||||
RowsCount int
|
||||
Txs []TxDetail
|
||||
}
|
||||
@ -157,8 +159,10 @@ func parseBinlogDetail(r io.Reader, f func(Transaction)) error {
|
||||
}
|
||||
}
|
||||
tx = Transaction{
|
||||
GTID: sql,
|
||||
StartPos: startPos,
|
||||
GTID: sql,
|
||||
StartPos: startPos,
|
||||
Timestamp: int64(h.Timestamp),
|
||||
Time: time.Unix(int64(h.Timestamp), 0),
|
||||
}
|
||||
case "":
|
||||
tx.EndPos = int(h.LogPos)
|
||||
@ -242,7 +246,7 @@ func GetDbTbAndQueryAndRowCntFromBinevent(ev *replication.BinlogEvent) (string,
|
||||
sqlType = "query"
|
||||
case replication.GTID_EVENT:
|
||||
ge := ev.Event.(*replication.GTIDEvent)
|
||||
gid, err := gtid.Parse(fmt.Sprintf("%s:%d", bytesToUuid(ge.SID), ge.SequenceNumber))
|
||||
gid, err := gtid.Parse(fmt.Sprintf("%s:%d", bytesToUuid(ge.SID), ge.GNO))
|
||||
if err == nil {
|
||||
sql = gid.String()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user