Skip to content

Commit

Permalink
export: don't +1 TSO when set GC safepoint (pingcap#290)
Browse files Browse the repository at this point in the history
  • Loading branch information
lance6716 authored Jul 6, 2021
1 parent 148e1bd commit 3cef509
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dumpling/v4/export/sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,7 @@ func parseSnapshotToTSO(pool *sql.DB, snapshot string) (uint64, error) {
if !tso.Valid {
return 0, errors.Errorf("snapshot %s format not supported. please use tso or '2006-01-02 15:04:05' format time", snapshot)
}
return (uint64(tso.Int64)<<18)*1000 + 1, nil
return (uint64(tso.Int64) << 18) * 1000, nil
}

func buildWhereCondition(conf *Config, where string) string {
Expand Down
2 changes: 1 addition & 1 deletion dumpling/v4/export/sql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ func (s *testSQLSuite) TestParseSnapshotToTSO(c *C) {
WillReturnRows(sqlmock.NewRows([]string{`unix_timestamp("2020/07/18 20:31:50")`}).AddRow(1595075510))
tso, err := parseSnapshotToTSO(db, snapshot)
c.Assert(err, IsNil)
c.Assert(tso, Equals, (unixTimeStamp<<18)*1000+1)
c.Assert(tso, Equals, (unixTimeStamp<<18)*1000)
c.Assert(mock.ExpectationsWereMet(), IsNil)

// generate columns not valid snapshot
Expand Down

0 comments on commit 3cef509

Please sign in to comment.