Skip to content

Commit

Permalink
CurrentTime in binlogevent is in nanoseconds, fixed
Browse files Browse the repository at this point in the history
Signed-off-by: Rohit Nayak <[email protected]>
  • Loading branch information
rohit-nayak-ps committed Mar 23, 2021
1 parent 3dbae71 commit 2d356a6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go/vt/vtgate/vstream_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go/vt/vtgate/vstream_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2d356a6

Please sign in to comment.