code: func (s *session) getCompactionRange(sourceLevel int, umin, umax []byte, noLimit bool) *compaction {
  	v := s.version()
  
  	if sourceLevel >= len(v.levels) {
  		v.release()
  		return nil
  	}
  
  	t0 := v.levels[sourceLevel].getOverlaps(nil, s.icmp, umin, umax, sourceLevel == 0)
  	if len(t0) == 0 {
  		v.release()
  		return nil
  	}
  
  	// Avoid compacting too much in one shot in case the range is large.
  	// But we cannot do this for level-0 since level-0 files can overlap
  	// and we must not pick one file and drop another older file if the
  	// two files overlap.
  	if !noLimit && sourceLevel > 0 {
  		limit := int64(v.s.o.GetCompactionSourceLimit(sourceLevel))
  		total := int64(0)
  		for i, t := range t0 {
  			total += t.size
  			if total >= limit {
  				s.logf("table@compaction limiting F·%d -> F·%d", len(t0), i+1)
  				t0 = t0[:i+1]
  				break
  			}
  		}
  	}
  
  	return newCompaction(s, v, sourceLevel, t0)
  }
docs: // Create compaction from given level and range; need external synchronization.