Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
crazycs520 committed May 28, 2019
1 parent 341617e commit b7b62d4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
4 changes: 1 addition & 3 deletions executor/executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,11 +294,9 @@ func (s *testSuite) TestAdmin(c *C) {
endKey := meta.DDLJobHistoryKey(m, historyJob[0].ID)
s.cluster.SplitKeys(s.mvccStore, startKey, endKey, int(historyJob[0].ID/2))

txn, err = s.store.Begin()
c.Assert(err, IsNil)
historyJob2, err := admin.GetHistoryDDLJobs(txn, 20)
c.Assert(err, IsNil)
c.Assert(len(historyJob2) >= len(historyJob), IsTrue)
c.Assert(historyJob, DeepEquals, historyJob2)
}

func (s *testSuite) fillData(tk *testkit.TestKit, table string) {
Expand Down
10 changes: 7 additions & 3 deletions store/mockstore/mocktikv/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,17 +245,21 @@ func (h *rpcHandler) handleKvGet(req *kvrpcpb.GetRequest) *kvrpcpb.GetResponse {
}

func (h *rpcHandler) handleKvScan(req *kvrpcpb.ScanRequest) *kvrpcpb.ScanResponse {
if !h.checkKeyInRegion(req.GetStartKey()) {
panic(fmt.Sprintf("KvScan: startKey not in region, region: [%v, %v), startKey: %v", h.startKey, h.endKey, req.GetStartKey()))
}

endKey := h.endKey
var pairs []Pair
if !req.Reverse {
if !h.checkKeyInRegion(req.GetStartKey()) {
panic("KvScan: startKey not in region")
}
if len(req.EndKey) > 0 && (len(endKey) == 0 || bytes.Compare(req.EndKey, endKey) < 0) {
endKey = req.EndKey
}
pairs = h.mvccStore.Scan(req.GetStartKey(), endKey, int(req.GetLimit()), req.GetVersion(), h.isolationLevel)
} else {
if !h.checkKeyInRegion(req.GetEndKey()) {
panic("KvScan: startKey not in region")
}
// TiKV use range [end_key, start_key) for reverse scan.
// So the req.StartKey actually is the end_key.
if len(req.GetStartKey()) > 0 && (len(endKey) == 0 || bytes.Compare(req.GetStartKey(), endKey) < 0) {
Expand Down

0 comments on commit b7b62d4

Please sign in to comment.