code: func (r *copRanges) split(key []byte) (*copRanges, *copRanges) {
  	n := sort.Search(r.len(), func(i int) bool {
  		cur := r.at(i)
  		return len(cur.EndKey) == 0 || bytes.Compare(cur.EndKey, key) > 0
  	})
  	// If a range p contains the key, it will split to 2 parts.
  	if n < r.len() {
  		p := r.at(n)
  		if bytes.Compare(key, p.StartKey) > 0 {
  			left := r.slice(0, n)
  			left.last = &kv.KeyRange{StartKey: p.StartKey, EndKey: key}
  			right := r.slice(n+1, r.len())
  			right.first = &kv.KeyRange{StartKey: key, EndKey: p.EndKey}
  			return left, right
  		}
  	}
  	return r.slice(0, n), r.slice(n, r.len())
  }
docs: // split ranges into (left, right) by key.