Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
514d075
Add some optional meta fields for TABLE_MAP_EVENT: signedness/column
huangjunwen Jan 29, 2020
1e585a9
Add mysql 8.0 new fields to GTIDEvent
huangjunwen Jan 30, 2020
782e710
Add some timestamp helper methods for GTIDEvent
huangjunwen Jan 30, 2020
3e9f1d7
Move some code
huangjunwen Jan 30, 2020
5dd4c32
Rename and move a function BytesToUint64 to mysql package
huangjunwen Jan 30, 2020
c61b8a9
Add some helper methods to TableMapEvent
huangjunwen Jan 30, 2020
c66d0a6
Make TableMapEvent's Dump prettier
huangjunwen Jan 31, 2020
d3fef7b
Remove unneccesary code
huangjunwen Jan 31, 2020
a624aa6
Fix compile error before go 1.13: shift count type int, must be unsig…
huangjunwen Jan 31, 2020
27d6b7e
Extract charset/collation info from TableMapEvent
huangjunwen Feb 1, 2020
fcf8f97
Minor fix: do not allocate collation map if not neccessary
huangjunwen Feb 1, 2020
9ddfbf2
Merge branch 'master' into master
siddontang Feb 22, 2020
efddbd1
Remove BytesToUint64 since FixedLengthInt already serve the same purpose
huangjunwen Mar 8, 2020
52c09af
Add note for field type
huangjunwen Mar 8, 2020
41ecfa6
Fix CollationMap error when the table contains enum or set fields
huangjunwen Mar 8, 2020
3e4d0b3
Refactor decodeOptionalMeta
huangjunwen Mar 8, 2020
6881af6
Add support for other table map optional meta as well
huangjunwen Mar 9, 2020
2a96a8c
Remove helper functions in TableMapEvent now. Need more investigation…
huangjunwen Mar 10, 2020
02e8369
Add some test cases for TabeMapEvent optional meta decode
huangjunwen Mar 10, 2020
7626785
Remove type.go
huangjunwen Mar 10, 2020
569203c
Merge branch 'master' of github.com:huangjunwen/go-mysql
huangjunwen Mar 10, 2020
b758aa5
Add some comments about new fields in GTIDEvent..
huangjunwen Mar 10, 2020
d9d4b74
Add more test for GTIDEvent and TableMapEvent
huangjunwen Mar 10, 2020
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add some timestamp helper methods for GTIDEvent
  • Loading branch information
huangjunwen committed Jan 30, 2020
commit 782e7102e701a822b408295be21947ec2ee5697f
30 changes: 28 additions & 2 deletions replication/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -388,14 +388,40 @@ func (e *GTIDEvent) Dump(w io.Writer) {
fmt.Fprintf(w, "GTID_NEXT: %s:%d\n", u.String(), e.GNO)
fmt.Fprintf(w, "LAST_COMMITTED: %d\n", e.LastCommitted)
fmt.Fprintf(w, "SEQUENCE_NUMBER: %d\n", e.SequenceNumber)
fmt.Fprintf(w, "Immediate commmit timestamp: %d\n", e.ImmediateCommitTimestamp)
fmt.Fprintf(w, "Orignal commmit timestamp: %d\n", e.OriginalCommitTimestamp)
fmt.Fprintf(w, "Immediate commmit timestamp: %d (%s)\n", e.ImmediateCommitTimestamp, e.fmtTime(e.ImmediateCommitTime()))
fmt.Fprintf(w, "Orignal commmit timestamp: %d (%s)\n", e.OriginalCommitTimestamp, e.fmtTime(e.OriginalCommitTime()))
fmt.Fprintf(w, "Transaction length: %d\n", e.TransactionLength)
fmt.Fprintf(w, "Immediate server version: %d\n", e.ImmediateServerVersion)
fmt.Fprintf(w, "Orignal server version: %d\n", e.OriginalServerVersion)
fmt.Fprintln(w)
}

// ImmediateCommitTime returns the commit time of this trx on the immediate server
// or zero time if not available.
func (e *GTIDEvent) ImmediateCommitTime() time.Time {
return e.microsecTimestamp2Time(e.ImmediateCommitTimestamp)
}

// OriginalCommitTime returns the commit time of this trx on the original server
// or zero time if not available.
func (e *GTIDEvent) OriginalCommitTime() time.Time {
return e.microsecTimestamp2Time(e.OriginalCommitTimestamp)
}

func (e *GTIDEvent) microsecTimestamp2Time(ts uint64) time.Time {
if ts == 0 {
return time.Time{}
}
return time.Unix(int64(ts/1000000), int64(ts%1000000)*1000)
}

func (e *GTIDEvent) fmtTime(t time.Time) string {
if t.IsZero() {
return "N/A"
}
return t.Format(time.RFC3339Nano)
}

type BeginLoadQueryEvent struct {
FileID uint32
BlockData []byte
Expand Down