code: func (mvcc *MVCCLevelDB) ReverseScan(startKey, endKey []byte, limit int, startTS uint64, isoLevel kvrpcpb.IsolationLevel) []Pair {
  	mvcc.mu.RLock()
  	defer mvcc.mu.RUnlock()
  
  	var mvccEnd []byte
  	if len(endKey) != 0 {
  		mvccEnd = mvccEncode(endKey, lockVer)
  	}
  	iter := mvcc.db.NewIterator(&util.Range{
  		Limit: mvccEnd,
  	}, nil)
  	defer iter.Release()
  
  	succ := iter.Last()
  	currKey, _, err := mvccDecode(iter.Key())
  	// TODO: return error.
  	terror.Log(errors.Trace(err))
  	helper := reverseScanHelper{
  		startTS:  startTS,
  		isoLevel: isoLevel,
  		currKey:  currKey,
  	}
  
  	for succ && len(helper.pairs) < limit {
  		key, ver, err := mvccDecode(iter.Key())
  		if err != nil {
  			break
  		}
  		if bytes.Compare(key, startKey) < 0 {
  			break
  		}
  
  		if !bytes.Equal(key, helper.currKey) {
  			helper.finishEntry()
  			helper.currKey = key
  		}
  		if ver == lockVer {
  			var lock mvccLock
  			err = lock.UnmarshalBinary(iter.Value())
  			helper.entry.lock = &lock
  		} else {
  			var value mvccValue
  			err = value.UnmarshalBinary(iter.Value())
  			helper.entry.values = append(helper.entry.values, value)
  		}
  		if err != nil {
  			logutil.Logger(context.Background()).Error("unmarshal fail", zap.Error(err))
  			break
  		}
  		succ = iter.Prev()
  	}
  	if len(helper.pairs) < limit {
  		helper.finishEntry()
  	}
  	return helper.pairs
  }
docs: // ReverseScan implements the MVCCStore interface. The search range is [startKey, endKey).