From 2d356a60fb2dac077ad4420a4507c566caef5e13 Mon Sep 17 00:00:00 2001 From: Rohit Nayak Date: Tue, 23 Mar 2021 10:16:29 +0100 Subject: [PATCH] CurrentTime in binlogevent is in nanoseconds, fixed Signed-off-by: Rohit Nayak --- go/vt/vtgate/vstream_manager.go | 2 +- go/vt/vtgate/vstream_manager_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go/vt/vtgate/vstream_manager.go b/go/vt/vtgate/vstream_manager.go index 1c44845c751..e75c1f7ba50 100644 --- a/go/vt/vtgate/vstream_manager.go +++ b/go/vt/vtgate/vstream_manager.go @@ -239,7 +239,7 @@ func (vs *vstream) computeSkew(streamID string, event *binlogdatapb.VEvent) bool vs.skewMu.Lock() defer vs.skewMu.Unlock() // account for skew between this vtgate and the source mysql server - secondsInThePast := event.CurrentTime - event.Timestamp + secondsInThePast := event.CurrentTime/1e9 - event.Timestamp vs.timestamps[streamID] = time.Now().Unix() - secondsInThePast var minTs, maxTs int64 diff --git a/go/vt/vtgate/vstream_manager_test.go b/go/vt/vtgate/vstream_manager_test.go index 86748a90f01..addbe49269b 100644 --- a/go/vt/vtgate/vstream_manager_test.go +++ b/go/vt/vtgate/vstream_manager_test.go @@ -56,13 +56,13 @@ func getVEvents(shard string, count, idx int64) []*binlogdatapb.VEvent { vevents = append(vevents, &binlogdatapb.VEvent{ Type: binlogdatapb.VEventType_GTID, Gtid: fmt.Sprintf("gtid-%s-%d", shard, j), Timestamp: currentTime - j, - CurrentTime: currentTime, + CurrentTime: currentTime * 1e9, }) vevents = append(vevents, &binlogdatapb.VEvent{ Type: binlogdatapb.VEventType_COMMIT, Timestamp: currentTime - j, - CurrentTime: currentTime, + CurrentTime: currentTime * 1e9, }) } return vevents