code: func (mc *MergeControl) waitForMerges() {
  	mc.Lock() // synchronized
  	defer mc.Unlock()
  	// ensureOpen(false)
  
  	if mc.infoStream.IsEnabled("IW") {
  		mc.infoStream.Message("IW", "waitForMerges")
  	}
  
  	for mc.pendingMerges.Len() > 0 || len(mc.runningMerges) > 0 {
  		mc.mergeSignal.Wait()
  	}
  
  	assert(len(mc.mergingSegments) == 0)
  
  	if mc.infoStream.IsEnabled("IW") {
  		mc.infoStream.Message("IW", "waitForMerges done")
  	}
  }
docs: /*
  Wait for any currently outstanding merges to finish.
  
  It is guaranteed that any merges started prior to calling this method
  will have completed once this method completes.
  */