master
兔子 1 year ago
parent 1ed514f350
commit 58c0291b7a

@ -42,6 +42,8 @@ type Transaction struct {
Size int `json:"size"` Size int `json:"size"`
RowsCount int `json:"rowsCount"` RowsCount int `json:"rowsCount"`
Status uint8 `json:"status"` Status uint8 `json:"status"`
TxStartTime int64 `json:"txStartTime"`
TxEndTime int64 `json:"txEndTime"`
sqlOrigin []string `json:"sqlOrigin"` sqlOrigin []string `json:"sqlOrigin"`
Txs []TxDetail `json:"txs"` Txs []TxDetail `json:"txs"`
validSchemaCount int validSchemaCount int
@ -611,11 +613,16 @@ func parseBinlogWithFilter(r io.Reader, parse *replication.BinlogParser, filter
if ev.Type == "query" { if ev.Type == "query" {
switch strings.ToLower(ev.Data) { switch strings.ToLower(ev.Data) {
case "begin": case "begin":
if tx.TxStartTime == 0 {
tx.TxStartTime = int64(h.Timestamp)
}
status = STATUS_BEGIN status = STATUS_BEGIN
case "commit": case "commit":
status = STATUS_COMMIT status = STATUS_COMMIT
tx.TxEndTime = int64(h.Timestamp)
case "rollback": case "rollback":
status = STATUS_ROLLBACK status = STATUS_ROLLBACK
tx.TxEndTime = int64(h.Timestamp)
} }
tx.Status = status tx.Status = status
} }

Loading…
Cancel
Save