Simplify table records loop in iterator

This commit is contained in:
Tobie Morgan Hitchcock 2017-12-01 00:36:14 +00:00
parent 34aa10f9b8
commit f623ded1e4

View file

@ -584,28 +584,30 @@ func (i *iterator) processTable(ctx context.Context, key *keys.Table) {
return return
} }
// If there are no further records
// fetched from the data layer, then
// return out of this loop iteration.
if x >= len(vals) { if x >= len(vals) {
return return
} }
for ; x < len(vals); x++ { // If there were at least 1 or 2
// keys-values, then loop over all
// the items and process the records.
for _, val := range vals {
if i.checkState(ctx) {
i.submitTask(nil, val, nil)
continue
}
}
// When we loop around, we will use // When we loop around, we will use
// the key of the last retrieved key // the key of the last retrieved key
// to perform the next range request. // to perform the next range request.
if x == len(vals)-1 {
beg.Decode(vals[len(vals)-1].Key()) beg.Decode(vals[len(vals)-1].Key())
}
if i.checkState(ctx) {
i.submitTask(nil, vals[x], nil)
continue
}
break
}
} }