mirror of https://github.com/tikv/client-go.git
fix RowKVClient scan method can't rightly break loop (#43)
* fix RowKVClient scan method can't rightly break loop Signed-off-by: Yushen Lin <ldnvnbl@gmail.com> * fix rawkv Scan and ReverseScan Signed-off-by: Yushen Lin <ldnvnbl@gmail.com>
This commit is contained in:
parent
ddd42ffad4
commit
a3ebdb020c
|
|
@ -1,2 +1,3 @@
|
|||
vendor
|
||||
go.sum
|
||||
.idea
|
||||
|
|
@ -263,7 +263,7 @@ func (c *Client) Scan(ctx context.Context, startKey, endKey []byte, limit int) (
|
|||
return nil, nil, errors.WithStack(ErrMaxScanLimitExceeded)
|
||||
}
|
||||
|
||||
for len(keys) < limit {
|
||||
for len(keys) < limit && (len(endKey) == 0 || bytes.Compare(startKey, endKey) < 0) {
|
||||
req := &rpc.Request{
|
||||
Type: rpc.CmdRawScan,
|
||||
RawScan: &kvrpcpb.RawScanRequest{
|
||||
|
|
@ -307,7 +307,7 @@ func (c *Client) ReverseScan(ctx context.Context, startKey, endKey []byte, limit
|
|||
return nil, nil, errors.WithStack(ErrMaxScanLimitExceeded)
|
||||
}
|
||||
|
||||
for len(keys) < limit {
|
||||
for len(keys) < limit && bytes.Compare(startKey, endKey) > 0 {
|
||||
req := &rpc.Request{
|
||||
Type: rpc.CmdRawScan,
|
||||
RawScan: &kvrpcpb.RawScanRequest{
|
||||
|
|
|
|||
Loading…
Reference in New Issue