code: func (w *WAL) ReleaseLockTo(index uint64) error {
  	w.mu.Lock()
  	defer w.mu.Unlock()
  
  	var smaller int
  	found := false
  
  	for i, l := range w.locks {
  		_, lockIndex, err := parseWalName(path.Base(l.Name()))
  		if err != nil {
  			return err
  		}
  		if lockIndex >= index {
  			smaller = i - 1
  			found = true
  			break
  		}
  	}
  
  	// if no lock index is greater than the release index, we can
  	// release lock up to the last one(excluding).
  	if !found && len(w.locks) != 0 {
  		smaller = len(w.locks) - 1
  	}
  
  	if smaller <= 0 {
  		return nil
  	}
  
  	for i := 0; i < smaller; i++ {
  		w.locks[i].Unlock()
  		w.locks[i].Destroy()
  	}
  	w.locks = w.locks[smaller:]
  
  	return nil
  }
docs: // ReleaseLockTo releases the locks, which has smaller index than the given index
  // except the largest one among them.
  // For example, if WAL is holding lock 1,2,3,4,5,6, ReleaseLockTo(4) will release
  // lock 1,2 but keep 3. ReleaseLockTo(5) will release 1,2,3 but keep 4.