Skip to content

Commit

Permalink
table: fix first key (pingcap#4572)
Browse files Browse the repository at this point in the history
  • Loading branch information
zimulala authored and hanfei1991 committed Sep 19, 2017
1 parent a239324 commit 2145586
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion table/tables/tables.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package tables

import (
"math"
"strings"

log "github.com/Sirupsen/logrus"
Expand Down Expand Up @@ -203,7 +204,7 @@ func (t *Table) RecordKey(h int64) kv.Key {

// FirstKey implements table.Table FirstKey interface.
func (t *Table) FirstKey() kv.Key {
return t.RecordKey(0)
return t.RecordKey(math.MinInt64)
}

// UpdateRecord implements table.Table UpdateRecord interface.
Expand Down
2 changes: 1 addition & 1 deletion table/tables/tables_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ func (ts *testSuite) TestIterRecords(c *C) {
ts.se.Execute("DROP TABLE IF EXISTS test.tIter")
_, err := ts.se.Execute("CREATE TABLE test.tIter (a int primary key, b int)")
c.Assert(err, IsNil)
_, err = ts.se.Execute("INSERT test.tIter VALUES (1, 2), (2, NULL)")
_, err = ts.se.Execute("INSERT test.tIter VALUES (-1, 2), (2, NULL)")
c.Assert(err, IsNil)
ctx := ts.se.(context.Context)
c.Assert(ctx.NewTxn(), IsNil)
Expand Down

0 comments on commit 2145586

Please sign in to comment.