Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion server/etcdserver/txn/range.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ func executeRange(ctx context.Context, lg *zap.Logger, txnRead mvcc.TxnRead, r *

func rangeLimit(r *pb.RangeRequest) int64 {
limit := r.Limit
if r.SortOrder != pb.RangeRequest_NONE ||
// If the requested sort is anything other than sort by key in ascending order (the default order used by the backend),
// we need to fetch everything and sort it in memory.
if r.SortOrder != pb.RangeRequest_NONE &&
!(r.SortOrder == pb.RangeRequest_ASCEND && r.SortTarget == pb.RangeRequest_KEY) ||
r.MinModRevision != 0 || r.MaxModRevision != 0 ||
r.MinCreateRevision != 0 || r.MaxCreateRevision != 0 {
// fetch everything; sort and truncate afterwards
Expand Down